// How many Value :
int NumberOfValue = mySupport->getNumberOfElements(MED_ALL_ELEMENTS);
// Value
- const double * Value = myField.getValue(MED_FULL_INTERLACE);
+ const double * Value = myField.getValue();
for(int i=0; i<NumberOfValue; i++) {
for(int j=0; j<NumberOfCompoennts; j++)
cout << Value[i*NumberOfCompoennts+j] << " " ;
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}
\fileCxx{MESHconnectivities.cxx}
\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 ;
+mode for each geometric type (use \method{setPolygonsConnectivity} and
+\method{setPolyhedraConnectivity} for poly elements);
\end{itemize}
\textbf{C++ Example~:}
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) ;
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 ;
}
MedFile = "pointe.med"
#MedFile = "carre_quad4_3.med"
+#MedFile = "polyedres.med"
+#MedFile = "polygones.med"
meshName = "maa1"
#meshName = "CARRE_EN_QUAD4"
+#meshName = "Erreur orientation"
+#meshName = "Bord"
myMesh = MESH(MED_DRIVER,MedFile,meshName)
myMesh.read()
print constituent," : ",(i+1)," : ",constituentConnectivity[
(indexBegin-1):(indexEnd-1)]
+ 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