Salome HOME
Copyrights update
[modules/med.git] / src / MEDMEM / test_MEDMEM_CellModel.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
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.
8 // 
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.
13 //
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
17 //
18 // See http://www.salome-platform.org/
19 //
20 #include "MEDMEM_CellModel.hxx"
21 #include "MEDMEM_DriversDef.hxx"
22
23 using namespace std;
24 using namespace MEDMEM;
25 using namespace MED_EN;
26
27 int main (int argc, char ** argv) {
28   list<medGeometryElement> geomList = meshEntities[MED_CELL] ;
29   list<medGeometryElement>::iterator itGeomList ;
30   for(itGeomList=geomList.begin();itGeomList!=geomList.end();itGeomList++) {
31     CELLMODEL myCellModel((MED_EN::medGeometryElement)(*itGeomList)) ;
32
33     cout << "First CellModel :" << endl << endl ;
34
35     cout << myCellModel << endl ;
36
37     cout << "Number of constituents type : "<<myCellModel.getNumberOfConstituentsType() << endl ;
38
39     set <medGeometryElement> geomType = myCellModel.getAllConstituentsType() ;
40     set <medGeometryElement>::iterator geomTypeIt ;
41     cout << "Types list : " ;
42     for(geomTypeIt=geomType.begin();geomTypeIt!=geomType.end();geomTypeIt++)
43       cout << (*geomTypeIt) << " " ;
44     cout << endl;
45     
46     map <medGeometryElement,int> myMap = myCellModel.getNumberOfConstituentsForeachType() ; 
47     map <medGeometryElement,int>::iterator myMapIt ;
48     for(myMapIt=myMap.begin();myMapIt!=myMap.end();myMapIt++)
49       cout << " - " << (*myMapIt).second << " constituent(s) of type " << (*myMapIt).first << endl ;
50     cout << endl;
51
52     cout << "Second CellModel :" << endl << endl ;
53     CELLMODEL myCellModel2=myCellModel ;
54     cout << myCellModel2 << endl ;
55
56     cout << "Third CellModel :" << endl << endl ;
57     CELLMODEL myCellModel3 ;
58     myCellModel3=myCellModel ;
59     cout << myCellModel3 << endl ;
60   }
61 }