MeshKit  1.0
test_get_entities_by_dim.cpp
Go to the documentation of this file.
00001 
00007 #include "meshkit/MKCore.hpp"
00008 #include <stdlib.h>
00009 
00010 using namespace MeshKit;
00011 
00012 #include "TestUtil.hpp"
00013 
00014 #define DEFAULT_TEST_FILE "cyl_grps.sat"
00015 
00016 MKCore *mk;
00017 
00018 void test_get_entities_by_dim();
00019 
00020 int main(int argc, char **argv)
00021 {
00022     mk = new MKCore();
00023     int num_fail = 0; 
00024     #ifdef HAVE_ACIS
00025     num_fail += RUN_TEST(test_get_entities_by_dim);
00026     #endif
00027     return num_fail;
00028 }
00029 
00030 void test_get_entities_by_dim()
00031 {
00032   std::cout << TestDir << std::endl;
00033   std::string filename = TestDir + "/" + DEFAULT_TEST_FILE;
00034   // load the test file
00035   mk->load_geometry(filename.c_str()); 
00036 
00037   // check that we find our group
00038   MEntVector groups;
00039   mk->get_entities_by_dimension(4, groups);
00040   int num_of_grps = groups.size();
00041   CHECK_EQUAL(1, num_of_grps);
00042 
00043   // check that we get the right number of volumes
00044   MEntVector vols;
00045   mk->get_entities_by_dimension(3, vols);
00046   int num_of_vols = vols.size();
00047   CHECK_EQUAL(1, num_of_vols);
00048 
00049   // check surfaces
00050   MEntVector surfs;
00051   mk->get_entities_by_dimension(2, surfs);
00052   int num_of_surfs = surfs.size();
00053   CHECK_EQUAL(3, num_of_surfs);
00054 
00055   MEntVector curves;
00056   mk->get_entities_by_dimension(1, curves);
00057   int num_of_curves = curves.size();
00058   CHECK_EQUAL(2, num_of_curves);
00059 
00060   MEntVector verts;
00061   mk->get_entities_by_dimension(0, verts);
00062   int num_of_verts = verts.size();
00063   CHECK_EQUAL(2, num_of_verts);
00064 
00065   MEntVector dum;
00066   bool found_error = false;
00067   try {mk->get_entities_by_dimension(6, dum);
00068   }
00069   catch(Error) {
00070     found_error = true;
00071   }
00072   CHECK(found_error);
00073 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines