16 #include "atlas/grid/Grid.h" 18 #include "atlas/mesh/detail/PartitionGraph.h" 19 #include "atlas/projection/Projection.h" 20 #include "atlas/util/Metadata.h" 21 #include "atlas/util/Object.h" 22 #include "atlas/util/ObjectHandle.h" 32 class PartitionPolygons;
36 class PartitionPolygon;
39 typedef HybridElements Edges;
40 typedef HybridElements Cells;
63 void encode( eckit::Stream& s )
const;
72 void print( std::ostream& )
const;
74 const Nodes& nodes()
const {
return *nodes_; }
75 Nodes& nodes() {
return *nodes_; }
77 const Cells& cells()
const {
return *cells_; }
78 Cells& cells() {
return *cells_; }
80 const Edges& edges()
const {
return *edges_; }
81 Edges& edges() {
return *edges_; }
92 bool generated()
const;
95 size_t footprint()
const;
97 idx_t partition()
const;
98 idx_t nb_partitions()
const;
100 void updateDevice()
const;
102 void updateHost()
const;
104 void syncHostDevice()
const;
106 const Projection& projection()
const {
return projection_; }
110 PartitionGraph::Neighbours nearestNeighbourPartitions()
const;
115 const Grid grid()
const {
return grid_; }
121 friend class ::atlas::Mesh;
123 friend std::ostream& operator<<( std::ostream& s,
const MeshImpl& p ) {
128 void createElements();
131 void setGrid(
const Grid& );
146 idx_t dimensionality_;
154 mutable std::vector<util::ObjectHandle<PartitionPolygon>> polygons_;
158 mutable std::vector<MeshObserver*> mesh_observers_;
165 std::vector<const MeshImpl*> registered_meshes_;
168 void registerMesh(
const MeshImpl& mesh ) {
169 if ( std::find( registered_meshes_.begin(), registered_meshes_.end(), &mesh ) == registered_meshes_.end() ) {
170 registered_meshes_.push_back( &mesh );
171 mesh.attachObserver( *
this );
174 void unregisterMesh(
const MeshImpl& mesh ) {
175 auto found = std::find( registered_meshes_.begin(), registered_meshes_.end(), &mesh );
176 if ( found != registered_meshes_.end() ) {
177 registered_meshes_.erase( found );
178 mesh.detachObserver( *
this );
182 for (
auto mesh : registered_meshes_ ) {
183 mesh->detachObserver( *
this );
187 virtual void onMeshDestruction(
MeshImpl& ) = 0;
Definition: Polygon.h:155
Definition: Projection.h:49
Definition: PartitionGraph.h:29
Most general grid container.
Definition: Grid.h:64
Nodes class that owns a collection of fields defined in nodes of the mesh.
Definition: Nodes.h:43
Definition: MeshImpl.h:54
HybridElements class that describes elements of different types.
Definition: HybridElements.h:64
Contains all atlas classes and methods.
Definition: atlas-grids.cc:33
long idx_t
Integer type for indices in connectivity tables.
Definition: config.h:42
Definition: MeshImpl.h:163
Polygon class that holds the boundary of a mesh partition.
Definition: PartitionPolygon.h:41
Definition: ObjectHandle.h:64