MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Public Member Functions | |
void | setUp () |
void | tearDown () |
XYRectangleTest () | |
void | test_snap_to () |
void | test_normal_at () |
void | test_closest_point () |
void | test_domain_DoF () |
Private Member Functions | |
CPPUNIT_TEST_SUITE (XYRectangleTest) | |
CPPUNIT_TEST (test_snap_to) | |
CPPUNIT_TEST (test_normal_at) | |
CPPUNIT_TEST (test_closest_point) | |
CPPUNIT_TEST (test_domain_DoF) | |
CPPUNIT_TEST_SUITE_END () | |
Private Attributes | |
vector< double > | vertCoords |
vector< double > | invertCoords |
vector< int > | fixedFlags |
vector< unsigned long > | triConn |
vector< unsigned long > | invertConn |
ArrayMesh | myMesh |
XYRectangle | myDomain |
std::vector< double > | mCoords |
std::vector< int > | mFlags |
Definition at line 45 of file XYRectangleTest.cpp.
XYRectangleTest::XYRectangleTest | ( | ) | [inline] |
XYRectangleTest::CPPUNIT_TEST | ( | test_snap_to | ) | [private] |
XYRectangleTest::CPPUNIT_TEST | ( | test_normal_at | ) | [private] |
XYRectangleTest::CPPUNIT_TEST | ( | test_closest_point | ) | [private] |
XYRectangleTest::CPPUNIT_TEST | ( | test_domain_DoF | ) | [private] |
XYRectangleTest::CPPUNIT_TEST_SUITE | ( | XYRectangleTest | ) | [private] |
XYRectangleTest::CPPUNIT_TEST_SUITE_END | ( | ) | [private] |
void XYRectangleTest::setUp | ( | ) |
Definition at line 127 of file XYRectangleTest.cpp.
References MBMesquite::arrptr(), ASSERT_NO_ERROR, MBMesquite::MsqError::clear(), NUM_TEST_MESH_TRIS, NUM_TEST_MESH_VERTS, TEST_MESH_CONN, TEST_MESH_COORDS, and MBMesquite::TRIANGLE.
{ MsqError err; mCoords.resize( 3 * NUM_TEST_MESH_VERTS ); std::copy( TEST_MESH_COORDS, TEST_MESH_COORDS + 3 * NUM_TEST_MESH_VERTS, mCoords.begin() ); mFlags.clear(); mFlags.resize( NUM_TEST_MESH_VERTS, 0 ); myMesh.set_mesh( 3, NUM_TEST_MESH_VERTS, arrptr( mCoords ), arrptr( mFlags ), NUM_TEST_MESH_TRIS, TRIANGLE, TEST_MESH_CONN ); myDomain.setup( &myMesh, err ); ASSERT_NO_ERROR( err ); }
void XYRectangleTest::tearDown | ( | ) |
Definition at line 140 of file XYRectangleTest.cpp.
{}
void XYRectangleTest::test_closest_point | ( | ) |
Definition at line 240 of file XYRectangleTest.cpp.
References MBMesquite::arrptr(), ASSERT_NO_ERROR, and CPPUNIT_ASSERT_VECTORS_EQUAL.
{ MsqError err; std::vector< Mesh::ElementHandle > elems; myMesh.get_all_elements( elems, err ); ASSERT_NO_ERROR( err ); for( size_t i = 0; i < elems.size(); ++i ) { std::vector< Mesh::VertexHandle > verts; std::vector< size_t > junk; MsqVertex coords; myMesh.elements_get_attached_vertices( &elems[i], 1, verts, junk, err ); ASSERT_NO_ERROR( err ); myMesh.vertices_get_coordinates( arrptr( verts ), &coords, 1, err ); ASSERT_NO_ERROR( err ); Vector3D offset( coords + Vector3D( 0, 0, 3 ) ), closest, norm; myDomain.closest_point( elems[i], offset, closest, norm, err ); ASSERT_NO_ERROR( err ); CPPUNIT_ASSERT_VECTORS_EQUAL( coords, closest, 1e-6 ); CPPUNIT_ASSERT_VECTORS_EQUAL( Vector3D( 0, 0, 1 ), norm, 1e-6 ); } }
void XYRectangleTest::test_domain_DoF | ( | ) |
Definition at line 273 of file XYRectangleTest.cpp.
References MBMesquite::arrptr(), ASSERT_NO_ERROR, CPPUNIT_ASSERT_EQUAL, and dof().
{ MsqError err; std::vector< Mesh::VertexHandle > verts; myMesh.get_all_vertices( verts, err ); ASSERT_NO_ERROR( err ); std::vector< MsqVertex > coords( verts.size() ); myMesh.vertices_get_coordinates( arrptr( verts ), arrptr( coords ), verts.size(), err ); ASSERT_NO_ERROR( err ); for( size_t i = 0; i < coords.size(); ++i ) { unsigned short exp = dof( coords[i] ); unsigned short act = 100; myDomain.domain_DoF( &verts[i], &act, 1, err ); ASSERT_NO_ERROR( err ); CPPUNIT_ASSERT_EQUAL( exp, act ); } }
void XYRectangleTest::test_normal_at | ( | ) |
Definition at line 218 of file XYRectangleTest.cpp.
References MBMesquite::arrptr(), ASSERT_NO_ERROR, and CPPUNIT_ASSERT_VECTORS_EQUAL.
{ MsqError err; std::vector< Mesh::VertexHandle > vertices; myMesh.get_all_vertices( vertices, err ); ASSERT_NO_ERROR( err ); std::vector< MsqVertex > coords( vertices.size() ); myMesh.vertices_get_coordinates( arrptr( vertices ), arrptr( coords ), vertices.size(), err ); ASSERT_NO_ERROR( err ); std::vector< Vector3D > normals( vertices.size() ); std::copy( coords.begin(), coords.end(), normals.begin() ); myDomain.vertex_normal_at( arrptr( vertices ), arrptr( normals ), vertices.size(), err ); ASSERT_NO_ERROR( err ); for( size_t i = 0; i < normals.size(); ++i ) { CPPUNIT_ASSERT_VECTORS_EQUAL( Vector3D( 0, 0, 1 ), normals[i], 1e-6 ); } }
void XYRectangleTest::test_snap_to | ( | ) |
Definition at line 164 of file XYRectangleTest.cpp.
References MBMesquite::arrptr(), ASSERT_NO_ERROR, CPPUNIT_ASSERT, CPPUNIT_ASSERT_VECTORS_EQUAL, and snap_to().
{ MsqError err; Vector3D off, exp, act; const Vector3D d1( 0.1, 0.1, 0.0 ); const Vector3D d2( 0.0, 0.2, 0.0 ); const Vector3D d3( 0.3, 0.0, 0.0 ); const Vector3D d4( 0.0, 0.0, 5.0 ); const Vector3D d5( 0.5, 0.5, 0.5 ); std::vector< Mesh::VertexHandle > verts; myMesh.get_all_vertices( verts, err ); ASSERT_NO_ERROR( err ); CPPUNIT_ASSERT( !verts.empty() ); std::vector< MsqVertex > coords( verts.size() ); myMesh.vertices_get_coordinates( arrptr( verts ), arrptr( coords ), verts.size(), err ); ASSERT_NO_ERROR( err ); for( size_t i = 0; i < coords.size(); ++i ) { off = coords[i] + d1; exp = snap_to( coords[i], off ); act = off; myDomain.snap_to( verts[i], act ); CPPUNIT_ASSERT_VECTORS_EQUAL( exp, act, 1e-6 ); off = coords[i] + d2; exp = snap_to( coords[i], off ); act = off; myDomain.snap_to( verts[i], act ); CPPUNIT_ASSERT_VECTORS_EQUAL( exp, act, 1e-6 ); off = coords[i] + d3; exp = snap_to( coords[i], off ); act = off; myDomain.snap_to( verts[i], act ); CPPUNIT_ASSERT_VECTORS_EQUAL( exp, act, 1e-6 ); off = coords[i] + d4; exp = snap_to( coords[i], off ); act = off; myDomain.snap_to( verts[i], act ); CPPUNIT_ASSERT_VECTORS_EQUAL( exp, act, 1e-6 ); off = coords[i] + d5; exp = snap_to( coords[i], off ); act = off; myDomain.snap_to( verts[i], act ); CPPUNIT_ASSERT_VECTORS_EQUAL( exp, act, 1e-6 ); } }
vector< int > XYRectangleTest::fixedFlags [private] |
Definition at line 56 of file XYRectangleTest.cpp.
vector< unsigned long > XYRectangleTest::invertConn [private] |
Definition at line 57 of file XYRectangleTest.cpp.
vector< double > XYRectangleTest::invertCoords [private] |
Definition at line 55 of file XYRectangleTest.cpp.
std::vector< double > XYRectangleTest::mCoords [private] |
Definition at line 61 of file XYRectangleTest.cpp.
std::vector< int > XYRectangleTest::mFlags [private] |
Definition at line 62 of file XYRectangleTest.cpp.
XYRectangle XYRectangleTest::myDomain [private] |
Definition at line 60 of file XYRectangleTest.cpp.
ArrayMesh XYRectangleTest::myMesh [private] |
Definition at line 59 of file XYRectangleTest.cpp.
vector< unsigned long > XYRectangleTest::triConn [private] |
Definition at line 57 of file XYRectangleTest.cpp.
vector< double > XYRectangleTest::vertCoords [private] |
Definition at line 55 of file XYRectangleTest.cpp.