/usr/include/dolfin/mesh/MeshConnectivity.h is in libdolfin1.0-dev 1.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | // Copyright (C) 2006-2007 Anders Logg
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// First added: 2006-05-09
// Last changed: 2010-11-28
#ifndef __MESH_CONNECTIVITY_H
#define __MESH_CONNECTIVITY_H
#include <vector>
#include <dolfin/common/types.h>
namespace dolfin
{
/// Mesh connectivity stores a sparse data structure of connections
/// (incidence relations) between mesh entities for a fixed pair of
/// topological dimensions.
///
/// The connectivity can be specified either by first giving the
/// number of entities and the number of connections for each entity,
/// which may either be equal for all entities or different, or by
/// giving the entire (sparse) connectivity pattern.
class MeshConnectivity
{
public:
/// Create empty connectivity between given dimensions (d0 -- d1)
MeshConnectivity(uint d0, uint d1);
/// Copy constructor
MeshConnectivity(const MeshConnectivity& connectivity);
/// Destructor
~MeshConnectivity();
/// Assignment
const MeshConnectivity& operator= (const MeshConnectivity& connectivity);
/// Return total number of connections
uint size() const { return _size; }
/// Return number of connections for given entity
uint size(uint entity) const
{ return (entity < num_entities ? offsets[entity + 1] - offsets[entity] : 0); }
/// Return array of connections for given entity
const uint* operator() (uint entity) const
{ return (entity < num_entities ? connections + offsets[entity] : 0); }
/// Return contiguous array of connections for all entities
const uint* operator() () const { return connections; }
/// Clear all data
void clear();
/// Initialize number of entities and number of connections (equal for all)
void init(uint num_entities, uint num_connections);
/// Initialize number of entities and number of connections (individually)
void init(std::vector<uint>& num_connections);
/// Set given connection for given entity
void set(uint entity, uint connection, uint pos);
/// Set all connections for given entity
void set(uint entity, const std::vector<uint>& connections);
/// Set all connections for given entity
void set(uint entity, uint* connections);
/// Set all connections for all entities
void set(const std::vector<std::vector<uint> >& connectivity);
/// Return informal string representation (pretty-print)
std::string str(bool verbose) const;
private:
// Friends
friend class BinaryFile;
friend class MeshRenumbering;
// Dimensions (only used for pretty-printing)
uint d0, d1;
// Total number of connections
uint _size;
// Number of entities
uint num_entities;
// Connections for all entities stored as a contiguous array
uint* connections;
// Offset for first connection for each entity
uint* offsets;
};
}
#endif
|