]> SALOME platform Git repositories - modules/hexablock.git/blob - src/HEXABLOCK/HexBiCylinder.hxx
Salome HOME
b26e22153776c49b1c7c4ae2a77d86ad01cbdbb9
[modules/hexablock.git] / src / HEXABLOCK / HexBiCylinder.hxx
1
2 // Class : Gestion des tutaux en T (like castles in scotland)
3
4 //  Copyright (C) 2009-2011  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/ 
21 //  or email : webmaster.salome@opencascade.com
22 //
23 #ifndef __BI_CYLINDER_H_
24 #define __BI_CYLINDER_H_
25
26 #include "HexElements.hxx"
27 #include <map>
28
29 BEGIN_NAMESPACE_HEXA
30
31 class BiCylinder : public Elements 
32 {
33 public:
34    virtual int countHexa   () { return nbr_hexas ; }
35    virtual int countQuad   () { return nbr_quads ; }
36    virtual int countEdge   () { return nbr_edges ; }
37    virtual int countVertex () { return nbr_vertex ; }
38
39 public:
40    BiCylinder (Document* doc);
41
42    virtual ~BiCylinder () {}
43
44    Hexa*   getHexaIJK   (int part, int nx, int ny, int nz);
45    Quad*   getQuadIJ    (int part, int nx, int ny, int nz);
46    Quad*   getQuadJK    (int part, int nx, int ny, int nz);
47    Quad*   getQuadIK    (int part, int nx, int ny, int nz);
48    Edge*   getEdgeI     (int part, int nx, int ny, int nz);
49    Edge*   getEdgeJ     (int part, int nx, int ny, int nz);
50    Edge*   getEdgeK     (int part, int nx, int ny, int nz);
51    Vertex* getVertexIJK (int part, int nx, int ny, int nz);
52
53                      // Tutaux en T (like castles in scotland)
54    int  crossCylinders (Cylinder* cyl1, Cylinder* cyl2);
55
56 private :
57  
58    enum { NbrSlices=5, NbrVslices=NbrSlices+1, NbrCotes=4 };
59
60    void createLittleCyl ();
61    void createBigCyl    ();
62    void adjustLittleSlice (int nx, int nzs);
63
64    Vertex* addVertex (double px, double py, double pz, 
65                       int cyl, int ni, int nj, int nk);
66    Edge* addEdge (Vertex* v1, Vertex* v2, 
67                   int cyl, int dir, int nx, int ny, int nz);
68    Quad* addQuad (Edge* e1, Edge* e2, Edge* e3, Edge* e4, 
69                   int cyl, int dir, int nx, int ny, int nz);
70    Hexa* addHexa (Quad* qa, Quad* qb, Quad* qc, Quad* qd, Quad* qe, Quad* qf,
71                   int cyl, int nx, int ny, int nz);
72
73    Vertex* findVertex (double px, double py, double pz, int ni, int nj, int nk);
74    Edge*   findEdge (Vertex* v1, Vertex* v2, int dir, int nx, int ny, int nz);
75    Quad*   findQuad (Vertex* v1, Vertex* v2, int dir, int nx, int ny, int nz);
76    Quad*   findQuad (Edge* e1, Edge* e2, int dir, int nx, int ny, int nz);
77    Hexa*   findHexa (Quad* qa, Quad* qb, int nx, int ny, int nz);
78
79    Edge* findEdge (Vertex* v1, Vertex* v2);
80    Quad* findQuad (Edge*   e1, Edge*   e2);
81
82    void assoCylinder  (int cyl, double* normal);
83    void assoCylinders (double* snormal, double* gnormal);
84    void assoSlice    (int cyl, int nx, int nzs, double* norm);
85    void assoArc (int cyl, int nx, int ny, int nz, string& brep, double ray);
86    int  assoIntersection (int nx, int nzlice, double* snorm, double* bnorm);
87
88
89    void addSlice  (int cyl, int i, int k, double h, double r, bool find=false);
90    void fillSlice (int cyl, int nia, int nka, int nib, int nkb, int nic, 
91                             int nkc, int nid, int nkd, bool med=false);
92    void fillSmallCyl ();
93
94    double getAngle (int nj)             { return  (2*((nj)%4)+1)*M_PI/4; }
95    int getKey (int cyl, int ni, int nj, int nk) 
96               { return 1000*(cyl+1) + 100*ni + 10*nj + nk; }
97    int getKey (int cyl, int dd, int ni, int nj, int nk) 
98               { return 10000*(cyl+1) + 1000*dd + 100*ni + 10*nj + nk; }
99 private :
100     Cylinder* cross_cyl1;    // Petit
101     Cylinder* cross_cyl2;    // gros
102     Real3     cross_center;
103    
104     map <int,int> map_vertex, map_edge, map_quad, map_hexa;
105     map <int,int> :: iterator it_map;
106
107     int    nbr_hexas1, nbr_quads1, nbr_edges1, nbr_vertex1;
108     double cross_rayext  [V_TWO];
109     double cross_rayint  [V_TWO];
110     double cross_hauteur [V_TWO];
111
112     bool   at_right, at_left;
113 };
114 END_NAMESPACE_HEXA
115 #endif