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"
19 void affiche_support(const SUPPORT * mySupport)
21 cout << " - Name : "<<mySupport->getName().c_str()<<endl ;
22 cout << " - Description : "<<mySupport->getDescription().c_str()<<endl ;
23 cout << " - Entity : "<<mySupport->getEntity()<<endl ;
24 cout << " - Entities list : "<<endl ;
25 if (!(mySupport->isOnAllElements())) {
26 int NumberOfTypes = mySupport->getNumberOfTypes() ;
27 cout<<" - NumberOfTypes : "<<NumberOfTypes<<endl;
28 const medGeometryElement * Types = mySupport->getTypes() ;
29 for (int j=0;j<NumberOfTypes;j++) {
30 cout<<" * Type "<<Types[j]<<" : ";
31 int NumberOfElements = mySupport->getNumberOfElements(Types[j]) ;
32 const int * Number = mySupport->getNumber(Types[j]) ;
33 for (int k=0; k<NumberOfElements;k++)
34 cout << Number[k] << " ";
38 cout << " Is on all entities !"<< endl;
42 void affiche_famille(const FAMILY * myFamily)
44 affiche_support(myFamily);
45 cout << " - Identifier : "<<myFamily->getIdentifier()<<endl ;
46 int NumberOfAttributes = myFamily->getNumberOfAttributes() ;
47 cout << " - Attributes ("<<NumberOfAttributes<<") :"<<endl;
48 for (int j=1;j<NumberOfAttributes+1;j++)
49 cout << " * "<<myFamily->getAttributeIdentifier(j)<<" : "<<myFamily->getAttributeValue(j)<<", "<<myFamily->getAttributeDescription(j).c_str()<<endl ;
50 int NumberOfGroups = myFamily->getNumberOfGroups() ;
51 cout << " - Groups ("<<NumberOfGroups<<") :"<<endl;
52 for (int j=1;j<NumberOfGroups+1;j++)
53 cout << " * "<<myFamily->getGroupName(j).c_str()<<endl ;
56 void affiche_groupe(const GROUP * myGroup)
58 affiche_support(myGroup);
59 int NumberOfFamillies = myGroup->getNumberOfFamilies() ;
60 cout << " - Families ("<<NumberOfFamillies<<") :"<<endl;
61 for (int j=1;j<NumberOfFamillies+1;j++)
62 cout << " * "<<myGroup->getFamily(j)->getName().c_str()<<endl ;
65 int main (int argc, char ** argv) {
69 if (argc <3) { // after 3, ignored !
70 cerr << "Usage : " << argv[0]
71 << " filename meshname" << endl << endl;
75 string filename = argv[1] ;
76 string meshname = argv[2] ;
78 MESH * myMesh= new MESH() ;
79 myMesh->setName(meshname);
80 MED_MESH_RDONLY_DRIVER myMeshDriver(filename,myMesh) ;
81 myMeshDriver.setMeshName(meshname);
84 myMeshDriver.close() ;
86 const GROUP * myGroup = myMesh->getGroup(MED_NODE,1);
87 cout << "Show Group :"<<endl ;
88 affiche_groupe(myGroup);
89 GROUP * myGroup2 = new GROUP(* myGroup);
90 //delete myGroup; // no because in mesh !!
91 affiche_groupe(myGroup2);
92 GROUP * myGroup3 = new GROUP(* myGroup2);
94 affiche_groupe(myGroup3);