MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Public Member Functions | |
PatchSetTest () | |
void | setUp () |
void | tearDown () |
void | test_vertex_patches () |
void | test_vertex_patches_bad_handle () |
void | test_vertex_patches_fail_handles () |
void | test_vertex_patches_fail_entities () |
void | test_global_patch () |
void | test_global_patch_fail_entities () |
Private Member Functions | |
CPPUNIT_TEST_SUITE (PatchSetTest) | |
CPPUNIT_TEST (test_vertex_patches) | |
CPPUNIT_TEST (test_vertex_patches_bad_handle) | |
CPPUNIT_TEST (test_vertex_patches_fail_handles) | |
CPPUNIT_TEST (test_vertex_patches_fail_entities) | |
CPPUNIT_TEST (test_global_patch) | |
CPPUNIT_TEST (test_global_patch_fail_entities) | |
CPPUNIT_TEST_SUITE_END () | |
void | test_bad_handle (PatchSet &ps) |
void | test_fail_handles (PatchSet &ps) |
void | test_fail_entities (PatchSet &ps) |
Private Attributes | |
FakeMesh | myMesh |
Definition at line 312 of file PatchSetTest.cpp.
PatchSetTest::PatchSetTest | ( | ) | [inline] |
Definition at line 339 of file PatchSetTest.cpp.
: myMesh( 10 ) {}
PatchSetTest::CPPUNIT_TEST | ( | test_vertex_patches | ) | [private] |
PatchSetTest::CPPUNIT_TEST | ( | test_vertex_patches_bad_handle | ) | [private] |
PatchSetTest::CPPUNIT_TEST | ( | test_vertex_patches_fail_handles | ) | [private] |
PatchSetTest::CPPUNIT_TEST | ( | test_vertex_patches_fail_entities | ) | [private] |
PatchSetTest::CPPUNIT_TEST | ( | test_global_patch | ) | [private] |
PatchSetTest::CPPUNIT_TEST | ( | test_global_patch_fail_entities | ) | [private] |
PatchSetTest::CPPUNIT_TEST_SUITE | ( | PatchSetTest | ) | [private] |
PatchSetTest::CPPUNIT_TEST_SUITE_END | ( | ) | [private] |
void PatchSetTest::setUp | ( | ) | [inline] |
Definition at line 341 of file PatchSetTest.cpp.
References myMesh, and FakeMesh::should_fail().
{ myMesh.should_fail( false ); }
void PatchSetTest::tearDown | ( | ) | [inline] |
Definition at line 345 of file PatchSetTest.cpp.
{}
void PatchSetTest::test_bad_handle | ( | PatchSet & | ps | ) | [private] |
Definition at line 456 of file PatchSetTest.cpp.
References MBMesquite::MsqError::clear(), CPPUNIT_ASSERT, MBMesquite::PatchSet::get_patch(), MBMesquite::PatchSet::get_patch_handles(), myMesh, and MBMesquite::PatchSet::set_mesh().
Referenced by test_vertex_patches_bad_handle().
{ MsqPrintError err( std::cout ); ps.set_mesh( &myMesh ); // Get list of patch handles vector< PatchSet::PatchHandle > patch_handles; ps.get_patch_handles( patch_handles, err ); CPPUNIT_ASSERT( !err ); // create an invalid handle size_t max_handle = (size_t)*max_element( patch_handles.begin(), patch_handles.end() ); size_t bad_handle = max_handle + 1; // try to get patch for invalid handle vector< Mesh::VertexHandle > patch_verts; vector< Mesh::ElementHandle > patch_elems; ps.get_patch( (PatchSet::PatchHandle)bad_handle, patch_elems, patch_verts, err ); CPPUNIT_ASSERT( err ); err.clear(); }
void PatchSetTest::test_fail_entities | ( | PatchSet & | ps | ) | [private] |
Definition at line 491 of file PatchSetTest.cpp.
References MBMesquite::MsqError::clear(), CPPUNIT_ASSERT, MBMesquite::PatchSet::get_patch(), MBMesquite::PatchSet::get_patch_handles(), myMesh, MBMesquite::PatchSet::set_mesh(), and FakeMesh::should_fail().
Referenced by test_global_patch_fail_entities(), and test_vertex_patches_fail_entities().
{ MsqPrintError err( std::cout ); ps.set_mesh( &myMesh ); // Get list of patch handles vector< PatchSet::PatchHandle > patch_handles; ps.get_patch_handles( patch_handles, err ); CPPUNIT_ASSERT( !err ); // try to get patch for invalid handle vector< Mesh::VertexHandle > patch_verts; vector< Mesh::ElementHandle > patch_elems; myMesh.should_fail( true ); ps.get_patch( patch_handles[0], patch_elems, patch_verts, err ); myMesh.should_fail( false ); CPPUNIT_ASSERT( err ); err.clear(); }
void PatchSetTest::test_fail_handles | ( | PatchSet & | ps | ) | [private] |
Definition at line 478 of file PatchSetTest.cpp.
References MBMesquite::MsqError::clear(), CPPUNIT_ASSERT, MBMesquite::PatchSet::get_patch_handles(), myMesh, MBMesquite::PatchSet::set_mesh(), and FakeMesh::should_fail().
Referenced by test_vertex_patches_fail_handles().
{ MsqPrintError err( std::cout ); ps.set_mesh( &myMesh ); myMesh.should_fail( true ); vector< PatchSet::PatchHandle > patch_handles; ps.get_patch_handles( patch_handles, err ); myMesh.should_fail( false ); CPPUNIT_ASSERT( err ); err.clear(); }
void PatchSetTest::test_global_patch | ( | ) |
Definition at line 421 of file PatchSetTest.cpp.
References CPPUNIT_ASSERT, FakeMesh::get_all_elements(), FakeMesh::get_all_vertices(), MBMesquite::GlobalPatch::get_patch(), MBMesquite::GlobalPatch::get_patch_handles(), myMesh, and MBMesquite::PatchSet::set_mesh().
{ GlobalPatch gp; MsqPrintError err( std::cout ); gp.set_mesh( &myMesh ); // Get data from myMesh to compare to vector< Mesh::VertexHandle > vertex_handles, patch_verts; vector< Mesh::ElementHandle > element_handles, patch_elems; myMesh.get_all_vertices( vertex_handles, err ); CPPUNIT_ASSERT( !err ); myMesh.get_all_elements( element_handles, err ); CPPUNIT_ASSERT( !err ); // Get list of patch handles vector< PatchSet::PatchHandle > patch_handles; gp.get_patch_handles( patch_handles, err ); CPPUNIT_ASSERT( !err ); CPPUNIT_ASSERT( 1 == patch_handles.size() ); // Get mesh data from GlobalPatch gp.get_patch( patch_handles[0], patch_elems, patch_verts, err ); CPPUNIT_ASSERT( !err ); // compare element list sort( element_handles.begin(), element_handles.end() ); sort( patch_elems.begin(), patch_elems.end() ); CPPUNIT_ASSERT( patch_elems == element_handles ); // compare vertex list sort( vertex_handles.begin(), vertex_handles.end() ); sort( patch_verts.begin(), patch_verts.end() ); CPPUNIT_ASSERT( patch_verts.empty() || patch_verts == vertex_handles ); }
Definition at line 529 of file PatchSetTest.cpp.
References test_fail_entities().
{ GlobalPatch ps; test_fail_entities( ps ); }
void PatchSetTest::test_vertex_patches | ( | ) |
Definition at line 362 of file PatchSetTest.cpp.
References MBMesquite::arrptr(), ASSERT_NO_ERROR, CPPUNIT_ASSERT, CPPUNIT_ASSERT_EQUAL, fixed, FakeMesh::get_all_vertices(), MBMesquite::VertexPatches::get_patch(), MBMesquite::VertexPatches::get_patch_handles(), myMesh, MBMesquite::PatchSet::set_mesh(), FakeMesh::vertices_get_attached_elements(), and FakeMesh::vertices_get_fixed_flag().
{ size_t i; VertexPatches vp; MsqPrintError err( std::cout ); vp.set_mesh( &myMesh ); MeshDomainAssoc mesh_and_domain = MeshDomainAssoc( &myMesh, 0 ); Instruction::initialize_vertex_byte( &mesh_and_domain, 0, err ); ASSERT_NO_ERROR( err ); // Get data from myMesh to compare to vector< Mesh::VertexHandle > vertex_handles, patch_verts; vector< Mesh::ElementHandle > element_handles, patch_elems; myMesh.get_all_vertices( vertex_handles, err ); ASSERT_NO_ERROR( err ); CPPUNIT_ASSERT( !vertex_handles.empty() ); std::vector< bool > fixed; myMesh.vertices_get_fixed_flag( arrptr( vertex_handles ), fixed, vertex_handles.size(), err ); ASSERT_NO_ERROR( err ); set< Mesh::VertexHandle > free_verts; for( i = 0; i < vertex_handles.size(); ++i ) if( !fixed[i] ) free_verts.insert( vertex_handles[i] ); // Get list of patch handles vector< PatchSet::PatchHandle > patch_handles; vp.get_patch_handles( patch_handles, err ); ASSERT_NO_ERROR( err ); CPPUNIT_ASSERT_EQUAL( free_verts.size(), patch_handles.size() ); // Check each patch handle vector< size_t > offsets; for( i = 0; i < patch_handles.size(); ++i ) { vp.get_patch( patch_handles[i], patch_elems, patch_verts, err ); ASSERT_NO_ERROR( err ); // Check that each patch contains exactly 1 free vertex // and that it is always a different free vertex. CPPUNIT_ASSERT( patch_verts.size() == 1 ); set< Mesh::VertexHandle >::iterator i = free_verts.find( patch_verts[0] ); CPPUNIT_ASSERT( i != free_verts.end() ); free_verts.erase( i ); // Get adjacent elements from myMesh to compare with element_handles.clear(); myMesh.vertices_get_attached_elements( arrptr( patch_verts ), 1, element_handles, offsets, err ); ASSERT_NO_ERROR( err ); // Compare element handle lists sort( element_handles.begin(), element_handles.end() ); sort( patch_elems.begin(), patch_elems.end() ); CPPUNIT_ASSERT( element_handles == patch_elems ); } }
Definition at line 511 of file PatchSetTest.cpp.
References test_bad_handle().
{ VertexPatches ps; test_bad_handle( ps ); }
Definition at line 523 of file PatchSetTest.cpp.
References test_fail_entities().
{ VertexPatches ps; test_fail_entities( ps ); }
Definition at line 517 of file PatchSetTest.cpp.
References test_fail_handles().
{ VertexPatches ps; test_fail_handles( ps ); }
FakeMesh PatchSetTest::myMesh [private] |
Definition at line 327 of file PatchSetTest.cpp.
Referenced by setUp(), test_bad_handle(), test_fail_entities(), test_fail_handles(), test_global_patch(), and test_vertex_patches().