Salome HOME
Copyright update 2021
[tools/medcoupling.git] / src / INTERP_KERNEL / OrientationInverter.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 // Author : Anthony Geay (EDF R&D)
20
21 #ifndef __ORIENTATIONINVERTER_HXX__
22 #define __ORIENTATIONINVERTER_HXX__
23
24 #include "INTERPKERNELDefines.hxx"
25 #include "NormalizedGeometricTypes"
26 #include "MCIdType.hxx"
27
28 namespace INTERP_KERNEL
29 {
30   class OrientationInverter
31   {
32   public:
33     INTERPKERNEL_EXPORT static OrientationInverter *BuildInstanceFrom(NormalizedCellType gt);
34     INTERPKERNEL_EXPORT virtual ~OrientationInverter() { }
35     INTERPKERNEL_EXPORT virtual void operate(mcIdType *beginPt, mcIdType *endPt) const = 0;
36   };
37
38   class OrientationInverterChecker : public OrientationInverter
39   {
40   public:
41     OrientationInverterChecker(unsigned nbNodes):_nb_nodes(nbNodes) { }
42     void operate(mcIdType *beginPt, mcIdType *endPt) const { check(beginPt,endPt); operateAndShutUp(beginPt); }
43     virtual void operateAndShutUp(mcIdType *beginPt) const = 0;
44   protected:
45     unsigned getNbNodes() const { return _nb_nodes; }
46   private:
47     void check(mcIdType *beginPt, mcIdType *endPt) const;
48   private:
49     unsigned _nb_nodes;
50   };
51
52   class OrientationInverterSEG2 : public OrientationInverterChecker
53   {
54   public:
55     OrientationInverterSEG2():OrientationInverterChecker(2u) { }
56     void operateAndShutUp(mcIdType *beginPt) const;
57   };
58
59   class OrientationInverterSEG3 : public OrientationInverterChecker
60   {
61   public:
62     OrientationInverterSEG3():OrientationInverterChecker(3u) { }
63     void operateAndShutUp(mcIdType *beginPt) const;
64   };
65
66   class OrientationInverter2DLinear : public OrientationInverterChecker
67   {
68   public:
69     OrientationInverter2DLinear(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
70     void operateAndShutUp(mcIdType *beginPt) const;
71   };
72
73   class OrientationInverter2DQuadratic : public OrientationInverterChecker
74   {
75   public:
76     OrientationInverter2DQuadratic(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
77     void operateAndShutUp(mcIdType *beginPt) const;
78   };
79
80   class OrientationInverterPolygon : public OrientationInverter
81   {
82   public:
83     void operate(mcIdType *beginPt, mcIdType *endPt) const;
84   };
85
86   class OrientationInverterQPolygon : public OrientationInverter
87   {
88   public:
89     void operate(mcIdType *beginPt, mcIdType *endPt) const;
90   };
91
92   class OrientationInverterTetra4 : public OrientationInverterChecker
93   {
94   public:
95     OrientationInverterTetra4():OrientationInverterChecker(4u) { }
96     void operateAndShutUp(mcIdType *beginPt) const;
97   };
98
99   class OrientationInverterTetra10 : public OrientationInverterChecker
100   {
101   public:
102     OrientationInverterTetra10():OrientationInverterChecker(10u) { }
103     void operateAndShutUp(mcIdType *beginPt) const;
104   };
105
106   class OrientationInverterPyra5 : public OrientationInverterChecker
107   {
108   public:
109     OrientationInverterPyra5():OrientationInverterChecker(5u) { }
110     void operateAndShutUp(mcIdType *beginPt) const;
111   };
112
113   class OrientationInverterPyra13 : public OrientationInverterChecker
114   {
115   public:
116     OrientationInverterPyra13():OrientationInverterChecker(13u) { }
117     void operateAndShutUp(mcIdType *beginPt) const;
118   };
119
120   class OrientationInverter3DExtrusionLinear : public OrientationInverterChecker
121   {
122   public:
123     OrientationInverter3DExtrusionLinear(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
124     void operateAndShutUp(mcIdType *beginPt) const;
125   };
126
127   class OrientationInverter3DExtrusionQuadratic : public OrientationInverterChecker
128   {
129   public:
130     OrientationInverter3DExtrusionQuadratic(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
131     void operateAndShutUp(mcIdType *beginPt) const;
132   };
133 }
134
135 #endif