1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef __SINGLE_ELEMENT_TETRA_TESTS_HXX_
20 #define __SINGLE_ELEMENT_TETRA_TESTS_HXX_
22 #include "InterpolationTestSuite.hxx"
27 * \brief Class testing algorithm by intersecting simple meshes having only one element each. This serves mainly to verify that
28 * the volume calculations between elements is correct.
31 class SingleElementTetraTests : public InterpolationTestSuite<3,3>
33 CPPUNIT_TEST_SUITE( SingleElementTetraTests );
35 CPPUNIT_TEST( tetraReflexiveUnit );
36 CPPUNIT_TEST( tetraReflexiveGeneral );
37 CPPUNIT_TEST( tetraNudgedSimpler );
38 CPPUNIT_TEST( tetraNudged );
39 CPPUNIT_TEST( tetraCorner );
40 CPPUNIT_TEST( tetraSimpleIncluded );
41 CPPUNIT_TEST( tetraDegenEdge );
42 CPPUNIT_TEST( tetraDegenFace );
43 CPPUNIT_TEST( tetraDegenTranslatedInPlane );
44 CPPUNIT_TEST( tetraHalfstripOnly );
45 CPPUNIT_TEST( tetraHalfstripOnly2 );
46 CPPUNIT_TEST( tetraSimpleHalfstripOnly );
47 CPPUNIT_TEST( generalTetra );
48 CPPUNIT_TEST( trickyTetra1 );
49 // CPPUNIT_TEST( inconsistentTetra );
51 CPPUNIT_TEST_SUITE_END();
55 /// Unit tetrahedron mesh intersecting itself
56 /// \brief Status : pass
57 void tetraReflexiveUnit()
59 _testTools->intersectMeshes("UnitTetra", "UnitTetra", 1.0/6.0);
62 /// Tetrahedron mesh with itself
63 /// \brief Status : pass
64 void tetraReflexiveGeneral()
66 _testTools->intersectMeshes("GeneralTetra", "GeneralTetra", 0.428559);
69 /// Unit tetrahedron mesh intersecting slightly displaced copy of itself
70 /// \brief Status : pass
73 _testTools->intersectMeshes("UnitTetra", "NudgedTetra", 0.142896);
76 /// Single-element unit tetrahedron mesh intersecting even slightly displaced (along one axis only) copy of itself
77 /// \brief Status : pass
78 void tetraNudgedSimpler()
80 _testTools->intersectMeshes("UnitTetra", "NudgedSimpler", 0.152112);
83 /// Tetrahedron intersecting unit tetrahedron with in non-degenerate way around corner O
84 /// \brief Status : pass
87 _testTools->intersectMeshes("UnitTetra", "CornerTetra", 0.0135435);
90 /// Tetrahedron situated totally inside another
91 /// \brief Status : pass
92 void tetraSimpleIncluded()
94 _testTools->intersectMeshes("SimpleIncludedTetra", "SimpleIncludingTetra", 17.0156);
97 /// Displaced unit tetrahedron intersecting another unit tetrahedron with which it shares an edge
98 /// \brief Status : pass
101 _testTools->intersectMeshes("UnitTetraDegenT", "DegenEdgeXY", 0.0);
104 /// Displaced unit tetrahedron intersecting another unit tetrahedron with which it shares a face
105 /// \brief Status : pass
106 void tetraDegenFace()
108 _testTools->intersectMeshes("UnitTetraDegenT", "DegenFaceXYZ", 0.0);
111 /// Displaced unit tetrahedron intersecting another unit tetrahedron with which it shares a part of the face XYZ
112 /// \brief Status : pass
113 void tetraDegenTranslatedInPlane()
115 _testTools->intersectMeshes("UnitTetraDegenT", "DegenTranslatedInPlane", 0.0571667);
118 /// Tetrahedron having only half-strip intersections with the unit tetrahedron
119 /// \brief Status : pass, but does not really test what it should - does not check that the intersections are detected. No longer needed.
120 void tetraHalfstripOnly()
122 // NB this test is not completely significant : we should also verify that
123 // there are triangles on the element that give a non-zero volume
124 _testTools->intersectMeshes("HalfstripOnly", "UnitTetra", 0.0);
127 /// Tetrahedron having only half-strip intersections with the unit tetrahedron
128 /// \brief Status : pass, but does not really test what it should - does not check that the intersections are detected. No longer needed.
129 void tetraHalfstripOnly2()
131 // NB this test is not completely significant : we should also verify that
132 // there are triangles on the element that give a non-zero volume
133 _testTools->intersectMeshes("HalfstripOnly2", "UnitTetra", 0.0);
136 /// Tetrahedron having only half-strip intersections with the unit tetrahedron
137 /// \brief Status : pass, but does not really test what it should - does not check that the intersections are detected. No longer needed.
138 void tetraSimpleHalfstripOnly()
140 // NB this test is not completely significant : we should also verify that
141 // there are triangles on the element that give a non-zero volume
142 _testTools->intersectMeshes("SimpleHalfstripOnly", "UnitTetra", 0.0);
145 /// Two intersecting tetrahedra situated in a general position in space
146 /// \brief Status : pass
149 _testTools->intersectMeshes("GenTetra1", "GenTetra2", 4.91393);
152 /// Tetrahedron which is in a tricky position relative to unit tetrahedron.
153 /// \brief Status : pass
156 _testTools->intersectMeshes("UnitTetra", "TrickyTetra1", 0.0);
159 /// Two large tetrahedra which nearly share part of an edge and intersect at the origin. Created with goal of getting the as-of-yet uncovered "consistency" test
160 /// part of the correction of double products covered. However, it does not succeed with this.
161 /// \brief Status : fails, but is quite far-fetched as far as typical use cases are concerned
162 void inconsistentTetra()
164 _testTools->intersectMeshes("LargeUnitTetra.med", "LargeUnitTetra", "LargeInconsistentTetra.med", "LargeInconsistent", 7.86231e7);