1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
22 // File : readEntete.cxx
26 #include "MEDMEM_Exception.hxx"
27 #include "MEDMEM_define.hxx"
28 #include "MEDMEM_Mesh.hxx"
29 #include "MEDMEM_MedMeshDriver.hxx"
30 #include "MEDMEM_DriversDef.hxx"
33 using namespace MEDMEM;
34 using namespace MED_EN;
36 void usage(char * name)
38 cout << " " << name <<" <file name>"<< " <mesh name> " << " <interlace mode>" << endl;
39 cout << " " << "displays all Nodes Coordinates in mdump mode" << endl;
41 cout << " " << "mesh name is mandatory. Try mdump if necessary" << endl;
42 cout << " " << "values for interlace mode are : " << endl;
43 cout << " " << "MED_FULL_INTERLACE (default value) or MED_NO_INTERLACE" << endl;
47 int main (int argc, char ** argv) {
49 if (argc < 3) usage(argv[0]);
50 if (argc > 4) usage(argv[0]);
52 string fileName = argv[1];
53 string meshName = argv[2];
55 medModeSwitch Mode = MED_FULL_INTERLACE;
59 if ( comp == "MED_NO_INTERLACE" ) Mode = MED_NO_INTERLACE;
60 else if ( comp != "MED_FULL_INTERLACE") usage(argv[0]);
64 MESH * myMesh= new MESH() ;
65 myMesh->setName(meshName);
66 MED_MESH_RDONLY_DRIVER myMeshDriver(fileName,myMesh);
69 myMeshDriver.setMeshName(meshName);
72 catch (const exception & ex)
74 MESSAGE("Catch Exception : ");
83 catch (const exception & ex)
85 MESSAGE("Catch Exception : ");
90 int SpaceDimension = myMesh->getSpaceDimension();
91 int MeshDimension = myMesh->getMeshDimension();
92 int NumberOfNodes = myMesh->getNumberOfNodes();
94 cout << "(****************************)" << endl;
95 cout << "(* INFORMATIONS GENERALES : *)" << endl;
96 cout << "(****************************)" << endl;
98 // string chainevide(MED_TAILLE_PNOM+2,' ');
99 cout << "- Nom du maillage : <<" << meshName << ">>" << endl;
100 cout << "- Dimension d'espace : "<< SpaceDimension << endl;
101 cout << "- Dimension du maillage : "<< MeshDimension << endl;
102 cout << "- Pas de nom universel " << endl ;
103 cout << "- Nombre de noeuds : " << NumberOfNodes << " " << endl;
105 int NumberOfTypes = myMesh->getNumberOfTypes(MED_CELL);
106 const medGeometryElement * Types;
108 cout << "- Nombre de Type de mailles : " << NumberOfTypes << endl;
110 if (NumberOfTypes > 0)
112 Types = myMesh->getTypes(MED_CELL);
115 for (int itype=0; itype<NumberOfTypes; itype++) cout << Types[itype] << " ";
118 const list<medGeometryElement> currentEntity = meshEntities[MED_CELL];
119 list<medGeometryElement>::const_iterator currentGeometry;
121 for (currentGeometry = currentEntity.begin();
122 currentGeometry != currentEntity.end();
125 cout << "- Nombre de mailles de type ";
126 cout << geoNames[(*currentGeometry)] << " : ";
127 cout << myMesh->getNumberOfElements(MED_CELL,(MED_EN::medGeometryElement)(*currentGeometry));
132 NumberOfTypes = myMesh->getNumberOfTypes(MED_FACE);
134 cout << "- Nombre de Type de faces : " << NumberOfTypes << endl;
136 if (NumberOfTypes > 0)
138 Types = myMesh->getTypes(MED_FACE);
141 for (int itype=0; itype<NumberOfTypes; itype++) cout << Types[itype] << " ";
144 const list<medGeometryElement> currentEntity2 = meshEntities[MED_FACE];
145 list<medGeometryElement>::const_iterator currentGeometry;
147 for (currentGeometry = currentEntity2.begin();
148 currentGeometry != currentEntity2.end();
151 cout << "- Nombre de faces de type ";
152 cout << geoNames[(*currentGeometry)] << " : ";
153 cout << myMesh->getNumberOfElements(MED_FACE,(*currentGeometry));
158 NumberOfTypes = myMesh->getNumberOfTypes(MED_EDGE);
160 cout << "- Nombre de Type de aretes : " << NumberOfTypes << endl;
162 if (NumberOfTypes > 0)
164 Types = myMesh->getTypes(MED_EDGE);
167 for (int itype=0; itype<NumberOfTypes; itype++) cout << Types[itype] << " ";
170 const list<medGeometryElement> currentEntity3 = meshEntities[MED_EDGE];
171 list<medGeometryElement>::const_iterator currentGeometry;
173 for (currentGeometry = currentEntity3.begin();
174 currentGeometry != currentEntity3.end();
177 cout << "- Nombre d'aretes de type ";
178 cout << geoNames[(*currentGeometry)] << " : ";
179 cout << myMesh->getNumberOfElements(MED_EDGE,(*currentGeometry));