From: nadir Date: Wed, 31 May 2006 12:20:06 +0000 (+0000) Subject: correction for docs and for some bug discovered. valid for an other beta X-Git-Tag: ForV3_2_0b2^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FBR_DEBUG_NEPTUNE;p=tools%2Fmedcoupling.git correction for docs and for some bug discovered. valid for an other beta version V3_2_0b2. --- diff --git a/doc/MEDMEM/MEDMEM_Content.tex.in b/doc/MEDMEM/MEDMEM_Content.tex.in index e0e9dd9bd..109e8bc66 100644 --- a/doc/MEDMEM/MEDMEM_Content.tex.in +++ b/doc/MEDMEM/MEDMEM_Content.tex.in @@ -52,13 +52,12 @@ of very few classes: All these are detailed in the following sections. The C++ formalism will be used for the description in these sections. - Python syntax is very similar and is given in - appendix \ref{app:python}. + Python syntax is very similar and is given in appendix \ref{sec:python}. \section{Naming conventions} -The naming conventions are rather straightforward, but -the reader used to the MED-file semantics will find that -there are a few noticeable differences. +The naming conventions are rather straightforward, but the user used to the +Med-File semantics may find that there are a few noticeable differences (see +the following section). \begin{description} \item[cell] entity of dimension equal to the mesh dimension ($1$, $2$ or $3$). \item[component] in a field, represents a value that is available for each @@ -101,14 +100,33 @@ default value). hexahedron, etc...). \end{description} +\section{Limitations and advantages regarding Med-File} +The Med Memory may only read meshes defined by their nodale connectivities. +Following this assumption, in Med File framework all elements defined +in the mesh should be stored as a {\bf MED\_MAILLE}. + +The Med Memory is able to read meshes defined by their nodale connectivities, +and where somme geometric faces are stored as a {\bf MED\_FACE} or a +{\bf MED\_ARETE} Med files. Which is not really Med File compliant. + +{\bf MED\_MAILLE}, {\bf MED\_FACE} and {\bf MED\_ARETE} should be taken in the +Med File sense. In future version, meshes defined by their descending +connectivities could be treated. + +The field notion in Med File and Med Memory is quite different. In Med memory +a field is of course its name, but as well its iteration number, its order +number and finally its corresponding sot of values. But in Med File a field is +only flagged by its name. + \chapter{Med Memory API}\label{sec:objects} \section{Conventions} \begin{itemize} -\item -In this document, one refers to the main user documentation \cite{RefManualMedMemory} -where the variable \verb+$MED_ROOT_DIR+ is the Med Memory directory installation. +\item In this document, one refers to the main user documentation +\cite{RefManualMedMemory} where the variable \verb+$MED_ROOT_DIR+ (resp. +\verb+$MED_SRC_DIR+) is the Med Memory directory installation (resp. sources +directory). \item All numberings start at one (take care of array index !). @@ -138,46 +156,47 @@ programer. \section{Classes} At a basic usage level, the API consists in few classes which are located in -the \verb+MEDMEM+ C++ namespace : +the \verb+MEDMEM+ C++ namespace (consult figure \ref{fig:uml_light} which gives +an UML diagram view of the main Med Memory classes~: \begin{description} \item[MED] the global container; \item[MESH] the class containing 2D or 3D mesh objects; -\item[SUPPORT] the class containing descriptions of list of elements; +\item[SUPPORT] the class containing mainly a list of mesh elements; \item[FIELD] the class template containing list of values lying on a particular support. \end{description} - -Figure \ref{fig:uml_light} gives a view of the UML diagram of the classes that -are sufficient for most integrations in the Salome platform, couplings using -the Med Memory libraries. With these classes, it is possible to : -\begin{itemize} -\item read/write meshes from MED-files; -\item create fields containing scalar or vectorial values on list of elements -of the mesh; -\item communicate these fields between different components; -\item read/write such fields. -\end{itemize} - -Note on this figure that the MED container controls the life cycle of all the -objects it contains : its destruction will destroy all the objects it -aggregates. On the other hand, the life cycle of mesh, support and field -objects are independent. Destroying a support will have no effect on the fields -which refer to it. - \begin{center} \begin{figure} \includegraphics[width=15cm]{MEDMEM_UML_light.png} \caption{UML diagram of basic Med Memory API classes.}\label{fig:uml_light} \end{figure} \end{center} +The API of those classes is quite sufficient for most of the component +integrations in the Salome platform. The use of the Med Memory libraries may +make easier the code coupling in the Salome framework. With these classes, it +is possible to~: +\begin{itemize} +\item read/write meshes and fields from MED-files; +\item create fields containing scalar or vectorial values on list of elements +of the mesh; +\item communicate these fields between different components; +\item read/write such fields. +\end{itemize} +Note that on the figure \ref{fig:uml_light} as well as \ref{fig:uml} that the +MED container controls the life cycle of all the objects it contains~: its +destructor will destroy all the objects it aggregates. On the other hand, the +life cycle of mesh, support and field objects are independent. Destroying a +support (resp. a mesh) will have no effect on the fields (resp. on the support) +which refer to it. But the user has to maintain the link~: a mesh agregates a +support which agregates a field. If the user has to delete Med Memory objects, +the field has to be deleted first, then the support and finally the mesh. A more advanced usage of the Med Memory is possible through other classes. Figure \ref{fig:uml} gives a complete view of the Med Memory API. It includes : \begin{description} \item[GROUP] a class inherited from the SUPPORT class used to create supports -linked to mesh groups (restricted list of elements used for setting boundary -conditions, initial values or transferring data from one component to the -other); +linked to mesh groups. It stores restricted list of elements used to set +boundary conditions, initial values. \item[FAMILY] which is used to manipulate a certain kind of support and does not intersect each other; \item[MESHING] which builds meshes from scratch, it can be used to transform @@ -187,20 +206,19 @@ mesh); \item[Driver classes] which enable the user to get a fine control of the I/O operations. \end{description} - \begin{center} \begin{figure} \includegraphics[width=15cm]{MEDMEM_UML.png} \caption{UML diagram of Med Memory API classes.}\label{fig:uml} \end{figure} \end{center} - \section{Enums} A few enums are defined in the \verb+MED_EN+ namespace : \begin{itemize} \item The \verb+medGeometryElement+ enum which defines geometry types. The -available types are linear and quadratic elements (c.f. [DR??]). The -entries of the enum are quite self-explanatory : +available types are linear and quadratic elements (consult +\cite{RefManualMedMemory}). The entries of the enum are quite +self-explanatory~: \begin{itemize} \item \verb+MED_NONE+ \item \verb+MED_POINT1+ @@ -277,6 +295,14 @@ should never delete it. One can add as well some MESH or FIELD object via the {\method{addMesh}} and the {\method{addField}} respectively. +To write a complete MED object in an available writing format, on may use +{\method{addDriver}} and then {\method{write}}. + +For an example using these methods, one may see the Python scripts in the +directory \verb+$MED_ROOT_DIR/bin/salome/+,\verb+testMedObj.py+, or C++ +example program in the directory \verb+$MED_SRC_DIR/src/MEDMEM+, +\verb+duplicateMED.cxx+. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{How to use MESH object} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -292,9 +318,11 @@ We could get some general information about a MESH object such as~: \item the space dimension (\method{getSpaceDimension}) \item the mesh dimension (\method{getMeshDimension}) \end{itemize} -\fileCxx{MESHgeneral.cxx} -\filePython{MESHgeneral.py} +Here is a small C++ example program which the Python version may be found in +\ref{MESHgeneral.py}. + +\fileCxx{MESHgeneral.cxx} \section{Information about nodes} @@ -321,9 +349,11 @@ an array where values are ordered like (\verb+X1,Y1,Z1, X2,Y2,Z2, ...+). \item I want to get one particular value of coordinate~: use \method{getCoordinate} which returns the value of \( i^{th} \) node and \( j^{th} \) axis. \end{enumerate} -\fileCxx{MESHcoordinates.cxx} -\filePython{MESHcoordinates.py} +Here is a small C++ example program which the Python version may be found in +\ref{MESHcoordinates.py}. + +\fileCxx{MESHcoordinates.cxx} \section{Information about cells} @@ -429,102 +459,25 @@ To get nodal connectivity of polyhedral elements, it is necessary use together and \method{getPolyhedronIndex} (see example \myref{MESHconnectivities.cxx}). \end{enumerate} -\fileCxx{MESHconnectivities.cxx} - -\filePython{MESHconnectivities.py} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\chapter{How to use MESHING object} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -This class is a derivated class of MESH class to build a MESH object from -scratch (use of set methods). - -All verifications are under user responsability : If arrays values or arrays -dimensions are wrongs, results are impredicable. - -All arrays in arguments in set methods are duplicated in MESHING object. - -\section{Build a MESHING} - -\label{BuildMeshing} - -\subsection{Coordinates} -First we must defined points coordinates of the mesh. We use -\method{setCoordinates}. +Here is a small C++ example program which the Python version may be found in +\ref{MESHconnectivities.py}. -\textbf{C++ Example~:} -\begin{verbatim} -MESHING myMeshing ; -const int SpaceDimension=2; -const int NumberOfNodes=6; -int * Coordinates = new int[SpaceDimension*NumberOfNodes] ; -string System="CARTESIAN"; -medModeSwitch MED_FULL_INTERLACE ; -myMeshing.setCoordinates(SpaceDimension,NumberOfNodes,Coordinates,System,Mode); -\end{verbatim} - -Then you could set the coordinates names and units (with -\method{setCoordinatesNames} and \method{setCoordinatesUnits}). - -\subsection{Connectivities} - -When coordinates are defined, we could defined connectivities. - -First we must defined connectivity of MED\_CELL elements. -After, we could defined constituent connectivity if necesary -(MED\_FACE and/or MED\_EDGE). - -For each connectivities, you could use some methods in the following order : -\begin{itemize} -\item \method{setNumberOfTypes} to set the number of differents geometrics -types (3 for example). This method allocates all arrays which size is this -number ; -\item \method{setTypes} to set the differents geometrics types -({MED\_TETRA4,MED\_PYRA5,MED\_HEXA8} for example). Types should be given -in increasing order of number of nodes for this type ; -\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); -\end{itemize} - -\textbf{C++ Example~:} -\begin{verbatim} -MESHING myMeshing ; -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); -\end{verbatim} - - -\section{Defined a GROUP object} - -To add a group in a MESHING object, use \method{addGroup}. +\fileCxx{MESHconnectivities.cxx} -This method duplicate the GROUP object in the MESH object. +\section{Information about FAMILY and GROUP} -To build this GROUP object, use SUPPORT methods \ref{CreateSupport} to set all attributes. +If one wants to get from a MESH object -\subsection{WARNING} -For instance, translation from GROUP objects to FAMILY objects are not completed ! -You MUST set GROUP objects as if they are FAMILY objects. -This feature will be fully implemented in next release of med memory. +To write a complete MESH object in an available writing format, on may use +{\method{addDriver}} and then {\method{write}}. -\section{Example} - -\fileCxx{MESHINGexample.cxx} - -%\filePython{MESHINGexample.py} +For an example using these methods, one may see the Python scripts in the +directory \verb+$MED_ROOT_DIR/bin/salome/+,\verb+med_test1.py+, or C++ example +program in the directory \verb+$MED_SRC_DIR/src/MEDMEM+, \verb+med_test.cxx+. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{How to use SUPPORT object} @@ -665,9 +618,10 @@ interlace). \item Third return the $j^{th}$ component of $i^{th}$ element. \end{itemize} -\fileCxx{FIELDgeneral.cxx} +Here is a small C++ example program which the Python version may be found in +\ref{FIELDgeneral.py}. -\filePython{FIELDgeneral.py} +\fileCxx{FIELDgeneral.cxx} \section{Create a Field} @@ -687,9 +641,102 @@ You \textbf{SHOULD} also set unit of your components with \method{setMEDComponen To set value, use \method{setValueIJ} to put new value of field. +Here is a small C++ example program which the Python version may be found in +\ref{FIELDcreate.py}. + \fileCxx{FIELDcreate.cxx} -\filePython{FIELDcreate.py} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\chapter{How to use MESHING object} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +This class is a derivated class of MESH class to build a MESH object from +scratch (use of set methods). + +All verifications are under user responsability : If arrays values or arrays +dimensions are wrongs, results are impredicable. + +All arrays in arguments in set methods are duplicated in MESHING object. + +\section{Build a MESHING} + +\label{BuildMeshing} + +\subsection{Coordinates} + +First we must defined points coordinates of the mesh. We use +\method{setCoordinates}. + +\textbf{C++ Example~:} +\begin{verbatim} +MESHING myMeshing ; +const int SpaceDimension=2; +const int NumberOfNodes=6; +int * Coordinates = new int[SpaceDimension*NumberOfNodes] ; +string System="CARTESIAN"; +medModeSwitch MED_FULL_INTERLACE ; +myMeshing.setCoordinates(SpaceDimension,NumberOfNodes,Coordinates,System,Mode); +\end{verbatim} + +Then you could set the coordinates names and units (with +\method{setCoordinatesNames} and \method{setCoordinatesUnits}). + +\subsection{Connectivities} + +When coordinates are defined, we could defined connectivities. + +First we must defined connectivity of MED\_CELL elements. +After, we could defined constituent connectivity if necesary +(MED\_FACE and/or MED\_EDGE). + +For each connectivities, you could use some methods in the following order : +\begin{itemize} +\item \method{setNumberOfTypes} to set the number of differents geometrics +types (3 for example). This method allocates all arrays which size is this +number ; +\item \method{setTypes} to set the differents geometrics types +({MED\_TETRA4,MED\_PYRA5,MED\_HEXA8} for example). Types should be given +in increasing order of number of nodes for this type ; +\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); +\end{itemize} + +\textbf{C++ Example~:} +\begin{verbatim} +MESHING myMeshing ; +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); +\end{verbatim} + + +\section{Defined a GROUP object} + +To add a group in a MESHING object, use \method{addGroup}. + +This method duplicate the GROUP object in the MESH object. + +To build this GROUP object, use SUPPORT methods \ref{CreateSupport} to set all attributes. + +\subsection{WARNING} + +For instance, translation from GROUP objects to FAMILY objects are not completed ! + +You MUST set GROUP objects as if they are FAMILY objects. + +This feature will be fully implemented in next release of med memory. + +Here is a small C++ example program which the Python version may be found in +\ref{MESHINGexample.py}. + +\fileCxx{MESHINGexample.cxx} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{Using drivers} @@ -731,9 +778,10 @@ rem 2 : Since the driver has read the object, the associated file is closed. You can reread the object with the default driver by calling the read() method : myObject.read(). -\fileCxx{MEDMEM_InvokingDriverAtObjectCreationTime.cxx} +Here is a small C++ example program which the Python version may be found in +\ref{MEDMEM_InvokingDriverAtObjectCreationTime.py}. -\filePython{MEDMEM_InvokingDriverAtObjectCreationTime.py} +\fileCxx{MEDMEM_InvokingDriverAtObjectCreationTime.cxx} \subsection{Invoking a driver from the standard driver method of an object\label{sec:invoking_a_driver_from_the_std_drv_method}} @@ -755,9 +803,10 @@ write() methods. rem 2 : If you use more than a driver you need to keep the driver handlers (myDriverI ). -\fileCxx{MEDMEM_InvokingDriverFromStandardObjectMethod.cxx} +Here is a small C++ example program which the Python version may be found in +\ref{MEDMEM_InvokingDriverFromStandardObjectMethod.py}. -\filePython{MEDMEM_InvokingDriverFromStandardObjectMethod.py} +\fileCxx{MEDMEM_InvokingDriverFromStandardObjectMethod.cxx} \subsection{Invoking a driver and attaching it to an existing object} @@ -776,9 +825,10 @@ Don't forget to close the file with myRdOnlyDriver->close(). ToDo : By now when you create such specific drivers, the object doesn't know anything about it. -\fileCxx{MEDMEM_InvokingDriverByAttachingItToAnObject.cxx} +Here is a small C++ example program which the Python version may be found in +\ref{MEDMEM_InvokingDriverByAttachingItToAnObject.py}. -\filePython{MEDMEM_InvokingDriverByAttachingItToAnObject.py} +\fileCxx{MEDMEM_InvokingDriverByAttachingItToAnObject.cxx} \section{Using the MED driver} @@ -867,3 +917,43 @@ myGibiMeshDriver.open() ; myGibiMeshDriver.read() ; myGibiMeshDriver.close() ; \end{verbatim} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\chapter{Appendix: Python example scripts.}\label{sec:python} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{Full Python example for \ref{MESHgeneral.cxx}~:} +\label{MESHgeneral.py} +\verbatiminput{@srcdir@/MESHgeneral.py} + +\section{Full Python example for \ref{MESHcoordinates.cxx}~:} +\label{MESHcoordinates.py} +\verbatiminput{@srcdir@/MESHcoordinates.py} + +\section{Full Python example for \ref{MESHconnectivities.cxx}~:} +\label{MESHconnectivities.py} +\verbatiminput{@srcdir@/MESHconnectivities.py} + +\section{Full Python example for \ref{FIELDgeneral.cxx}~:} +\label{FIELDgeneral.py} +\verbatiminput{@srcdir@/FIELDgeneral.py} + +\section{Full Python example for \ref{FIELDcreate.cxx}~:} +\label{FIELDcreate.py} +\verbatiminput{@srcdir@/FIELDcreate.py} + +\section{Full Python example for \ref{MESHINGexample.cxx}~:} +\label{MESHINGexample.py} +\verbatiminput{@srcdir@/MESHINGexample.py} + +\section{Full Python example for \ref{MEDMEM_InvokingDriverAtObjectCreationTime.cxx}~:} +\label{MEDMEM_InvokingDriverAtObjectCreationTime.py} +\verbatiminput{@srcdir@/MEDMEM_InvokingDriverAtObjectCreationTime.py} + +\section{Full Python example for \ref{MEDMEM_InvokingDriverFromStandardObjectMethod.cxx}~:} +\label{MEDMEM_InvokingDriverFromStandardObjectMethod.py} +\verbatiminput{@srcdir@/MEDMEM_InvokingDriverFromStandardObjectMethod.py} + +\section{Full Python example for \ref{MEDMEM_InvokingDriverByAttachingItToAnObject.cxx}~:} +\label{MEDMEM_InvokingDriverByAttachingItToAnObject.py} +\verbatiminput{@srcdir@/MEDMEM_InvokingDriverByAttachingItToAnObject.py} diff --git a/doc/MEDMEM/MEDMEM_UML.png.in b/doc/MEDMEM/MEDMEM_UML.png.in index dfa05ef3b..28418d122 100644 Binary files a/doc/MEDMEM/MEDMEM_UML.png.in and b/doc/MEDMEM/MEDMEM_UML.png.in differ diff --git a/doc/MEDMEM/MEDMEM_UML_light.png.in b/doc/MEDMEM/MEDMEM_UML_light.png.in index 153b3be11..8eff5fa9c 100644 Binary files a/doc/MEDMEM/MEDMEM_UML_light.png.in and b/doc/MEDMEM/MEDMEM_UML_light.png.in differ diff --git a/doc/MEDMEM/MEDMEM_UsersGuide.tex.in b/doc/MEDMEM/MEDMEM_UsersGuide.tex.in index 8da8ce3e2..a0ea7cd2a 100644 --- a/doc/MEDMEM/MEDMEM_UsersGuide.tex.in +++ b/doc/MEDMEM/MEDMEM_UsersGuide.tex.in @@ -72,7 +72,7 @@ % |___________________________________________________________________________| % \title{User's Guide Of Med Memory V 3.2} -\author{Patrick Goldbronn \and Eric Fayolle \and Nadir Bouhamou \and Jerome Roy \and Nicolas Crouzet} +\author{Patrick Goldbronn \and Eric Fayolle \and Nadir Bouhamou \and Jerome Roy \and Nicolas Crouzet \and Vincent Bergeaud} % ___________________________________________________________________________ % | | @@ -120,6 +120,10 @@ \bibitem{RefManualMedFile} \newblock {Reference Manual for Med File~:} \\ +{\sc V. Lefebvre \and E. Fayolle} \\ +\newblock {Projet PAL: Définition du modèle d'échange de données MED V2.2} +\newblock {\it Note technique EDF/SINETICS} +\newblock {HI-26-03-012/A} \\ \newblock {\verb+http://www-drn2.cea.fr/MED/MEDMEM/DOC/html/index.html+} \bibitem{RefManualMedMemory} diff --git a/doc/MEDMEM/MESHINGexample.py b/doc/MEDMEM/MESHINGexample.py new file mode 100644 index 000000000..9d88636d6 --- /dev/null +++ b/doc/MEDMEM/MESHINGexample.py @@ -0,0 +1,696 @@ +################################################################################### +# +# This Python script uses the wrapped C++ class MESHING to buid a mesh from only +# primitive data like coordinates (Pythoin double array) and connectivity (Python +# integer arrays). It is the Python equivalent of the C++ program +# test_MEDMEM_Meshing.cxx in the ../MEDMEM directory of the SALOME distribution +# +################################################################################### + +from libMEDMEM_Swig import * + +# files name to save the generated MESH(ING) in different format +# Med V2.1 Med V2.2 and vtk + +med21FileName = "toto21.med" + +med22FileName = "toto22.med" + +vtkFileName = "toto.vtk" + +myMeshing = MESHING() + +myMeshing.setName("meshing") + +# definition of the coordinates + +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]) + +myMeshing.setCoordinates(spaceDimension,numberOfNodes,coordinates,"CARTESIAN",MED_FULL_INTERLACE) + +for i in range(spaceDimension): + unit = "cm " + if (i == 0): + name = "X " + elif (i == 1): + name = "Y " + elif (i == 2): + name = "Z " + + myMeshing.setCoordinateName(name,i) + myMeshing.setCoordinateUnit(unit,i) + +# definition of connectivities +# cell part + +numberOfTypes = 3 +entity = MED_CELL + +types = [] +numberOfElements = [] + +types.append(MED_TETRA4) +numberOfElements.append(12) + +types.append(MED_PYRA5) +numberOfElements.append(2) + +types.append(MED_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]) + +# face part + +numberOfTypes = 2 +entity = MED_FACE + +types = [] +numberOfElements = [] + +types.append(MED_TRIA3) +numberOfElements.append(4) + +types.append(MED_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) + +# edge part + +# adding GROUPs +# on Node + +myGroup = GROUP() +myGroup.setName("SomeNodes") +myGroup.setMesh(myMeshing) +myGroup.setEntity(MED_NODE) +myGroup.setNumberOfGeometricType(1) + +myTypes = [MED_NONE] +myGroup.setGeometricType(myTypes) + +myNumberOfElements = [4] +myGroup.setNumberOfElements(myNumberOfElements) + +index = [1,5] +values = [1,4,5,7] +myGroup.setNumber(index,values) + +myMeshing.addGroup(myGroup) + +myGroup = GROUP() +myGroup.setName("OtherNodes") +myGroup.setMesh(myMeshing) +myGroup.setEntity(MED_NODE) +myGroup.setNumberOfGeometricType(1) + +myTypes = [MED_NONE] +myGroup.setGeometricType(myTypes) + +myNumberOfElements = [3] +myGroup.setNumberOfElements(myNumberOfElements) + +index = [1,4] +values = [2,3,6] +myGroup.setNumber(index,values) + +myMeshing.addGroup(myGroup) + +# on Cell + +myGroup = GROUP() +myGroup.setName("SomeCells") +myGroup.setMesh(myMeshing) +myGroup.setEntity(MED_CELL) +myGroup.setNumberOfGeometricType(3) + +myTypes = [MED_TETRA4,MED_PYRA5,MED_HEXA8] +myGroup.setGeometricType(myTypes) + +myNumberOfElements = [4,1,2] +myGroup.setNumberOfElements(myNumberOfElements) + +index = [1,5,6,8] +values = [ + 2,7,8,12, + 13, + 15,16 + ] +myGroup.setNumber(index,values) + +myMeshing.addGroup(myGroup) + +myGroup = GROUP() +myGroup.setName("OtherCells") +myGroup.setMesh(myMeshing) +myGroup.setEntity(MED_CELL) +myGroup.setNumberOfGeometricType(2) + +myTypes = [MED_TETRA4,MED_PYRA5] +myGroup.setGeometricType(myTypes) + +myNumberOfElements = [4,1] +myGroup.setNumberOfElements(myNumberOfElements) + +index = [1,5,6] +values = [ + 3,4,5,9, + 14 + ] +myGroup.setNumber(index,values) + +myMeshing.addGroup(myGroup) + +# on Face + +myGroup = GROUP() +myGroup.setName("SomeFaces") +myGroup.setMesh(myMeshing) +myGroup.setEntity(MED_FACE) +myGroup.setNumberOfGeometricType(2) + +myTypes = [MED_TRIA3,MED_QUAD4] +myGroup.setGeometricType(myTypes) + +myNumberOfElements = [2,3] +myGroup.setNumberOfElements(myNumberOfElements) + +index = [1,3,6] +values = [ + 2,4, + 5,6,8 + ] +myGroup.setNumber(index,values) + +myMeshing.addGroup(myGroup) + +myGroup = GROUP() +myGroup.setName("OtherFaces") +myGroup.setMesh(myMeshing) +myGroup.setEntity(MED_FACE) +myGroup.setNumberOfGeometricType(1) + +myTypes = [MED_TRIA3] +myGroup.setGeometricType(myTypes) + +myNumberOfElements = [2] +myGroup.setNumberOfElements(myNumberOfElements) + +index = [1,3] +values = [ + 1,3 + ] +myGroup.setNumber(index,values) + +myMeshing.addGroup(myGroup) + +# saving of the generated mesh in MED 2.1, 2.2 and VTK format + +medFileVersion = getMedFileVersionForWriting() +print "Med File Version For Writing ",medFileVersion + +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) + +# we build now 8 fields : 4 fields double (integer) : +# 2 fields on nodes (cells) : +# 1 scalar (vector) + +supportOnNodes = SUPPORT(myMeshing,"On_All_Nodes",MED_NODE) +numberOfNodes = supportOnNodes.getNumberOfElements(MED_ALL_ELEMENTS) + +supportOnCells = SUPPORT(myMeshing,"On_All_Cells",MED_CELL) +numberOfCells = supportOnCells.getNumberOfElements(MED_ALL_ELEMENTS) + +fieldDoubleScalarOnNodes = FIELDDOUBLE(supportOnNodes,1) +fieldDoubleScalarOnNodes.setName("fieldScalarDoubleNode") +fieldDoubleScalarOnNodes.setIterationNumber(-1) +fieldDoubleScalarOnNodes.setOrderNumber(-1) +fieldDoubleScalarOnNodes.setTime(0.0) + +fieldDoubleScalarOnNodes.setComponentName(1,"Vx") +fieldDoubleScalarOnNodes.setComponentDescription(1,"comp1") +fieldDoubleScalarOnNodes.setMEDComponentUnit(1,"unit1") + +fieldDoubleVectorOnNodes = FIELDDOUBLE(supportOnNodes,spaceDimension) +fieldDoubleVectorOnNodes.setName("fieldVectorDoubleNode") +fieldDoubleVectorOnNodes.setIterationNumber(-1) +fieldDoubleVectorOnNodes.setOrderNumber(-1) +fieldDoubleVectorOnNodes.setTime(0.0) + +fieldDoubleVectorOnNodes.setComponentName(1,"Vx") +fieldDoubleVectorOnNodes.setComponentDescription(1,"comp1") +fieldDoubleVectorOnNodes.setMEDComponentUnit(1,"unit1") +fieldDoubleVectorOnNodes.setComponentName(2,"Vy") +fieldDoubleVectorOnNodes.setComponentDescription(2,"comp2") +fieldDoubleVectorOnNodes.setMEDComponentUnit(2,"unit2") +fieldDoubleVectorOnNodes.setComponentName(3,"Vz") +fieldDoubleVectorOnNodes.setComponentDescription(3,"comp3") +fieldDoubleVectorOnNodes.setMEDComponentUnit(3,"unit3") + +fieldDoubleScalarOnCells = FIELDDOUBLE(supportOnCells,1) +fieldDoubleScalarOnCells.setName("fieldScalarDoubleCell") +fieldDoubleScalarOnCells.setIterationNumber(-1) +fieldDoubleScalarOnCells.setOrderNumber(-1) +fieldDoubleScalarOnCells.setTime(0.0) + +fieldDoubleScalarOnCells.setComponentName(1,"Vx") +fieldDoubleScalarOnCells.setComponentDescription(1,"comp1") +fieldDoubleScalarOnCells.setMEDComponentUnit(1,"unit1") + +fieldDoubleVectorOnCells = FIELDDOUBLE(supportOnCells,spaceDimension) +fieldDoubleVectorOnCells.setName("fieldVectorrDoubleCell") +fieldDoubleVectorOnCells.setIterationNumber(-1) +fieldDoubleVectorOnCells.setOrderNumber(-1) +fieldDoubleVectorOnCells.setTime(0.0) + +fieldDoubleVectorOnCells.setComponentName(1,"Vx") +fieldDoubleVectorOnCells.setComponentDescription(1,"comp1") +fieldDoubleVectorOnCells.setMEDComponentUnit(1,"unit1") +fieldDoubleVectorOnCells.setComponentName(2,"Vy") +fieldDoubleVectorOnCells.setComponentDescription(2,"comp2") +fieldDoubleVectorOnCells.setMEDComponentUnit(2,"unit2") +fieldDoubleVectorOnCells.setComponentName(3,"Vz") +fieldDoubleVectorOnCells.setComponentDescription(3,"comp3") +fieldDoubleVectorOnCells.setMEDComponentUnit(3,"unit3") + +fieldIntScalarOnNodes = FIELDINT(supportOnNodes,1) +fieldIntScalarOnNodes.setName("fieldScalarIntNode") +fieldIntScalarOnNodes.setIterationNumber(-1) +fieldIntScalarOnNodes.setOrderNumber(-1) +fieldIntScalarOnNodes.setTime(0.0) + +fieldIntScalarOnNodes.setComponentName(1,"Vx") +fieldIntScalarOnNodes.setComponentDescription(1,"comp1") +fieldIntScalarOnNodes.setMEDComponentUnit(1,"unit1") + +fieldIntVectorOnNodes = FIELDINT(supportOnNodes,spaceDimension) +fieldIntVectorOnNodes.setName("fieldVectorIntNode") +fieldIntVectorOnNodes.setIterationNumber(-1) +fieldIntVectorOnNodes.setOrderNumber(-1) +fieldIntVectorOnNodes.setTime(0.0) + +fieldIntVectorOnNodes.setComponentName(1,"Vx") +fieldIntVectorOnNodes.setComponentDescription(1,"comp1") +fieldIntVectorOnNodes.setMEDComponentUnit(1,"unit1") +fieldIntVectorOnNodes.setComponentName(2,"Vy") +fieldIntVectorOnNodes.setComponentDescription(2,"comp2") +fieldIntVectorOnNodes.setMEDComponentUnit(2,"unit2") +fieldIntVectorOnNodes.setComponentName(3,"Vz") +fieldIntVectorOnNodes.setComponentDescription(3,"comp3") +fieldIntVectorOnNodes.setMEDComponentUnit(3,"unit3") + +fieldIntScalarOnCells = FIELDINT(supportOnCells,1) +fieldIntScalarOnCells.setName("fieldScalarIntCell") +fieldIntScalarOnCells.setIterationNumber(-1) +fieldIntScalarOnCells.setOrderNumber(-1) +fieldIntScalarOnCells.setTime(0.0) + +fieldIntScalarOnCells.setComponentName(1,"Vx") +fieldIntScalarOnCells.setComponentDescription(1,"comp1") +fieldIntScalarOnCells.setMEDComponentUnit(1,"unit1") + +fieldIntVectorOnCells = FIELDINT(supportOnCells,spaceDimension) +fieldIntVectorOnCells.setName("fieldVectorrIntCell") +fieldIntVectorOnCells.setIterationNumber(-1) +fieldIntVectorOnCells.setOrderNumber(-1) +fieldIntVectorOnCells.setTime(0.0) + +fieldIntVectorOnCells.setComponentName(1,"Vx") +fieldIntVectorOnCells.setComponentDescription(1,"comp1") +fieldIntVectorOnCells.setMEDComponentUnit(1,"unit1") +fieldIntVectorOnCells.setComponentName(2,"Vy") +fieldIntVectorOnCells.setComponentDescription(2,"comp2") +fieldIntVectorOnCells.setMEDComponentUnit(2,"unit2") +fieldIntVectorOnCells.setComponentName(3,"Vz") +fieldIntVectorOnCells.setComponentDescription(3,"comp3") +fieldIntVectorOnCells.setMEDComponentUnit(3,"unit3") + +for i in range(numberOfNodes): + valueInt1 = i+1 + valueInt2 = i+2 + valueInt3 = i+3 + valueDbl1 = valueInt1*0.1 + valueDbl2 = valueInt2*0.1 + valueDbl3 = valueInt3*0.1 + fieldDoubleScalarOnNodes.setValueIJ(i+1,1,valueDbl1) + + fieldIntScalarOnNodes.setValueIJ(i+1,1,valueInt1) + + fieldDoubleVectorOnNodes.setValueIJ(i+1,1,valueDbl1) + fieldDoubleVectorOnNodes.setValueIJ(i+1,2,valueDbl2) + fieldDoubleVectorOnNodes.setValueIJ(i+1,3,valueDbl3) + + fieldIntVectorOnNodes.setValueIJ(i+1,1,valueInt1) + fieldIntVectorOnNodes.setValueIJ(i+1,2,valueInt2) + fieldIntVectorOnNodes.setValueIJ(i+1,3,valueInt3) + +for i in range(numberOfCells): + valueInt1 = i+1 + valueInt2 = i+2 + valueInt3 = i+3 + valueDbl1 = valueInt1*0.1 + valueDbl2 = valueInt2*0.1 + valueDbl3 = valueInt3*0.1 + fieldDoubleScalarOnCells.setValueIJ(i+1,1,valueDbl1) + + fieldIntScalarOnCells.setValueIJ(i+1,1,valueInt1) + + fieldDoubleVectorOnCells.setValueIJ(i+1,1,valueDbl1) + fieldDoubleVectorOnCells.setValueIJ(i+1,2,valueDbl2) + fieldDoubleVectorOnCells.setValueIJ(i+1,3,valueDbl3) + + fieldIntVectorOnCells.setValueIJ(i+1,1,valueInt1) + 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) + +idMedV22 = fieldIntVectorOnCells.addDriver(MED_DRIVER,med22FileName,fieldIntVectorOnCells.getName()) +fieldIntVectorOnCells.write(idMedV22) + +idVtk = fieldDoubleScalarOnNodes.addDriver(VTK_DRIVER,vtkFileName,fieldDoubleScalarOnNodes.getName()) +fieldDoubleScalarOnNodes.writeAppend(idVtk) + +idVtk = fieldIntScalarOnNodes.addDriver(VTK_DRIVER,vtkFileName,fieldIntScalarOnNodes.getName()) +fieldIntScalarOnNodes.writeAppend(idVtk) + +idVtk = fieldDoubleVectorOnNodes.addDriver(VTK_DRIVER,vtkFileName,fieldDoubleVectorOnNodes.getName()) +fieldDoubleVectorOnNodes.writeAppend(idVtk) + +idVtk = fieldIntVectorOnNodes.addDriver(VTK_DRIVER,vtkFileName,fieldIntVectorOnNodes.getName()) +fieldIntVectorOnNodes.writeAppend(idVtk) + +idVtk = fieldDoubleScalarOnCells.addDriver(VTK_DRIVER,vtkFileName,fieldDoubleScalarOnCells.getName()) +fieldDoubleScalarOnCells.writeAppend(idVtk) + +idVtk = fieldIntScalarOnCells.addDriver(VTK_DRIVER,vtkFileName,fieldIntScalarOnCells.getName()) +fieldIntScalarOnCells.writeAppend(idVtk) + +idVtk = fieldDoubleVectorOnCells.addDriver(VTK_DRIVER,vtkFileName,fieldDoubleVectorOnCells.getName()) +fieldDoubleVectorOnCells.writeAppend(idVtk) + +idVtk = fieldIntVectorOnCells.addDriver(VTK_DRIVER,vtkFileName,fieldIntVectorOnCells.getName()) +fieldIntVectorOnCells.writeAppend(idVtk) diff --git a/doc/MEDMEM/MESHconnectivities.cxx b/doc/MEDMEM/MESHconnectivities.cxx index 680308d7f..1580d640f 100644 --- a/doc/MEDMEM/MESHconnectivities.cxx +++ b/doc/MEDMEM/MESHconnectivities.cxx @@ -2,7 +2,6 @@ // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // #include "MEDMEM_Mesh.hxx" -#include "MEDMEM_CellModel.hxx" using namespace MEDMEM ; using namespace MED_EN ; @@ -22,16 +21,15 @@ int main (int argc, char ** argv) { // we get all type for cell entity : int NumberOfTypes = myMesh.getNumberOfTypes(MED_CELL) ; - const CELLMODEL * Types = myMesh.getCellsTypes(MED_CELL) ; - cout << "Show Connectivity (Nodal) :" << endl ; - // this example use access with a specified medGeometryElement through - // CELLMODEL class + // this example use access with a specified medGeometryElement array + const medGeometryElement * Types = myMesh.getTypes(MED_CELL); + string * cellTypeNames = myMesh.getCellTypeNames(MED_CELL); for (int i=0; i