|
MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include <iostream>#include "moab/Interface.hpp"#include "TestUtil.hpp"#include "Internals.hpp"#include "moab/Core.hpp"#include "MBTagConventions.hpp"#include "moab/Types.hpp"#include "moab/GeomTopoTool.hpp"
Include dependency graph for read_obj_test.cpp:Go to the source code of this file.
Defines | |
| #define | CHKERR(A) |
Functions | |
| void | read_file (Interface &moab, const char *input_file) |
| void | test_check_num_entities () |
| void | test_check_meshsets () |
| void | test_check_groups () |
| int | main () |
Variables | |
| std::string | test = "unittest/io/test.obj" |
| std::string | shuttle = "unittest/io/shuttle.obj" |
| GeomTopoTool * | myGeomTool |
| Tag | geom_tag |
| Tag | name_tag |
| Tag | id_tag |
| #define CHKERR | ( | A | ) |
do \ { \ if( MB_SUCCESS != ( A ) ) \ { \ std::cerr << "Failure (error code " << ( A ) << ") at " __FILE__ ":" << __LINE__ << std::endl; \ return A; \ } \ } while( false )
Definition at line 12 of file read_obj_test.cpp.
| int main | ( | ) |
Definition at line 36 of file read_obj_test.cpp.
References RUN_TEST, test_check_groups(), test_check_meshsets(), and test_check_num_entities().
{
int result = 0;
result += RUN_TEST( test_check_num_entities );
result += RUN_TEST( test_check_meshsets );
result += RUN_TEST( test_check_groups );
return result;
}
| void test_check_groups | ( | ) |
Definition at line 125 of file read_obj_test.cpp.
References CHECK_EQUAL, CHECK_ERR, ErrorCode, moab::Interface::get_entities_by_dimension(), moab::Interface::get_entities_by_type_and_tag(), moab::Interface::globalId_tag(), id_tag, MBENTITYSET, read_file(), and shuttle.
Referenced by main().
{
ErrorCode rval;
Core core;
Interface* mbi = &core;
read_file( core, shuttle.c_str() );
// check that number of tris created is 616
// 170 tris + 223 quads split into 2 tris = 616
Range tris;
int tri_dim = 2;
rval = mbi->get_entities_by_dimension( 0, tri_dim, tris );CHECK_ERR( rval );
CHECK_EQUAL( 616, (int)tris.size() );
// check that 11 mesh sets are created
// 1 for global vert set + 1 for each of 10 groups
Range ent_sets, mesh_sets;
id_tag = mbi->globalId_tag();
rval = mbi->get_entities_by_type_and_tag( 0, MBENTITYSET, &id_tag, NULL, 1, ent_sets );
CHECK_EQUAL( 11, (int)ent_sets.size() );
}
| void test_check_meshsets | ( | ) |
Definition at line 72 of file read_obj_test.cpp.
References moab::Range::begin(), CHECK_EQUAL, CHECK_ERR, children, moab::Range::clear(), dim, moab::Range::end(), ErrorCode, GEOM_DIMENSION_TAG_NAME, geom_tag, moab::Interface::get_child_meshsets(), moab::Interface::get_entities_by_type_and_tag(), moab::Interface::get_parent_meshsets(), MB_TYPE_INTEGER, MBENTITYSET, myGeomTool, read_file(), moab::Range::size(), moab::Interface::tag_get_data(), moab::Interface::tag_get_handle(), and test.
Referenced by main().
{
ErrorCode rval;
Core core;
Interface* mbi = &core;
read_file( core, test.c_str() );
myGeomTool = new GeomTopoTool( mbi );
Range ent_sets;
rval = mbi->tag_get_handle( GEOM_DIMENSION_TAG_NAME, 1, MB_TYPE_INTEGER, geom_tag );CHECK_ERR( rval );
rval = mbi->get_entities_by_type_and_tag( 0, MBENTITYSET, &geom_tag, NULL, 1, ent_sets );CHECK_ERR( rval );
Range::iterator it;
Range parents, children;
int sense;
int dim, num_surfs = 0, num_vols = 0;
for( it = ent_sets.begin(); it != ent_sets.end(); ++it )
{
rval = mbi->tag_get_data( geom_tag, &( *it ), 1, &dim );
if( dim == 2 )
{
num_surfs++;
// check that one parent is created for each surface
parents.clear();
rval = mbi->get_parent_meshsets( *it, parents );CHECK_ERR( rval );
CHECK_EQUAL( 1, (int)parents.size() );
// check that sense of surface wrt parent is FORWARD = 1
rval = myGeomTool->get_sense( *it, *parents.begin(), sense );CHECK_ERR( rval );
CHECK_EQUAL( 1, sense );
}
else if( dim == 3 )
{
num_vols++;
// check that one child is created for each volume
children.clear();
rval = mbi->get_child_meshsets( *it, children );CHECK_ERR( rval );
CHECK_EQUAL( 1, (int)children.size() );
}
}
// check that two surfaces and two volumes are created
CHECK_EQUAL( 2, num_surfs );
CHECK_EQUAL( 2, num_vols );
delete myGeomTool;
}
| void test_check_num_entities | ( | ) |
Definition at line 52 of file read_obj_test.cpp.
References CHECK_EQUAL, CHECK_ERR, ErrorCode, moab::Interface::get_entities_by_dimension(), read_file(), and test.
Referenced by main().
{
ErrorCode rval;
Core core;
Interface* mbi = &core;
read_file( core, test.c_str() );
// check that number of verts created is 7
Range verts;
int vert_dim = 0;
rval = mbi->get_entities_by_dimension( 0, vert_dim, verts );CHECK_ERR( rval );
CHECK_EQUAL( 7, (int)verts.size() );
// check that number of tris created is 3
Range tris;
int tri_dim = 2;
rval = mbi->get_entities_by_dimension( 0, tri_dim, tris );CHECK_ERR( rval );
CHECK_EQUAL( 3, (int)tris.size() );
}
Definition at line 27 of file read_obj_test.cpp.
Referenced by build_cube(), moab::Skinner::find_geometric_skin(), moab::FBEngine::find_vertex_set_for_node(), get_all_handles(), get_children_by_dimension(), moab::FBEngine::getNumOfType(), moab::FBEngine::initializeSmoothing(), main(), print_partitioned_entities(), quads_to_tris(), read_cube_curves_test(), read_cube_surfs_test(), read_cube_vols_test(), read_cylcube_curve_senses_test(), read_cylcube_surf_senses_test(), test_check_meshsets(), test_elements_on_several_procs(), test_ghost_elements(), and moab::WriteGmsh::write_file().
Definition at line 29 of file read_obj_test.cpp.
Definition at line 25 of file read_obj_test.cpp.
Referenced by test_check_meshsets().
Definition at line 28 of file read_obj_test.cpp.
Referenced by build_cube(), get_all_handles(), moab::Tqdcfr::parse_acis_attribs(), and read_cylcube_groups_test().
| std::string shuttle = "unittest/io/shuttle.obj" |
Definition at line 23 of file read_obj_test.cpp.
Referenced by test_check_groups().
| std::string test = "unittest/io/test.obj" |
Definition at line 22 of file read_obj_test.cpp.
Referenced by find_volume_tests(), main(), register_test(), test_check_meshsets(), and test_check_num_entities().