Go to the documentation of this file.00001
00014 #include <PCU.h>
00015 #include <chef.h>
00016 #include <phstream.h>
00017 #include <gmi_mesh.h>
00018 #ifdef HAVE_SIMMETRIX
00019 #include <gmi_sim.h>
00020 #include <SimUtil.h>
00021 #endif
00022 #include <stdio.h>
00023
00024 namespace {
00025 void freeMesh(apf::Mesh* m) {
00026 m->destroyNative();
00027 apf::destroyMesh(m);
00028 }
00029 void reconfigureChef(ph::Input& ctrl) {
00030 ctrl.tetrahedronize = 0;
00031 ctrl.solutionMigration = 1;
00032 ctrl.outMeshFileName = std::string("bz2:chefStream/");
00033 }
00034 }
00035
00036 int main(int argc, char** argv) {
00037 MPI_Init(&argc, &argv);
00038 PCU_Comm_Init();
00039 PCU_Protect();
00040 #ifdef HAVE_SIMMETRIX
00041 Sim_readLicenseFile(0);
00042 gmi_sim_start();
00043 gmi_register_sim();
00044 #endif
00045 gmi_register_mesh();
00046 gmi_model* g = NULL;
00047 apf::Mesh2* m = NULL;
00048 GRStream* grs = makeGRStream();
00049 ph::Input ctrl;
00050 ctrl.load("adapt.inp");
00051 chef::cook(g,m,ctrl,grs);
00052 RStream* rs = makeRStream();
00053 attachRStream(grs,rs);
00054 reconfigureChef(ctrl);
00055 chef::cook(g,m,ctrl,rs);
00056 destroyGRStream(grs);
00057 destroyRStream(rs);
00058 freeMesh(m);
00059 #ifdef HAVE_SIMMETRIX
00060 gmi_sim_stop();
00061 Sim_unregisterAllKeys();
00062 #endif
00063 PCU_Comm_Free();
00064 MPI_Finalize();
00065 }