MeshKit  1.0
test_submapping.cpp
Go to the documentation of this file.
00001 
00007 #include "meshkit/MKCore.hpp"
00008 #include "meshkit/SubMapping.hpp"
00009 #include "meshkit/SizingFunction.hpp"
00010 #include "meshkit/ModelEnt.hpp"
00011 #include "meshkit/Matrix.hpp"
00012 #include "meshkit/EdgeMesher.hpp"
00013 #include "meshkit/SubMapping.hpp"
00014 
00015 using namespace MeshKit;
00016 
00017 #include "TestUtil.hpp"
00018 
00019 MKCore *mk = NULL;
00020 
00021 void test_SubMappingcubit();
00022 
00023 int main(int argc, char **argv) 
00024 {
00025   
00026     // start up MK and load the geometry
00027   mk = new MKCore();
00028 
00029   int num_fail = 0;
00030   
00031   //num_fail += RUN_TEST(test_TFImapping);
00032   
00033   num_fail += RUN_TEST(test_SubMappingcubit);
00034 
00035 
00036  #if HAVE_OCC
00037   return 0;
00038 #else
00039   return num_fail;
00040 #endif 
00041 }
00042 
00043 void test_SubMappingcubit()
00044 {
00045     std::string file_name = TestDir + "/submapping_simple_example.cub";
00046     mk->load_geometry_mesh(file_name.c_str(), file_name.c_str());
00047 
00048         //check the number of geometrical edges
00049         MEntVector surfs, curves, loops;
00050         mk->get_entities_by_dimension(2, surfs);
00051         ModelEnt *this_surf = (*surfs.rbegin());
00052 
00053         this_surf->get_adjacencies(1, curves);
00054 
00055         //CHECK_EQUAL(4, (int)curves.size());
00056         
00057         //check the number of mesh line segments
00058         moab::Range edges;
00059         moab::ErrorCode rval = mk->moab_instance()->get_entities_by_dimension(0, 1, edges);
00060         CHECK_EQUAL(moab::MB_SUCCESS, rval);
00061         //CHECK_EQUAL(40, (int)edges.size());
00062 
00063         SizingFunction swSize(mk, -1, 0.5);
00064         this_surf->sizing_function_index(swSize.core_index());
00065         //now, do the SubMapping
00066         SubMapping *tm = (SubMapping*)mk->construct_meshop("SubMapping", surfs);
00067         //tm->SetupMeshSize(5.0);
00068 
00069         mk->setup_and_execute();
00070 
00071         //check the number of quads
00072         moab::Range faces;
00073         rval = mk->moab_instance()->get_entities_by_dimension(0, 2, faces);
00074         CHECK_EQUAL(moab::MB_SUCCESS, rval);
00075         //CHECK_EQUAL(100, (int)faces.size());
00076 
00077         mk->save_mesh("submapping.vtk");
00078 
00079         delete tm;
00080         mk->clear_graph();
00081         
00082 }
00083 
00084   
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines