Back to index

salome-med  6.5.0
test_MEDMEM_CellModel.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #include "MEDMEM_CellModel.hxx"
00021 #include "MEDMEM_DriversDef.hxx"
00022 
00023 using namespace std;
00024 using namespace MEDMEM;
00025 using namespace MED_EN;
00026 
00027 int main (int argc, char ** argv) {
00028   list<medGeometryElement> geomList = meshEntities[MED_CELL] ;
00029   list<medGeometryElement>::iterator itGeomList ;
00030   for(itGeomList=geomList.begin();itGeomList!=geomList.end();itGeomList++) {
00031     CELLMODEL myCellModel((MED_EN::medGeometryElement)(*itGeomList)) ;
00032 
00033     cout << "First CellModel :" << endl << endl ;
00034 
00035     cout << myCellModel << endl ;
00036 
00037     cout << "Number of constituents type : "<<myCellModel.getNumberOfConstituentsType() << endl ;
00038 
00039     set <medGeometryElement> geomType = myCellModel.getAllConstituentsType() ;
00040     set <medGeometryElement>::iterator geomTypeIt ;
00041     cout << "Types list : " ;
00042     for(geomTypeIt=geomType.begin();geomTypeIt!=geomType.end();geomTypeIt++)
00043       cout << (*geomTypeIt) << " " ;
00044     cout << endl;
00045     
00046     map <medGeometryElement,int> myMap = myCellModel.getNumberOfConstituentsForeachType() ; 
00047     map <medGeometryElement,int>::iterator myMapIt ;
00048     for(myMapIt=myMap.begin();myMapIt!=myMap.end();myMapIt++)
00049       cout << " - " << (*myMapIt).second << " constituent(s) of type " << (*myMapIt).first << endl ;
00050     cout << endl;
00051 
00052     cout << "Second CellModel :" << endl << endl ;
00053     CELLMODEL myCellModel2=myCellModel ;
00054     cout << myCellModel2 << endl ;
00055 
00056     cout << "Third CellModel :" << endl << endl ;
00057     CELLMODEL myCellModel3 ;
00058     myCellModel3=myCellModel ;
00059     cout << myCellModel3 << endl ;
00060   }
00061 }