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(MESH *myMesh,medEntityMesh Entity)
58 int NumberOfGroups = myMesh->getNumberOfGroups(Entity) ;
59 cout << "NumberOfGroups : "<<NumberOfGroups<<endl;
60 for (int i=1; i<NumberOfGroups+1;i++) {
61 const GROUP* myGroup = myMesh->getGroup(Entity,i);
62 affiche_support(myGroup);
63 int NumberOfFamillies = myGroup->getNumberOfFamilies() ;
64 cout << " - Families ("<<NumberOfFamillies<<") :"<<endl;
65 for (int j=1;j<NumberOfFamillies+1;j++)
66 cout << " * "<<myGroup->getFamily(j)->getName().c_str()<<endl ;
70 int main (int argc, char ** argv) {
74 if (argc <3) { // after 3, ignored !
75 cerr << "Usage : " << argv[0]
76 << " filename meshname" << endl << endl;
80 string filename = argv[1] ;
81 string meshname = argv[2] ;
83 MESH * myMesh= new MESH() ;
84 myMesh->setName(meshname);
85 MED_MESH_RDONLY_DRIVER myMeshDriver(filename,myMesh) ;
86 myMeshDriver.setMeshName(meshname);
89 myMeshDriver.close() ;
91 const FAMILY * myFamily = myMesh->getFamily(MED_NODE,1);
92 //On renseigne les attributs spécifiques à FAMILY (p/r à SUPPORT) et non renseignés lors de la lecture du maillage
93 // int NumberOfAttribute = 3;
94 // int *AttributeIdentifier = new int[NumberOfAttribute];
95 // int *AttributeValue = new int[NumberOfAttribute];
96 // string *AttributeDescription = new string[NumberOfAttribute];
98 // for (int i=0;i<NumberOfAttribute;i++)
100 // AttributeIdentifier[i]=i+1;
101 // AttributeValue[i]=(i+1)*10;
102 // sprintf(tmp,"Attribut N° %d",i+1);
103 // AttributeDescription[i]=tmp;
106 // myFamily->setNumberOfAttributes(NumberOfAttribute);
107 // myFamily->setAttributesIdentifiers (AttributeIdentifier);
108 // myFamily->setAttributesValues (AttributeValue);
109 // myFamily->setAttributesDescriptions (AttributeDescription);
111 cout << "Show Family :"<<endl ;
112 affiche_famille(myFamily);
113 FAMILY * myFamily2 = new FAMILY(* myFamily);
115 cout << "Show Family2 :"<<endl ;
116 affiche_famille(myFamily2);
117 FAMILY * myFamily3 = new FAMILY(* myFamily2);
119 cout << "Show Family3 :"<<endl ;
120 affiche_famille(myFamily3);
123 cout << "That's all"<<endl ;
126 cout << "Show Group :"<<endl ;
127 affiche_groupe(myMesh,MED_NODE);
128 affiche_groupe(myMesh,MED_CELL);
129 affiche_groupe(myMesh,MED_FACE);
130 affiche_groupe(myMesh,MED_EDGE);