]> SALOME platform Git repositories - modules/hexablock.git/blob - src/HEXABLOCK/HexQuad.hxx
Salome HOME
Undef max Visual Studio definition.
[modules/hexablock.git] / src / HEXABLOCK / HexQuad.hxx
1
2 // class : Les Quadrangles
3
4 // Copyright (C) 2009-2013  CEA/DEN, EDF R&D
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.
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 #ifndef __QUAD_H
23 #define __QUAD_H
24
25 #include "Hex_defines.hxx"
26 #include "HexEdge.hxx"
27
28 BEGIN_NAMESPACE_HEXA
29
30 #ifndef SWIG
31 struct HEXABLOCKENGINE_EXPORT StrOrient
32 {
33    Vertex* v11;     // 1er sommet 1er quad
34    Vertex* v12;     // 2eme
35    Vertex* v21;     // 1er sommet 2eme quad
36    Vertex* v22;     // 2eme
37    int dir;         // direction element suivant
38
39 StrOrient ( Vertex* n11, Vertex* n12, Vertex* n21, Vertex* n22, int d=0)
40     : v11 (n11), v12 (n12), v21 (n21), v22 (n22), dir (d) {}
41
42 StrOrient ( StrOrient* s)
43     : v11 (s->v11), v12(s->v12), v21(s->v21), v22(s->v22), dir(s->dir){}
44
45 };
46 #endif
47
48 class HEXABLOCKENGINE_EXPORT Quad : public EltBase
49 {
50 public:
51     virtual Edge*   getEdge   (int  nro);
52     virtual Vertex* getVertex (int  nro);
53
54     int   addAssociation (NewShape*  forme, int subid);
55     virtual void  clearAssociation  ();
56
57     void setColor  (double valeur);
58     Vertex* nearestVertex (Vertex* other);
59     double* getCenter     (double* center);
60
61     Quad (Vertex* va, Vertex* vb, Vertex* vc, Vertex* vd);
62
63 #ifndef SWIG
64 public:
65     Quad (Edge* ea, Edge* eb, Edge* ec, Edge* ed);
66     Quad (Quad* other);
67
68     virtual int countEdge   () { return QUAD4; }
69     virtual int countVertex () { return QUAD4; }
70
71     Hexa* getParent (int nro);
72
73     Edge* findEdge   (Vertex* v1, Vertex*v2);
74     Edge* commonEdge (Quad* other);
75     int   anaMerge (Vertex* v1, Vertex* v2, Vertex* tv[], Edge* te[]);
76
77     int   ordoVertex (Vertex* v1, Vertex* v2, Vertex* tv[]);
78     int   ordonner   (Vertex* v1, Vertex* v2, Vertex* tv[], Edge* ted[]);
79
80     int   inter     (Quad* other, int& nro);
81     Edge* inter     (Quad* other);
82     bool  definedBy (Vertex* v1, Vertex* v2);
83     bool  definedBy (Edge*   e1,  Edge*   e2);
84
85     int   indexVertex (Vertex* elt);
86     int   indexEdge   (Edge*   elt);
87
88     //int   accoupler (Quad* other, StrOrient* orient);
89     int   coupler (Quad* other, StrOrient* orient, Elements* table);
90
91     Edge*   getOpposEdge   (Edge* arete, int &sens);
92     Vertex* getOpposVertex (Vertex* sommet);
93
94     virtual void majReferences();            // M.A.J relation "utilise par"
95     virtual void dump ();
96     virtual void dumpPlus ();
97     virtual void saveXml (XmlWriter* xml);
98     void setScalar (double valeur)              { setColor (valeur); }
99
100     void         replace (Quad* old);
101     virtual void replaceEdge   (Edge*   old, Edge*   nouveau);
102     virtual void replaceVertex (Vertex* old, Vertex* nouveau);
103
104     virtual void  setAssociation (Shape* forme) {}              // PERIME
105     virtual int   addAssociation (Shape* forme) {return HOK ; } // PERIME
106
107
108     // const Shapes& getAssociations ()        { return tab_shapes ; }
109
110
111     virtual void duplicate ();
112     Quad* getClone ()               {  return q_clone ; }
113
114     Edge* getOpposEdge     (Edge* arete);   // Version simplifiee
115     Edge* getPerpendicular (Edge* arete, Vertex* node);
116     int   getOrientation ()            { return q_orientation; }
117     int   setOrientation ();
118     void  setOrientation (int ori);
119     void  reorienter ();
120                                                       // Hexa5
121     int   addAssociation (FaceShape* forme);
122     int   countAssociation ()                     { return tab_assoc.size () ; }
123     FaceShape* getAssociation (int nro);
124
125     double  dist2         (double* point);
126
127 private:
128     friend class Cloner;
129     Quad* getBrother (StrOrient* orient);
130
131 private:
132     Edge*   q_edge   [QUAD4];
133     Vertex* q_vertex [QUAD4];
134     Quad*   q_clone;
135     int     q_orientation;
136
137     FaceShapes tab_assoc;
138 #endif
139 };
140 END_NAMESPACE_HEXA
141 #endif
142