SCOREC core
Parallel unstructured mesh tools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
chefStream.cc
Go to the documentation of this file.
1 
14 #include <PCU.h>
15 #include <chef.h>
16 #include <phstream.h>
17 #include <gmi_mesh.h>
18 #ifdef HAVE_SIMMETRIX
19 #include <gmi_sim.h>
20 #include <SimUtil.h>
21 #endif
22 #include <stdio.h>
23 
24 namespace {
25  void freeMesh(apf::Mesh* m) {
26  m->destroyNative();
28  }
29  void reconfigureChef(ph::Input& ctrl) {
30  ctrl.tetrahedronize = 0;
31  ctrl.solutionMigration = 1;
32  ctrl.outMeshFileName = std::string("bz2:chefStream/");
33  }
34 }
35 
36 int main(int argc, char** argv) {
37  MPI_Init(&argc, &argv);
38  PCU_Comm_Init();
39  PCU_Protect();
40 #ifdef HAVE_SIMMETRIX
41  Sim_readLicenseFile(0);
42  gmi_sim_start();
43  gmi_register_sim();
44 #endif
46  gmi_model* g = NULL;
47  apf::Mesh2* m = NULL;
48  GRStream* grs = makeGRStream();
49  ph::Input ctrl;
50  ctrl.load("adapt.inp");
51  chef::cook(g,m,ctrl,grs);
52  RStream* rs = makeRStream();
53  attachRStream(grs,rs);
54  reconfigureChef(ctrl);
55  chef::cook(g,m,ctrl,rs);
56  destroyGRStream(grs);
57  destroyRStream(rs);
58  freeMesh(m);
59 #ifdef HAVE_SIMMETRIX
60  gmi_sim_stop();
61  Sim_unregisterAllKeys();
62 #endif
63  PCU_Comm_Free();
64  MPI_Finalize();
65 }
int main(int argc, char **argv)
run the operations requested in &quot;adapt.inp&quot;
Definition: chef.cc:31
The Chef interface.
void destroyMesh(Mesh *m)
Destroys an apf::Mesh.
int tetrahedronize
tetrahedronize a mixed mesh if set to 1.
Definition: phInput.h:118
void destroyGRStream(grstream grs)
destroy geom-restart stream
the basic structure for all GMI models
Definition: gmi.h:112
Interface to a mesh part.
Definition: apfMesh.h:103
User configuration for Chef execution.
Definition: phInput.h:21
grstream makeGRStream()
make geom-restart stream
GMI meshmodel interface.
virtual void destroyNative()=0
actually destroy the underlying mesh data structure
int PCU_Comm_Free(void)
Frees all PCU library structures.
Definition: pcu.c:77
int PCU_Comm_Init(void)
Initializes the PCU library.
Definition: pcu.c:58
std::string outMeshFileName
output mesh file name, see meshFileName
Definition: phInput.h:55
void destroyRStream(rstream rs)
detach output stream
Extended mesh interface for modification.
Definition: apfMesh2.h:29
void attachRStream(grstream grs, rstream rs)
dev function
The data stream API.
void gmi_register_mesh(void)
register the meshmodel reader for .dmg files
rstream makeRStream()
make restart stream