Salome HOME
5c53a4df29c7ff7fe879a29b01e981b63a38753e
[modules/med.git] / src / MEDWrapper / Base / MED_Utilities.cxx
1 //  
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : 
25 //  Author : 
26 //  Module : 
27 //  $Header$
28
29 #include "MED_Utilities.hxx"
30 #include "MED_Common.hxx"
31
32 using namespace std;
33
34 #ifdef _DEBUG_
35 static int MYDEBUG = 0;
36 #else
37 static int MYDEBUG = 0;
38 #endif
39
40
41 int MED::PrefixPrinter::myCounter = 0;
42
43 MED::PrefixPrinter::PrefixPrinter(bool theIsActive):
44   myIsActive(theIsActive)
45 {
46   if(myIsActive)
47     myCounter++;
48   MSG(MYDEBUG,"MED::PrefixPrinter::PrefixPrinter(...)- "<<myCounter);
49 }
50
51 MED::PrefixPrinter::~PrefixPrinter()
52 {
53   if(myIsActive)
54     myCounter--;
55 }
56
57 string MED::PrefixPrinter::GetPrefix()
58 {
59   if(myCounter)
60     return string(myCounter*2,' ');
61   return "";
62 }
63
64
65 static MED::TEntity2GeomSet Entity2GeomSet;
66
67 bool InitEntity2GeomSet()
68 {
69   using namespace MED;
70
71   TGeomSet& aGeomARETESet = Entity2GeomSet[eARETE];
72   aGeomARETESet.insert(eSEG2);
73   aGeomARETESet.insert(eSEG3);
74
75   TGeomSet& aGeomFACESet = Entity2GeomSet[eFACE];
76   aGeomFACESet.insert(eTRIA3);
77   aGeomFACESet.insert(eQUAD4);
78   aGeomFACESet.insert(eTRIA6);
79   aGeomFACESet.insert(eQUAD8);
80   aGeomFACESet.insert(ePOLYGONE);
81
82   TGeomSet& aGeomMAILLESet = Entity2GeomSet[eMAILLE];
83   aGeomMAILLESet.insert(ePOINT1);
84   aGeomMAILLESet.insert(aGeomARETESet.begin(),aGeomARETESet.end());
85   aGeomMAILLESet.insert(aGeomFACESet.begin(),aGeomFACESet.end());
86   aGeomMAILLESet.insert(eTETRA4);
87   aGeomMAILLESet.insert(ePYRA5);
88   aGeomMAILLESet.insert(ePENTA6);
89   aGeomMAILLESet.insert(eHEXA8);
90   aGeomMAILLESet.insert(eTETRA10);
91   aGeomMAILLESet.insert(ePYRA13);
92   aGeomMAILLESet.insert(ePENTA15);
93   aGeomMAILLESet.insert(eHEXA20);
94   aGeomMAILLESet.insert(ePOLYEDRE);
95   
96   return true;
97 }
98
99 static bool anIsInited = InitEntity2GeomSet();
100
101 const MED::TEntity2GeomSet& MED::GetEntity2GeomSet()
102 {
103   return Entity2GeomSet;
104 }
105
106