21#ifndef __MESH_TOPOLOGY_H
22#define __MESH_TOPOLOGY_H
29#include <dolfin/common/Variable.h>
30#include "MeshConnectivity.h"
69 std::size_t
dim()
const;
72 std::size_t
size(std::size_t
dim)
const;
85 void clear(std::size_t d0, std::size_t d1);
92 void init(std::size_t
dim, std::size_t local_size, std::size_t global_size);
104 std::int64_t global_index)
106 dolfin_assert(
dim < _global_indices.size());
107 dolfin_assert(local_index < _global_indices[
dim].
size());
108 _global_indices[
dim][local_index] = global_index;
115 dolfin_assert(d < _global_indices.size());
116 return _global_indices[d];
123 dolfin_assert(
dim < _global_indices.size());
124 return !_global_indices[
dim].empty();
130 {
return (_shared_entities.find(
dim) != _shared_entities.end()); }
134 std::map<std::int32_t, std::set<unsigned int> >&
139 const std::map<std::int32_t, std::set<unsigned int> >&
146 {
return _cell_owner; }
152 {
return _cell_owner; }
159 std::size_t d1)
const;
165 std::string
str(
bool verbose)
const;
177 std::map<std::vector<std::size_t>,
178 std::pair<std::vector<std::size_t>,
182 std::map<unsigned, std::shared_ptr<MeshView>> mapping()
const
185 void add_mapping(
const std::pair<
unsigned, std::shared_ptr<MeshView>> _pair)
186 { _mapping.emplace(_pair); }
190 friend class MeshView;
193 std::map<unsigned, std::shared_ptr<MeshView>> _mapping;
196 std::vector<unsigned int> num_entities;
199 std::vector<std::size_t> ghost_offset_index;
202 std::vector<std::size_t> global_num_entities;
205 std::vector<std::vector<std::int64_t> > _global_indices;
209 std::map<unsigned int, std::map<std::int32_t, std::set<unsigned int>>>
215 std::vector<unsigned int> _cell_owner;
218 std::vector<std::vector<MeshConnectivity> > connectivity;
Definition: MeshConnectivity.h:42
Definition: MeshTopology.h:53
std::size_t size(std::size_t dim) const
Return number of entities for given dimension.
Definition: MeshTopology.cpp:79
std::string str(bool verbose) const
Return informal string representation (pretty-print)
Definition: MeshTopology.cpp:215
void clear()
Clear all data.
Definition: MeshTopology.cpp:106
~MeshTopology()
Destructor.
Definition: MeshTopology.cpp:51
void init_ghost(std::size_t dim, std::size_t index)
Initialise the offset index of ghost entities for this dimension.
Definition: MeshTopology.cpp:161
std::size_t dim() const
Return topological dimension.
Definition: MeshTopology.cpp:74
void init_global_indices(std::size_t dim, std::size_t size)
Definition: MeshTopology.cpp:167
std::vector< unsigned int > & cell_owner()
Definition: MeshTopology.h:145
bool have_shared_entities(unsigned int dim) const
Definition: MeshTopology.h:129
void set_global_index(std::size_t dim, std::size_t local_index, std::int64_t global_index)
Definition: MeshTopology.h:103
std::map< std::vector< std::size_t >, std::pair< std::vector< std::size_t >, std::vector< std::vector< std::size_t > > > > coloring
Definition: MeshTopology.h:179
void init(std::size_t dim)
Initialize topology of given maximum dimension.
Definition: MeshTopology.cpp:126
size_t hash() const
Return hash based on the hash of cell-vertex connectivity.
Definition: MeshTopology.cpp:210
MeshTopology()
Create empty mesh topology.
Definition: MeshTopology.cpp:32
const std::vector< unsigned int > & cell_owner() const
Definition: MeshTopology.h:151
std::size_t ghost_offset(std::size_t dim) const
Definition: MeshTopology.cpp:97
bool have_global_indices(std::size_t dim) const
Definition: MeshTopology.h:121
const std::vector< std::int64_t > & global_indices(std::size_t d) const
Definition: MeshTopology.h:113
dolfin::MeshConnectivity & operator()(std::size_t d0, std::size_t d1)
Return connectivity for given pair of topological dimensions.
Definition: MeshTopology.cpp:174
std::map< std::int32_t, std::set< unsigned int > > & shared_entities(unsigned int dim)
Definition: MeshTopology.cpp:191
MeshTopology & operator=(const MeshTopology &topology)
Assignment.
Definition: MeshTopology.cpp:56
std::size_t size_global(std::size_t dim) const
Return global number of entities for given dimension.
Definition: MeshTopology.cpp:88
Common base class for DOLFIN variables.
Definition: Variable.h:36