Salome HOME
Get relevant changes from V7_dev branch (copyright update, adm files etc)
[tools/medcoupling.git] / src / INTERP_KERNELTest / SingleElementTetraTests.hxx
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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
20 #ifndef __SINGLE_ELEMENT_TETRA_TESTS_HXX_
21 #define __SINGLE_ELEMENT_TETRA_TESTS_HXX_
22
23 #include "InterpolationTestSuite.hxx"
24
25 namespace INTERP_TEST 
26 {
27   /**
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.
30    *
31    */
32   class SingleElementTetraTests : public InterpolationTestSuite<3,3>
33   {
34     CPPUNIT_TEST_SUITE( SingleElementTetraTests );
35
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 );
51
52     CPPUNIT_TEST_SUITE_END();
53
54   public:
55
56     /// Unit tetrahedron mesh intersecting itself
57     /// \brief Status : pass
58     void tetraReflexiveUnit()
59     {
60       _testTools->intersectMeshes("UnitTetra", "UnitTetra", 1.0/6.0);
61     }
62
63     /// Tetrahedron mesh with itself
64     /// \brief Status : pass
65     void tetraReflexiveGeneral()
66     {
67       _testTools->intersectMeshes("GeneralTetra", "GeneralTetra", 0.428559);
68     }
69
70     /// Unit tetrahedron mesh intersecting slightly displaced copy of itself
71     /// \brief Status : pass
72     void tetraNudged()
73     {
74       _testTools->intersectMeshes("UnitTetra", "NudgedTetra", 0.142896);
75     }
76
77     /// Single-element unit tetrahedron mesh intersecting even slightly displaced (along one axis only) copy of itself
78     /// \brief Status : pass
79     void tetraNudgedSimpler()
80     {
81       _testTools->intersectMeshes("UnitTetra", "NudgedSimpler", 0.152112);
82     }
83
84     /// Tetrahedron intersecting unit tetrahedron with in non-degenerate way around corner O
85     /// \brief Status : pass
86     void tetraCorner()
87     {
88       _testTools->intersectMeshes("UnitTetra", "CornerTetra", 0.0135435);
89     }
90
91     /// Tetrahedron situated totally inside another
92     /// \brief Status : pass
93     void tetraSimpleIncluded()
94     {
95       _testTools->intersectMeshes("SimpleIncludedTetra", "SimpleIncludingTetra", 17.0156);
96     }
97
98     /// Displaced unit tetrahedron intersecting another unit tetrahedron with which it shares an edge
99     /// \brief Status : pass
100     void tetraDegenEdge()
101     {
102       _testTools->intersectMeshes("UnitTetraDegenT", "DegenEdgeXY", 0.0);
103     }
104
105     /// Displaced unit tetrahedron intersecting another unit tetrahedron with which it shares a face
106     /// \brief Status : pass
107     void tetraDegenFace()
108     {
109       _testTools->intersectMeshes("UnitTetraDegenT", "DegenFaceXYZ", 0.0);
110     }
111
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()
115     {
116       _testTools->intersectMeshes("UnitTetraDegenT", "DegenTranslatedInPlane", 0.0571667);
117     }
118
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()
122     {
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);
126     }
127
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()
131     {
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);
135     }
136   
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()
140     {
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);
144     }
145
146     /// Two intersecting tetrahedra situated in a general position in space
147     /// \brief Status : pass
148     void generalTetra()
149     {
150       _testTools->intersectMeshes("GenTetra1", "GenTetra2", 4.91393);
151     }
152
153     /// Tetrahedron which is in a tricky position relative to unit tetrahedron.
154     /// \brief Status : pass
155     void trickyTetra1()
156     {
157       _testTools->intersectMeshes("UnitTetra", "TrickyTetra1", 0.0);
158     }
159
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()
164     {
165       _testTools->intersectMeshes("LargeUnitTetra.med", "LargeUnitTetra", "LargeInconsistentTetra.med", "LargeInconsistent", 7.86231e7);
166     }
167
168   };
169 }
170 #endif