Salome HOME
Copyright update 2021
[tools/medcoupling.git] / src / INTERP_KERNELTest / MultiElementTetraTests.hxx
1 // Copyright (C) 2007-2021  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 __MULTI_ELEMENT_TETRA_TESTS_HXX_
21 #define __MULTI_ELEMENT_TETRA_TESTS_HXX_
22
23 #include "InterpolationTestSuite.hxx"
24
25 namespace INTERP_TEST
26 {
27   /**
28    * \brief Class testing algorithm by intersecting meshes of several 
29    * elements (all tetrahedra) - up to a few thousand. This serves to check the 
30    * filtering methods and the matrix assemblage, as well as verifying
31    * that computation errors do not become unmanageable. It uses mehes of 
32    * different geometries : tetrahedra, boxes and cylinders.
33    *
34    */
35   class MultiElementTetraTests : public InterpolationTestSuite<3,3>
36   {
37     CPPUNIT_TEST_SUITE( MultiElementTetraTests );
38
39     CPPUNIT_TEST( tetraComplexIncluded );
40     CPPUNIT_TEST( dividedUnitTetraSimplerReflexive );
41     CPPUNIT_TEST( dividedUnitTetraReflexive );
42     CPPUNIT_TEST( nudgedDividedUnitTetraSimpler );
43     CPPUNIT_TEST( nudgedDividedUnitTetra );
44     CPPUNIT_TEST( dividedGenTetra );
45     CPPUNIT_TEST( tinyBoxReflexive );
46     CPPUNIT_TEST( moderateBoxEvenSmallerReflexive );
47     CPPUNIT_TEST( moderateBoxSmallReflexive );
48     CPPUNIT_TEST( boxReflexive );
49     CPPUNIT_TEST( boxReflexiveModerate );
50     CPPUNIT_TEST( tetraBoxes );
51     CPPUNIT_TEST( moderateBoxesSmaller );
52     CPPUNIT_TEST( moderateBoxes );
53
54     CPPUNIT_TEST_SUITE_END();
55
56   public:
57
58     /// Tetrahedron situated totally inside another
59     /// \brief Status : pass
60     void tetraComplexIncluded()
61     {
62       _testTools->intersectMeshes("ComplexIncludedTetra", "ComplexIncludingTetra", 17.0156);
63     }
64
65     /// Unit tetrahedron divided in 4 elements intersecting itself.
66     /// \brief Status : pass
67     void dividedUnitTetraSimplerReflexive()
68     {
69       _testTools->intersectMeshes("DividedUnitTetraSimpler", "DividedUnitTetraSimpler", 0.1666667);
70     }
71
72     /// Unit tetrahedron divided in 14 elements intersecting itself.
73     /// \brief Status : pass
74     void dividedUnitTetraReflexive()
75     {
76       _testTools->intersectMeshes("DividedUnitTetra", "DividedUnitTetra", 0.1666667);
77     }
78
79     /// Unit tetrahedron divided in 4 elements intersecting slightly displaced version of itself.
80     /// \brief Status : pass
81     void nudgedDividedUnitTetraSimpler()
82     {
83       _testTools->intersectMeshes("NudgedDividedUnitTetraSimpler", "DividedUnitTetraSimpler", 0.150191);
84     }
85
86     /// Unit tetrahedron divided in 14 elements intersecting slightly displaced version of itself.
87     /// \brief Status : pass
88     void nudgedDividedUnitTetra()
89     {
90       _testTools->intersectMeshes("NudgedDividedUnitTetra", "DividedUnitTetra", 0.150191);
91     }
92
93     /// Two intersecting tetrahedra in general position, one with 23 elements, the other with 643 elements
94     /// \brief Status : pass
95     void dividedGenTetra()
96     {
97       _testTools->intersectMeshes("DividedGenTetra1",  "DividedGenTetra2", 0.546329);
98     }
99
100     /// Large box in general position with 12 elements intersecting itself
101     /// \brief Status : pass
102     void tinyBoxReflexive()
103     {
104       _testTools->intersectMeshes("TinyBox", "TinyBox", 979200);
105     }
106
107     /// Small box in general position with 33 elements intersecting itself
108     /// \brief Status : pass
109     void boxReflexive()
110     {
111       _testTools->intersectMeshes("Box3",  "Box3", 13.9954);
112     }
113
114     /// Box in general position with 67 elements intersecting itself
115     /// \brief Status : pass
116     void moderateBoxEvenSmallerReflexive()
117     {
118       _testTools->intersectMeshes("BoxEvenSmaller1", "BoxEvenSmaller1", 1.44018e6);
119     }
120
121     /// Box in general position with 544 elements intersecting itself
122     /// \brief Status : pass
123     void moderateBoxSmallReflexive()
124     {
125       _testTools->intersectMeshes("BoxModSmall1", "BoxModSmall1", 1.44018e6);
126     }
127
128     /// Large box in general position with 2943 elements intersecting itself
129     /// \brief Status : pass
130     void boxReflexiveModerate()
131     {
132       _testTools->intersectMeshes("Box1Moderate",  "Box1Moderate", 1.0e6);
133     }
134
135     /// Two intersecting boxes in general position with 12 and 18 elements
136     /// \brief Status : pass
137     void tetraBoxes()
138     {
139       _testTools->intersectMeshes("Box1", "Box2", 124.197);
140     }
141     
142     /// Two intersecting boxes in general position with 430 and 544 elements
143     /// \brief Status : pass
144     void moderateBoxesSmaller()
145     {
146       _testTools->intersectMeshes("BoxModSmall1", "BoxModSmall2", 321853);
147     }
148
149     /// Two intersecting boxes in general position with 2943 and 3068 elements
150     /// \brief Status : pass
151     void moderateBoxes()
152     {
153       _testTools->intersectMeshes("Box1Moderate",  "Box2Moderate", 376856);
154     }
155
156   };
157 }
158
159 #endif