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