7 #include "MEDMEM_Exception.hxx"
8 #include "MEDMEM_Mesh.hxx"
9 #include "MEDMEM_Family.hxx"
10 #include "MEDMEM_Group.hxx"
12 #include "MEDMEM_MedMeshDriver.hxx"
13 #include "MEDMEM_MedFieldDriver.hxx"
14 #include "MEDMEM_Support.hxx"
15 #include "MEDMEM_Field.hxx"
16 #include "MEDMEM_define.hxx"
18 using namespace MEDMEM;
20 void affiche_support(const SUPPORT * mySupport)
22 cout << " - Name : "<<mySupport->getName().c_str()<<endl ;
23 cout << " - Description : "<<mySupport->getDescription().c_str()<<endl ;
24 cout << " - Entity : "<<mySupport->getEntity()<<endl ;
25 cout << " - Entities list : "<<endl ;
26 if (!(mySupport->isOnAllElements())) {
27 int NumberOfTypes = mySupport->getNumberOfTypes() ;
28 cout<<" - NumberOfTypes : "<<NumberOfTypes<<endl;
29 const medGeometryElement * Types = mySupport->getTypes() ;
30 for (int j=0;j<NumberOfTypes;j++) {
31 cout<<" * Type "<<Types[j]<<" : ";
32 int NumberOfElements = mySupport->getNumberOfElements(Types[j]) ;
33 const int * Number = mySupport->getNumber(Types[j]) ;
34 for (int k=0; k<NumberOfElements;k++)
35 cout << Number[k] << " ";
39 cout << " Is on all entities !"<< endl;
43 void affiche_famille(const FAMILY * myFamily)
45 affiche_support(myFamily);
46 cout << " - Identifier : "<<myFamily->getIdentifier()<<endl ;
47 int NumberOfAttributes = myFamily->getNumberOfAttributes() ;
48 cout << " - Attributes ("<<NumberOfAttributes<<") :"<<endl;
49 for (int j=1;j<NumberOfAttributes+1;j++)
50 cout << " * "<<myFamily->getAttributeIdentifier(j)<<" : "<<myFamily->getAttributeValue(j)<<", "<<myFamily->getAttributeDescription(j).c_str()<<endl ;
51 int NumberOfGroups = myFamily->getNumberOfGroups() ;
52 cout << " - Groups ("<<NumberOfGroups<<") :"<<endl;
53 for (int j=1;j<NumberOfGroups+1;j++)
54 cout << " * "<<myFamily->getGroupName(j).c_str()<<endl ;
57 void affiche_groupe(const GROUP * myGroup)
59 affiche_support(myGroup);
60 int NumberOfFamillies = myGroup->getNumberOfFamilies() ;
61 cout << " - Families ("<<NumberOfFamillies<<") :"<<endl;
62 for (int j=1;j<NumberOfFamillies+1;j++)
63 cout << " * "<<myGroup->getFamily(j)->getName().c_str()<<endl ;
66 int main (int argc, char ** argv) {
70 if (argc <3) { // after 3, ignored !
71 cerr << "Usage : " << argv[0]
72 << " filename meshname" << endl << endl;
76 string filename = argv[1] ;
77 string meshname = argv[2] ;
79 MESH * myMesh= new MESH() ;
80 myMesh->setName(meshname);
81 MED_MESH_RDONLY_DRIVER myMeshDriver(filename,myMesh) ;
82 myMeshDriver.setMeshName(meshname);
85 myMeshDriver.close() ;
87 const GROUP * myGroup = myMesh->getGroup(MED_NODE,1);
88 cout << "Show Group :"<<endl ;
89 affiche_groupe(myGroup);
90 GROUP * myGroup2 = new GROUP(* myGroup);
91 //delete myGroup; // no because in mesh !!
92 affiche_groupe(myGroup2);
93 GROUP * myGroup3 = new GROUP(* myGroup2);
95 affiche_groupe(myGroup3);