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