MOAB: Mesh Oriented datABase
(version 5.4.1)
|
00001 /* ***************************************************************** 00002 MESQUITE -- The Mesh Quality Improvement Toolkit 00003 00004 Copyright 2006 Sandia National Laboratories. Developed at the 00005 University of Wisconsin--Madison under SNL contract number 00006 624796. The U.S. Government and the University of Wisconsin 00007 retian certain rights to this software. 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License 00020 (lgpl.txt) along with this library; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 00023 (2006) [email protected] 00024 00025 ***************************************************************** */ 00026 00027 /** \file EdgeLengthMetricTest.cpp 00028 * \brief unit tests for EdgeLengthQualityMetric 00029 * \author Jason Kraftcheck 00030 */ 00031 00032 #include "Mesquite.hpp" 00033 #include "EdgeLengthMetric.hpp" 00034 #include "cppunit/extensions/HelperMacros.h" 00035 #include "QualityMetricTester.hpp" 00036 00037 using namespace MBMesquite; 00038 00039 class EdgeLengthMetricTest : public CppUnit::TestFixture 00040 { 00041 private: 00042 CPPUNIT_TEST_SUITE( EdgeLengthMetricTest ); 00043 00044 CPPUNIT_TEST( test_supported_types ); 00045 CPPUNIT_TEST( test_ideal_element_eval ); 00046 CPPUNIT_TEST( test_valid_hessian ); 00047 CPPUNIT_TEST( test_get_evaluations ); 00048 CPPUNIT_TEST( test_get_edge_indices ); 00049 CPPUNIT_TEST( test_eval_with_indices ); 00050 CPPUNIT_TEST( test_eval_with_gradient ); 00051 CPPUNIT_TEST( test_location_invariant ); 00052 CPPUNIT_TEST( test_orient_invariant ); 00053 00054 CPPUNIT_TEST_SUITE_END(); 00055 00056 EdgeLengthMetric mMetric; 00057 QualityMetricTester tester; 00058 00059 public: 00060 EdgeLengthMetricTest() : mMetric( 0.0 ), tester( QualityMetricTester::ALL_FE_EXCEPT_SEPTAHEDRON ) {} 00061 00062 void test_supported_types() 00063 { 00064 tester.test_supported_element_types( &mMetric ); 00065 } 00066 00067 void test_ideal_element_eval() 00068 { 00069 tester.test_evaluate_unit_edge_element( &mMetric, TRIANGLE, 1.0 ); 00070 tester.test_evaluate_unit_edge_element( &mMetric, QUADRILATERAL, 1.0 ); 00071 tester.test_evaluate_unit_edge_element( &mMetric, TETRAHEDRON, 1.0 ); 00072 tester.test_evaluate_unit_edge_element( &mMetric, PYRAMID, 1.0 ); 00073 tester.test_evaluate_unit_edge_element( &mMetric, PRISM, 1.0 ); 00074 tester.test_evaluate_unit_edge_element( &mMetric, HEXAHEDRON, 1.0 ); 00075 } 00076 00077 void test_valid_hessian() 00078 { 00079 tester.test_symmetric_Hessian_diagonal_blocks( &mMetric ); 00080 } 00081 00082 void test_get_evaluations() 00083 { 00084 tester.test_get_edge_evaluations( &mMetric ); 00085 } 00086 00087 void test_get_edge_indices() 00088 { 00089 tester.test_get_edge_indices( &mMetric ); 00090 } 00091 00092 void test_eval_with_indices() 00093 { 00094 tester.compare_eval_and_eval_with_indices( &mMetric ); 00095 } 00096 00097 void test_eval_with_gradient() 00098 { 00099 tester.compare_eval_with_indices_and_eval_with_gradient( &mMetric ); 00100 tester.compare_analytical_and_numerical_gradients( &mMetric ); 00101 } 00102 00103 void test_location_invariant() 00104 { 00105 tester.test_location_invariant( &mMetric ); 00106 tester.test_grad_location_invariant( &mMetric ); 00107 } 00108 00109 void test_orient_invariant() 00110 { 00111 tester.test_orient_invariant( &mMetric ); 00112 tester.test_grad_orient_invariant( &mMetric ); 00113 } 00114 }; 00115 00116 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( EdgeLengthMetricTest, "EdgeLengthMetricTest" ); 00117 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( EdgeLengthMetricTest, "Unit" );