Salome HOME
feat: new crackAlong method
[tools/medcoupling.git] / src / MEDLoader / Test / CrackAlgoTest.hxx
1 // Copyright (C) 2007-2024  CEA, EDF
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 // Author : Aymeric SONOLET (CEA/DES)
20
21 #ifndef __CRACKALGOTEST_HXX__
22 #define __CRACKALGOTEST_HXX__
23
24 #include <cppunit/extensions/HelperMacros.h>
25 #include <string>
26 #include <vector>
27 #include <utility>
28
29 #include <MCIdType.hxx>
30
31 namespace MEDCoupling {
32
33 class MEDFileUMesh;
34 class MEDCouplingUMesh;
35
36 class CrackAlgoTest : public CppUnit::TestFixture {
37     CPPUNIT_TEST_SUITE(CrackAlgoTest);
38     CPPUNIT_TEST(test3DHalfCrossCut);
39     CPPUNIT_TEST(test3DFullCrossCut);
40     CPPUNIT_TEST(test3DHalfCut);
41     CPPUNIT_TEST(test3DFullCut);
42     CPPUNIT_TEST(test3DFullFullCut);
43     CPPUNIT_TEST(test3DAngleCut);
44     CPPUNIT_TEST(test2DGrp);
45     CPPUNIT_TEST(test2DMeshNonConnexCut);
46     CPPUNIT_TEST(test1DMesh);
47     CPPUNIT_TEST(testInnerCrossCut);
48     CPPUNIT_TEST_SUITE_END();
49
50  public:
51
52     void test3DHalfCrossCut();
53     void test3DFullCrossCut();
54     void test3DAngleCut();
55     void test3DFullCut();
56     void test3DFullFullCut();
57     void test3DHalfCut();
58     void test2DGrp();
59     void test2DMeshNonConnexCut();
60     void test1DMesh();
61     void testInnerCrossCut();
62
63  private:
64     using Connections = std::vector<std::pair<mcIdType, mcIdType>>;
65     static std::pair<bool, bool>
66     TestCrack(
67         MEDFileUMesh * mm_init,
68         const std::string & grp_name,
69         const std::string & test_name);
70
71     static bool
72     CheckM0Mesh(
73         const MEDFileUMesh * mm,
74         const Connections& c2cBrokenConnection,
75         const Connections& c2cPreservedConnection);
76
77     static bool
78     CheckM1Mesh(
79         const MEDCouplingUMesh * f2dup_before,
80         const MEDCouplingUMesh * f2dup_after);
81
82     static Connections
83     GetC2CBroken(
84         const MEDFileUMesh * mm,
85         const std::string & grp_name);
86
87     static std::vector<std::pair<mcIdType, mcIdType>>
88     GetC2CPreserved(
89         const MEDFileUMesh * mm,
90         const std::string & grp_name);
91
92     static MEDFileUMesh *
93     make2x2Voxel();
94
95     static MEDFileUMesh *
96     make4x4Voxel();
97
98     static MEDFileUMesh *
99     make2DMesh();
100
101     static MEDFileUMesh *
102     make2DMesh2();
103
104     static MEDFileUMesh *
105     make1DMesh();
106 };
107 }  // namespace MEDCoupling
108 #endif  // __CRACKALGOTEST_HXX__