30 #define __MeshBase_H 1
32 #include <feel/feelcore/feel.hpp>
33 #include <feel/feelcore/context.hpp>
47 MESH_UPDATE_EDGES = ( 1 << 0 ),
48 MESH_UPDATE_FACES = ( 1 << 1 ),
49 MESH_CHECK = ( 1 << 2 ),
50 MESH_PARTITION = ( 1 << 3 ),
51 MESH_RENUMBER = ( 1 << 4 ),
52 MESH_ADD_ELEMENTS_INFO = ( 1 << 5 ),
53 MESH_PROPAGATE_MARKERS = ( 1 << 6 ),
54 MESH_REMOVE_PERIODIC_FACES_FROM_BOUNDARY = ( 1 << 7 )
57 const uint16_type MESH_ALL_COMPONENTS = MESH_UPDATE_EDGES | MESH_UPDATE_FACES | MESH_CHECK | MESH_PARTITION | MESH_RENUMBER;
58 const uint16_type MESH_COMPONENTS_DEFAULTS = MESH_RENUMBER | MESH_CHECK;
87 typedef boost::shared_ptr<smd_type> smd_ptrtype;
195 virtual double measure()
const = 0;
202 return M_is_parametric;
254 virtual void clear();
272 virtual void partition (
const uint16_type n_parts ) = 0;
282 virtual void setWorldComm( WorldComm
const& _worldComm ) = 0;
284 void setWorldCommMeshBase( WorldComm
const& _worldComm )
286 M_worldComm = _worldComm;
289 mpi::communicator
const& comm()
const
291 return M_worldComm.localComm();
294 virtual void meshModified() = 0;
306 typename smd_type::mesh_ptrtype
subMesh()
const
308 CHECK( M_smd ) <<
"mesh doesn't have any submesh data\n";
315 DVLOG(4) <<
"isSubMeshFrom<mesh_ptrtype> called\n";
316 if ( !M_smd )
return false;
317 bool res= (M_smd->mesh.get() == m);
318 DVLOG(4) <<
"this isSubMeshFrom m: " << res <<
"\n";
330 DVLOG(4) <<
"isParentMeshOf<mesh_ptrtype> called\n";
331 bool res = m->isSubMeshFrom(
this );
332 if ( res ==
false )
return res;
333 DVLOG(4) <<
"this isParentMeshOf m: " << res <<
"\n";
340 DVLOG(4) <<
"isSubMeshFrom<M> called\n";
345 bool isSameMesh( M
const* m )
const
347 bool same_mesh = (
dynamic_cast<void const*
>( this ) == dynamic_cast<void const*>( m ) );
352 bool isSameMesh( boost::shared_ptr<M> m )
const
354 bool same_mesh = (
dynamic_cast<void const*
>( this ) == dynamic_cast<void*>( m.get() ) );
358 bool isRelatedTo( boost::shared_ptr<M> m )
const
360 bool same_mesh = isSameMesh(m);
361 DVLOG(4) <<
"same_mesh: " << same_mesh <<
"\n";
363 DVLOG(4) <<
"isSubMeshFrom: " << is_submesh_from <<
"\n";
365 DVLOG(4) <<
"is_parentmesh_of: " << is_parentmesh_of <<
"\n";
366 return same_mesh || is_submesh_from || is_parentmesh_of;
372 CHECK( M_smd ) <<
"mesh doesn't have any submesh data\n";
373 return M_smd->bm.left.find(
id )->second;
379 CHECK( M_smd ) <<
"mesh doesn't have any submesh data\n";
380 if ( M_smd->bm.right.find(
id ) != M_smd->bm.right.end() )
381 return M_smd->bm.right.find(
id )->second;
389 if (
this == m.get() )
391 if ( isRelatedTo( m ) )
393 CHECK( M_smd ) <<
"mesh doesn't have any submesh data\n";
394 return M_smd->bm.left.find(
id )->second;
402 if (
this == m.get() )
404 if ( isRelatedTo( m ) )
406 CHECK( M_smd ) <<
"mesh doesn't have any submesh data\n";
407 if ( M_smd->bm.right.find(
id ) != M_smd->bm.right.end() )
408 return M_smd->bm.right.find(
id )->second;
453 virtual void check()
const = 0;
462 friend class boost::serialization::access;
463 template<
class Archive>
464 void serialize( Archive & ar,
const unsigned int version )
468 ar & M_is_parametric;
477 Context M_components;
487 bool M_is_parametric;
503 uint16_type M_n_parts;
505 WorldComm M_worldComm;