Salome HOME
Update copyrights
[modules/smesh.git] / src / MEDWrapper / MED_Common.cxx
1 // Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  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, 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
23 #include "MED_Common.hxx"
24 #include <med.h>
25
26 namespace MED
27 {
28   TInt
29   GetDESCLength()
30   {
31     return 200;
32   }
33
34   TInt
35   GetIDENTLength()
36   {
37     return 8;
38   }
39
40   TInt
41   GetNOMLength()
42   {
43     return 64;
44   }
45
46   TInt
47   GetLNOMLength()
48   {
49     return 80;
50   }
51
52   TInt
53   GetPNOMLength()
54   {
55     return 16;
56   }
57
58   void
59   GetVersionRelease(TInt& major, TInt& minor, TInt& release)
60   {
61     major   = MED_MAJOR_NUM;
62     minor   = MED_MINOR_NUM;
63     release = MED_RELEASE_NUM;
64   }
65
66   TInt
67   GetNbConn(EGeometrieElement typmai,
68             EEntiteMaillage typent,
69             TInt mdim)
70   {
71     return typmai % 100;
72   }
73
74   TInt
75   GetNbNodes(EGeometrieElement typmai)
76   {
77     return typmai % 100;
78   }
79
80   const MED::TEntity2GeomSet& GetEntity2GeomSet()
81   {
82     static MED::TEntity2GeomSet Entity2GeomSet;
83
84     if ( Entity2GeomSet.empty() ) {
85       TGeomSet& aGeomARETESet = Entity2GeomSet[MED::eARETE];
86       aGeomARETESet.insert(MED::eSEG2);
87       aGeomARETESet.insert(MED::eSEG3);
88
89       TGeomSet& aGeomFACESet = Entity2GeomSet[MED::eFACE];
90       aGeomFACESet.insert(MED::eTRIA3);
91       aGeomFACESet.insert(MED::eQUAD4);
92       aGeomFACESet.insert(MED::eTRIA6);
93       aGeomFACESet.insert(MED::eTRIA7);
94       aGeomFACESet.insert(MED::eQUAD8);
95       aGeomFACESet.insert(MED::eQUAD9);
96       aGeomFACESet.insert(MED::ePOLYGONE);
97       aGeomFACESet.insert(MED::ePOLYGON2);
98
99       TGeomSet& aGeomMAILLESet = Entity2GeomSet[MED::eMAILLE];
100       aGeomMAILLESet.insert(MED::ePOINT1);
101       aGeomMAILLESet.insert(aGeomARETESet.begin(), aGeomARETESet.end());
102       aGeomMAILLESet.insert(aGeomFACESet.begin(), aGeomFACESet.end());
103       aGeomMAILLESet.insert(MED::eTETRA4);
104       aGeomMAILLESet.insert(MED::ePYRA5);
105       aGeomMAILLESet.insert(MED::ePENTA6);
106       aGeomMAILLESet.insert(MED::eHEXA8);
107       aGeomMAILLESet.insert(MED::eOCTA12);
108       aGeomMAILLESet.insert(MED::eTETRA10);
109       aGeomMAILLESet.insert(MED::ePYRA13);
110       aGeomMAILLESet.insert(MED::ePENTA15);
111       aGeomMAILLESet.insert(MED::ePENTA18);
112       aGeomMAILLESet.insert(MED::eHEXA20);
113       aGeomMAILLESet.insert(MED::eHEXA27);
114       aGeomMAILLESet.insert(MED::ePOLYEDRE);
115
116       /* This combination allows reading nb of models of structure elements */
117       Entity2GeomSet[MED::eSTRUCT_ELEMENT].insert(MED::eAllGeoType);
118     }
119
120     return Entity2GeomSet;
121   }
122 }