1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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
20 #ifndef __SINGLE_ELEMENT_TETRA_TESTS_HXX_
21 #define __SINGLE_ELEMENT_TETRA_TESTS_HXX_
23 #include "InterpolationTestSuite.hxx"
28 * \brief Class testing algorithm by intersecting simple meshes having only one element each. This serves mainly to verify that
29 * the volume calculations between elements is correct.
32 class SingleElementTetraTests : public InterpolationTestSuite<3,3>
34 CPPUNIT_TEST_SUITE( SingleElementTetraTests );
36 CPPUNIT_TEST( tetraReflexiveUnit );
37 CPPUNIT_TEST( tetraReflexiveGeneral );
38 CPPUNIT_TEST( tetraNudgedSimpler );
39 CPPUNIT_TEST( tetraNudged );
40 CPPUNIT_TEST( tetraCorner );
41 CPPUNIT_TEST( tetraSimpleIncluded );
42 CPPUNIT_TEST( tetraDegenEdge );
43 CPPUNIT_TEST( tetraDegenFace );
44 CPPUNIT_TEST( tetraDegenTranslatedInPlane );
45 CPPUNIT_TEST( tetraHalfstripOnly );
46 CPPUNIT_TEST( tetraHalfstripOnly2 );
47 CPPUNIT_TEST( tetraSimpleHalfstripOnly );
48 CPPUNIT_TEST( generalTetra );
49 CPPUNIT_TEST( trickyTetra1 );
50 // CPPUNIT_TEST( inconsistentTetra );
52 CPPUNIT_TEST_SUITE_END();
56 /// Unit tetrahedron mesh intersecting itself
57 /// \brief Status : pass
58 void tetraReflexiveUnit()
60 _testTools->intersectMeshes("UnitTetra", "UnitTetra", 1.0/6.0);
63 /// Tetrahedron mesh with itself
64 /// \brief Status : pass
65 void tetraReflexiveGeneral()
67 _testTools->intersectMeshes("GeneralTetra", "GeneralTetra", 0.428559);
70 /// Unit tetrahedron mesh intersecting slightly displaced copy of itself
71 /// \brief Status : pass
74 _testTools->intersectMeshes("UnitTetra", "NudgedTetra", 0.142896);
77 /// Single-element unit tetrahedron mesh intersecting even slightly displaced (along one axis only) copy of itself
78 /// \brief Status : pass
79 void tetraNudgedSimpler()
81 _testTools->intersectMeshes("UnitTetra", "NudgedSimpler", 0.152112);
84 /// Tetrahedron intersecting unit tetrahedron with in non-degenerate way around corner O
85 /// \brief Status : pass
88 _testTools->intersectMeshes("UnitTetra", "CornerTetra", 0.0135435);
91 /// Tetrahedron situated totally inside another
92 /// \brief Status : pass
93 void tetraSimpleIncluded()
95 _testTools->intersectMeshes("SimpleIncludedTetra", "SimpleIncludingTetra", 17.0156);
98 /// Displaced unit tetrahedron intersecting another unit tetrahedron with which it shares an edge
99 /// \brief Status : pass
100 void tetraDegenEdge()
102 _testTools->intersectMeshes("UnitTetraDegenT", "DegenEdgeXY", 0.0);
105 /// Displaced unit tetrahedron intersecting another unit tetrahedron with which it shares a face
106 /// \brief Status : pass
107 void tetraDegenFace()
109 _testTools->intersectMeshes("UnitTetraDegenT", "DegenFaceXYZ", 0.0);
112 /// Displaced unit tetrahedron intersecting another unit tetrahedron with which it shares a part of the face XYZ
113 /// \brief Status : pass
114 void tetraDegenTranslatedInPlane()
116 _testTools->intersectMeshes("UnitTetraDegenT", "DegenTranslatedInPlane", 0.0571667);
119 /// Tetrahedron having only half-strip intersections with the unit tetrahedron
120 /// \brief Status : pass, but does not really test what it should - does not check that the intersections are detected. No longer needed.
121 void tetraHalfstripOnly()
123 // NB this test is not completely significant : we should also verify that
124 // there are triangles on the element that give a non-zero volume
125 _testTools->intersectMeshes("HalfstripOnly", "UnitTetra", 0.0);
128 /// Tetrahedron having only half-strip intersections with the unit tetrahedron
129 /// \brief Status : pass, but does not really test what it should - does not check that the intersections are detected. No longer needed.
130 void tetraHalfstripOnly2()
132 // NB this test is not completely significant : we should also verify that
133 // there are triangles on the element that give a non-zero volume
134 _testTools->intersectMeshes("HalfstripOnly2", "UnitTetra", 0.0);
137 /// Tetrahedron having only half-strip intersections with the unit tetrahedron
138 /// \brief Status : pass, but does not really test what it should - does not check that the intersections are detected. No longer needed.
139 void tetraSimpleHalfstripOnly()
141 // NB this test is not completely significant : we should also verify that
142 // there are triangles on the element that give a non-zero volume
143 _testTools->intersectMeshes("SimpleHalfstripOnly", "UnitTetra", 0.0);
146 /// Two intersecting tetrahedra situated in a general position in space
147 /// \brief Status : pass
150 _testTools->intersectMeshes("GenTetra1", "GenTetra2", 4.91393);
153 /// Tetrahedron which is in a tricky position relative to unit tetrahedron.
154 /// \brief Status : pass
157 _testTools->intersectMeshes("UnitTetra", "TrickyTetra1", 0.0);
160 /// 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
161 /// part of the correction of double products covered. However, it does not succeed with this.
162 /// \brief Status : fails, but is quite far-fetched as far as typical use cases are concerned
163 void inconsistentTetra()
165 _testTools->intersectMeshes("LargeUnitTetra.med", "LargeUnitTetra", "LargeInconsistentTetra.med", "LargeInconsistent", 7.86231e7);