/* read MESH */
MESH * myMesh = new MESH(MED_DRIVER,MedFile,MeshName) ;
- // myMesh->read() ;
// we need a support :
SUPPORT * mySupport = new SUPPORT(myMesh,"Support on all CELLs",MED_CELL);
myField.setTime(Time) ;
// Value :
- int NumberOfValue = mySupport->getNumberOfElements(MED_ALL_ELEMENTS);
+ int NumberOfValue = mySupport->getNumberOfElements(MEDMEM_ALL_ELEMENTS);
for(int i=1; i<=NumberOfValue; i++) // i^th element
for (int j=1; j<=NumberOfCompoennts; j++) { // j^th component
double myValue = (i+j) * 0.1 ;
}
// save this new field
- int id = myField.addDriver(MED_DRIVER) ;
+ myField.write(MED_DRIVER,filename) ;
return 0 ;
}
myMesh = MESH(MED_DRIVER,MedFile,meshName)
-mySupport = myMesh.getSupportOnAll(MED_CELL)
+mySupport = SUPPORT(myMesh,"Support on all CELLs",MED_CELL)
numberOfComponents = 3
myField = FIELDDOUBLE(mySupport,numberOfComponents)
time = 3.435678
myField.setTime(time)
-numberOfValue = mySupport.getNumberOfElements(MED_ALL_ELEMENTS)
+numberOfValue = mySupport.getNumberOfElements(MEDMEM_ALL_ELEMENTS)
for i in range(numberOfValue):
ip1 = i+1
" (and order number " << OrderNumber << ")" << endl ;
// How many Value :
- int NumberOfValue = mySupport->getNumberOfElements(MED_ALL_ELEMENTS);
+ int NumberOfValue = mySupport->getNumberOfElements(MEDMEM_ALL_ELEMENTS);
// Value
const double * Value = myField.getValue();
for(int i=0; i<NumberOfValue; i++) {
cout << endl ;
}
- delete mySupport;
- delete myMesh;
+ mySupport->removeReference();
+ myMesh->removeReference();
return 0 ;
}
myMesh = MESH(MED_DRIVER,MedFile,meshName)
-mySupport = myMesh.getSupportOnAll(MED_CELL)
+mySupport = SUPPORT(myMesh,"Support on CELLs",MED_CELL)
myField = FIELDDOUBLE(mySupport,MED_DRIVER,MedFile,fieldName,-1,-1)
print "Iteration ",iterationNumber," at time ",time,\
" (and order number ",orderNumber,")"
-numberOfValue = mySupport.getNumberOfElements(MED_ALL_ELEMENTS)
+numberOfValue = mySupport.getNumberOfElements(MEDMEM_ALL_ELEMENTS)
value = myField.getValue()
for i in range(numberOfValue):
\cite{RefManualMedMemory}). The entries of the enum are quite
self-explanatory~:
\begin{itemize}
-\item \verb+MED_NONE+
-\item \verb+MED_POINT1+
-\item \verb+MED_SEG2+
-\item \verb+MED_SEG3+
-\item \verb+MED_TRIA3+
-\item \verb+MED_QUAD4+
-\item \verb+MED_TRIA6+
-\item \verb+MED_QUAD8+
-\item \verb+MED_TETRA4+
-\item \verb+MED_PYRA5+
-\item \verb+MED_PENTA6+
-\item \verb+MED_HEXA8+
-\item \verb+MED_TETRA10+
-\item \verb+MED_PYRA13+
-\item \verb+MED_PENTA15+
-\item \verb+MED_HEXA20+
-\item \verb+MED_POLYGON+
-\item \verb+MED_POLYHEDRA+
-\item \verb+MED_ALL_ELEMENTS+
+\item \verb+MEDMEM_NONE+
+\item \verb+MEDMEM_POINT1+
+\item \verb+MEDMEM_SEG2+
+\item \verb+MEDMEM_SEG3+
+\item \verb+MEDMEM_TRIA3+
+\item \verb+MEDMEM_QUAD4+
+\item \verb+MEDMEM_TRIA6+
+\item \verb+MEDMEM_QUAD8+
+\item \verb+MEDMEM_TETRA4+
+\item \verb+MEDMEM_PYRA5+
+\item \verb+MEDMEM_PENTA6+
+\item \verb+MEDMEM_HEXA8+
+\item \verb+MEDMEM_TETRA10+
+\item \verb+MEDMEM_PYRA13+
+\item \verb+MEDMEM_PENTA15+
+\item \verb+MEDMEM_HEXA20+
+\item \verb+MEDMEM_POLYGON+
+\item \verb+MEDMEM_POLYHEDRA+
+\item \verb+MEDMEM_ALL_ELEMENTS+
\end{itemize}
\item
an enum which contains the different mesh entities, \verb+medEntityMesh+, the
\textbf{C++ Example~:}
-\verb+int NumberOfTriangle = myMesh.getNumberOfElements(MED_FACE,MED_TRIA3);+
+\verb+int NumberOfTriangle = myMesh.getNumberOfElements(MED_FACE,MEDMEM_TRIA3);+
\verb+int NumberOfFace = myMesh.getNumberOfElements(MED_FACE,MED_ALL_ELEMENT);+
\textbf{C++ Example~:}
\begin{verbatim}
-int NumberOfTetrahedron = myMesh.getNumberOfElements(MED_CELL,MED_TETRA4);
+int NumberOfTetrahedron = myMesh.getNumberOfElements(MED_CELL,MEDMEM_TETRA4);
const int * TetrahedronConnectivity =
myMesh.getConnectivity(MED_FULL_ENTERLACE,
MED_NODAL,
MED_CELL,
- MED_TETRA4);
+ MEDMEM_TETRA4);
\end{verbatim}
\verb+TetrahedronConnectivity+ contain nodal connectivity
of tetrahedron in mesh. It is arranged in full enterlace mode and
its size is \verb+NumberOfTetrahedron x 4+.
-If you want to get connectivity of all elements (with \verb+Type=MED_ALL_ELEMENTS+),
+If you want to get connectivity of all elements (with \verb+Type=MEDMEM_ALL_ELEMENTS+),
you must use the index array (return by \method{getConnectivityIndex})
to get connectivity for each elements (see example \myref{MESHconnectivities.cxx}).
myElementConnectivity);
\end{verbatim}
-%%%%%%%%%%% WITH POLY METHODS %%%%%%%%%%%%
-
-\item The listed above methods do not take into account information about
- \verb+polygonal+ and \verb+polyhedral+ cells contained in a MESH object. To get
- full information about cell types, use the same methods with
- \verb+WithPoly+ postfix:
-\begin{itemize}
-\item use \method{getNumberOfTypesWithPoly} to get the number of
- geometric types for a mesh entity;
-\item use \method{getTypesWithPoly} to get all geometric types for a mesh entity;
-\item use \method{getNumberOfElementsWithPoly} to get the number of cells;
-\item use \method{getElementTypeWithPoly} to get the geometric type of
- one element.
-\end{itemize}
-There are separate methods to get number of polygons and polyhedrons:
-\method{getNumberOfPolygons} and \method{getNumberOfPolyhedron}
-
-To get connectivity of polygonal elements, use \method{getPolygonsConnectivity} along with
-\method{getPolygonsConnectivityIndex} (see example \myref{MESHconnectivities.cxx}).
-
-To get nodal connectivity of polyhedral elements, it is necessary use together
-3 methods: \method{getPolyhedronConnectivity}, \method{getPolyhedronFacesIndex}
-and \method{getPolyhedronIndex} (see example \myref{MESHconnectivities.cxx}).
-
\end{enumerate}
Here is a small C++ example program which the Python version may be found in
\item \method{setNumberOfElements} to set the number of elements for
each geometric type. This method allocates connectivities array ;
\item \method{setConnectivity} to set the connectivity in MED\_FULL\_INTERLACE
-mode for each geometric type (use \method{setPolygonsConnectivity} and
-\method{setPolyhedraConnectivity} for poly elements);
+mode for each geometric type;
\end{itemize}
\textbf{C++ Example~:}
myMeshing.setCoordinates(SpaceDimension,NumberOfNodes,Coordinates,System,Mode);
myMeshing.setNumberOfTypes(2,MED_CELL);
-myMeshing.setTypes({MED_TRIA3,MED_QUAD4},MED_CELL);
-myMeshing.setNumberOfElements({3,2},MED_CELL); // 3 MED_TRIA3 and 2 MED_QUAD4
-myMeshing.setConnectivity({1,2,3,6,8,9,4,5,6},MED_CELL,MED_TRIA3);
-myMeshing.setConnectivity({1,3,4,5,4,5,7,8},MED_CELL,MED_QUAD4);
+myMeshing.setTypes({MEDMEM_TRIA3,MEDMEM_QUAD4},MED_CELL);
+myMeshing.setNumberOfElements({3,2},MED_CELL); // 3 MEDMEM_TRIA3 and 2 MEDMEM_QUAD4
+myMeshing.setConnectivity({1,2,3,6,8,9,4,5,6},MED_CELL,MEDMEM_TRIA3);
+myMeshing.setConnectivity({1,3,4,5,4,5,7,8},MED_CELL,MEDMEM_QUAD4);
\end{verbatim}
#include "MEDMEM_Field.hxx"
#include "MEDMEM_Mesh.hxx"
-#include "MEDMEM_Med.hxx"
using namespace MEDMEM ;
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<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();
+ myField.rmDriver();
myMesh.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:
try:
myMesh = MESH()
-
myRdOnlyDriver = MED_MESH_RDONLY_DRIVER(medFile,myMesh)
myRdOnlyDriver.setMeshName(meshName)
myRdOnlyDriver.open()
myRdOnlyDriver.read()
myRdOnlyDriver.close()
- myWrOnlyDriver = MED_MESH_WRONLY_DRIVER(medFile2,myMesh)
+ myWrOnlyDriver = MED_MESH_WRONLY_DRIVER(medFile,myMesh)
myWrOnlyDriver.setMeshName(meshName)
myWrOnlyDriver.open()
myWrOnlyDriver.write()
+
myWrOnlyDriver.close()
print "Invoking mesh drivers OK"
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()
-
- 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 !!"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_Mesh.hxx"
-#include "MEDMEM_Med.hxx"
using namespace MEDMEM ;
using namespace MED_EN ;
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()) ;
}
}
from libMEDMEM_Swig import *
medFile = "pointe.med"
-medFile2 = "fieldCellDoubleOfpointe.med"
-fieldName = "fieldcelldouble"
+medFile2 = "fieldCellDoubleOfpointe.me"
+fieldName = "fieldcelldoublescalar"
meshName = "maa1"
try:
myMesh.read()
myMesh.rmDriver()
- myMed = MED(MED_DRIVER,medFile)
- myMed.readFileStruct()
- myMed.rmDriver()
-
except:
print "There is a problem somewhere !!"
print "Please consult the error standart output of the python execution !!"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_Mesh.hxx"
-#include "MEDMEM_Med.hxx"
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";
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()) ;
}
}
\latex latex
\backslash
-verb+int NumberOfTriangle = myMesh.getNumberOfElements(MED_FACE,MED_TRIA3);+
+verb+int NumberOfTriangle = myMesh.getNumberOfElements(MED_FACE,MEDMEM_TRIA3);+
\layout Standard
\backslash
begin{verbatim}
\newline
-int NumberOfTetrahedron = myMesh.getNumberOfElements(MED_CELL,MED_TETRA4);
+int NumberOfTetrahedron = myMesh.getNumberOfElements(MED_CELL,MEDMEM_TETRA4);
\newline
int * TetrahedronConnectivity =
\newline
\newline
MED_CELL,
\newline
- MED_TETRA4);
+ MEDMEM_TETRA4);
\newline
\backslash
\latex latex
\backslash
-verb+Type=MED_ALL_ELEMENTS+
+verb+Type=MEDMEM_ALL_ELEMENTS+
\latex default
), you must use the index array (return by
\latex latex
// 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
// cell part
const int NumberOfTypes = 3 ;
- medGeometryElement Types[NumberOfTypes] = {MED_TETRA4,MED_PYRA5,MED_HEXA8} ;
+ medGeometryElement Types[NumberOfTypes] = {MEDMEM_TETRA4,MEDMEM_PYRA5,MEDMEM_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,MEDMEM_TETRA4,ConnectivityTetra);
int ConnectivityPyra[2*5]=
{
15,18,17,16,19
};
- myMeshing.setConnectivity(ConnectivityPyra,MED_CELL,MED_PYRA5);
+ myMeshing->setConnectivity(MED_CELL,MEDMEM_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,MEDMEM_HEXA8,ConnectivityHexa);
// face part
const int NumberOfFacesTypes = 2 ;
- medGeometryElement FacesTypes[NumberOfFacesTypes] = {MED_TRIA3,MED_QUAD4} ;
+ medGeometryElement FacesTypes[NumberOfFacesTypes] = {MEDMEM_TRIA3,MEDMEM_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,MEDMEM_TRIA3,ConnectivityTria);
int ConnectivityQua[4*4]=
{
12,8,9,13
};
- myMeshing.setConnectivity(ConnectivityQua,MED_FACE,MED_QUAD4);
+ myMeshing->setConnectivity(MED_FACE,MEDMEM_QUAD4,ConnectivityQua);
// edge part
// Node :
{
- GROUP myGroup ;
- myGroup.setName("SomeNodes");
- myGroup.setMesh(&myMeshing);
- myGroup.setEntity(MED_NODE);
- myGroup.setNumberOfGeometricType(1);
- medGeometryElement myTypes[1] = {MED_NONE};
- myGroup.setGeometricType(myTypes);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("SomeNodes");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_NODE);
+ myGroup->setNumberOfGeometricType(1);
+ medGeometryElement myTypes[1] = {MEDMEM_NONE};
+ 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);
- medGeometryElement myTypes[1] = {MED_NONE};
- myGroup.setGeometricType(myTypes);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("OtherNodes");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_NODE);
+ myGroup->setNumberOfGeometricType(1);
+ medGeometryElement myTypes[1] = {MEDMEM_NONE};
+ 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);
- medGeometryElement myTypes[3] = {MED_TETRA4,MED_PYRA5,MED_HEXA8};
- myGroup.setGeometricType(myTypes);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("SomeCells");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_CELL);
+ myGroup->setNumberOfGeometricType(3);
+ medGeometryElement myTypes[3] = {MEDMEM_TETRA4,MEDMEM_PYRA5,MEDMEM_HEXA8};
+ 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);
- medGeometryElement myTypes[] = {MED_TETRA4,MED_PYRA5};
- myGroup.setGeometricType(myTypes);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("OtherCells");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_CELL);
+ myGroup->setNumberOfGeometricType(2);
+ medGeometryElement myTypes[] = {MEDMEM_TETRA4,MEDMEM_PYRA5};
+ 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);
- medGeometryElement myTypes[2] = {MED_TRIA3,MED_QUAD4};
- myGroup.setGeometricType(myTypes);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("SomeFaces");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_FACE);
+ myGroup->setNumberOfGeometricType(2);
+ medGeometryElement myTypes[2] = {MEDMEM_TRIA3,MEDMEM_QUAD4};
+ 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);
- medGeometryElement myTypes[1] = {MED_TRIA3};
- myGroup.setGeometricType(myTypes);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("OtherFaces");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_FACE);
+ myGroup->setNumberOfGeometricType(1);
+ medGeometryElement myTypes[1] = {MEDMEM_TRIA3};
+ 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)
types = []
numberOfElements = []
-types.append(MED_TETRA4)
+types.append(MEDMEM_TETRA4)
numberOfElements.append(12)
-types.append(MED_PYRA5)
+types.append(MEDMEM_PYRA5)
numberOfElements.append(2)
-types.append(MED_HEXA8)
+types.append(MEDMEM_HEXA8)
numberOfElements.append(2)
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
types = []
numberOfElements = []
-types.append(MED_TRIA3)
+types.append(MEDMEM_TRIA3)
numberOfElements.append(4)
-types.append(MED_QUAD4)
+types.append(MEDMEM_QUAD4)
numberOfElements.append(4)
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
myGroup.setEntity(MED_NODE)
myGroup.setNumberOfGeometricType(1)
-myTypes = [MED_NONE]
+myTypes = [MEDMEM_NONE]
myGroup.setGeometricType(myTypes)
myNumberOfElements = [4]
myGroup.setEntity(MED_NODE)
myGroup.setNumberOfGeometricType(1)
-myTypes = [MED_NONE]
+myTypes = [MEDMEM_NONE]
myGroup.setGeometricType(myTypes)
myNumberOfElements = [3]
myGroup.setEntity(MED_CELL)
myGroup.setNumberOfGeometricType(3)
-myTypes = [MED_TETRA4,MED_PYRA5,MED_HEXA8]
+myTypes = [MEDMEM_TETRA4,MEDMEM_PYRA5,MEDMEM_HEXA8]
myGroup.setGeometricType(myTypes)
myNumberOfElements = [4,1,2]
myGroup.setEntity(MED_CELL)
myGroup.setNumberOfGeometricType(2)
-myTypes = [MED_TETRA4,MED_PYRA5]
+myTypes = [MEDMEM_TETRA4,MEDMEM_PYRA5]
myGroup.setGeometricType(myTypes)
myNumberOfElements = [4,1]
myGroup.setEntity(MED_FACE)
myGroup.setNumberOfGeometricType(2)
-myTypes = [MED_TRIA3,MED_QUAD4]
+myTypes = [MEDMEM_TRIA3,MEDMEM_QUAD4]
myGroup.setGeometricType(myTypes)
myNumberOfElements = [2,3]
myGroup.setEntity(MED_FACE)
myGroup.setNumberOfGeometricType(1)
-myTypes = [MED_TRIA3]
+myTypes = [MEDMEM_TRIA3]
myGroup.setGeometricType(myTypes)
myNumberOfElements = [2]
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) :
# 1 scalar (vector)
-supportOnNodes = myMeshing.getSupportOnAll(MED_NODE)
-numberOfNodes = supportOnNodes.getNumberOfElements(MED_ALL_ELEMENTS)
+supportOnNodes = SUPPORT(myMeshing,"On_All_Nodes",MED_NODE)
+numberOfNodes = supportOnNodes.getNumberOfElements(MEDMEM_ALL_ELEMENTS)
-supportOnCells = myMeshing.getSupportOnAll(MED_CELL)
-numberOfCells = supportOnCells.getNumberOfElements(MED_ALL_ELEMENTS)
+supportOnCells = SUPPORT(myMeshing,"On_All_Cells",MED_CELL)
+numberOfCells = supportOnCells.getNumberOfElements(MEDMEM_ALL_ELEMENTS)
fieldDoubleScalarOnNodes = FIELDDOUBLE(supportOnNodes,1)
fieldDoubleScalarOnNodes.setName("fieldScalarDoubleNode")
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 ;
medGeometryElement myType = Types[i] ;
int NumberOfElements = myMesh.getNumberOfElements(MED_CELL,myType);
int NomberOfNodesPerCell = Types[i]%100 ;
- const int * Connectivity =
- myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_NODAL,
- MED_CELL,
- myType);
+ const int * Connectivity = myMesh.getConnectivity(MED_NODAL,MED_CELL,myType);
for (int j=0; j<NumberOfElements; j++){
cout << "Element "<< j+1 <<" : " ;
for (int k=0; k<NomberOfNodesPerCell; k++)
cout << "Show Connectivity (Descending) :" << endl ;
// this example use global access with index array
- int NumberOfElements = myMesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS);
+ int NumberOfElements = myMesh.getNumberOfElements(MED_CELL,MEDMEM_ALL_ELEMENTS);
const int * DescendingConnectivity =
- myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_DESCENDING,
- MED_CELL,
- MED_ALL_ELEMENTS);
+ myMesh.getConnectivity(MED_DESCENDING,MED_CELL,MEDMEM_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);
-
+ myMesh.getNumberOfElements(ConstituentEntity,MEDMEM_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
+ // Index value begin at 1 so use j-1
cout << ReverseDescendingConnectivity[j-1] << " " ;
cout << endl ;
}
cout << "Show "<< Constituent <<" Connectivity (Nodal) :" << endl ;
// this example use global access with index array
const int * ConstituentConnectivity =
- myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_NODAL,
- ConstituentEntity,
- MED_ALL_ELEMENTS);
+ myMesh.getConnectivity(MED_NODAL,ConstituentEntity,MEDMEM_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 ;
}
type = cellType.getType()
numberOfElements = myMesh.getNumberOfElements(MED_CELL,type)
numberOfNodesPerCell = cellType.getNumberOfNodes()
- connectivity = myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_NODAL,MED_CELL,type)
+ connectivity = myMesh.getConnectivity(MED_NODAL,MED_CELL,type)
print "For Type ",nameType," : "
for j in range(numberOfElements):
print "Element ",(j+1)," : ",connectivity[j*numberOfNodesPerCell:
# This example use global access with index array
-numberOfElements = myMesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS)
-descendingConnectivity = myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_DESCENDING,MED_CELL,
- MED_ALL_ELEMENTS)
-descendingConnectivityIndex = myMesh.getConnectivityIndex(MED_DESCENDING,
- MED_CELL)
+numberOfElements = myMesh.getNumberOfElements(MED_CELL,MEDMEM_ALL_ELEMENTS)
+descendingConnectivity = myMesh.getConnectivity(MED_DESCENDING,MED_CELL,MEDMEM_ALL_ELEMENTS)
+descendingConnectivityIndex = myMesh.getConnectivityIndex(MED_DESCENDING,MED_CELL)
for i in range(numberOfElements):
indexBegin = descendingConnectivityIndex[i]
constituentEntity = MED_FACE
numberOfConstituents = myMesh.getNumberOfElements(constituentEntity,
- MED_ALL_ELEMENTS)
+ MEDMEM_ALL_ELEMENTS)
reverseDescendingConnectivity = myMesh.getReverseConnectivity(
MED_DESCENDING)
reverseDescendingConnectivityIndex = myMesh.getReverseConnectivityIndex(
print "Show ",constituent," Connectivity (Nodal) :"
- constituentConnectivity = myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_NODAL,
- constituentEntity,
- MED_ALL_ELEMENTS)
- constituentConnectivityIndex = myMesh.getConnectivityIndex(MED_NODAL,
- constituentEntity)
+ constituentConnectivity = myMesh.getConnectivity(MED_NODAL,constituentEntity,MEDMEM_ALL_ELEMENTS)
+ constituentConnectivityIndex = myMesh.getConnectivityIndex(MED_NODAL,constituentEntity)
for i in range(numberOfConstituents):
indexBegin = constituentConnectivityIndex[i]
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