Salome HOME
1c83427efd8d3cc984b08dadbaaa368d833cd01a
[modules/hexablock.git] / src / HEXABLOCK / HexQpattern.hxx
1
2 // C++ : Quads Pattern (for replaceHexas)
3
4 // Copyright (C) 2009-2023  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 #ifndef __HEX_QPATTERN_H_
24
25 #include "HexGlobale.hxx"
26
27 #include <cmath>
28 #include <map>
29
30 BEGIN_NAMESPACE_HEXA
31
32 // --------------------------------------------------------
33 class HexaExport QpatQuad
34 {
35 public :
36    QpatQuad (Quad* refer=NULL);
37    void operator= (const QpatQuad& other);
38 public :
39    int   q_edge [QUAD4];
40    Quad* refer;
41    Quad* cible;
42    Quad* oppos;
43 }; 
44 // --------------------------------------------------------
45 class HexaExport QpatEdge
46 {
47 public :
48    QpatEdge (Edge* refer=NULL);
49    void operator= (const QpatEdge& other);
50
51 public :
52    int   v_amont, v_aval;
53    Edge* refer;
54    Edge* cible;
55    Edge* oppos;
56 }; 
57 // --------------------------------------------------------
58 class HexaExport QpatVertex
59 {
60 public :
61    QpatVertex (Vertex* refer=NULL);
62    void operator= (const QpatVertex& other);
63
64 public :
65    double  v_x, v_y;
66    Vertex* refer;
67    Vertex* cible;
68    Vertex* oppos;
69    bool    on_contour;
70    int     quad_cible;
71 }; 
72
73 // --------------------------------------------------------
74 class HexaExport Qpattern 
75 {
76 friend class Elements;
77 public  :
78     Qpattern();
79     void setPattern (Vertices& contour, Quads& pattern);
80     void setTarget  (Vertices& contour, Quads& target);
81     void stepDown ();
82     void extrude  ();
83     void getSize  (int& nbq, int& nbed, int& nbv, int& prof);
84
85     void anaTarget  (double tmin[], double tmax[], double centre[]);
86     Vertex* getTargetVertex (int nro)
87            { return old_contour [nro] ; }
88
89 private :
90     int  setOrigin (double* v1, double* v2, double* v3);
91     int  addQuad   (Quad* quad);
92     int  addEdge   (Edge*   edge);
93     int  addVertex (Vertex* vertex, Vertex* ref=NULL);
94     void projeter  (Vertex* vertex, double& ux, double& uy);
95
96 private :
97    std::vector <QpatVertex> pat_vertex;
98    std::vector <QpatEdge  > pat_edge;
99    std::vector <QpatQuad  > pat_quad;
100
101    Quads    old_top, old_bottom;
102    Hexas    old_hexa;
103    Vertices old_contour;
104
105    int      nbr_vertex, nbr_edges, nbr_quads;
106    int      cont_nbnodes;
107    Real3    base_i, base_j, origine;
108    double   ux_mini, uy_mini, ux_delta, uy_delta;
109
110    int pos_vertex4;
111    int pos_edge3, pos_edge4;
112    int nbr_layers;
113 };
114 END_NAMESPACE_HEXA
115 #endif