15 #include "GenIterator.h"
16 #include "mPartEntityContainer.h"
20 enum PUMI_EntTopology {
40 class mPartEntityContainer;
42 class gModel :
public TagHolder
45 mPartEntityContainer allEntities;
51 gEntity* getGeomEnt(
int d, gmi_ent* ge);
52 void add (
int d, gEntity *ge) {allEntities.add(d, ge);}
53 void del(
int d, gEntity *ge) {allEntities.del(d, ge); }
54 typedef mPartEntityContainer::iter iterall;
55 iterall begin(
int d) {
return allEntities.begin(d);}
56 iterall end(
int d) {
return allEntities.end(d);}
57 int size(
int d) {
return allEntities.size(d); }
60 typedef gModel* pGeom;
61 typedef gEntity* pGeomEnt;
63 typedef gModel::iterall pGeomIter;
64 typedef GenIterator<mPartEntityContainer::iter, gEntity>* gIter;
67 typedef apf::MeshEntity* pMeshEnt;
68 typedef apf::EntityVector EntityVector;
69 typedef apf::MeshIterator* pMeshIter;
71 typedef apf::Copies::iterator pCopyIter;
72 typedef apf::MeshTag* pMeshTag;
75 typedef apf::Field* pField;
90 static pumi* instance() {
91 static pumi _instance;
94 void initializePCU(
pcu::PCU *newPCU) {
95 PCU_ALWAYS_ASSERT_VERBOSE(PCUObj==
nullptr,
"pumi::instance() PCUObj already initialized\n");
98 [[nodiscard]]
pcu::PCU* getPCU() const noexcept {
return PCUObj;}
105 pMeshTag ghosted_tag;
107 std::vector<pMeshEnt> ghost_vec[4];
108 std::vector<pMeshEnt> ghosted_vec[4];
120 void pumi_load_pcu(
pcu::PCU *PCUObj);
125 void pumi_printSys();
126 double pumi_getTime();
127 double pumi_getMem();
128 void pumi_printTimeMem(
const char* msg,
double time,
double memory);
139 const char* model_type=
"mesh",
140 const char* fileName=NULL,
141 void (*fp)(
const char*)=NULL);
143 pGeom pumi_geom_load (
const char* fileName,
const char* model_type=
"mesh",
144 void (*fp)(
const char*)=NULL);
145 void pumi_geom_delete(pGeom g);
146 void pumi_geom_freeze(pGeom g);
147 void pumi_geom_createID(pGeom g);
148 int pumi_geom_getNumEnt(pGeom g,
int d);
149 pGeomEnt pumi_geom_findEnt(pGeom g,
int d,
int id);
151 void pumi_geom_print(pGeom g,
bool print_ent=
false);
155 int pumi_gent_getDim(pGeomEnt ge);
157 int pumi_gent_getID(pGeomEnt ge);
158 void pumi_gent_getRevClas (pGeomEnt g, std::vector<pMeshEnt>& ents);
159 int pumi_gent_getNumAdj (pGeomEnt g,
int target_dim);
160 void gmi_getAdj (
gmi_model*, gmi_ent* ge,
int tgt_dim, std::set<gmi_ent*>& result);
161 void gmi_get2ndAdj(
gmi_model*, gmi_ent* ge,
int brg_dim,
int tgt_dim, std::set<gmi_ent*>& result);
162 void pumi_gent_getAdj (pGeomEnt g,
int target_dim, std::vector<pGeomEnt>& ents);
163 void pumi_gent_get2ndAdj (pGeomEnt e,
int brgType,
int tgtType, std::vector<pGeomEnt>& ents);
166 pTag pumi_geom_createTag (pGeom g,
const char* tagName,
int tagType,
int tagSize);
167 void pumi_geom_deleteTag (pGeom g, pTag tag,
bool force_delete=
false);
168 pTag pumi_geom_findTag (pGeom g,
const char* tagName);
169 bool pumi_geom_hasTag (pGeom g,
const pTag tag);
170 void pumi_geom_getTag (pGeom g, std::vector<pTag>& tags);
172 int pumi_tag_getType (
const pTag tag);
173 void pumi_tag_getName (
const pTag tag,
const char** name);
174 int pumi_tag_getSize (
const pTag tag);
175 int pumi_tag_getByte (
const pTag tag);
177 void pumi_gent_deleteTag (pGeomEnt ent, pTag tag);
178 bool pumi_gent_hasTag (pGeomEnt ent, pTag tag);
179 void pumi_gent_getTag (pGeomEnt ent, std::vector<pTag>& tags);
181 void pumi_gent_setPtrTag (pGeomEnt ent, pTag tag,
void* data);
182 void pumi_gent_getPtrTag (pGeomEnt ent, pTag tag,
void** data);
183 void pumi_gent_setIntTag (pGeomEnt ent, pTag tag,
const int data);
184 void pumi_gent_getIntTag (pGeomEnt ent, pTag tag,
int* data);
185 void pumi_gent_setLongTag (pGeomEnt ent, pTag tag,
const long data);
186 void pumi_gent_getLongTag (pGeomEnt ent, pTag tag,
long*);
187 void pumi_gent_setDblTag (pGeomEnt ent, pTag tag,
const double data);
188 void pumi_gent_getDblTag (pGeomEnt ent, pTag tag,
double*);
189 void pumi_gent_setEntTag (pGeomEnt ent, pTag tag,
const pGeomEnt data);
190 void pumi_gent_getEntTag (pGeomEnt ent, pTag tag, pGeomEnt*);
192 void pumi_gent_setPtrArrTag (pGeomEnt ent, pTag tag,
void*
const* data);
193 void pumi_gent_getPtrArrTag (pGeomEnt ent, pTag tag,
void** data);
194 void pumi_gent_setIntArrTag (pGeomEnt ent, pTag tag,
const int* data);
195 void pumi_gent_getIntArrTag (pGeomEnt ent, pTag tag,
int** data,
int* data_size);
196 void pumi_gent_setLongArrTag (pGeomEnt ent, pTag tag,
const long* data);
197 void pumi_gent_getLongArrTag (pGeomEnt ent, pTag tag,
long** data,
int* data_size);
198 void pumi_gent_setDblArrTag (pGeomEnt ent, pTag tag,
const double* data);
199 void pumi_gent_getDblArrTag (pGeomEnt ent, pTag tag,
double** data,
int* data_size);
200 void pumi_gent_setEntArrTag (pGeomEnt ent, pTag tag,
const pGeomEnt* data);
201 void pumi_gent_getEntArrTag (pGeomEnt ent, pTag tag, pGeomEnt** data,
int* data_size);
209 pMesh pumi_mesh_create(pGeom g,
int mesh_dim,
bool periodic=
false);
210 void pumi_mesh_freeze(
pMesh m);
211 pMeshEnt pumi_mesh_createVtx(
pMesh m, pGeomEnt ge,
double* xyz);
213 pMeshEnt pumi_mesh_createEnt(
pMesh m, pGeomEnt ge,
int target_topology, pMeshEnt* down);
214 pMeshEnt pumi_mesh_createElem(
pMesh m, pGeomEnt ge,
int target_topology, pMeshEnt* vertices);
217 pMesh pumi_mesh_loadSerial(pGeom g,
const char* file_name,
const char* mesh_type=
"mds");
220 pMesh pumi_mesh_load(pGeom geom,
const char* fileName,
int num_in_part,
const char* mesh_type=
"mds");
227 pMesh pumi_mesh_loadAll(pGeom g,
const char* filename,
bool stich_link=
true);
230 void pumi_mesh_delete(
pMesh m);
235 void pumi_mesh_stitch(
pMesh m,
bool dup=
false);
238 bool pumi_mesh_hasAdjacency(
pMesh m,
int from_dim,
int to_dim);
239 void pumi_mesh_createAdjacency(
pMesh m,
int from_dim,
int to_dim);
240 void pumi_mesh_deleteAdjacency(
pMesh m,
int from_dim,
int to_dim);
241 void pumi_mesh_createFullAdjacency(
pMesh m);
244 void pumi_mesh_write (
pMesh m,
const char* fileName,
const char* mesh_type=
"mds");
245 pGeom pumi_mesh_getGeom(
pMesh m);
248 int pumi_mesh_getDim(
pMesh m);
252 int pumi_mesh_getNumEnt(
pMesh m,
int d);
253 int pumi_mesh_getNumGlobalEnt(
pMesh m,
int d);
254 int pumi_mesh_getNumOwnEnt(
pMesh m,
int d);
255 pMeshEnt pumi_mesh_findEnt(
pMesh m,
int d,
int id);
260 pMeshTag pumi_mesh_createIntTag(
pMesh m,
const char* name,
int size);
261 pMeshTag pumi_mesh_createLongTag(
pMesh m,
const char* name,
int size);
262 pMeshTag pumi_mesh_createDblTag(
pMesh m,
const char* name,
int size);
264 void pumi_mesh_deleteTag(
pMesh m, pMeshTag tag,
bool force_delete=
false);
265 pMeshTag pumi_mesh_findTag(
pMesh m,
const char* name);
266 bool pumi_mesh_hasTag (
pMesh m,
const pMeshTag tag);
267 void pumi_mesh_getTag(
pMesh m, std::vector<pMeshTag> tags);
298 pMesh getMesh() {
return m;}
325 int count(pMeshEnt e,
int d);
336 pMesh getMesh() {
return m;}
341 pMeshTag parts_index_tag;
342 std::vector<Parts*> parts_vec[4];
362 void pumi_ghost_createLayer (
pMesh m,
int brgType,
int ghostType,
int numLayer,
int includeCopy);
367 void pumi_ghost_delete (
pMesh m);
374 void pumi_mesh_deleteGlobalID(
pMesh m);
377 void pumi_mesh_verify(
pMesh m,
bool abort_on_error=
true);
381 void pumi_mesh_print(
pMesh m,
bool print_ent=
false);
387 int pumi_ment_getDim(pMeshEnt e);
388 int pumi_ment_getTopo(pMeshEnt e);
390 int pumi_ment_getID(pMeshEnt e);
395 int pumi_ment_getGlobalID(pMeshEnt e);
398 int pumi_ment_getNumAdj(pMeshEnt e,
int tgtType);
401 void pumi_ment_getAdj(pMeshEnt e,
int tgtType, std::vector<pMeshEnt>& vecAdjEnt);
402 void pumi_ment_get2ndAdj (pMeshEnt e,
int brgType,
int tgtType, std::vector<pMeshEnt>& vecAdjEnt);
405 int pumi_ment_getAdjacent(pMeshEnt e,
int tgtType, Adjacent& result);
406 int pumi_ment_get2ndAdjacent(pMeshEnt e,
int brgType,
int tgtType, Adjacent& result);
409 pGeomEnt pumi_ment_getGeomClas(pMeshEnt e);
412 pMeshEnt pumi_medge_getOtherVtx(pMeshEnt edge, pMeshEnt vtx);
415 void pumi_ment_deleteTag (pMeshEnt e, pMeshTag tag);
416 bool pumi_ment_hasTag (pMeshEnt e, pMeshTag tag);
418 void pumi_ment_setIntTag(pMeshEnt e, pMeshTag tag,
int const* data);
419 void pumi_ment_getIntTag(pMeshEnt e, pMeshTag tag,
int* data);
420 void pumi_ment_setLongTag(pMeshEnt e, pMeshTag tag,
long const* data);
421 void pumi_ment_getLongTag(pMeshEnt e, pMeshTag tag,
long* data);
422 void pumi_ment_setDblTag(pMeshEnt e, pMeshTag tag,
double const* data);
423 void pumi_ment_getDblTag(pMeshEnt e, pMeshTag tag,
double* data);
426 bool pumi_ment_isOn(pMeshEnt e,
int partID);
429 int pumi_ment_getOwnPID(pMeshEnt e,
pOwnership o=NULL);
432 pMeshEnt pumi_ment_getOwnEnt(pMeshEnt e,
pOwnership o=NULL);
435 bool pumi_ment_isOwned(pMeshEnt e,
pOwnership o=NULL);
439 bool pumi_ment_isOnBdry (pMeshEnt e);
443 int pumi_ment_getNumRmt (pMeshEnt e);
447 void pumi_ment_getAllRmt(pMeshEnt e, Copies& remotes);
451 pMeshEnt pumi_ment_getRmt(pMeshEnt& meshEnt,
int destPart);
454 void pumi_ment_getResidence(pMeshEnt e, Parts& residence);
457 void pumi_ment_getClosureResidence(pMeshEnt ent, Parts& residence);
460 bool pumi_ment_isGhost(pMeshEnt e);
463 bool pumi_ment_isGhosted (pMeshEnt e);
466 int pumi_ment_getNumGhost (pMeshEnt e);
469 void pumi_ment_getAllGhost (pMeshEnt e, Copies&);
472 pMeshEnt pumi_ment_getGhost(pMeshEnt& e,
int partID);
477 pNumbering pumi_numbering_create (
pMesh m,
const char* name,
pShape shape=NULL,
int num_component=1);
478 pNumbering pumi_numbering_createLocal (
pMesh m,
const char* name,
pShape shape=NULL);
480 pNumbering pumi_numbering_createOwn (
pMesh m,
const char* name,
pShape shape=NULL,
pOwnership o=NULL);
481 pNumbering pumi_numbering_createOwnDim (
pMesh m,
const char* name,
int dim,
pOwnership o=NULL);
482 pNumbering pumi_numbering_createProcGrp (
pMesh m,
const char* name,
int num_proc_grp,
485 void pumi_numbering_delete(pNumbering n);
486 int pumi_numbering_getNumNode(pNumbering n);
488 void pumi_node_setNumber(pNumbering nb, pMeshEnt e,
int n,
int c,
int number);
489 int pumi_node_getNumber(pNumbering nb, pMeshEnt e,
int n=0,
int c=0);
490 bool pumi_node_isNumbered(pNumbering nb, pMeshEnt e,
int n=0,
int c=0);
491 void pumi_numbering_print(pNumbering nb,
int rank = -1);
497 int pumi_shape_getNumNode (
pShape s,
int topo);
498 bool pumi_shape_hasNode (
pShape s,
int topo);
500 void pumi_node_getCoord(pMeshEnt e,
int i,
double* xyz);
501 void pumi_node_setCoord(pMeshEnt e,
int i,
double* xyz);
502 void pumi_node_getCoordVector(pMeshEnt e,
int i,
Vector3& xyz);
503 void pumi_node_setCoordVector(pMeshEnt e,
int i,
Vector3 const& xyz);
505 void pumi_node_getField (pField f, pMeshEnt e,
int i,
double* dof_data);
506 void pumi_node_setField (pField f, pMeshEnt e,
int i,
double* dof_data);
511 pShape pumi_shape_getLagrange (
int order);
512 pShape pumi_shape_getSerendipity ();
513 pShape pumi_shape_getConstant (
int dimension);
514 pShape pumi_shape_getIP (
int dimension,
int order);
515 pShape pumi_shape_getVoronoi (
int dimension,
int order);
516 pShape pumi_shape_getIPFit(
int dimension,
int order);
517 pShape pumi_shape_getHierarchic (
int order);
523 pField pumi_field_create(
pMesh m,
const char* name,
524 int num_dof_per_node,
int field_type=PUMI_PACKED,
pShape shape = NULL);
525 int pumi_field_getSize(pField f);
526 int pumi_field_getType(pField f);
527 std::string pumi_field_getName(pField f);
528 pShape pumi_field_getShape (pField f);
529 pNumbering pumi_field_getNumbering(pField f);
531 void pumi_field_delete(pField f);
532 void pumi_field_synchronize(pField f,
pOwnership o=NULL);
533 void pumi_field_accumulate(pField f,
pOwnership o=NULL);
534 void pumi_field_freeze(pField f);
535 void pumi_field_unfreeze(pField f);
536 pField pumi_mesh_findField(
pMesh m,
const char* name);
537 int pumi_mesh_getNumField(
pMesh m);
538 pField pumi_mesh_getField(
pMesh m,
int i);
540 void pumi_field_copy(pField f, pField r);
541 void pumi_field_add(pField f1, pField f2, pField r);
542 void pumi_field_multiply(pField f,
double d, pField r);
546 void pumi_field_print(pField f);
The APF Mesh modification interface.
Distribution plan object: send local elements to multiple destinations.
Distribution(pMesh m)
must be constructed with a mesh
void send(pMeshEnt e, int to)
assign a destination part id to an element
bool has(pMeshEnt e)
return true if the i'th element has been assigned destination(s)
Parts & sending(pMeshEnt e)
return the destination part id of an element
Ghosting plan object: local elements or part to destinations.
void send(int to)
assign a destination part id of all ghost_dim entities
void send(pMeshEnt e, int to)
assign a destination part id to an entity
Parts & sending(pMeshEnt e, int d)
return the destination parts of an entity
bool has(pMeshEnt e)
return true if the i'th element has been assigned a destination
int count()
return the number of elements with ghost destinations
Ghosting(pMesh, int d)
must be constructed with a mesh
Describes field distribution and shape functions.
Extended mesh interface for modification.
Migration plan object: local elements to destinations.
convenience wrapper over apf::Vector<3>
The Parallel Contrul Unit class encapsulates parallel communication.
abstract Geometric Model Interface
DynamicArray< Copy > CopyArray
a set of copies, possibly multiple copies per part
DynamicArray< MeshEntity * > Adjacent
Set of adjacent mesh entities.
std::set< int > Parts
Set of unique part ids.
void number(Numbering *n, MeshEntity *e, int node, int component, int number)
number a degree of freedom
std::map< int, MeshEntity * > Copies
Remote copy container.
NumberingOf< int > Numbering
Numbering is meant to be a 32-bit local numbering.
Vector< T, N > project(Vector< T, N > const &a, Vector< T, N > const &b)
returns vector a projected onto vector b
abstract description of entity copy sharing
the basic structure for all GMI models