cout << endl ;
}
- delete mySupport;
- delete myMesh;
+ mySupport->removeReference();
+ myMesh->removeReference();
return 0 ;
}
MedFile = "pointe.med"
meshName = "maa1"
-fieldName = "fieldcelldouble"
+fieldName = "fieldcelldoublescalar"
myMesh = MESH(MED_DRIVER,MedFile,meshName)
mySupport = SUPPORT(myMesh,"Support on CELLs",MED_CELL)
-myField = FIELDDOUBLE(mySupport,MED_DRIVER,MedFile,fieldName)
+myField = FIELDDOUBLE(mySupport,MED_DRIVER,MedFile,fieldName,-1,-1)
numberOfComponents = myField.getNumberOfComponents()
" (and order number ",orderNumber,")"
numberOfValue = mySupport.getNumberOfElements(MED_ALL_ELEMENTS)
-value = myField.getValue(MED_FULL_INTERLACE)
+value = myField.getValue()
for i in range(numberOfValue):
print " * ",value[i*numberOfComponents:(i+1)*numberOfComponents]
main () {
const char * fileName = "pointe.med";
- const char * fieldName = "fieldcelldouble";
+ const char * fieldName = "fieldcelldoublescalar";
const char * meshName = "maa1";
try {
// Test creation of drivers at object Creation time
- //This test failed due to inadequate Support implementation
- // FIELD<double> myField (MED_DRIVER,fileName,fieldName);
+ FIELD<double> myField (MED_DRIVER,fileName,fieldName);
MESH myMesh (MED_DRIVER,fileName,meshName);
- MED myMed (MED_DRIVER,fileName);
// Test removal of drivers
//myField.rmDriver();
myMed.rmDriver ();
} catch (MEDEXCEPTION& ex){
- MESSAGE(ex.what()) ;
+ MESSAGE_MED(ex.what()) ;
}
}
print "Creation of MESH object"
myMesh = MESH(MED_DRIVER,medFile,meshName)
- print "Creation of MED object"
- myMed = MED(MED_DRIVER,medFile)
-
- print "Test the driver removal dor MESH"
+ print "Test the driver removal for MESH"
myMesh.rmDriver()
- print "Test the driver removal dor MED"
- myMed.rmDriver()
-
print "End of Python script"
except:
#include "MEDMEM_Field.hxx"
#include "MEDMEM_Mesh.hxx"
-#include "MEDMEM_Med.hxx"
-#include "MEDMEM_MedMedDriver.hxx"
#include "MEDMEM_MedMeshDriver.hxx"
using namespace MEDMEM ;
delete myMesh;
}
- {
- MED * myMed = new MED();
- MED_MED_RDONLY_DRIVER myRdOnlyDriver(fileName,myMed);
- myRdOnlyDriver.open();
- myRdOnlyDriver.readFileStruct();
- myRdOnlyDriver.close();
- myMed->updateSupport(); // DOIT ETRE SUPPRIMEE
- // myRdOnlyDriver.read();
- // try { myRdOnlyDriver.write(); } catch (MEDEXCEPTION& ex)
- // { MESSAGE(ex.what()); }
- //MED_MED_WRONLY_DRIVER myWrOnlyDriver(fileName3,myMed);
- //myWrOnlyDriver.open();
- //myWrOnlyDriver.write(); // Not implemented yet.
- //myWrOnlyDriver.close();
- delete myMed;
- }
} catch (MEDEXCEPTION& ex){
cout << "MAIN BLOCK EXCEPTION" << endl;
- MESSAGE(ex.what()) ;
+ MESSAGE_MED(ex.what()) ;
}
}
medFile = "pointe.med"
medFile2 = "Field&MeshGeneratedPointe.med"
-fieldName = "fieldcelldouble"
+fieldName = "fieldcelldoublescalar"
meshName = "maa1"
try:
print "there is a problem in invoking mesh drivers !!"
print "Please consult the error standart output of the python execution !!"
-try:
- myMed = MED()
- myRdOnlyDriver = MED_MED_RDONLY_DRIVER(medFile,myMed)
- myRdOnlyDriver.open()
- myRdOnlyDriver.readFileStruct()
- myRdOnlyDriver.close()
- myMed.updateSupport()
+# try:
+# myMed = MED()
+# myRdOnlyDriver = MED_MED_RDONLY_DRIVER(medFile,myMed)
+# myRdOnlyDriver.open()
+# myRdOnlyDriver.readFileStruct()
+# myRdOnlyDriver.close()
+# myMed.updateSupport()
- print "Invoking Med drivers OK"
-except :
- print "There is a problem in invoking MED drivers !!"
- print "Please consult the error standart output of the python execution !!"
+# print "Invoking Med drivers OK"
+# except :
+# print "There is a problem in invoking MED drivers !!"
+# print "Please consult the error standart output of the python execution !!"
const char * fileName = "pointe.med";
const char * fileName2 = "fieldCellDoubleOfpointe.med";
- const char * fieldName = "fieldcelldouble";
+ const char * fieldName = "fieldcelldoublescalar";
const char * meshName = "maa1";
try {
myMesh->read();
myMesh->rmDriver();
- MED * myMed = new MED();
- int myDriver4 = myMed->addDriver(MED_DRIVER, fileName);
- myMed->readFileStruct();
- myMed->rmDriver();
- delete myField;
- delete myMesh;
- delete myMed;
+ myMesh->removeReference();
+ myField->removeReference();
} catch (MEDEXCEPTION& ex){
- MESSAGE(ex.what()) ;
+ MESSAGE_MED(ex.what()) ;
}
}
medFile = "pointe.med"
medFile2 = "fieldCellDoubleOfpointe.me"
-fieldName = "fieldcelldouble"
+fieldName = "fieldcelldoublescalar"
meshName = "maa1"
try:
- myField = FIEDLDOUBLE()
+ myField = FIELDDOUBLE()
- myDriver1 = myField->addDriver(MED_DRIVER,medFile,fieldName)
+ myDriver1 = myField.addDriver(MED_DRIVER,medFile,fieldName)
myField.rmDriver()
- myDriver2 = myField->addDriver(MED_DRIVER,medFile2,fieldName)
+ myDriver2 = myField.addDriver(MED_DRIVER,medFile2,fieldName)
myField.rmDriver(myDriver2)
myMesh = MESH()
- myDriver3 = myMesh->addDriver(MED_DRIVER,medFile,meshName)
+ myDriver3 = myMesh.addDriver(MED_DRIVER,medFile,meshName)
myMesh.read()
myMesh.rmDriver()
- myMed = MED()
- myMed.readFileStruct()
- myMed.rmDriver()
-
except:
print "There is a problem somewhere !!"
print "Please consult the error standart output of the python execution !!"
const char * fileName = "pointe.med";
const char * fileName2 = "Field&MeshGeneratedPointe.med";
const char * fileName3 = "MedGeneratedPointe.med";
- const char * fieldName1 = "fieldcelldouble";
+ const char * fieldName1 = "fieldcelldoublescalar";
const char * fieldName2 = "fieldcelldoublebis";
const char * meshName1 = "maa1";
const char * meshName2 = "maa1bis";
myMesh.setName(meshName2);
myMesh.rmDriver();
- MED myMed(MED_DRIVER,fileName);
- myMed.read();
- myMed.addMesh(&myMesh);
- int myMedDriver = myMed.addDriver(MED_DRIVER,fileName3);
- myMed.write(myMedDriver);
-
// FAIRE LE TEST AVEC LES CHAMPS AUSSI !.
} catch (MEDEXCEPTION& ex){
- MESSAGE(ex.what()) ;
+ MESSAGE_MED(ex.what()) ;
}
}
// filename to save the generated MESH
string filename = "meshing.med" ;
- MESHING myMeshing ;
- myMeshing.setName("meshing") ;
+ MESHING* myMeshing = new MESHING;
+ myMeshing->setName("meshing") ;
// define coordinates
0.0, 0.0, 5.0
};
- myMeshing.setCoordinates(SpaceDimension,NumberOfNodes,Coordinates,"CARTESIAN",MED_FULL_INTERLACE);
+ myMeshing->setCoordinates(SpaceDimension,NumberOfNodes,Coordinates,"CARTESIAN",MED_FULL_INTERLACE);
string Names[3] = { "X","Y","Z" } ;
- myMeshing.setCoordinatesNames(Names);
+ myMeshing->setCoordinatesNames(Names);
string Units[3] = { "cm","cm","cm" } ;
- myMeshing.setCoordinatesUnits(Units) ;
+ myMeshing->setCoordinatesUnits(Units) ;
// define conectivities
medGeometryElement Types[NumberOfTypes] = {MED_TETRA4,MED_PYRA5,MED_HEXA8} ;
const int NumberOfElements[NumberOfTypes] = {12,2,2} ;
- myMeshing.setNumberOfTypes(NumberOfTypes,MED_CELL);
- myMeshing.setTypes(Types,MED_CELL);
- myMeshing.setNumberOfElements(NumberOfElements,MED_CELL);
+ myMeshing->setNumberOfTypes(NumberOfTypes,MED_CELL);
+ myMeshing->setTypes(Types,MED_CELL);
+ myMeshing->setNumberOfElements(NumberOfElements,MED_CELL);
const int sizeTetra = 12*4 ;
int ConnectivityTetra[sizeTetra]=
2,10,6,9
};
- myMeshing.setConnectivity(ConnectivityTetra,MED_CELL,MED_TETRA4);
+ myMeshing->setConnectivity(MED_CELL,MED_TETRA4,ConnectivityTetra);
int ConnectivityPyra[2*5]=
{
15,18,17,16,19
};
- myMeshing.setConnectivity(ConnectivityPyra,MED_CELL,MED_PYRA5);
+ myMeshing->setConnectivity(MED_CELL,MED_PYRA5,ConnectivityPyra);
int ConnectivityHexa[2*8]=
{
15,16,17,18,11,12,13,14
};
- myMeshing.setConnectivity(ConnectivityHexa,MED_CELL,MED_HEXA8);
+ myMeshing->setConnectivity(MED_CELL,MED_HEXA8,ConnectivityHexa);
// face part
medGeometryElement FacesTypes[NumberOfFacesTypes] = {MED_TRIA3,MED_QUAD4} ;
const int NumberOfFacesElements[NumberOfFacesTypes] = {4,4} ;
- myMeshing.setNumberOfTypes(NumberOfFacesTypes,MED_FACE);
- myMeshing.setTypes(FacesTypes,MED_FACE);
- myMeshing.setNumberOfElements(NumberOfFacesElements,MED_FACE);
+ myMeshing->setNumberOfTypes(NumberOfFacesTypes,MED_FACE);
+ myMeshing->setTypes(FacesTypes,MED_FACE);
+ myMeshing->setNumberOfElements(NumberOfFacesElements,MED_FACE);
const int sizeTria = 3*4 ;
int ConnectivityTria[sizeTria]=
1,3,6
};
- myMeshing.setConnectivity(ConnectivityTria,MED_FACE,MED_TRIA3);
+ myMeshing->setConnectivity(MED_FACE,MED_TRIA3,ConnectivityTria);
int ConnectivityQua[4*4]=
{
12,8,9,13
};
- myMeshing.setConnectivity(ConnectivityQua,MED_FACE,MED_QUAD4);
+ myMeshing->setConnectivity(MED_FACE,MED_QUAD4,ConnectivityQua);
// edge part
// Node :
{
- GROUP myGroup ;
- myGroup.setName("SomeNodes");
- myGroup.setMesh(&myMeshing);
- myGroup.setEntity(MED_NODE);
- myGroup.setNumberOfGeometricType(1);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("SomeNodes");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_NODE);
+ myGroup->setNumberOfGeometricType(1);
medGeometryElement myTypes[1] = {MED_NONE};
- myGroup.setGeometricType(myTypes);
+ myGroup->setGeometricType(myTypes);
const int myNumberOfElements[1] = {4} ;
- myGroup.setNumberOfElements(myNumberOfElements);
+ myGroup->setNumberOfElements(myNumberOfElements);
const int index[1+1] = {1,5} ;
const int value[4]= { 1,4,5,7} ;
- myGroup.setNumber(index,value);
+ myGroup->setNumber(index,value);
- myMeshing.addGroup(myGroup);
+ myMeshing->addGroup(*myGroup);
+ myGroup->removeReference();
}
{
- GROUP myGroup ;
- myGroup.setName("OtherNodes");
- myGroup.setMesh(&myMeshing);
- myGroup.setEntity(MED_NODE);
- myGroup.setNumberOfGeometricType(1);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("OtherNodes");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_NODE);
+ myGroup->setNumberOfGeometricType(1);
medGeometryElement myTypes[1] = {MED_NONE};
- myGroup.setGeometricType(myTypes);
+ myGroup->setGeometricType(myTypes);
const int myNumberOfElements[1] = {3} ;
- myGroup.setNumberOfElements(myNumberOfElements);
+ myGroup->setNumberOfElements(myNumberOfElements);
const int index[1+1] = {1,4} ;
const int value[3]= { 2,3,6} ;
- myGroup.setNumber(index,value);
+ myGroup->setNumber(index,value);
- myMeshing.addGroup(myGroup);
+ myMeshing->addGroup(*myGroup);
+ myGroup->removeReference();
}
// Cell :
{
- GROUP myGroup ;
- myGroup.setName("SomeCells");
- myGroup.setMesh(&myMeshing);
- myGroup.setEntity(MED_CELL);
- myGroup.setNumberOfGeometricType(3);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("SomeCells");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_CELL);
+ myGroup->setNumberOfGeometricType(3);
medGeometryElement myTypes[3] = {MED_TETRA4,MED_PYRA5,MED_HEXA8};
- myGroup.setGeometricType(myTypes);
+ myGroup->setGeometricType(myTypes);
const int myNumberOfElements[3] = {4,1,2} ;
- myGroup.setNumberOfElements(myNumberOfElements);
+ myGroup->setNumberOfElements(myNumberOfElements);
const int index[3+1] = {1,5,6,8} ;
const int value[4+1+2]=
{
13,
15,16
};
- myGroup.setNumber(index,value);
+ myGroup->setNumber(index,value);
- myMeshing.addGroup(myGroup);
+ myMeshing->addGroup(*myGroup);
+ myGroup->removeReference();
}
{
- GROUP myGroup ;
- myGroup.setName("OtherCells");
- myGroup.setMesh(&myMeshing);
- myGroup.setEntity(MED_CELL);
- myGroup.setNumberOfGeometricType(2);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("OtherCells");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_CELL);
+ myGroup->setNumberOfGeometricType(2);
medGeometryElement myTypes[] = {MED_TETRA4,MED_PYRA5};
- myGroup.setGeometricType(myTypes);
+ myGroup->setGeometricType(myTypes);
const int myNumberOfElements[] = {4,1} ;
- myGroup.setNumberOfElements(myNumberOfElements);
+ myGroup->setNumberOfElements(myNumberOfElements);
const int index[3+1] = {1,5,6} ;
const int value[4+1]=
{
3,4,5,9,
14
};
- myGroup.setNumber(index,value);
+ myGroup->setNumber(index,value);
- myMeshing.addGroup(myGroup);
+ myMeshing->addGroup(*myGroup);
+ myGroup->removeReference();
}
// Face :
{
- GROUP myGroup ;
- myGroup.setName("SomeFaces");
- myGroup.setMesh(&myMeshing);
- myGroup.setEntity(MED_FACE);
- myGroup.setNumberOfGeometricType(2);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("SomeFaces");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_FACE);
+ myGroup->setNumberOfGeometricType(2);
medGeometryElement myTypes[2] = {MED_TRIA3,MED_QUAD4};
- myGroup.setGeometricType(myTypes);
+ myGroup->setGeometricType(myTypes);
const int myNumberOfElements[2] = {2,3} ;
- myGroup.setNumberOfElements(myNumberOfElements);
+ myGroup->setNumberOfElements(myNumberOfElements);
const int index[2+1] = {1,3,6} ;
const int value[2+3]=
{
2,4,
5,6,8
} ;
- myGroup.setNumber(index,value);
+ myGroup->setNumber(index,value);
- myMeshing.addGroup(myGroup);
+ myMeshing->addGroup(*myGroup);
+ myGroup->removeReference();
}
{
- GROUP myGroup ;
- myGroup.setName("OtherFaces");
- myGroup.setMesh(&myMeshing);
- myGroup.setEntity(MED_FACE);
- myGroup.setNumberOfGeometricType(1);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("OtherFaces");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_FACE);
+ myGroup->setNumberOfGeometricType(1);
medGeometryElement myTypes[1] = {MED_TRIA3};
- myGroup.setGeometricType(myTypes);
+ myGroup->setGeometricType(myTypes);
const int myNumberOfElements[1] = {2} ;
- myGroup.setNumberOfElements(myNumberOfElements);
+ myGroup->setNumberOfElements(myNumberOfElements);
const int index[1+1] = {1,3} ;
const int value[2]=
{
1,3
} ;
- myGroup.setNumber(index,value);
+ myGroup->setNumber(index,value);
- myMeshing.addGroup(myGroup);
+ myMeshing->addGroup(*myGroup);
+ myGroup->removeReference();
}
// all rigtht, we save it !
- int id = myMeshing.addDriver(MED_DRIVER,filename,myMeshing.getName());
- myMeshing.write(id) ;
-
+ int id = myMeshing->addDriver(MED_DRIVER,filename,myMeshing->getName());
+ myMeshing->write(id) ;
+ myMeshing->removeReference();
}
numberOfNodes = 19
-coordinates = []
-
-coordinate = [0.0, 0.0, 0.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [0.0, 0.0, 1.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [2.0, 0.0, 1.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [0.0, 2.0, 1.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [-2.0, 0.0, 1.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [0.0, -2.0, 1.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [1.0, 1.0, 2.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [-1.0, 1.0, 2.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [-1.0, -1.0, 2.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [1.0, -1.0, 2.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [1.0, 1.0, 3.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [-1.0, 1.0, 3.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [-1.0, -1.0, 3.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [1.0, -1.0, 3.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [1.0, 1.0, 4.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [-1.0, 1.0, 4.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [-1.0, -1.0, 4.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [1.0, -1.0, 4.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [0.0, 0.0, 5.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
+coordinates = [
+ 0.0, 0.0, 0.0 ,
+ 0.0, 0.0, 1.0 ,
+ 2.0, 0.0, 1.0 ,
+ 0.0, 2.0, 1.0 ,
+ -2.0, 0.0, 1.0 ,
+ 0.0, -2.0, 1.0 ,
+ 1.0, 1.0, 2.0 ,
+ -1.0, 1.0, 2.0 ,
+ -1.0, -1.0, 2.0,
+ 1.0, -1.0, 2.0 ,
+ 1.0, 1.0, 3.0 ,
+ -1.0, 1.0, 3.0 ,
+ -1.0, -1.0, 3.0,
+ 1.0, -1.0, 3.0 ,
+ 1.0, 1.0, 4.0 ,
+ -1.0, 1.0, 4.0 ,
+ -1.0, -1.0, 4.0,
+ 1.0, -1.0, 4.0 ,
+ 0.0, 0.0, 5.0]
myMeshing.setCoordinates(spaceDimension,numberOfNodes,coordinates,"CARTESIAN",MED_FULL_INTERLACE)
myMeshing.setTypes(types,entity)
myMeshing.setNumberOfElements(numberOfElements,entity)
-connectivityTetra = []
-
-connectivity = [1,2,3,6]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [1,2,4,3]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [1,2,5,4]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [1,2,6,5]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,7,4,3]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,8,5,4]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,9,6,5]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,10,3,6]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,7,3,10]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,8,4,7]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,9,5,8]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,10,6,9]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-
-myMeshing.setConnectivity(connectivityTetra,entity,types[0])
-
-connectivityPyra = []
-connectivity = [7,8,9,10,2]
-connectivityPyra.append(connectivity[0])
-connectivityPyra.append(connectivity[1])
-connectivityPyra.append(connectivity[2])
-connectivityPyra.append(connectivity[3])
-connectivityPyra.append(connectivity[4])
-connectivity = [15,18,17,16,19]
-connectivityPyra.append(connectivity[0])
-connectivityPyra.append(connectivity[1])
-connectivityPyra.append(connectivity[2])
-connectivityPyra.append(connectivity[3])
-connectivityPyra.append(connectivity[4])
-
-myMeshing.setConnectivity(connectivityPyra,entity,types[1])
-
-connectivityHexa = []
-connectivity = [11,12,13,14,7,8,9,10]
-connectivityHexa.append(connectivity[0])
-connectivityHexa.append(connectivity[1])
-connectivityHexa.append(connectivity[2])
-connectivityHexa.append(connectivity[3])
-connectivityHexa.append(connectivity[4])
-connectivityHexa.append(connectivity[5])
-connectivityHexa.append(connectivity[6])
-connectivityHexa.append(connectivity[7])
-connectivity = [15,16,17,18,11,12,13,14]
-connectivityHexa.append(connectivity[0])
-connectivityHexa.append(connectivity[1])
-connectivityHexa.append(connectivity[2])
-connectivityHexa.append(connectivity[3])
-connectivityHexa.append(connectivity[4])
-connectivityHexa.append(connectivity[5])
-connectivityHexa.append(connectivity[6])
-connectivityHexa.append(connectivity[7])
-
-myMeshing.setConnectivity(connectivityHexa,entity,types[2])
+connectivityTetra = [
+ 1,2,3,6 ,
+ 1,2,4,3 ,
+ 1,2,5,4 ,
+ 1,2,6,5 ,
+ 2,7,4,3 ,
+ 2,8,5,4 ,
+ 2,9,6,5 ,
+ 2,10,3,6,
+ 2,7,3,10,
+ 2,8,4,7 ,
+ 2,9,5,8 ,
+ 2,10,6,9]
+
+myMeshing.setConnectivity(entity,types[0],connectivityTetra)
+
+connectivityPyra = [
+ 7,8,9,10,2,
+ 15,18,17,16,19]
+
+myMeshing.setConnectivity(entity,types[1],connectivityPyra)
+
+connectivityHexa = [
+ 11,12,13,14,7,8,9,10,
+ 15,16,17,18,11,12,13,14]
+
+myMeshing.setConnectivity(entity,types[2],connectivityPyra)
# face part
myMeshing.setTypes(types,entity)
myMeshing.setNumberOfElements(numberOfElements,entity)
-connectivityTria = []
-connectivity = [1,4,3]
-connectivityTria.append(connectivity[0])
-connectivityTria.append(connectivity[1])
-connectivityTria.append(connectivity[2])
-connectivity = [1,5,4]
-connectivityTria.append(connectivity[0])
-connectivityTria.append(connectivity[1])
-connectivityTria.append(connectivity[2])
-connectivity = [1,6,5]
-connectivityTria.append(connectivity[0])
-connectivityTria.append(connectivity[1])
-connectivityTria.append(connectivity[2])
-connectivity = [1,3,6]
-connectivityTria.append(connectivity[0])
-connectivityTria.append(connectivity[1])
-connectivityTria.append(connectivity[2])
-
-myMeshing.setConnectivity(connectivityTria,entity,types[0])
-
-connectivityQuad = []
-connectivity = [7,8,9,10]
-connectivityQuad.append(connectivity[0])
-connectivityQuad.append(connectivity[1])
-connectivityQuad.append(connectivity[2])
-connectivityQuad.append(connectivity[3])
-connectivity = [11,12,13,14]
-connectivityQuad.append(connectivity[0])
-connectivityQuad.append(connectivity[1])
-connectivityQuad.append(connectivity[2])
-connectivityQuad.append(connectivity[3])
-connectivity = [11,7,8,12]
-connectivityQuad.append(connectivity[0])
-connectivityQuad.append(connectivity[1])
-connectivityQuad.append(connectivity[2])
-connectivityQuad.append(connectivity[3])
-connectivity = [12,8,9,13]
-connectivityQuad.append(connectivity[0])
-connectivityQuad.append(connectivity[1])
-connectivityQuad.append(connectivity[2])
-connectivityQuad.append(connectivity[3])
-
-myMeshing.setConnectivity(connectivityQuad,entity,types[1])
-
-meshDimension = spaceDimension # because there 3D cells in the mesh
-myMeshing.setMeshDimension(meshDimension)
+connectivityTria = [
+ 1,4,3,
+ 1,5,4,
+ 1,6,5,
+ 1,3,6]
+
+myMeshing.setConnectivity(entity,types[0],connectivityPyra)
+
+connectivityQuad = [
+ 7,8,9,10 ,
+ 11,12,13,14,
+ 11,7,8,12 ,
+ 12,8,9,13]
+
+myMeshing.setConnectivity(entity,types[1],connectivityQuad)
# edge part
myMeshing.addGroup(myGroup)
-# saving of the generated mesh in MED 2.1, 2.2 and VTK format
+# saving of the generated mesh in MED and VTK format
-medFileVersion = getMedFileVersionForWriting()
-print "Med File Version For Writing ",medFileVersion
+myMeshing.write(MED_DRIVER,med22FileName)
-if (medFileVersion == V22):
- setMedFileVersionForWriting(V21)
-
-idMedV21 = myMeshing.addDriver(MED_DRIVER,med21FileName,myMeshing.getName())
-myMeshing.write(idMedV21)
-
-medFileVersion = getMedFileVersionForWriting()
-if (medFileVersion == V21):
- setMedFileVersionForWriting(V22)
-
-idMedV22 = myMeshing.addDriver(MED_DRIVER,med22FileName,myMeshing.getName())
-myMeshing.write(idMedV22)
-
-idVtk = myMeshing.addDriver(VTK_DRIVER,vtkFileName,myMeshing.getName())
-myMeshing.write(idVtk)
+myMeshing.write(VTK_DRIVER,vtkFileName)
# we build now 8 fields : 4 fields double (integer) :
# 2 fields on nodes (cells) :
fieldIntVectorOnCells.setValueIJ(i+1,2,valueInt2)
fieldIntVectorOnCells.setValueIJ(i+1,3,valueInt3)
-medFileVersion = getMedFileVersionForWriting()
-print "Med File Version For Writing ",medFileVersion
-
-if (medFileVersion == V22):
- setMedFileVersionForWriting(V21)
-
-idMedV21 = fieldDoubleScalarOnNodes.addDriver(MED_DRIVER,med21FileName,fieldDoubleScalarOnNodes.getName())
-fieldDoubleScalarOnNodes.write(idMedV21)
-
-idMedV21 = fieldIntScalarOnNodes.addDriver(MED_DRIVER,med21FileName,fieldIntScalarOnNodes.getName())
-fieldIntScalarOnNodes.write(idMedV21)
-
-idMedV21 = fieldDoubleVectorOnNodes.addDriver(MED_DRIVER,med21FileName,fieldDoubleVectorOnNodes.getName())
-fieldDoubleVectorOnNodes.write(idMedV21)
-
-idMedV21 = fieldIntVectorOnNodes.addDriver(MED_DRIVER,med21FileName,fieldIntVectorOnNodes.getName())
-fieldIntVectorOnNodes.write(idMedV21)
-
-idMedV21 = fieldDoubleScalarOnCells.addDriver(MED_DRIVER,med21FileName,fieldDoubleScalarOnCells.getName())
-fieldDoubleScalarOnCells.write(idMedV21)
-
-idMedV21 = fieldIntScalarOnCells.addDriver(MED_DRIVER,med21FileName,fieldIntScalarOnCells.getName())
-fieldIntScalarOnCells.write(idMedV21)
-
-idMedV21 = fieldDoubleVectorOnCells.addDriver(MED_DRIVER,med21FileName,fieldDoubleVectorOnCells.getName())
-fieldDoubleVectorOnCells.write(idMedV21)
-
-idMedV21 = fieldIntVectorOnCells.addDriver(MED_DRIVER,med21FileName,fieldIntVectorOnCells.getName())
-fieldIntVectorOnCells.write(idMedV21)
-
-medFileVersion = getMedFileVersionForWriting()
-if (medFileVersion == V21):
- setMedFileVersionForWriting(V22)
-
-idMedV22 = fieldDoubleScalarOnNodes.addDriver(MED_DRIVER,med22FileName,fieldDoubleScalarOnNodes.getName())
-fieldDoubleScalarOnNodes.write(idMedV22)
-
-idMedV22 = fieldIntScalarOnNodes.addDriver(MED_DRIVER,med22FileName,fieldIntScalarOnNodes.getName())
-fieldIntScalarOnNodes.write(idMedV22)
-
-idMedV22 = fieldDoubleVectorOnNodes.addDriver(MED_DRIVER,med22FileName,fieldDoubleVectorOnNodes.getName())
-fieldDoubleVectorOnNodes.write(idMedV22)
-
-idMedV22 = fieldIntVectorOnNodes.addDriver(MED_DRIVER,med22FileName,fieldIntVectorOnNodes.getName())
-fieldIntVectorOnNodes.write(idMedV22)
-
-idMedV22 = fieldDoubleScalarOnCells.addDriver(MED_DRIVER,med22FileName,fieldDoubleScalarOnCells.getName())
-fieldDoubleScalarOnCells.write(idMedV22)
-
-idMedV22 = fieldIntScalarOnCells.addDriver(MED_DRIVER,med22FileName,fieldIntScalarOnCells.getName())
-fieldIntScalarOnCells.write(idMedV22)
-
-idMedV22 = fieldDoubleVectorOnCells.addDriver(MED_DRIVER,med22FileName,fieldDoubleVectorOnCells.getName())
-fieldDoubleVectorOnCells.write(idMedV22)
+fieldIntScalarOnNodes.write(MED_DRIVER,med21FileName)
+fieldDoubleVectorOnNodes.write(MED_DRIVER,med21FileName)
+fieldIntVectorOnNodes.write(MED_DRIVER,med21FileName)
+fieldDoubleScalarOnCells.write(MED_DRIVER,med21FileName)
+fieldIntScalarOnCells.write(MED_DRIVER,med21FileName)
+fieldDoubleVectorOnCells.write(MED_DRIVER,med21FileName)
+fieldIntVectorOnCells.addDriver(MED_DRIVER,med21FileName)
-idMedV22 = fieldIntVectorOnCells.addDriver(MED_DRIVER,med22FileName,fieldIntVectorOnCells.getName())
-fieldIntVectorOnCells.write(idMedV22)
idVtk = fieldDoubleScalarOnNodes.addDriver(VTK_DRIVER,vtkFileName,fieldDoubleScalarOnNodes.getName())
fieldDoubleScalarOnNodes.writeAppend(idVtk)
using namespace MEDMEM ;
using namespace MED_EN ;
-int main (int argc, char ** argv) {
-
-// const string MedFile = "polyedres.med" ;
-// const string MeshName = "Erreur orientation" ;
-// const string MedFile = "polygones.med" ;
-// const string MeshName = "Bord" ;
+int main (int argc, char ** argv)
+{
+ // const string MedFile = "polyedres.med" ;
+ // const string MeshName = "Erreur orientation" ;
+ // const string MedFile = "polygones.med" ;
+ // const string MeshName = "Bord" ;
const string MedFile = "pointe.med" ;
const string MeshName = "maa1" ;
MESH myMesh(MED_DRIVER,MedFile,MeshName) ;
- myMesh.read() ;
cout << "Mesh name : " << myMesh.getName() << endl << endl ;
int NomberOfNodesPerCell = Types[i]%100 ;
const int * Connectivity =
myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_NODAL,
- MED_CELL,
- myType);
+ MED_NODAL,
+ MED_CELL,
+ myType);
for (int j=0; j<NumberOfElements; j++){
cout << "Element "<< j+1 <<" : " ;
for (int k=0; k<NomberOfNodesPerCell; k++)
- cout << Connectivity[j*NomberOfNodesPerCell+k]<<" ";
+ cout << Connectivity[j*NomberOfNodesPerCell+k]<<" ";
cout << endl ;
}
}
int NumberOfElements = myMesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS);
const int * DescendingConnectivity =
myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_DESCENDING,
- MED_CELL,
- MED_ALL_ELEMENTS);
+ MED_DESCENDING,
+ MED_CELL,
+ MED_ALL_ELEMENTS);
const int * DescendingConnectivityIndex =
myMesh.getConnectivityIndex(MED_DESCENDING,MED_CELL);
for (int i=0; i<NumberOfElements; i++) {
NumberOfConstituents =
myMesh.getNumberOfElements(ConstituentEntity,MED_ALL_ELEMENTS);
-
+
if (MeshDimension==1) {
- MESSAGE("ERROR : MeshDimension = 1 !");
- MESSAGE("We could not see Reverse Descending Connectivity.") ;
+ MESSAGE_MED("ERROR : MeshDimension = 1 !");
+ MESSAGE_MED("We could not see Reverse Descending Connectivity.") ;
} else {
for (int i=0; i<NumberOfConstituents; i++) {
cout << Constituent << " " << i+1 << " : " ;
int IndexBegin = ReverseDescendingConnectivityIndex[i] ;
int IndexEnd = ReverseDescendingConnectivityIndex[i+1] ;
for (int j=IndexBegin;j<IndexEnd;j++)
- // Index value begin at 1 so use j-1
- cout << ReverseDescendingConnectivity[j-1] << " " ;
+ // Index value begin at 1 so use j-1
+ cout << ReverseDescendingConnectivity[j-1] << " " ;
cout << endl ;
}
}
// this example use global access with index array
const int * ConstituentConnectivity =
myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_NODAL,
- ConstituentEntity,
- MED_ALL_ELEMENTS);
+ MED_NODAL,
+ ConstituentEntity,
+ MED_ALL_ELEMENTS);
const int * ConstituentConnectivityIndex =
myMesh.getConnectivityIndex(MED_NODAL,ConstituentEntity);
for (int i=0; i<NumberOfConstituents; i++) {
cout << endl ;
}
- int nbPolygons = myMesh.getNumberOfPolygons();
- if ( nbPolygons > 0 )
- {
- cout << "Show Connectivity (Nodal) of POLYGONS:" << endl ;
- const int* Connectivity = myMesh.getPolygonsConnectivity(MED_NODAL,MED_CELL);
- const int* ConnectivityIndex = myMesh.getPolygonsConnectivityIndex(MED_NODAL,MED_CELL);
- for (int j=0; j<nbPolygons; j++){
- cout << "Polygon "<< j+1 <<" : " ;
- int IndexBegin = ConnectivityIndex[j];
- int IndexEnd = ConnectivityIndex[j+1];
- for (int k=IndexBegin; k<IndexEnd; k++)
- cout << Connectivity[k-1]<<" ";
- cout << endl ;
- }
- }
-
- int nbPolyhedrons = myMesh.getNumberOfPolyhedron();
- if ( nbPolyhedrons > 0 )
- {
- cout << "Show Connectivity (Nodal) of POLYHEDRONS:" << endl ;
- const int* Connectivity = myMesh.getPolyhedronConnectivity(MED_NODAL);
- const int* FaceIndex = myMesh.getPolyhedronFacesIndex();
- const int* Index = myMesh.getPolyhedronIndex(MED_NODAL);
- for (int j=0; j<nbPolyhedrons; j++){
- cout << "Polyhedron "<< j+1 <<" : " << endl;
- int FaceIndexBegin = Index[j];
- int FaceIndexEnd = Index[j+1];
- for (int k=FaceIndexBegin; k<FaceIndexEnd; k++) {
- cout << " Face " << k - FaceIndexBegin + 1 << " : ";
- int IndexBegin = FaceIndex[k-1];
- int IndexEnd = FaceIndex[k];
- for (int i=IndexBegin; i<IndexEnd; i++)
- cout << Connectivity[i-1]<<" ";
- cout << endl ;
- }
- }
- }
-
return 0 ;
}
pass
pass
-nbPolygons = myMesh.getNumberOfPolygons()
-if nbPolygons > 0 :
- print ""
- print " Show Connectivity (Nodal) of POLYGONS:"
- print ""
- connectivity = myMesh.getPolygonsConnectivity(MED_NODAL,MED_CELL)
- index = myMesh.getPolygonsConnectivityIndex(MED_NODAL,MED_CELL)
- for j in range(nbPolygons):
- print " Polygon",(j+1)," ",connectivity[ index[j]-1 : index[j+1]-1 ]
- pass
- pass
-
-nbPolyhedrons = myMesh.getNumberOfPolyhedron()
-if nbPolyhedrons > 0 :
- print ""
- print " Show Connectivity (Nodal) of POLYHEDRONS:"
- print ""
- connectivity = myMesh.getPolyhedronConnectivity(MED_NODAL)
- fIndex = myMesh.getPolyhedronFacesIndex()
- index = myMesh.getPolyhedronIndex(MED_NODAL)
- for j in range(nbPolyhedrons):
- print " Polyhedra",(j+1)
- iF1, iF2 = index[ j ]-1, index[ j+1 ]-1
- for f in range( iF2 - iF1 ):
- iN1, iN2 = fIndex[ iF1+f ]-1, fIndex[ iF1+f+1 ]-1
- print " Face",f+1," ",connectivity[ iN1 : iN2 ]
- pass
- pass
- pass
string Name = myMesh.getName() ;
if (Name != MeshName) {
cout << "Error when reading mesh name : We ask for mesh #"
- << MeshName <<"# and we get mesh #"<< Name <<"#"<< endl << endl ;
+ << MeshName <<"# and we get mesh #"<< Name <<"#"<< endl << endl ;
return -1;
}