MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Definition at line 44 of file CachingTargetTest.cpp.
CachingTargetTest::CPPUNIT_TEST | ( | test_surface_orient_flag | ) | [private] |
CachingTargetTest::CPPUNIT_TEST | ( | test_3d_targets_cached | ) | [private] |
CachingTargetTest::CPPUNIT_TEST | ( | test_2d_targets_cached | ) | [private] |
CachingTargetTest::CPPUNIT_TEST | ( | test_surface_targets_cached | ) | [private] |
CachingTargetTest::CPPUNIT_TEST | ( | test_3d_target_values | ) | [private] |
CachingTargetTest::CPPUNIT_TEST | ( | test_2d_target_values | ) | [private] |
CachingTargetTest::CPPUNIT_TEST | ( | test_surface_target_values | ) | [private] |
CachingTargetTest::CPPUNIT_TEST | ( | test_3d_target_subpatch | ) | [private] |
CachingTargetTest::CPPUNIT_TEST | ( | test_2d_target_subpatch | ) | [private] |
CachingTargetTest::CPPUNIT_TEST | ( | test_surface_target_subpatch | ) | [private] |
CachingTargetTest::CPPUNIT_TEST | ( | test_cache_cleared | ) | [private] |
CachingTargetTest::CPPUNIT_TEST_SUITE | ( | CachingTargetTest | ) | [private] |
CachingTargetTest::CPPUNIT_TEST_SUITE_END | ( | ) | [private] |
unsigned CachingTargetTest::request_all_targets_2d | ( | ) | [private] |
Definition at line 216 of file CachingTargetTest.cpp.
References ASSERT_NO_ERROR, and CPPUNIT_ASSERT.
{ unsigned total = 0; MsqMatrix< 2, 2 > W; MsqPrintError err( std::cout ); std::vector< Sample > locations; for( size_t i = 0; i < patch_2d.num_elements(); ++i ) { patch_2d.get_samples( i, locations, err ); ASSERT_NO_ERROR( err ); total += locations.size(); for( unsigned j = 0; j < locations.size(); ++j ) { bool rval = cacher->get_2D_target( patch_2d, i, locations[j], W, err ); CPPUNIT_ASSERT( rval ); CPPUNIT_ASSERT( !err ); } } return total; }
unsigned CachingTargetTest::request_all_targets_3d | ( | ) | [private] |
Definition at line 194 of file CachingTargetTest.cpp.
References ASSERT_NO_ERROR, and CPPUNIT_ASSERT.
{ unsigned total = 0; MsqMatrix< 3, 3 > W; MsqPrintError err( std::cout ); std::vector< Sample > locations; for( size_t i = 0; i < patch_3d.num_elements(); ++i ) { patch_3d.get_samples( i, locations, err ); ASSERT_NO_ERROR( err ); total += locations.size(); for( unsigned j = 0; j < locations.size(); ++j ) { bool rval = cacher->get_3D_target( patch_3d, i, locations[j], W, err ); CPPUNIT_ASSERT( rval ); CPPUNIT_ASSERT( !err ); } } return total; }
unsigned CachingTargetTest::request_all_targets_surf | ( | ) | [private] |
Definition at line 238 of file CachingTargetTest.cpp.
References ASSERT_NO_ERROR, and CPPUNIT_ASSERT.
{ unsigned total = 0; MsqMatrix< 3, 2 > W; MsqPrintError err( std::cout ); std::vector< Sample > locations; for( size_t i = 0; i < patch_2d.num_elements(); ++i ) { patch_2d.get_samples( i, locations, err ); ASSERT_NO_ERROR( err ); total += locations.size(); for( unsigned j = 0; j < locations.size(); ++j ) { bool rval = cacher->get_surface_target( patch_2d, i, locations[j], W, err ); CPPUNIT_ASSERT( rval ); CPPUNIT_ASSERT( !err ); } } return total; }
void CachingTargetTest::setUp | ( | ) |
Definition at line 177 of file CachingTargetTest.cpp.
References CPPUNIT_ASSERT, MBMesquite::create_four_quads_patch(), and MBMesquite::create_qm_two_hex_patch().
{ // make sure these are null so that if we fail within setUp, // tearDown doesn't try to delete stale pointers cached = 0; cacher = 0; MsqError err; create_four_quads_patch( patch_2d, err ); CPPUNIT_ASSERT( !err ); create_qm_two_hex_patch( patch_3d, err ); CPPUNIT_ASSERT( !err ); cached = new CachedTargetCalculator(); cacher = new CachingTargetCalculator( cached ); }
void CachingTargetTest::tearDown | ( | ) |
Definition at line 260 of file CachingTargetTest.cpp.
Definition at line 442 of file CachingTargetTest.cpp.
References ASSERT_MATRICES_EQUAL, ASSERT_NO_ERROR, CPPUNIT_ASSERT, CPPUNIT_ASSERT_EQUAL, MBMesquite::PatchData::get_subpatch(), CachedTargetCalculator::make_2d(), and u.
{ MsqPrintError err( std::cout ); std::vector< Sample > locations; // cache some values on the main patch cached->surf_orient( false ); request_all_targets_2d(); // clear the count so we know if any additional // evalutions of the base target calculator are // done during subpatch creation. cached->clear(); // create a sub-patch CPPUNIT_ASSERT( patch_2d.num_nodes() > 1 ); PatchData subpatch; patch_2d.get_subpatch( 1, 1, subpatch, err ); CPPUNIT_ASSERT( !err ); // make sure we copied the cached values onto the subpatch CPPUNIT_ASSERT_EQUAL( cached->calls_2d(), 0u ); // Test the values for each cached matrix on the subpatch // NOTE: This test takes advantange of the fact that the // "handles" in the subpatch are indices into the main patch. // test each value for( size_t i = 0; i < subpatch.num_elements(); ++i ) { subpatch.get_samples( i, locations, err ); ASSERT_NO_ERROR( err ); for( unsigned j = 0; j < locations.size(); ++j ) { MsqMatrix< 2, 2 > W; bool rval = cacher->get_2D_target( subpatch, i, locations[j], W, err ); CPPUNIT_ASSERT( rval && !err ); Mesh::ElementHandle h = subpatch.get_element_handles_array()[i]; Mesh::ElementHandle* old_h = patch_2d.get_element_handles_array(); size_t old_idx = std::find( old_h, old_h + patch_2d.num_elements(), h ) - old_h; CPPUNIT_ASSERT( old_idx < patch_2d.num_elements() ); MsqMatrix< 2, 2 > M = CachedTargetCalculator::make_2d( old_idx, locations[j] ); ASSERT_MATRICES_EQUAL( W, M, DBL_EPSILON ); } } }
Definition at line 343 of file CachingTargetTest.cpp.
References ASSERT_MATRICES_EQUAL, ASSERT_NO_ERROR, CPPUNIT_ASSERT, and CachedTargetCalculator::make_2d().
{ MsqPrintError err( std::cout ); std::vector< Sample > locations; // evaluate all once to make sure we test the cached values cached->surf_orient( false ); request_all_targets_2d(); // test each value for( size_t i = 0; i < patch_2d.num_elements(); ++i ) { patch_2d.get_samples( i, locations, err ); ASSERT_NO_ERROR( err ); for( unsigned j = 0; j < locations.size(); ++j ) { MsqMatrix< 2, 2 > W; bool rval = cacher->get_2D_target( patch_2d, i, locations[j], W, err ); CPPUNIT_ASSERT( rval && !err ); MsqMatrix< 2, 2 > M = CachedTargetCalculator::make_2d( i, locations[j] ); ASSERT_MATRICES_EQUAL( W, M, DBL_EPSILON ); } } }
Definition at line 288 of file CachingTargetTest.cpp.
References CPPUNIT_ASSERT_EQUAL, and u.
{ cached->surf_orient( false ); CPPUNIT_ASSERT_EQUAL( cached->calls_2d(), 0u ); CPPUNIT_ASSERT_EQUAL( cached->calls_surf(), 0u ); CPPUNIT_ASSERT_EQUAL( cached->calls_3d(), 0u ); unsigned count = request_all_targets_2d(); CPPUNIT_ASSERT_EQUAL( cached->calls_2d(), count ); CPPUNIT_ASSERT_EQUAL( cached->calls_surf(), 0u ); CPPUNIT_ASSERT_EQUAL( cached->calls_3d(), 0u ); cached->clear(); request_all_targets_2d(); CPPUNIT_ASSERT_EQUAL( cached->calls_2d(), 0u ); }
Definition at line 395 of file CachingTargetTest.cpp.
References ASSERT_MATRICES_EQUAL, ASSERT_NO_ERROR, CPPUNIT_ASSERT, CPPUNIT_ASSERT_EQUAL, MBMesquite::PatchData::get_subpatch(), CachedTargetCalculator::make_3d(), and u.
{ MsqPrintError err( std::cout ); std::vector< Sample > locations; // cache some values on the main patch request_all_targets_3d(); // clear the count so we know if any additional // evalutions of the base target calculator are // done during subpatch creation. cached->clear(); // create a sub-patch CPPUNIT_ASSERT( patch_3d.num_nodes() > 1 ); PatchData subpatch; patch_3d.get_subpatch( 1, 1, subpatch, err ); CPPUNIT_ASSERT( !err ); // make sure we copied the cached values onto the subpatch CPPUNIT_ASSERT_EQUAL( cached->calls_3d(), 0u ); // Test the values for each cached matrix on the subpatch // NOTE: This test takes advantange of the fact that the // "handles" in the subpatch are indices into the main patch. // test each value for( size_t i = 0; i < subpatch.num_elements(); ++i ) { subpatch.get_samples( i, locations, err ); ASSERT_NO_ERROR( err ); for( unsigned j = 0; j < locations.size(); ++j ) { MsqMatrix< 3, 3 > W; bool rval = cacher->get_3D_target( subpatch, i, locations[j], W, err ); CPPUNIT_ASSERT( rval && !err ); Mesh::ElementHandle h = subpatch.get_element_handles_array()[i]; Mesh::ElementHandle* old_h = patch_3d.get_element_handles_array(); size_t old_idx = std::find( old_h, old_h + patch_3d.num_elements(), h ) - old_h; CPPUNIT_ASSERT( old_idx < patch_3d.num_elements() ); MsqMatrix< 3, 3 > M = CachedTargetCalculator::make_3d( old_idx, locations[j] ); ASSERT_MATRICES_EQUAL( W, M, DBL_EPSILON ); } } }
Definition at line 318 of file CachingTargetTest.cpp.
References ASSERT_MATRICES_EQUAL, ASSERT_NO_ERROR, CPPUNIT_ASSERT, and CachedTargetCalculator::make_3d().
{ MsqPrintError err( std::cout ); std::vector< Sample > locations; // evaluate all once to make sure we test the cached values request_all_targets_3d(); // test each value for( size_t i = 0; i < patch_3d.num_elements(); ++i ) { patch_3d.get_samples( i, locations, err ); ASSERT_NO_ERROR( err ); for( unsigned j = 0; j < locations.size(); ++j ) { MsqMatrix< 3, 3 > W; bool rval = cacher->get_3D_target( patch_3d, i, locations[j], W, err ); CPPUNIT_ASSERT( rval && !err ); MsqMatrix< 3, 3 > M = CachedTargetCalculator::make_3d( i, locations[j] ); ASSERT_MATRICES_EQUAL( W, M, DBL_EPSILON ); } } }
Definition at line 274 of file CachingTargetTest.cpp.
References CPPUNIT_ASSERT_EQUAL, and u.
{ CPPUNIT_ASSERT_EQUAL( cached->calls_3d(), 0u ); CPPUNIT_ASSERT_EQUAL( cached->calls_surf(), 0u ); CPPUNIT_ASSERT_EQUAL( cached->calls_2d(), 0u ); unsigned count = request_all_targets_3d(); CPPUNIT_ASSERT_EQUAL( cached->calls_3d(), count ); CPPUNIT_ASSERT_EQUAL( cached->calls_surf(), 0u ); CPPUNIT_ASSERT_EQUAL( cached->calls_2d(), 0u ); cached->clear(); request_all_targets_3d(); CPPUNIT_ASSERT_EQUAL( cached->calls_3d(), 0u ); }
Definition at line 538 of file CachingTargetTest.cpp.
References CPPUNIT_ASSERT, CPPUNIT_ASSERT_EQUAL, and MBMesquite::create_twelve_hex_patch().
{ MsqPrintError err( std::cout ); // cache some values on the main patch request_all_targets_3d(); // clear the count so we know if any additional // evalutions of the base target calculator are // done. cached->clear(); // now re-create the patch, which should result in the // cached data being notified that the mesh has changed create_twelve_hex_patch( patch_3d, err ); CPPUNIT_ASSERT( !err ); // now get cached values for each element unsigned count = request_all_targets_3d(); // and check that they were all re-calculated CPPUNIT_ASSERT_EQUAL( cached->calls_3d(), count ); }
Definition at line 266 of file CachingTargetTest.cpp.
References CPPUNIT_ASSERT.
{ cached->surf_orient( true ); CPPUNIT_ASSERT( cacher->have_surface_orient() ); cached->surf_orient( false ); CPPUNIT_ASSERT( !cacher->have_surface_orient() ); }
Definition at line 490 of file CachingTargetTest.cpp.
References ASSERT_MATRICES_EQUAL, ASSERT_NO_ERROR, CPPUNIT_ASSERT, CPPUNIT_ASSERT_EQUAL, MBMesquite::PatchData::get_subpatch(), CachedTargetCalculator::make_surf(), and u.
{ MsqPrintError err( std::cout ); std::vector< Sample > locations; // cache some values on the main patch cached->surf_orient( true ); request_all_targets_surf(); // clear the count so we know if any additional // evalutions of the base target calculator are // done during subpatch creation. cached->clear(); // create a sub-patch CPPUNIT_ASSERT( patch_2d.num_nodes() > 1 ); PatchData subpatch; patch_2d.get_subpatch( 1, 1, subpatch, err ); CPPUNIT_ASSERT( !err ); // make sure we copied the cached values onto the subpatch CPPUNIT_ASSERT_EQUAL( cached->calls_2d(), 0u ); // Test the values for each cached matrix on the subpatch // NOTE: This test takes advantange of the fact that the // "handles" in the subpatch are indices into the main patch. // test each value for( size_t i = 0; i < subpatch.num_elements(); ++i ) { subpatch.get_samples( i, locations, err ); ASSERT_NO_ERROR( err ); for( unsigned j = 0; j < locations.size(); ++j ) { MsqMatrix< 3, 2 > W; bool rval = cacher->get_surface_target( subpatch, i, locations[j], W, err ); CPPUNIT_ASSERT( rval && !err ); Mesh::ElementHandle h = subpatch.get_element_handles_array()[i]; Mesh::ElementHandle* old_h = patch_2d.get_element_handles_array(); size_t old_idx = std::find( old_h, old_h + patch_2d.num_elements(), h ) - old_h; CPPUNIT_ASSERT( old_idx < patch_2d.num_elements() ); MsqMatrix< 3, 2 > M = CachedTargetCalculator::make_surf( old_idx, locations[j] ); ASSERT_MATRICES_EQUAL( W, M, DBL_EPSILON ); } } }
Definition at line 369 of file CachingTargetTest.cpp.
References ASSERT_MATRICES_EQUAL, ASSERT_NO_ERROR, CPPUNIT_ASSERT, and CachedTargetCalculator::make_surf().
{ MsqPrintError err( std::cout ); std::vector< Sample > locations; // evaluate all once to make sure we test the cached values cached->surf_orient( true ); request_all_targets_surf(); // test each value for( size_t i = 0; i < patch_2d.num_elements(); ++i ) { patch_2d.get_samples( i, locations, err ); ASSERT_NO_ERROR( err ); for( unsigned j = 0; j < locations.size(); ++j ) { MsqMatrix< 3, 2 > W; bool rval = cacher->get_surface_target( patch_2d, i, locations[j], W, err ); CPPUNIT_ASSERT( rval && !err ); MsqMatrix< 3, 2 > M = CachedTargetCalculator::make_surf( i, locations[j] ); ASSERT_MATRICES_EQUAL( W, M, DBL_EPSILON ); } } }
Definition at line 303 of file CachingTargetTest.cpp.
References CPPUNIT_ASSERT_EQUAL, and u.
{ cached->surf_orient( true ); CPPUNIT_ASSERT_EQUAL( cached->calls_2d(), 0u ); CPPUNIT_ASSERT_EQUAL( cached->calls_surf(), 0u ); CPPUNIT_ASSERT_EQUAL( cached->calls_3d(), 0u ); unsigned count = request_all_targets_surf(); CPPUNIT_ASSERT_EQUAL( cached->calls_2d(), 0u ); CPPUNIT_ASSERT_EQUAL( cached->calls_surf(), count ); CPPUNIT_ASSERT_EQUAL( cached->calls_3d(), 0u ); cached->clear(); request_all_targets_surf(); CPPUNIT_ASSERT_EQUAL( cached->calls_surf(), 0u ); }
CachedTargetCalculator* CachingTargetTest::cached [private] |
Definition at line 62 of file CachingTargetTest.cpp.
CachingTargetCalculator* CachingTargetTest::cacher [private] |
Definition at line 63 of file CachingTargetTest.cpp.
PatchData CachingTargetTest::patch_2d [private] |
Definition at line 61 of file CachingTargetTest.cpp.
PatchData CachingTargetTest::patch_3d [private] |
Definition at line 61 of file CachingTargetTest.cpp.