MeshKit  1.0
test_copygeom.cpp
Go to the documentation of this file.
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   std::cout << "Filename value: " << filename << std::endl;
00042   mk->load_geometry(filename.c_str());
00043 
00044   MEntVector vols;
00045   mk->get_entities_by_dimension(3, vols);
00046 
00047   CopyGeom *cg = (CopyGeom*) mk->construct_meshop("CopyGeom", vols);
00048   cg->set_name("copy_move_geom");
00049 
00050 // some entity tag types are always copy or expand
00051 //  cg->expand_sets().add_tag("MATERIAL_SET");
00052 //  cg->expand_sets().add_tag("DIRICHLET_SET");
00053 //  cg->expand_sets().add_tag("NEUMANN_SET");
00054 
00055   // set the location
00056   Vector<3> dx; dx[0] = 1; dx[1] = 0; dx[2] = 0;
00057   cg->set_location(dx);
00058 
00059   // put them in the graph
00060   mk->get_graph().addArc(mk->root_node()->get_node(), cg->get_node());
00061   mk->get_graph().addArc(cg->get_node(), mk->leaf_node()->get_node());
00062 
00063   // execute the copygeom graph
00064   mk->setup_and_execute();
00065 
00066   // merge and imprint the o/p geometry
00067   std::vector<iBase_EntityHandle> entities_out;
00068   mk->igeom_instance()->getEntities(0, iBase_REGION, entities_out);
00069   double dTol = 1.0e-2;
00070   mk->igeom_instance()->mergeEnts(&entities_out[0],entities_out.size(), dTol);
00071   mk->igeom_instance()->imprintEnts(&entities_out[0], entities_out.size());
00072 
00073   // delete the cg instance
00074   delete cg;
00075 }
00076 
00077 
00078 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines