]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM/test_MEDMEM_CellModel.cxx
Salome HOME
NRI : Merge from V1_2.
[modules/med.git] / src / MEDMEM / test_MEDMEM_CellModel.cxx
1 //  MED MEDMEM : MED files in memory
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   : test_MEDMEM_CellModel.cxx
25 //  Module : MED
26
27 using namespace std;
28 #include "utilities.h"
29 #include "MEDMEM_CellModel.hxx"
30 #include "MEDMEM_DriversDef.hxx"
31
32 int main (int argc, char ** argv) {
33   list<MED_FR::med_geometrie_element> geomList = MED_FR::meshEntities[MED_FR::MED_MAILLE] ;
34   list<MED_FR::med_geometrie_element>::iterator itGeomList ;
35   for(itGeomList=geomList.begin();itGeomList!=geomList.end();itGeomList++) {
36     CELLMODEL myCellModel((MED_EN::medGeometryElement)(*itGeomList)) ;
37
38     cout << "First CellModel :" << endl << endl ;
39
40     cout << myCellModel << endl ;
41
42     cout << "Number of constituents type : "<<myCellModel.getNumberOfConstituentsType() << endl ;
43
44     set <medGeometryElement> geomType = myCellModel.getAllConstituentsType() ;
45     set <medGeometryElement>::iterator geomTypeIt ;
46     cout << "Types list : " ;
47     for(geomTypeIt=geomType.begin();geomTypeIt!=geomType.end();geomTypeIt++)
48       cout << (*geomTypeIt) << " " ;
49     cout << endl;
50     
51     map <medGeometryElement,int> myMap = myCellModel.getNumberOfConstituentsForeachType() ; 
52     map <medGeometryElement,int>::iterator myMapIt ;
53     for(myMapIt=myMap.begin();myMapIt!=myMap.end();myMapIt++)
54       cout << " - " << (*myMapIt).second << " constituent(s) of type " << (*myMapIt).first << endl ;
55     cout << endl;
56
57     cout << "Second CellModel :" << endl << endl ;
58     CELLMODEL myCellModel2=myCellModel ;
59     cout << myCellModel2 << endl ;
60
61     cout << "Third CellModel :" << endl << endl ;
62     CELLMODEL myCellModel3 ;
63     myCellModel3=myCellModel ;
64     cout << myCellModel3 << endl ;
65   }
66 }