]> SALOME platform Git repositories - modules/hexablock.git/blob - src/HEXABLOCK/HexGlobale.hxx
Salome HOME
Move Hex_defines.hxx to the list of the headers.
[modules/hexablock.git] / src / HEXABLOCK / HexGlobale.hxx
1
2 // Singleton : Var globales : Disposition sommets/aretes/faces d'un hexaedre
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/ 
21 // or email : webmaster.salome@opencascade.com
22 //
23
24 #ifndef _HEX_GLOBALE_H
25 #define _HEX_GLOBALE_H
26
27 #include "Hex_defines.hxx"
28 #include "hexa_base.hxx"
29 #include "HexDumpStudy.hxx"
30 #include "HexWitness.hxx"
31
32 /* -----------------------------------------------------
33
34                 // ---- Numerotation des faces (%x) 
35                    
36        6=bed  +----bd-----+ bdf=7
37              /|          /|
38            be |   B    bf |
39            /  |        /  |
40     4=bce +----bc-----+...|...bcf=5
41           |  de     D |   df
42           | E |       | F |             z
43          ce   | C     cf  |             ^
44   2=ade...|...+----ad-|---+ adf=3       |   y
45           |  /        |  /              |  /
46           | ae    A   | af              | /
47           |/          |/                |/
48     0=ace +----ac-----+ acf=1           +----->  x
49                 
50  * ----------------------------------------------------- */
51
52
53 BEGIN_NAMESPACE_HEXA
54
55 class HEXABLOCKENGINE_EXPORT Globale
56 {
57 public :
58    static Globale* getInstance ();
59
60    int CoordVertex (int edge, EnumCoord dim)
61        { return coord_vertex [edge] [dim] ; }
62
63    EnumHVertex EdgeVertex (int edge, EnumVertex sens)
64        { return edge_vertex [edge] [sens] ; }
65
66    EnumHEdge QuadEdge (int face, EnumQuad cote)
67        { return quad_edge [face] [cote] ; }
68
69    cpchar namofHexaEdge   (int arete)   { return h_edge_name   [arete] ; }
70    cpchar namofHexaVertex (int sommet)  { return h_vertex_name [sommet]; }
71    cpchar namofHexaQuad   (int face)    { return h_quad_name   [face];   }
72
73    EnumHQuad getOpposedQuad (int face)  { return h_opposed_quad [face]; }
74
75    void setArgs  (int nbargs, cpchar tabargs[]);
76    int  findArg  (cpchar opt);
77    bool isinArgs (cpchar opt)  { return findArg (opt) >= 0; }
78    cpchar getArg (int nro)     { return nro>=nbr_args ? NULL : tab_args[nro]; }
79
80 public  :
81    DumpStudy dump;
82    Witness   mess;
83
84 private :
85    Globale ();         // Constructeur prive
86
87    void setCoordVertex (EnumHVertex node, int px, int py, int pz);
88    void setEdgeVertex  (EnumHEdge edge, EnumHVertex amont, EnumHVertex aval);
89    void setQuadEdge    (EnumHQuad face, EnumHEdge c1, EnumHEdge c2, 
90                                         EnumHEdge c3, EnumHEdge c4);
91    void setOpposedVertex (EnumHVertex lun, EnumHVertex lautre);
92    void setOpposedQuad   (EnumHQuad   lun, EnumHQuad   lautre);
93
94    void setNames ();
95
96 private :
97    int     nbr_args;
98    cpchar* tab_args;
99    bool    dump_study;
100
101    int         coord_vertex [HV_MAXI] [DIM3];
102    EnumHVertex edge_vertex  [HE_MAXI] [V_TWO];
103    EnumHEdge   quad_edge    [HQ_MAXI] [QUAD4];
104
105    cpchar h_edge_name   [HE_MAXI]; 
106    cpchar h_vertex_name [HV_MAXI];
107    cpchar h_quad_name   [HQ_MAXI]; 
108
109    EnumHVertex  h_opposed_vertex [HV_MAXI];
110    EnumHQuad    h_opposed_quad   [HQ_MAXI];
111
112    static Globale* unique_instance;
113 };
114 // ===================================================== setArgs
115 inline void Globale::setArgs (int nbargs, cpchar tabargs[])
116 {
117    nbr_args = nbargs;
118    tab_args = tabargs;
119 }
120 // ===================================================== findArg
121 inline int Globale::findArg (cpchar option)
122 {
123    for (int nro=1 ; nro<nbr_args ; nro++)
124        if (Cestegal (option, tab_args[nro]))
125           return nro;
126
127    return NOTHING;
128 }
129 END_NAMESPACE_HEXA
130
131 #endif