MeshKit
1.0
|
00001 00008 #include "meshkit/MKCore.hpp" 00009 #include "meshkit/MeshOp.hpp" 00010 #include "meshkit/CopyGeom.hpp" 00011 #include "meshkit/ModelEnt.hpp" 00012 00013 using namespace MeshKit; 00014 00015 #include "TestUtil.hpp" 00016 00017 #ifdef HAVE_ACIS 00018 #define DEFAULT_TEST_FILE "brick.sat" 00019 #elif defined(HAVE_OCC) 00020 #define DEFAULT_TEST_FILE "brick.stp" 00021 #endif 00022 00023 MKCore *mk; 00024 00025 void test_load_and_copymove(); 00026 00027 int main(int argc, char **argv) 00028 { 00029 mk = new MKCore(); 00030 int num_fail = 0; 00031 00032 num_fail += RUN_TEST(test_load_and_copymove); 00033 00034 delete mk; 00035 return num_fail; 00036 } 00037 00038 void test_load_and_copymove() 00039 { 00040 std::string filename = TestDir + "/" + DEFAULT_TEST_FILE; 00041 mk->load_geometry(filename.c_str()); 00042 00043 MEntVector vols; 00044 mk->get_entities_by_dimension(3, vols); 00045 00046 CopyGeom *cg = (CopyGeom*) mk->construct_meshop("CopyGeom", vols); 00047 cg->set_name("copy_move_geom"); 00048 00049 // some entity tag types are always copy or expand 00050 // cg->expand_sets().add_tag("MATERIAL_SET"); 00051 // cg->expand_sets().add_tag("DIRICHLET_SET"); 00052 // cg->expand_sets().add_tag("NEUMANN_SET"); 00053 00054 // set the location 00055 Vector<3> dx; dx[0] = 1; dx[1] = 0; dx[2] = 0; 00056 cg->set_location(dx); 00057 00058 // put them in the graph 00059 mk->get_graph().addArc(mk->root_node()->get_node(), cg->get_node()); 00060 mk->get_graph().addArc(cg->get_node(), mk->leaf_node()->get_node()); 00061 00062 // execute the copygeom graph 00063 mk->setup_and_execute(); 00064 00065 // merge and imprint the o/p geometry 00066 std::vector<iBase_EntityHandle> entities_out; 00067 mk->igeom_instance()->getEntities(0, iBase_REGION, entities_out); 00068 double dTol = 1.0e-2; 00069 mk->igeom_instance()->mergeEnts(&entities_out[0],entities_out.size(), dTol); 00070 mk->igeom_instance()->imprintEnts(&entities_out[0], entities_out.size()); 00071 00072 // delete the cg instance 00073 delete cg; 00074 } 00075 00076 00077