MeshKit
1.0
|
00001 00015 #include "meshkit/MKCore.hpp" 00016 #include "meshkit/MeshOp.hpp" 00017 #include "meshkit/CopyMesh.hpp" 00018 #include "meshkit/ModelEnt.hpp" 00019 00020 using namespace MeshKit; 00021 00022 #define DEFAULT_TEST_FILE1 "c.h5m" 00023 #define DEFAULT_TEST_FILE2 "d.h5m" 00024 00025 MKCore *mk; 00026 00027 int main(int argc, char **argv) 00028 { 00029 mk = new MKCore(); 00030 std::vector <CopyMesh*> cm; 00031 iMesh *imesh = mk->imesh_instance(); 00032 int err =0; 00033 std::vector<std::string> files; 00034 std::string name1 = std::string(MESH_DIR) + "/" + DEFAULT_TEST_FILE1; 00035 std::string name2 = std::string(MESH_DIR) + "/" + DEFAULT_TEST_FILE2; 00036 00037 files.push_back(name1); 00038 files.push_back(name2); 00039 cm.resize(files.size()); 00040 iBase_EntitySetHandle orig_set; 00041 00042 for (unsigned int i = 0; i < files.size(); i++) { 00043 iMesh_createEntSet(imesh->instance(), 0, &orig_set, &err); 00044 iMesh_load(imesh->instance(), orig_set, files[i].c_str(), NULL, &err, strlen(files[i].c_str()), 0); 00045 ModelEnt *me; 00046 me = NULL; 00047 me = new ModelEnt(mk, iBase_EntitySetHandle(0), /*igeom instance*/0, (moab::EntityHandle)orig_set, 0); 00048 MEntVector assm_set; 00049 assm_set.push_back(me); 00050 cm[i] = (CopyMesh*) mk->construct_meshop("CopyMesh", assm_set); 00051 cm[i]->set_name("copy_move_mesh"); 00052 cm[i]->copy_sets().add_set(orig_set); 00053 // some entity tag types are always copy or expand 00054 cm[i]->expand_sets().add_tag("MATERIAL_SET"); 00055 cm[i]->expand_sets().add_tag("DIRICHLET_SET"); 00056 cm[i]->expand_sets().add_tag("NEUMANN_SET"); 00057 cm[i]->copy_sets().add_tag("GEOM_DIMENSION"); 00058 Vector<3> dx; dx[0] = 10; dx[1] = 0; dx[2] = 0; 00059 cm[i]->set_transform(Copy::Translate(dx)); 00060 } 00061 // copy and merge 00062 mk->setup_and_execute(); 00063 for (unsigned int i = 0; i < files.size(); i++) 00064 delete cm[i]; 00065 mk->save_mesh("o.h5m"); 00066 return 0; 00067 }