6 #include "MEDMEM_Exception.hxx"
7 #include "MEDMEM_Mesh.hxx"
8 #include "MEDMEM_Family.hxx"
9 #include "MEDMEM_Group.hxx"
11 #include "MEDMEM_MedMeshDriver.hxx"
12 #include "MEDMEM_MedFieldDriver.hxx"
13 #include "MEDMEM_Support.hxx"
14 #include "MEDMEM_Field.hxx"
15 #include "MEDMEM_define.hxx"
18 #include "LocalTraceCollector.hxx"
19 #endif /* ifdef _DEBUG_*/
22 using namespace MEDMEM;
23 using namespace MED_EN;
25 void affiche_support(const SUPPORT * mySupport)
27 cout << " - Name : "<<mySupport->getName().c_str()<<endl ;
28 cout << " - Description : "<<mySupport->getDescription().c_str()<<endl ;
29 cout << " - Entity : "<<mySupport->getEntity()<<endl ;
30 cout << " - Entities list : "<<endl ;
31 if (!(mySupport->isOnAllElements())) {
32 int NumberOfTypes = mySupport->getNumberOfTypes() ;
33 cout<<" - NumberOfTypes : "<<NumberOfTypes<<endl;
34 const medGeometryElement * Types = mySupport->getTypes() ;
35 for (int j=0;j<NumberOfTypes;j++) {
36 cout<<" * Type "<<Types[j]<<" : ";
37 int NumberOfElements = mySupport->getNumberOfElements(Types[j]) ;
38 const int * Number = mySupport->getNumber(Types[j]) ;
39 for (int k=0; k<NumberOfElements;k++)
40 cout << Number[k] << " ";
44 cout << " Is on all entities !"<< endl;
48 void affiche_famille(const FAMILY * myFamily)
50 affiche_support(myFamily);
51 cout << " - Identifier : "<<myFamily->getIdentifier()<<endl ;
52 int NumberOfAttributes = myFamily->getNumberOfAttributes() ;
53 cout << " - Attributes ("<<NumberOfAttributes<<") :"<<endl;
54 for (int j=1;j<NumberOfAttributes+1;j++)
55 cout << " * "<<myFamily->getAttributeIdentifier(j)<<" : "<<myFamily->getAttributeValue(j)<<", "<<myFamily->getAttributeDescription(j).c_str()<<endl ;
56 int NumberOfGroups = myFamily->getNumberOfGroups() ;
57 cout << " - Groups ("<<NumberOfGroups<<") :"<<endl;
58 for (int j=1;j<NumberOfGroups+1;j++)
59 cout << " * "<<myFamily->getGroupName(j).c_str()<<endl ;
62 void affiche_groupe(const GROUP * myGroup)
64 affiche_support(myGroup);
65 int NumberOfFamillies = myGroup->getNumberOfFamilies() ;
66 cout << " - Families ("<<NumberOfFamillies<<") :"<<endl;
67 for (int j=1;j<NumberOfFamillies+1;j++)
68 cout << " * "<<myGroup->getFamily(j)->getName().c_str()<<endl ;
71 int main (int argc, char ** argv) {
73 LocalTraceCollector::instance();
74 #endif /* ifdef _DEBUG_*/
78 if (argc <3) { // after 3, ignored !
79 cerr << "Usage : " << argv[0]
80 << " filename meshname" << endl << endl;
84 string filename = argv[1] ;
85 string meshname = argv[2] ;
87 MESH * myMesh= new MESH() ;
88 myMesh->setName(meshname);
89 MED_MESH_RDONLY_DRIVER myMeshDriver(filename,myMesh) ;
90 myMeshDriver.setMeshName(meshname);
93 myMeshDriver.close() ;
95 const GROUP * myGroup = myMesh->getGroup(MED_NODE,1);
96 cout << "Show Group :"<<endl ;
97 affiche_groupe(myGroup);
98 GROUP * myGroup2 = new GROUP(* myGroup);
99 //delete myGroup; // no because in mesh !!
100 affiche_groupe(myGroup2);
101 GROUP * myGroup3 = new GROUP(* myGroup2);
103 affiche_groupe(myGroup3);