Salome HOME
Updated copyright comment
[modules/hexablock.git] / src / HEXABLOCK / HexCrossElements.hxx
1
2 // Class : Gestion des tutaux en T (like castles in scotland)
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 #ifndef __CROSS_ELEMENTS_H
23 #define __CROSS_ELEMENTS_H
24
25 #include "Hex_defines.hxx"
26 #include "HexElements.hxx"
27
28 BEGIN_NAMESPACE_HEXA
29
30 enum { NbrSlices1=6, NbrSlices2=4 };
31 enum { SizeRay=3, BiCyl=2};
32 enum { NbrVSlices1=NbrSlices1+1, NbrVSlices2=NbrSlices2+1};
33 enum { MiddleSlice1=NbrSlices1/2};
34 enum { Cyl1=CylSmall, Cyl2=CylBig };
35 enum { NO_CYL=-1, NO_PIPE=0, IS_HERE=1 };
36
37 class HEXABLOCKENGINE_EXPORT CrossElements : public Elements
38 {
39 public:
40    CrossElements (Document* doc, EnumGrid type);
41
42    Hexa*   getHexaIJK   (int part, int nx, int ny, int nz);
43    Quad*   getQuadIJ    (int part, int nx, int ny, int nz);
44    Quad*   getQuadJK    (int part, int nx, int ny, int nz);
45    Quad*   getQuadIK    (int part, int nx, int ny, int nz);
46    Edge*   getEdgeI     (int part, int nx, int ny, int nz);
47    Edge*   getEdgeJ     (int part, int nx, int ny, int nz);
48    Edge*   getEdgeK     (int part, int nx, int ny, int nz);
49    Vertex* getVertexIJK (int part, int nx, int ny, int nz);
50
51 #ifndef SWIG
52 public :
53    virtual ~CrossElements () {}
54                      // Tutaux en T (like castles in scotland)
55    int  crossCylinders (Cylinder* cyl1, Cylinder* cyl2, bool fill=true);
56    void dump ();
57    void dumpVertex ();
58    void dumpHexas  ();
59
60    virtual int countHexa   () { return nbr_hexas ; }
61    virtual int countQuad   () { return nbr_quads ; }
62    virtual int countEdge   () { return nbr_edges ; }
63    virtual int countVertex () { return nbr_vertex ; }
64
65 private :
66
67    void resize ();
68    void fillGrid   (int cyl, int deb=-1, int fin=-1);
69    void fillCenter (int cyl, int deb, int fin);
70    void createLittleCyl ();
71    void createBigCyl    ();
72
73    void copyVertex (int i1, int j1, int k1, int i2, int j2, int k2);
74    void copyEdge (int d1, int i, int j, int k, int d2, int i2, int j2, int k2);
75    void copyQuad (int d1, int i, int j, int k, int d2, int i2, int j2, int k2);
76
77    void setVertex (int cyl, int nx, int ny, int nz, double px, double py,
78                                                                double pz);
79
80    void setVertex (Vertex* vv, int cyl, int nx, int ny, int nz);
81    void setEdge   (Edge* edge, int cyl, int dir, int nx, int ny, int nz);
82    void setQuad   (Quad* quad, int cyl, int dir, int nx, int ny, int nz);
83    void setHexa   (Hexa* cell, int cyl, int nx, int ny, int nz);
84
85    Edge* addEdge   (Vertex* v1, Vertex* v2, int cyl, int dir, int nx,
86                                                     int ny, int nz);
87    Quad* addQuad   (Edge* e1, Edge* e2, Edge* e3, Edge* e4, int cyl, int dir,
88                    int nx, int ny, int nz);
89    Hexa* addHexa   (Quad* qa, Quad* qb, Quad* qc, Quad* qd, Quad* qe, Quad* qf,
90                    int cyl, int nx, int ny, int nz);
91
92    int  indVertex (int cyl, int nx, int ny, int nz);
93    int  indHexa   (int cyl, int nx, int ny, int nz);
94    int  indQuad   (int cyl, int dir, int nx, int ny, int nz);
95    int  indEdge   (int cyl, int dir, int nx, int ny, int nz);
96
97    Hexa* findHexa1 (Quad*   q1, Quad*   q2);
98    Edge* findEdge1 (Vertex* v1, Vertex* v2);
99    Quad* findQuad1 (Edge*   e1, Edge*   e2);
100
101    void assoCylinder  (int cyl, double* normal);
102    void assoSlice     (int cyl, double* base, double* norm, int nx, int zlice);
103    void assoArc    (int cyl, int nx, int ny, int nz, int subid);
104    void assoArcMid (double mid[], int nx, int ny, int nz, double ray, int subid);
105    void assoBigMiddle (double* base, double* normal, int nzlice);
106    int  assoIntersection (int nx, int nzlice, double* snorm, double* bnorm);
107    void adjustAsso       (int nx, int ny, int nz, int sens);
108
109
110    double getAngle  (int cyl, int ny, int nz=0);
111    double getAngleInter (int cyl, int nz);
112    void   addSlice  (int cyl, int ni, int nk, double px, double rayon=-1);
113    void   addVertex (int cyl, int ni, int nj, int nk, double px, double rayon);
114    void   majIntersection ();
115    void   adjustLittleSlice (int nx, int nk, int nxbig);
116
117 private :
118     enum {NbrIntCotes = 4 };
119     enum {size_hiy = NbrIntCotes, size_h1z = 6,    size_h2z=4};
120     enum {size_v1z = size_h1z+1,  size_v2z = size_h2z+1};
121
122     bool      is_filled;
123     Cylinder* cross_cyl1;
124     Cylinder* cross_cyl2;
125     Vertex*   cross_center;
126
127     int  size_vz[BiCyl], size_hz[BiCyl];
128     int  nbr_hexas1, nbr_quads1, nbr_edges1, nbr_vertex1;
129
130     double angle_inter     [BiCyl];
131     double angle_intermed;
132     double cross_rayon [BiCyl][SizeRay];
133     double big_hauteur [size_v2z];
134
135     bool  at_right,  at_left;
136     int   cyl_right, cyl_left;
137     NewShape* grid_geom;
138 #endif   // SWIG
139 };
140 END_NAMESPACE_HEXA
141 #endif