]> SALOME platform Git repositories - tools/medcoupling.git/blob - src/INTERP_KERNELTest/SingleElementTetraTests.hxx
Salome HOME
Merge from BR_V5_DEV 16Feb09
[tools/medcoupling.git] / src / INTERP_KERNELTest / SingleElementTetraTests.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef __SINGLE_ELEMENT_TETRA_TESTS_HXX_
20 #define __SINGLE_ELEMENT_TETRA_TESTS_HXX_
21
22 #include "InterpolationTestSuite.hxx"
23
24 namespace INTERP_TEST 
25 {
26   /**
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.
29    *
30    */
31   class SingleElementTetraTests : public InterpolationTestSuite<3,3>
32   {
33     CPPUNIT_TEST_SUITE( SingleElementTetraTests );
34
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 );
50
51     CPPUNIT_TEST_SUITE_END();
52
53   public:
54
55     /// Unit tetrahedron mesh intersecting itself
56     /// \brief Status : pass
57     void tetraReflexiveUnit()
58     {
59       _testTools->intersectMeshes("UnitTetra", "UnitTetra", 1.0/6.0);
60     }
61
62     /// Tetrahedron mesh with itself
63     /// \brief Status : pass
64     void tetraReflexiveGeneral()
65     {
66       _testTools->intersectMeshes("GeneralTetra", "GeneralTetra", 0.428559);
67     }
68
69     /// Unit tetrahedron mesh intersecting slightly displaced copy of itself
70     /// \brief Status : pass
71     void tetraNudged()
72     {
73       _testTools->intersectMeshes("UnitTetra", "NudgedTetra", 0.142896);
74     }
75
76     /// Single-element unit tetrahedron mesh intersecting even slightly displaced (along one axis only) copy of itself
77     /// \brief Status : pass
78     void tetraNudgedSimpler()
79     {
80       _testTools->intersectMeshes("UnitTetra", "NudgedSimpler", 0.152112);
81     }
82
83     /// Tetrahedron intersecting unit tetrahedron with in non-degenerate way around corner O
84     /// \brief Status : pass
85     void tetraCorner()
86     {
87       _testTools->intersectMeshes("UnitTetra", "CornerTetra", 0.0135435);
88     }
89
90     /// Tetrahedron situated totally inside another
91     /// \brief Status : pass
92     void tetraSimpleIncluded()
93     {
94       _testTools->intersectMeshes("SimpleIncludedTetra", "SimpleIncludingTetra", 17.0156);
95     }
96
97     /// Displaced unit tetrahedron intersecting another unit tetrahedron with which it shares an edge
98     /// \brief Status : pass
99     void tetraDegenEdge()
100     {
101       _testTools->intersectMeshes("UnitTetraDegenT", "DegenEdgeXY", 0.0);
102     }
103
104     /// Displaced unit tetrahedron intersecting another unit tetrahedron with which it shares a face
105     /// \brief Status : pass
106     void tetraDegenFace()
107     {
108       _testTools->intersectMeshes("UnitTetraDegenT", "DegenFaceXYZ", 0.0);
109     }
110
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()
114     {
115       _testTools->intersectMeshes("UnitTetraDegenT", "DegenTranslatedInPlane", 0.0571667);
116     }
117
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()
121     {
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);
125     }
126
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()
130     {
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);
134     }
135   
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()
139     {
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);
143     }
144
145     /// Two intersecting tetrahedra situated in a general position in space
146     /// \brief Status : pass
147     void generalTetra()
148     {
149       _testTools->intersectMeshes("GenTetra1", "GenTetra2", 4.91393);
150     }
151
152     /// Tetrahedron which is in a tricky position relative to unit tetrahedron.
153     /// \brief Status : pass
154     void trickyTetra1()
155     {
156       _testTools->intersectMeshes("UnitTetra", "TrickyTetra1", 0.0);
157     }
158
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()
163     {
164       _testTools->intersectMeshes("LargeUnitTetra.med", "LargeUnitTetra", "LargeInconsistentTetra.med", "LargeInconsistent", 7.86231e7);
165     }
166
167   };
168 }
169 #endif