Salome HOME
Updated copyright comment
[modules/hexablock.git] / src / HEXABLOCK / HexHexa.hxx
1
2 // class : Les hexaedres
3
4 // Copyright (C) 2009-2024  CEA, EDF
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 /* -----------------------------------------------------
24
25                 // ---- Numerotation des faces (%x)
26
27        6=bed  +----bd-----+ bdf=7
28              /|          /|
29            be |   B    bf |
30            /  |        /  |
31     4=bce +----bc-----+...|...bcf=5
32           |  de     D |   df
33           | E |       | F |             z
34          ce   | C     cf  |             ^
35   2=ade...|...+----ad-|---+ adf=3       |   y
36           |  /        |  /              |  /
37           | ae    A   | af              | /
38           |/          |/                |/
39     0=ace +----ac-----+ acf=1           +----->  x
40
41  * ----------------------------------------------------- */
42 #ifndef __HEX_HEXA_H_
43 #define __HEX_HEXA_H_
44
45 #include "HexEltBase.hxx"
46
47 #include "HexQuad.hxx"
48 #include "HexEdge.hxx"
49 #include "HexVertex.hxx"
50
51 BEGIN_NAMESPACE_HEXA
52
53 class HexaExport Hexa : public EltBase
54 {
55 public:
56     virtual Quad*   getQuad   (int  nro);
57     virtual Edge*   getEdge   (int  nro);
58     virtual Vertex* getVertex (int  nro);
59
60     void    setColor  (double valeur);
61
62     Hexa (Quad* qa, Quad* qb, Quad* qc, Quad* qd, Quad* qe, Quad* qf);
63
64 #ifndef SWIG
65 public:
66
67     Hexa (Vertex* v1, Vertex* v2, Vertex* v3, Vertex* v4,
68           Vertex* v5, Vertex* v6, Vertex* v7, Vertex* v8);
69
70     virtual int     countQuad   () { return HQ_MAXI; }
71     virtual int     countEdge   () { return HE_MAXI; }
72     virtual int     countVertex () { return HV_MAXI; }
73
74     Hexa (Hexa* other);
75     Quad* Inter   (Hexa* other);
76     bool  definedBy  (Vertex* v1, Vertex* v2);
77     bool  definedBy  (Quad*   va, Quad*   v2);
78     virtual void dump ();
79     virtual void dumpPlus ();
80     virtual void dumpFull ();
81
82     void razNodes ();
83     int  countNodes ();                      // Compte et numerote les noeuds
84     void printNodes (pfile vtk, int& count); // Impression format vtk
85     void colorNodes (pfile vtk);             // Impression scalaires vtk
86     void moveNodes  (Matrix* matrice);       // transfo controlee ds un ensemble
87     void transform  (Matrix* matrice);       // transfo indivituelle
88     void printHexa  (pfile vtk);             // Impression de la cellule
89     void printHexaVtk (pfile vtk);           // Impression de la cellule
90     virtual void majReferences();            // M.A.J relation "utilise par"
91
92     bool hasFreeEdges  ();
93     void propager (Propagation* prop, int nro);
94     void setScalar (double valeur)          { setColor (valeur) ; }
95
96     virtual void saveXml (XmlWriter* xml);
97
98     Elements*  disconnectQuad   (Quad*   face);
99     Elements*  disconnectEdge   (Edge*   arete);
100     Elements*  disconnectVertex (Vertex* noeud);
101
102     int  disconnectQuad   (Quad*   face,  Elements* dest);
103     int  disconnectEdge   (Edge*   arete, Elements* dest);
104     int  disconnectVertex (Vertex* noeud, Elements* dest);
105
106     int getBase (Vertex* orig, Edge* normale);
107
108     void replaceQuad   (Quad*   old, Quad* nouveau);
109     void replaceEdge   (Edge*   old, Edge* nouveau);
110     void replaceVertex (Vertex* old, Vertex* nouveau);
111     void removeConnected ();
112     void markElements (int marque);
113     double* getCenter    (double centre[]);
114
115     virtual void   duplicate ();
116     Hexa* getClone ()               {  return h_clone ; }
117     Quad*   getOpposedQuad   (Quad* face);
118     Vertex* opposedVertex     (Quad* face, Vertex* vertex);
119     Edge*   perpendicularEdge (Quad* face, Vertex* vertex);
120     Quad*   perpendicularQuad (Quad* face, Edge* edge);
121     Edge*   getPerpendicularEdge (Quad* face, Vertex* vertex)
122           { return perpendicularEdge (face, vertex); }
123     // Edge* getParallelEdge      (Quad* face, Edge*   edge);
124     Quad* findQuad             (Edge* e1, Edge* e2);
125     Edge* findEdge             (Vertex* v1, Vertex* v2);
126
127     int   findQuad   (Quad*   element);
128     int   findEdge   (Edge*   element);
129     int   findVertex (Vertex* element);
130
131
132 private:
133     friend class Cloner;
134     void  OrdonnerAretes ();    // obsolete ?
135     void  OrdonnerSommets ();   // obsolete ?
136
137     void  controlerFaces   ();  // Controle primaire des donnees utilisateur
138     void  controlerSommets ();  // Idem;
139
140     void  verifierSommets ();   // Controle de coherence des quads
141     void  verifierAretes ();    // Idem
142
143     void  controlerArete (int arete, int face1, int face2);
144     void  controlerSommet (int node, int arete1, int arete2, int arete3);
145
146     int   findOpposedQuad (Quad* face, Edge* arete);
147
148 private:
149     Quad*   h_quad   [HQ_MAXI];
150     Edge*   h_edge   [HE_MAXI];
151     Vertex* h_vertex [HV_MAXI];
152     Hexa*   h_clone;
153 #endif
154 };
155 END_NAMESPACE_HEXA
156 #endif
157