From fbc32d3adcfc9303e72524602ac11fbd234babf7 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 7 Sep 2010 13:25:21 +0000 Subject: [PATCH] Preparation of MEDMEM for SALOME 6x update according to module changes --- doc/MEDMEM/FIELDgeneral.cxx | 4 +- doc/MEDMEM/FIELDgeneral.py | 6 +- ...MEM_InvokingDriverAtObjectCreationTime.cxx | 8 +- ...DMEM_InvokingDriverAtObjectCreationTime.py | 8 +- ..._InvokingDriverByAttachingItToAnObject.cxx | 20 +- ...M_InvokingDriverByAttachingItToAnObject.py | 24 +- ...InvokingDriverFromStandardObjectMethod.cxx | 13 +- ..._InvokingDriverFromStandardObjectMethod.py | 14 +- .../MEDMEM_MedAddingAnExistingObject.cxx | 10 +- doc/MEDMEM/MESHINGexample.cxx | 152 +++---- doc/MEDMEM/MESHINGexample.py | 372 ++++-------------- doc/MEDMEM/MESHconnectivities.cxx | 81 +--- doc/MEDMEM/MESHconnectivities.py | 29 -- doc/MEDMEM/MESHgeneral.cxx | 2 +- 14 files changed, 206 insertions(+), 537 deletions(-) diff --git a/doc/MEDMEM/FIELDgeneral.cxx b/doc/MEDMEM/FIELDgeneral.cxx index ee63c79f0..06bf41a89 100644 --- a/doc/MEDMEM/FIELDgeneral.cxx +++ b/doc/MEDMEM/FIELDgeneral.cxx @@ -77,8 +77,8 @@ int main (int argc, char ** argv) { cout << endl ; } - delete mySupport; - delete myMesh; + mySupport->removeReference(); + myMesh->removeReference(); return 0 ; } diff --git a/doc/MEDMEM/FIELDgeneral.py b/doc/MEDMEM/FIELDgeneral.py index 1ba51b769..bb9701756 100644 --- a/doc/MEDMEM/FIELDgeneral.py +++ b/doc/MEDMEM/FIELDgeneral.py @@ -31,13 +31,13 @@ from libMEDMEM_Swig import * 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() @@ -59,7 +59,7 @@ print "Iteration ",iterationNumber," at time ",time,\ " (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] diff --git a/doc/MEDMEM/MEDMEM_InvokingDriverAtObjectCreationTime.cxx b/doc/MEDMEM/MEDMEM_InvokingDriverAtObjectCreationTime.cxx index 3ae53a608..bd8e87c26 100644 --- a/doc/MEDMEM/MEDMEM_InvokingDriverAtObjectCreationTime.cxx +++ b/doc/MEDMEM/MEDMEM_InvokingDriverAtObjectCreationTime.cxx @@ -33,17 +33,15 @@ using namespace MED_EN ; 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 myField (MED_DRIVER,fileName,fieldName); + FIELD myField (MED_DRIVER,fileName,fieldName); MESH myMesh (MED_DRIVER,fileName,meshName); - MED myMed (MED_DRIVER,fileName); // Test removal of drivers //myField.rmDriver(); @@ -51,6 +49,6 @@ main () { myMed.rmDriver (); } catch (MEDEXCEPTION& ex){ - MESSAGE(ex.what()) ; + MESSAGE_MED(ex.what()) ; } } diff --git a/doc/MEDMEM/MEDMEM_InvokingDriverAtObjectCreationTime.py b/doc/MEDMEM/MEDMEM_InvokingDriverAtObjectCreationTime.py index d6c56cb89..939395bc1 100644 --- a/doc/MEDMEM/MEDMEM_InvokingDriverAtObjectCreationTime.py +++ b/doc/MEDMEM/MEDMEM_InvokingDriverAtObjectCreationTime.py @@ -37,15 +37,9 @@ try: 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: diff --git a/doc/MEDMEM/MEDMEM_InvokingDriverByAttachingItToAnObject.cxx b/doc/MEDMEM/MEDMEM_InvokingDriverByAttachingItToAnObject.cxx index 2c3240a13..2ec038ab6 100644 --- a/doc/MEDMEM/MEDMEM_InvokingDriverByAttachingItToAnObject.cxx +++ b/doc/MEDMEM/MEDMEM_InvokingDriverByAttachingItToAnObject.cxx @@ -25,8 +25,6 @@ #include "MEDMEM_Field.hxx" #include "MEDMEM_Mesh.hxx" -#include "MEDMEM_Med.hxx" -#include "MEDMEM_MedMedDriver.hxx" #include "MEDMEM_MedMeshDriver.hxx" using namespace MEDMEM ; @@ -84,25 +82,9 @@ main () { 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()) ; } } diff --git a/doc/MEDMEM/MEDMEM_InvokingDriverByAttachingItToAnObject.py b/doc/MEDMEM/MEDMEM_InvokingDriverByAttachingItToAnObject.py index ef6ba4e50..1fa1ba07e 100644 --- a/doc/MEDMEM/MEDMEM_InvokingDriverByAttachingItToAnObject.py +++ b/doc/MEDMEM/MEDMEM_InvokingDriverByAttachingItToAnObject.py @@ -31,7 +31,7 @@ from libMEDMEM_Swig import * medFile = "pointe.med" medFile2 = "Field&MeshGeneratedPointe.med" -fieldName = "fieldcelldouble" +fieldName = "fieldcelldoublescalar" meshName = "maa1" try: @@ -71,15 +71,15 @@ except : 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 !!" diff --git a/doc/MEDMEM/MEDMEM_InvokingDriverFromStandardObjectMethod.cxx b/doc/MEDMEM/MEDMEM_InvokingDriverFromStandardObjectMethod.cxx index 01ea3d2ce..8a21f0993 100644 --- a/doc/MEDMEM/MEDMEM_InvokingDriverFromStandardObjectMethod.cxx +++ b/doc/MEDMEM/MEDMEM_InvokingDriverFromStandardObjectMethod.cxx @@ -34,7 +34,7 @@ main () { const char * fileName = "pointe.med"; const char * fileName2 = "fieldCellDoubleOfpointe.med"; - const char * fieldName = "fieldcelldouble"; + const char * fieldName = "fieldcelldoublescalar"; const char * meshName = "maa1"; try { @@ -55,16 +55,11 @@ main () { 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()) ; } } diff --git a/doc/MEDMEM/MEDMEM_InvokingDriverFromStandardObjectMethod.py b/doc/MEDMEM/MEDMEM_InvokingDriverFromStandardObjectMethod.py index f0c454e40..aafefdeee 100644 --- a/doc/MEDMEM/MEDMEM_InvokingDriverFromStandardObjectMethod.py +++ b/doc/MEDMEM/MEDMEM_InvokingDriverFromStandardObjectMethod.py @@ -31,27 +31,23 @@ from libMEDMEM_Swig import * 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 !!" diff --git a/doc/MEDMEM/MEDMEM_MedAddingAnExistingObject.cxx b/doc/MEDMEM/MEDMEM_MedAddingAnExistingObject.cxx index f3794fbe1..e74ba51b6 100644 --- a/doc/MEDMEM/MEDMEM_MedAddingAnExistingObject.cxx +++ b/doc/MEDMEM/MEDMEM_MedAddingAnExistingObject.cxx @@ -32,7 +32,7 @@ main () { 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"; @@ -45,15 +45,9 @@ main () { 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()) ; } } diff --git a/doc/MEDMEM/MESHINGexample.cxx b/doc/MEDMEM/MESHINGexample.cxx index 4a4fdc7d0..ee702fa6c 100644 --- a/doc/MEDMEM/MESHINGexample.cxx +++ b/doc/MEDMEM/MESHINGexample.cxx @@ -33,8 +33,8 @@ int main (int argc, char ** argv) { // filename to save the generated MESH string filename = "meshing.med" ; - MESHING myMeshing ; - myMeshing.setName("meshing") ; + MESHING* myMeshing = new MESHING; + myMeshing->setName("meshing") ; // define coordinates @@ -62,13 +62,13 @@ int main (int argc, char ** argv) { 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 @@ -78,9 +78,9 @@ int main (int argc, char ** argv) { 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]= @@ -99,7 +99,7 @@ int main (int argc, char ** argv) { 2,10,6,9 }; - myMeshing.setConnectivity(ConnectivityTetra,MED_CELL,MED_TETRA4); + myMeshing->setConnectivity(MED_CELL,MED_TETRA4,ConnectivityTetra); int ConnectivityPyra[2*5]= { @@ -107,7 +107,7 @@ int main (int argc, char ** argv) { 15,18,17,16,19 }; - myMeshing.setConnectivity(ConnectivityPyra,MED_CELL,MED_PYRA5); + myMeshing->setConnectivity(MED_CELL,MED_PYRA5,ConnectivityPyra); int ConnectivityHexa[2*8]= { @@ -115,7 +115,7 @@ int main (int argc, char ** argv) { 15,16,17,18,11,12,13,14 }; - myMeshing.setConnectivity(ConnectivityHexa,MED_CELL,MED_HEXA8); + myMeshing->setConnectivity(MED_CELL,MED_HEXA8,ConnectivityHexa); // face part @@ -123,9 +123,9 @@ int main (int argc, char ** argv) { 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]= @@ -136,7 +136,7 @@ int main (int argc, char ** argv) { 1,3,6 }; - myMeshing.setConnectivity(ConnectivityTria,MED_FACE,MED_TRIA3); + myMeshing->setConnectivity(MED_FACE,MED_TRIA3,ConnectivityTria); int ConnectivityQua[4*4]= { @@ -146,7 +146,7 @@ int main (int argc, char ** argv) { 12,8,9,13 }; - myMeshing.setConnectivity(ConnectivityQua,MED_FACE,MED_QUAD4); + myMeshing->setConnectivity(MED_FACE,MED_QUAD4,ConnectivityQua); // edge part @@ -156,49 +156,51 @@ int main (int argc, char ** argv) { // 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]= { @@ -206,75 +208,79 @@ int main (int argc, char ** argv) { 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(); } diff --git a/doc/MEDMEM/MESHINGexample.py b/doc/MEDMEM/MESHINGexample.py index 9b8feb761..dd18d2ff9 100644 --- a/doc/MEDMEM/MESHINGexample.py +++ b/doc/MEDMEM/MESHINGexample.py @@ -49,84 +49,26 @@ spaceDimension = 3 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) @@ -164,108 +106,33 @@ myMeshing.setNumberOfTypes(numberOfTypes,entity) 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 @@ -285,52 +152,21 @@ myMeshing.setNumberOfTypes(numberOfTypes,entity) 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 @@ -461,26 +297,11 @@ myGroup.setNumber(index,values) 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) : @@ -634,63 +455,14 @@ for i in range(numberOfCells): 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) diff --git a/doc/MEDMEM/MESHconnectivities.cxx b/doc/MEDMEM/MESHconnectivities.cxx index df05d1faf..1c56b7b77 100644 --- a/doc/MEDMEM/MESHconnectivities.cxx +++ b/doc/MEDMEM/MESHconnectivities.cxx @@ -25,16 +25,15 @@ 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 ; @@ -51,13 +50,13 @@ int main (int argc, char ** argv) { 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 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 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 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 diff --git a/doc/MEDMEM/MESHgeneral.cxx b/doc/MEDMEM/MESHgeneral.cxx index e0ff37975..9417a7988 100644 --- a/doc/MEDMEM/MESHgeneral.cxx +++ b/doc/MEDMEM/MESHgeneral.cxx @@ -36,7 +36,7 @@ int main (int argc, char ** argv) { 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; } -- 2.39.2