MeshKit  1.0
example_coregen.cpp
Go to the documentation of this file.
00001 
00011 #include "meshkit/MKCore.hpp"
00012 #include "meshkit/MeshOp.hpp"
00013 #include "meshkit/ModelEnt.hpp"
00014 #include "meshkit/CoreGen.hpp"
00015 #include "mpi.h"
00016 using namespace MeshKit;
00017 
00018 
00019 void test_coregen_default(int argc, char **argv);
00020 
00021 int main(int argc, char *argv[])
00022 {
00023     test_coregen_default(argc, argv);
00024     return 0;
00025 }
00026 
00027 void test_coregen_default(int argc, char **argv)
00028 {
00029     // serial process
00030     int nrank = 0, nprocs =1;
00031 
00032     //Initialize MPI
00033 #ifdef HAVE_PARALLEL_MOAB
00034     MPI::Init(argc, argv);
00035     nprocs = MPI::COMM_WORLD.Get_size();
00036     nrank = MPI::COMM_WORLD.Get_rank();
00037 #endif
00038 
00039     MKCore *mk;
00040     mk = new MKCore();
00041     // create a model entity vector for construting coregen meshop, note that NO model entities are required.
00042     MEntVector nullMEntVec;
00043 
00044     // construct the meshop and set name
00045     CoreGen *cg = (CoreGen*) mk->construct_meshop("CoreGen", nullMEntVec);
00046     cg->set_name("coregen");
00047 
00048     // setup input/output files for creating the 'Reactor Core' model
00049     cg->prepareIO(argc, argv, nrank, nprocs, std::string(MESH_DIR));
00050     mk->setup_and_execute();
00051     mk->save_mesh("cgd.h5m");
00052 #ifdef HAVE_PARALLEL_MOAB
00053     MPI::COMM_WORLD.Barrier();
00054     MPI::Finalize();
00055 #endif
00056 
00057     delete mk;
00058 }
00059 
00060 
00061 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines