MeshKit
1.0
|
00001 00007 #include <iostream> 00008 00009 #include <time.h> 00010 #include <stdlib.h> 00011 #include <cstring> 00012 #include <cstring> 00013 00014 #include "meshkit/MKCore.hpp" 00015 #include "meshkit/MeshOp.hpp" 00016 #include "meshkit/ModelEnt.hpp" 00017 #include "meshkit/MBGeomOp.hpp" 00018 00019 using namespace MeshKit; 00020 00021 #include "TestUtil.hpp" 00022 00023 MKCore *mk; 00024 00025 std::string usage_string = 00026 "<input file> input file \n" 00027 "<output file> Output final model to given file \n" 00028 "\n"; 00029 00030 int main(int argc, char* argv[]) 00031 { 00032 // check command line arg 00033 const char *filename = 0; 00034 const char *outfile = 0; 00035 std::string fstr; 00036 if (argc==3) 00037 { 00038 filename = argv[1]; 00039 outfile = argv[2]; 00040 } 00041 else 00042 { 00043 std::cout << usage_string ; 00044 fstr=TestDir + "/partBed.smf"; 00045 std::cout << "using default input file:" << fstr <<", no output\n"; 00046 filename = fstr.c_str(); 00047 } 00048 00049 // initialize everything 00050 00051 mk = new MKCore(); 00052 mk->load_mesh(filename); 00053 MEntVector selection, dum; 00054 mk->get_entities_by_dimension(2, dum); 00055 selection.push_back(*dum.rbegin());// push just the last one retrieved from core 00056 00057 mk->construct_meshop("MBGeomOp", selection); 00058 00059 mk->setup_and_execute(); 00060 00061 if(outfile) 00062 { 00063 std::cout << "writing the set output to " << outfile << std::endl; 00064 moab::EntityHandle outset= (*dum.begin())->mesh_handle(); 00065 mk->moab_instance()->write_mesh(outfile, &outset, 1);// write the original mesh set 00066 // it will write its children too 00067 } 00068 return 0; 00069 00070 } 00071 00072 //process options