Cherrypick from master 2003-05-20 12:16:39 UTC nri <nri@opencascade.com> 'NRI : Update 1.1a and New organisation.':
idl/Med_Gen.idl
src/MEDMEM/MEDMEM_PointerOf.hxx
src/MEDMEM/test_affect_medarray.cxx
src/MEDMEM/test_copie_connectivity.cxx
src/MEDMEM/test_copie_coordinate.cxx
src/MEDMEM/test_copie_family.cxx
src/MEDMEM/test_copie_fieldT.cxx
src/MEDMEM/test_copie_field_.cxx
src/MEDMEM/test_copie_group.cxx
src/MEDMEM/test_copie_medarray.cxx
src/MEDMEM/test_copie_support.cxx
src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.cxx
src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.hxx
src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.cxx
src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.hxx
--- /dev/null
+//=============================================================================
+// File : Med_Gen.idl
+// Project : SALOME
+// Copyright : EDF 2001
+//=============================================================================
+
+#ifndef _Med_GEN_IDL_
+#define _Med_GEN_IDL_
+
+
+#include "SALOME_Exception.idl"
+#include "SALOME_Component.idl"
+#include "SALOMEDS.idl"
+#include "MED.idl"
+
+module Engines
+{
+ interface Med_Gen : Engines::Component, SALOMEDS::Driver
+ {
+ SALOME_MED::MESH readMeshInFile(in string fileName,
+ in string studyName,
+ in string meshName )
+ raises (SALOME::SALOME_Exception);
+ SALOME_MED::FIELD readFieldInFile(in string fileName,
+ in string studyName,
+ in string fieldName,
+ in long ordre,
+ in long iter )
+ raises (SALOME::SALOME_Exception);
+ SALOME_MED::MED readStructFile(in string fileName,
+ in string studyName )
+ raises (SALOME::SALOME_Exception);
+
+ void readStructFileWithFieldType(in string fileName,
+ in string studyName )
+ raises (SALOME::SALOME_Exception);
+ };
+
+};
+
+#endif
--- /dev/null
+# if ! defined( __PointerOf_HXX__ )
+# define __PointerOf_HXX__
+
+#include <cstdlib>
+#include "utilities.h"
+
+/*!
+ The template class PointerOf embedding a standard pointer (_pointer) is in charge of
+ managing a the pointed memory.
+*/
+
+template <typename T> class PointerOf
+{
+protected :
+ T* _pointer ;
+ bool _done ;
+public :
+ PointerOf() ; //
+ PointerOf( const int &size ) ;
+ PointerOf( const T *pointer ) ;
+ ~PointerOf() ;
+ operator T*() ;
+ operator const T*() const ;
+
+ //operator T*() const ;
+
+ void set( const int &size ) ;
+ void set( const T *pointer ) ;
+ PointerOf<T>& operator=( const PointerOf<T> &pointer ) ;
+} ;
+
+template <typename T> PointerOf<T>& PointerOf<T>::operator=( const PointerOf<T> &pointer )
+{
+ BEGIN_OF("PointerOf<T>::operator=( const PointerOf<T> &pointer )") ;
+ if ( &pointer != this )
+ {
+ this->set( pointer._pointer ) ;
+ }
+ END_OF("PointerOf<T>::operator=( const PointerOf<T> &pointer )") ;
+ return *this ;
+}
+
+template <typename T> PointerOf<T>::PointerOf() : _pointer(0), _done(false)
+{
+}
+
+template <typename T> PointerOf<T>::PointerOf( const int &size ) : _pointer( new T[ size ]), _done(true)
+{
+}
+
+template <typename T> PointerOf<T>::PointerOf( const T* pointer ) : _pointer( (T*)pointer ), _done(false)
+{
+}
+
+template <typename T> PointerOf<T>::~PointerOf()
+{
+ if ( _pointer )
+ {
+ if( _done )
+ {
+ MESSAGE("PointerOf<T>::~PointerOf() --> deleting _pointer") ;
+ delete [] _pointer ;
+ _done = false ;
+ }
+ else
+ {
+ MESSAGE("_pointer is only nullified") ;
+ }
+ _pointer = 0 ;
+ }
+}
+
+template <typename T> PointerOf<T>::operator T*()
+{
+ return _pointer ;
+}
+
+template <typename T> PointerOf<T>::operator const T*() const
+{
+ return _pointer ;
+}
+
+// template <typename T> PointerOf<T>::operator T*() const
+// {
+// return _pointer ;
+// }
+
+template <typename T> void PointerOf<T>::set( const int &size )
+{
+ ASSERT(size>0) ;
+ if ( _pointer && _done )
+ {
+ delete [] _pointer ;
+ _pointer=0 ;
+ }
+ _pointer = new T[ size ] ;
+ _done = true ;
+ return ;
+}
+template <typename T> void PointerOf<T>::set( const T *pointer )
+{
+ MESSAGE( "PointerOf<T>::set( const T *pointer )" ) ;
+ SCRUTE(pointer) ;
+ SCRUTE(_done) ;
+ if ( _pointer && _done )
+ {
+ MESSAGE("PointerOf<T>::set --> deleting _pointer") ;
+ delete [] _pointer ;
+ _pointer=0 ;
+ _done=false ;
+ }
+ _pointer=(T*)pointer ;
+ _done=false ;
+ MESSAGE( "PointerOf<T>::set( const T *pointer )" ) ;
+ return ;
+}
+
+# endif /* # if ! defined( __PointerOf_HXX__ ) */
--- /dev/null
+using namespace std;
+/* Programme de test du constructeur de copies de la classe MEDARRAY de MEDMEM
+ jroy - 16/12/2002 */
+
+#include <string>
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "MEDMEM_Exception.hxx"
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Family.hxx"
+#include "MEDMEM_Group.hxx"
+
+#include "MEDMEM_MedMeshDriver.hxx"
+#include "MEDMEM_MedFieldDriver.hxx"
+#include "MEDMEM_Support.hxx"
+#include "MEDMEM_Field.hxx"
+#include "MEDMEM_define.hxx"
+
+
+void affiche_medarray(MEDARRAY<double> & myMedArray)
+{
+ int numberof ;
+ MESSAGE("Show all 1 :");
+ numberof = myMedArray.getLeadingValue() ;
+ for (int i=1; i<=myMedArray.getLengthValue() ; i++) {
+ double * node = myMedArray.getI(MED_FULL_INTERLACE,i) ;
+ cout << " - " ;
+ for (int j=0;j<numberof;j++)
+ cout << node[j] << " " ;
+ cout << endl ;
+ }
+ MESSAGE("Show all 2 :");
+ numberof = myMedArray.getLengthValue() ;
+ for (int i=1; i<=myMedArray.getLeadingValue() ; i++) {
+ double * node = myMedArray.getI(MED_NO_INTERLACE,i) ;
+ cout << " - " ;
+ for (int j=0;j<numberof;j++)
+ cout << node[j] << " " ;
+ cout << endl ;
+ }
+ MESSAGE("Show all 3 :");
+ numberof = myMedArray.getLeadingValue() ;
+ for (int i=1; i<=myMedArray.getLengthValue() ; i++) {
+ cout << " - " ;
+ for (int j=1;j<numberof+1;j++)
+ cout << myMedArray.getIJ(i,j) << " " ;
+ cout << endl ;
+ }
+
+ MESSAGE("Show all 0 :");
+ numberof = myMedArray.getLeadingValue() ;
+ int length = myMedArray.getLengthValue() ;
+ double * NoInterlaceArray = myMedArray.get(MED_NO_INTERLACE) ;
+ for (int i=0; i<length ; i++) {
+ cout << " - " ;
+ for (int j=0;j<numberof;j++)
+ cout << NoInterlaceArray[j*length+i] << " " ;
+ cout << endl ;
+ }
+
+
+ /*
+ cout << "Nombre de lignes : " << myMedArray.getLengthValue() << endl;
+ cout << "Nombre de colonnes : " << myMedArray.getLeadingValue() << endl;
+ cout << "Mode d'écriture en mémoire : " << myMedArray.getMode() << endl;
+ cout << "Valeurs (_valuesDefault) :" << endl;
+
+ for (med_int i=1; i<=myMedArray.getLengthValue(); i++) {
+ for (med_int j=1; j<=myMedArray.getLeadingValue(); j++)
+ cout << i << " " << j << " " << myMedArray.getIJ(i,j) << " " << endl;
+ }
+ */
+}
+
+
+int main (int argc, char ** argv) {
+
+ /*
+ if ((argc !=3) && (argc != 4)) {
+ cerr << "Usage : " << argv[0]
+ << " filename meshname fieldname" << endl << endl;
+ exit(-1);
+ }
+ */
+ const med_int nb_noeuds = 8;
+ const med_int dimension = 3;
+ const medModeSwitch mode = MED_NO_INTERLACE;
+
+
+ MEDARRAY<double> * myMedArray = new MEDARRAY<double>(dimension,nb_noeuds,mode);
+ for (med_int i=1; i<=myMedArray->getLengthValue(); i++) {
+ for (med_int j=1; j<=myMedArray->getLeadingValue(); j++)
+ myMedArray->setIJ(i,j,(double) random());
+ };
+
+ affiche_medarray(* myMedArray);
+ MEDARRAY<double> * myMedArray2 = new MEDARRAY<double>();
+ * myMedArray2 = * myMedArray;
+ delete myMedArray;
+ affiche_medarray(* myMedArray2);
+ delete myMedArray2;
+
+ return 0;
+}
--- /dev/null
+using namespace std;
+/* Programme de test du constructeur de copies de la classe CONNECTIVITY de MEDMEM
+ jroy - 19/12/2002 */
+
+#include <string>
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "MEDMEM_Exception.hxx"
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Family.hxx"
+#include "MEDMEM_Group.hxx"
+
+#include "MEDMEM_MedMeshDriver.hxx"
+#include "MEDMEM_MedFieldDriver.hxx"
+#include "MEDMEM_Support.hxx"
+#include "MEDMEM_Field.hxx"
+#include "MEDMEM_define.hxx"
+
+void affiche_connectivity(CONNECTIVITY * myConnectivity, MESH * myMesh)
+{
+ int SpaceDimension = myMesh->getSpaceDimension() ;
+ int MeshDimension = myMesh->getMeshDimension() ;
+ int NumberOfNodes = myMesh->getNumberOfNodes() ;
+
+ int NumberOfTypes = myMesh->getNumberOfTypes(MED_CELL) ;
+ medGeometryElement * Types = myMesh->getTypes(MED_CELL) ;
+
+ cout << "Show Connectivity (Nodal) :" << endl ;
+ for (int i=0; i<NumberOfTypes; i++) {
+ cout << "For type " << Types[i] << " : " << endl ;
+ int NumberOfElements = myMesh->getNumberOfElements(MED_CELL,Types[i]);
+ int * connectivity = myMesh->getConnectivity(MED_FULL_INTERLACE,MED_NODAL,MED_CELL,Types[i]);
+ int NomberOfNodesPerCell = Types[i]%100 ;
+ for (int j=0;j<NumberOfElements;j++){
+ cout << "Element "<< j+1 <<" : " ;
+ for (int k=0;k<NomberOfNodesPerCell;k++)
+ cout << connectivity[j*NomberOfNodesPerCell+k]<<" ";
+ cout << endl ;
+ }
+ }
+
+ cout << "Show Reverse Nodal Connectivity :" << endl ;
+ int * ReverseNodalConnectivity = myMesh->getReverseConnectivity(MED_NODAL) ;
+ int * ReverseNodalConnectivityIndex = myMesh->getReverseConnectivityIndex(MED_NODAL) ;
+ for (int i=0; i<NumberOfNodes; i++) {
+ cout << "Node "<<i+1<<" : " ;
+ for (int j=ReverseNodalConnectivityIndex[i];j<ReverseNodalConnectivityIndex[i+1];j++)
+ cout << ReverseNodalConnectivity[j-1] << " " ;
+ cout << endl ;
+ }
+
+ cout << "Show Connectivity (Descending) :" << endl ;
+ int NumberOfElements ;
+ int * connectivity ;
+ int * connectivity_index ;
+ myMesh->calculateConnectivity(MED_FULL_INTERLACE,MED_DESCENDING,MED_CELL);
+ try {
+ NumberOfElements = myMesh->getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS);
+ connectivity = myMesh->getConnectivity(MED_FULL_INTERLACE,MED_DESCENDING,MED_CELL,MED_ALL_ELEMENTS);
+ connectivity_index = myMesh->getConnectivityIndex(MED_DESCENDING,MED_CELL);
+ }
+ catch (MEDEXCEPTION m) {
+ cout << m.what() << endl ;
+ exit (-1) ;
+ }
+ for (int j=0;j<NumberOfElements;j++) {
+ cout << "Element "<<j+1<<" : " ;
+ for (int k=connectivity_index[j];k<connectivity_index[j+1];k++)
+ cout << connectivity[k-1]<<" ";
+ cout << endl ;
+ }
+
+ cout << "Show Reverse Descending Connectivity :" << endl ;
+ int * ReverseDescendingConnectivity = myMesh->getReverseConnectivity(MED_DESCENDING) ;
+ int * ReverseDescendingConnectivityIndex = myMesh->getReverseConnectivityIndex(MED_DESCENDING) ;
+
+ int NumberOfConstituents = 0;
+ string constituent ;
+ medEntityMesh constituentEntity ;
+
+ if (MeshDimension==3) {
+ constituent = "Face" ;
+ constituentEntity = MED_FACE ;
+ }
+
+ if (MeshDimension==2) {
+ constituent = "Edge" ;
+ constituentEntity = MED_EDGE ;
+ }
+
+ if (MeshDimension==1) {
+ MESSAGE("ERROR : MeshDimension = 1 !");
+ MESSAGE("We could not see Reverse Descending Connectivity.") ;
+ } else {
+ NumberOfConstituents = myMesh->getNumberOfElements (constituentEntity,MED_ALL_ELEMENTS);
+ for (int i=0; i<NumberOfConstituents; i++) {
+ cout << constituent <<i+1<<" : " ;
+ for (int j=ReverseDescendingConnectivityIndex[i];j<ReverseDescendingConnectivityIndex[i+1];j++)
+ cout << ReverseDescendingConnectivity[j-1] << " " ;
+ cout << endl ;
+ }
+ }
+ cout << "Show "<<constituent<<" Connectivity (Nodal) :" << endl ;
+ int * face_connectivity = myMesh->getConnectivity(MED_FULL_INTERLACE,MED_NODAL,constituentEntity,MED_ALL_ELEMENTS);
+ int * face_connectivity_index = myMesh->getConnectivityIndex(MED_NODAL,constituentEntity);
+ for (int i=0; i<NumberOfConstituents; i++) {
+ cout << constituent <<i+1<<" : " ;
+ for (int j=face_connectivity_index[i];j<face_connectivity_index[i+1];j++)
+ cout << face_connectivity[j-1]<<" ";
+ cout << endl ;
+ }
+}
+
+
+int main (int argc, char ** argv) {
+
+
+ if (argc !=3) {
+ cerr << "Usage : " << argv[0]
+ << " filename meshname" << endl << endl;
+ exit(-1);
+ }
+ string filename = argv[1] ;
+ string meshname = argv[2] ;
+
+ //Construction d'un maillage
+ MESH * myMesh= new MESH() ;
+ myMesh->setName(meshname);
+ MED_MESH_RDONLY_DRIVER myMeshDriver(filename,myMesh) ;
+ myMeshDriver.setMeshName(meshname);
+ myMeshDriver.open() ;
+ myMeshDriver.read() ; //A partir d'ici la connectivité est construite
+ myMeshDriver.close() ;
+
+ CONNECTIVITY * myConnectivity = myMesh->getConnectivityptr();
+ affiche_connectivity(myConnectivity, myMesh);
+ CONNECTIVITY * myConnectivity2 = new CONNECTIVITY(* myConnectivity);
+ affiche_connectivity(myConnectivity2, myMesh);
+ delete myConnectivity;//myConnectivity utile pour afficher myConnectivity2 via myMesh!
+
+ return 0;
+}
--- /dev/null
+using namespace std;
+/* Programme de test du constructeur de copies de la classe COORDINATE de MEDMEM
+ jroy - 17/12/2002 */
+
+#include <string>
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "MEDMEM_Exception.hxx"
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Family.hxx"
+#include "MEDMEM_Group.hxx"
+
+#include "MEDMEM_MedMeshDriver.hxx"
+#include "MEDMEM_MedFieldDriver.hxx"
+#include "MEDMEM_Support.hxx"
+#include "MEDMEM_Field.hxx"
+#include "MEDMEM_define.hxx"
+
+
+void affiche_tableau(const double * myArray, int nb_lignes, int nb_colonnes)
+{
+ cout << "Nombre de lignes : " << nb_lignes << endl;
+ cout << "Nombre de colonnes : " << nb_colonnes << endl;
+ cout << "Valeurs :" << endl;
+
+ for (int i=0; i<nb_lignes; i++) {
+ for (int j=0; j<nb_colonnes; j++)
+ cout << myArray[j*nb_lignes+i] << " ";
+ cout << endl;}
+}
+
+void affiche_coordinate(COORDINATE & myCoordinate, int _numberofNodes, int _spaceDimension)
+{
+ cout << "- Système de coordonnées : " << myCoordinate.getCoordinatesSystem() << endl;
+ cout << "- Tableau des coordonnées : " << endl;
+ // affiche_medarray(* myCoordinate.getCoordinatePtr());
+ affiche_tableau(myCoordinate.getCoordinates(MED_NO_INTERLACE),_numberofNodes,_spaceDimension);
+ //on récupère les dimensions
+ // int _spaceDimension = (int) myCoordinate.getCoordinatePtr()->getLeadingValue();
+ //int _numberofNodes = (int) myCoordinate.getCoordinatePtr()->getLengthValue();
+ cout << "- Nom des coordonnées : " << endl;
+ for (int i=1; i<=_spaceDimension; i++)
+ cout << i << " " << myCoordinate.getCoordinateName(i) << endl;
+ // cout<<myCoordinate.getCoordinatesNames()<<endl;
+ cout << "- Unité des coordonnées : " << endl;
+ for (int i=1; i<=_spaceDimension; i++)
+ cout << i << " " << myCoordinate.getCoordinateUnit(i) << endl;
+ cout << "- Indices des noeuds : " << endl;
+ // cout<<myCoordinate.getNodesNumbers()<<endl;
+ for (int i=0; i<_numberofNodes; i++)
+ cout << i << " " << myCoordinate.getNodesNumbers()[i] << endl;
+}
+
+
+int main (int argc, char ** argv) {
+
+ /*
+ if ((argc !=3) && (argc != 4)) {
+ cerr << "Usage : " << argv[0]
+ << " filename meshname fieldname" << endl << endl;
+ exit(-1);
+ }
+ */
+ const med_int numberofNodes = 5;
+ const med_int spaceDimension = 3;
+ const medModeSwitch mode = MED_FULL_INTERLACE;
+
+ //construction tableau MEDARRAY des coordonnées
+ MEDARRAY<double> * myMedArray = new MEDARRAY<double>(spaceDimension,numberofNodes,mode);
+ for (med_int i=1; i<=myMedArray->getLengthValue(); i++) {
+ for (med_int j=1; j<=myMedArray->getLeadingValue(); j++)
+ myMedArray->setIJ(i,j,(double) random());
+ };
+
+ //construction noms des coordonnées
+ string * myCoordinatesNames = new string[spaceDimension];
+ if (spaceDimension >= 1) myCoordinatesNames[0] = "x";
+ if (spaceDimension >= 2) myCoordinatesNames[1] = "y";
+ if (spaceDimension >= 3) myCoordinatesNames[2] = "z";
+
+ //construction unités des coordonnées
+ string * myCoordinatesUnits = new string[spaceDimension];
+ if (spaceDimension >= 1) myCoordinatesUnits[0] = "m";
+ if (spaceDimension >= 2) myCoordinatesUnits[1] = "m";
+ if (spaceDimension >= 3) myCoordinatesUnits[2] = "m";
+
+ //construction des indices des noeuds
+ int * myNodeNumber = new int[numberofNodes];
+ for (int i=0; i<numberofNodes; i++)
+ myNodeNumber[i]=numberofNodes-i-1;
+
+ //construction de l'objet COORDINATE
+ COORDINATE * myCoordinate = new COORDINATE();
+ myCoordinate->setCoordinates(myMedArray);
+ myCoordinate->setCoordinatesNames(myCoordinatesNames);
+ myCoordinate->setCoordinatesUnits(myCoordinatesUnits);
+ myCoordinate->setNodesNumbers(myNodeNumber);
+
+ // myCoordinate->setCoordinatesNames((string *)NULL);
+ // myCoordinate->setNodesNumbers((int *) NULL);
+
+ affiche_coordinate(* myCoordinate,numberofNodes,spaceDimension);
+ COORDINATE * myCoordinate2 = new COORDINATE(* myCoordinate);
+ delete myCoordinate;
+ affiche_coordinate(* myCoordinate2,numberofNodes,spaceDimension);
+
+ return 0;
+}
--- /dev/null
+using namespace std;
+#include<string>
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "MEDMEM_Exception.hxx"
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Family.hxx"
+#include "MEDMEM_Group.hxx"
+
+#include "MEDMEM_MedMeshDriver.hxx"
+#include "MEDMEM_MedFieldDriver.hxx"
+#include "MEDMEM_Support.hxx"
+#include "MEDMEM_Field.hxx"
+#include "MEDMEM_define.hxx"
+
+
+void affiche_support(SUPPORT * mySupport)
+{
+ cout << " - Name : "<<mySupport->getName().c_str()<<endl ;
+ cout << " - Description : "<<mySupport->getDescription().c_str()<<endl ;
+ cout << " - Entity : "<<mySupport->getEntity()<<endl ;
+ cout << " - Entities list : "<<endl ;
+ if (!(mySupport->isOnAllElements())) {
+ int NumberOfTypes = mySupport->getNumberOfTypes() ;
+ cout<<" - NumberOfTypes : "<<NumberOfTypes<<endl;
+ medGeometryElement * Types = mySupport->getTypes() ;
+ for (int j=0;j<NumberOfTypes;j++) {
+ cout<<" * Type "<<Types[j]<<" : ";
+ int NumberOfElements = mySupport->getNumberOfElements(Types[j]) ;
+ int * Number = mySupport->getNumber(Types[j]) ;
+ for (int k=0; k<NumberOfElements;k++)
+ cout << Number[k] << " ";
+ cout << endl ;
+ }
+ } else
+ cout << " Is on all entities !"<< endl;
+}
+
+
+void affiche_famille(FAMILY * myFamily)
+{
+ affiche_support(myFamily);
+ cout << " - Identifier : "<<myFamily->getIdentifier()<<endl ;
+ int NumberOfAttributes = myFamily->getNumberOfAttributes() ;
+ cout << " - Attributes ("<<NumberOfAttributes<<") :"<<endl;
+ for (int j=1;j<NumberOfAttributes+1;j++)
+ cout << " * "<<myFamily->getAttributeIdentifier(j)<<" : "<<myFamily->getAttributeValue(j)<<", "<<myFamily->getAttributeDescription(j).c_str()<<endl ;
+ int NumberOfGroups = myFamily->getNumberOfGroups() ;
+ cout << " - Groups ("<<NumberOfGroups<<") :"<<endl;
+ for (int j=1;j<NumberOfGroups+1;j++)
+ cout << " * "<<myFamily->getGroupName(j).c_str()<<endl ;
+}
+
+void affiche_groupe(MESH *myMesh,medEntityMesh Entity)
+{
+ int NumberOfGroups = myMesh->getNumberOfGroups(Entity) ;
+ cout << "NumberOfGroups : "<<NumberOfGroups<<endl;
+ for (int i=1; i<NumberOfGroups+1;i++) {
+ GROUP* myGroup = myMesh->getGroup(Entity,i);
+ affiche_support(myGroup);
+ int NumberOfFamillies = myGroup->getNumberOfFamilies() ;
+ cout << " - Families ("<<NumberOfFamillies<<") :"<<endl;
+ for (int j=1;j<NumberOfFamillies+1;j++)
+ cout << " * "<<myGroup->getFamily(j)->getName().c_str()<<endl ;
+ }
+}
+
+int main (int argc, char ** argv) {
+
+ int read;
+
+ if (argc !=3) {
+ cerr << "Usage : " << argv[0]
+ << " filename meshname" << endl << endl;
+ exit(-1);
+ }
+
+ string filename = argv[1] ;
+ string meshname = argv[2] ;
+
+ MESH * myMesh= new MESH() ;
+ myMesh->setName(meshname);
+ MED_MESH_RDONLY_DRIVER myMeshDriver(filename,myMesh) ;
+ myMeshDriver.setMeshName(meshname);
+ myMeshDriver.open() ;
+ myMeshDriver.read() ;
+ myMeshDriver.close() ;
+
+ FAMILY * myFamily = myMesh->getFamily(MED_NODE,1);
+ //On renseigne les attributs spécifiques à FAMILY (p/r à SUPPORT) et non renseignés lors de la lecture du maillage
+ int NumberOfAttribute = 3;
+ int *AttributeIdentifier = new int[NumberOfAttribute];
+ int *AttributeValue = new int[NumberOfAttribute];
+ string *AttributeDescription = new string[NumberOfAttribute];
+ char *tmp;
+ for (int i=0;i<NumberOfAttribute;i++)
+ {
+ AttributeIdentifier[i]=i+1;
+ AttributeValue[i]=(i+1)*10;
+ sprintf(tmp,"Attribut N° %d",i+1);
+ AttributeDescription[i]=tmp;
+ }
+
+ myFamily->setNumberOfAttributes(NumberOfAttribute);
+ myFamily->setAttributesIdentifiers (AttributeIdentifier);
+ myFamily->setAttributesValues (AttributeValue);
+ myFamily->setAttributesDescriptions (AttributeDescription);
+
+ cout << "Show Family :"<<endl ;
+ affiche_famille(myFamily);
+ FAMILY * myFamily2 = new FAMILY(* myFamily);
+ delete myFamily;
+ affiche_famille(myFamily2);
+ delete myFamily2;
+
+ /*
+ cout << "Show Group :"<<endl ;
+ affiche_groupe(myMesh,MED_NODE);
+ affiche_groupe(myMesh,MED_CELL);
+ affiche_groupe(myMesh,MED_FACE);
+ affiche_groupe(myMesh,MED_EDGE);
+ */
+ return 0;
+}
--- /dev/null
+using namespace std;
+/* Programme de test du constructeur de copies de la classe FIELD_ de MEDMEM
+ jroy - 12/12/2002 */
+
+#include<string>
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "MEDMEM_Exception.hxx"
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Family.hxx"
+#include "MEDMEM_Group.hxx"
+
+#include "MEDMEM_MedMeshDriver.hxx"
+#include "MEDMEM_MedFieldDriver.hxx"
+#include "MEDMEM_Support.hxx"
+#include "MEDMEM_Field.hxx"
+#include "MEDMEM_define.hxx"
+
+
+void affiche_field_(FIELD_ * myField, const SUPPORT * mySupport)
+{
+ cout << "Field "<< myField->getName() << " : " <<myField->getDescription() << endl ;
+ int NumberOfComponents = myField->getNumberOfComponents() ;
+ cout << "- Nombre de composantes : "<< NumberOfComponents << endl ;
+ for (int i=1; i<NumberOfComponents+1; i++) {
+ cout << " - composante "<<i<<" :"<<endl ;
+ cout << " - nom : "<<myField->getComponentName(i)<< endl;
+ cout << " - description : "<<myField->getComponentDescription(i) << endl;
+ cout << " - units : "<<myField->getMEDComponentUnit(i) << endl;
+ }
+ cout << "- iteration :" << endl ;
+ cout << " - numero : " << myField->getIterationNumber()<< endl ;
+ cout << " - ordre : " << myField->getOrderNumber()<< endl ;
+ cout << " - temps : " << myField->getTime()<< endl ;
+
+ cout << "- Type : " << myField->getValueType()<< endl;
+
+ cout << "- Adresse support : " << mySupport << endl;
+}
+
+void affiche_fieldT(FIELD<double> * myField, const SUPPORT * mySupport)
+{
+ affiche_field_((FIELD_ *) myField, mySupport);
+
+ cout << "- Valeurs :"<<endl;
+ int NumberOf = mySupport->getNumberOfElements(MED_ALL_ELEMENTS);
+ int NumberOfComponents = myField->getNumberOfComponents() ;
+
+ for (int i=1; i<NumberOf+1; i++) {
+ double * value = myField->getValueI(MED_FULL_INTERLACE,i) ;
+ for (int j=0; j<NumberOfComponents; j++)
+ cout << value[j]<< " ";
+ cout<<endl;
+ }
+}
+
+int main (int argc, char ** argv) {
+
+ int read;
+
+ if ((argc !=3) && (argc != 4)) {
+ cerr << "Usage : " << argv[0]
+ << " filename meshname fieldname" << endl << endl;
+ exit(-1);
+ }
+
+ string filename = argv[1] ;
+ string meshname = argv[2] ;
+
+ MESH * myMesh= new MESH() ;
+ myMesh->setName(meshname);
+ MED_MESH_RDONLY_DRIVER myMeshDriver(filename,myMesh) ;
+ myMeshDriver.setMeshName(meshname);
+ myMeshDriver.open() ;
+ myMeshDriver.read() ;
+ myMeshDriver.close() ;
+
+ // read field :
+ if (argc != 4) exit(0) ;
+ // else we have a field !
+ string fieldname = argv[3];
+
+ // SUPPORT * mySupport = new SUPPORT(myMesh,"On_all_node",MED_NODE);
+ SUPPORT * mySupport = new SUPPORT(myMesh,"On_all_cell",MED_CELL);
+ FIELD<double> * myField = new FIELD<double>() ;
+
+ myField->setName(fieldname);
+ myField->setSupport(mySupport);
+ MED_FIELD_RDONLY_DRIVER<double> myFieldDriver(filename,myField) ;
+ myFieldDriver.setFieldName(fieldname);
+ myFieldDriver.open() ;
+
+ try {
+ myFieldDriver.read() ;
+ } catch (...) {
+ delete mySupport ;
+ mySupport = new SUPPORT(myMesh,"On_all_node",MED_NODE);
+ myField->setSupport(mySupport);
+ try {
+ myFieldDriver.read() ;
+ } catch (...) {
+ cout << "Field " << fieldname << " not found !!!" << endl ;
+ exit (-1) ;
+ }
+ }
+
+ myFieldDriver.close() ;
+
+ affiche_fieldT(myField, mySupport);
+ FIELD<double> * myField2 = new FIELD<double>(* myField);
+ delete myField;
+ affiche_fieldT(myField2, myField2->getSupport());
+ delete myField2;
+
+ return 0;
+}
--- /dev/null
+using namespace std;
+/* Programme de test du constructeur de copies de la classe FIELD_ de MEDMEM
+ jroy - 12/12/2002 */
+
+#include<string>
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "MEDMEM_Exception.hxx"
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Family.hxx"
+#include "MEDMEM_Group.hxx"
+
+#include "MEDMEM_MedMeshDriver.hxx"
+#include "MEDMEM_MedFieldDriver.hxx"
+#include "MEDMEM_Support.hxx"
+#include "MEDMEM_Field.hxx"
+#include "MEDMEM_define.hxx"
+
+
+void affiche_field(FIELD_ * myField, const SUPPORT * mySupport)
+{
+ cout << "Field "<< myField->getName() << " : " <<myField->getDescription() << endl ;
+ int NumberOfComponents = myField->getNumberOfComponents() ;
+ cout << "- Nombre de composantes : "<< NumberOfComponents << endl ;
+ for (int i=1; i<NumberOfComponents+1; i++) {
+ cout << " - composante "<<i<<" :"<<endl ;
+ cout << " - nom : "<<myField->getComponentName(i)<< endl;
+ cout << " - description : "<<myField->getComponentDescription(i) << endl;
+ cout << " - units : "<<myField->getMEDComponentUnit(i) << endl;
+ }
+ cout << "- iteration :" << endl ;
+ cout << " - numero : " << myField->getIterationNumber()<< endl ;
+ cout << " - ordre : " << myField->getOrderNumber()<< endl ;
+ cout << " - temps : " << myField->getTime()<< endl ;
+
+ cout << "- Type : " << myField->getValueType()<< endl;
+ /*
+ cout << "- Valeurs :"<<endl;
+ int NumberOf = mySupport->getNumberOfElements(MED_ALL_ELEMENTS);
+
+ for (int i=1; i<NumberOf+1; i++) {
+ double * value = myField->getValueI(MED_FULL_INTERLACE,i) ;
+ for (int j=0; j<NumberOfComponents; j++)
+ cout << value[j]<< " ";
+ cout<<endl;
+ }
+ */
+ cout << "- Adresse support : " << mySupport << endl;
+}
+
+
+int main (int argc, char ** argv) {
+
+ int read;
+
+ if ((argc !=3) && (argc != 4)) {
+ cerr << "Usage : " << argv[0]
+ << " filename meshname fieldname" << endl << endl;
+ exit(-1);
+ }
+
+ string filename = argv[1] ;
+ string meshname = argv[2] ;
+
+ // MESH * myMesh= new MESH(MED_DRIVER,filename,meshname) ;
+ MESH * myMesh= new MESH() ;
+ myMesh->setName(meshname);
+ MED_MESH_RDONLY_DRIVER myMeshDriver(filename,myMesh) ;
+ myMeshDriver.setMeshName(meshname);
+ myMeshDriver.open() ;
+ myMeshDriver.read() ;
+ myMeshDriver.close() ;
+
+ // int drv = myMesh->addDriver(MED_DRIVER,"sortie.med",meshname);
+ // myMesh->write(drv);
+
+
+
+
+ // if (argc < 4) return 0;
+
+ // read field :
+
+ if (argc != 4) exit(0) ;
+ // else we have a field !
+
+ string fieldname = argv[3];
+
+
+ // SUPPORT * mySupport = new SUPPORT(myMesh,"On_all_node",MED_NODE);
+ SUPPORT * mySupport = new SUPPORT(myMesh,"On_all_cell",MED_CELL);
+ FIELD<double> * myField = new FIELD<double>() ;
+
+ myField->setName(fieldname);
+ myField->setSupport(mySupport);
+ MED_FIELD_RDONLY_DRIVER<double> myFieldDriver(filename,myField) ;
+ myFieldDriver.setFieldName(fieldname);
+ myFieldDriver.open() ;
+
+ try {
+ myFieldDriver.read() ;
+ } catch (...) {
+ delete mySupport ;
+ mySupport = new SUPPORT(myMesh,"On_all_node",MED_NODE);
+ myField->setSupport(mySupport);
+ try {
+ myFieldDriver.read() ;
+ } catch (...) {
+ cout << "Field " << fieldname << " not found !!!" << endl ;
+ exit (-1) ;
+ }
+ }
+
+ myFieldDriver.close() ;
+
+ FIELD_ * pt_field_ = myField;
+ affiche_field(pt_field_, mySupport);
+ FIELD_ * pt_field_2 = new FIELD_(* pt_field_);
+ delete myField;
+ affiche_field(pt_field_2, pt_field_2->getSupport());
+
+ return 0;
+}
--- /dev/null
+using namespace std;
+#include<string>
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "MEDMEM_Exception.hxx"
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Family.hxx"
+#include "MEDMEM_Group.hxx"
+
+#include "MEDMEM_MedMeshDriver.hxx"
+#include "MEDMEM_MedFieldDriver.hxx"
+#include "MEDMEM_Support.hxx"
+#include "MEDMEM_Field.hxx"
+#include "MEDMEM_define.hxx"
+
+
+void affiche_support(SUPPORT * mySupport)
+{
+ cout << " - Name : "<<mySupport->getName().c_str()<<endl ;
+ cout << " - Description : "<<mySupport->getDescription().c_str()<<endl ;
+ cout << " - Entity : "<<mySupport->getEntity()<<endl ;
+ cout << " - Entities list : "<<endl ;
+ if (!(mySupport->isOnAllElements())) {
+ int NumberOfTypes = mySupport->getNumberOfTypes() ;
+ cout<<" - NumberOfTypes : "<<NumberOfTypes<<endl;
+ medGeometryElement * Types = mySupport->getTypes() ;
+ for (int j=0;j<NumberOfTypes;j++) {
+ cout<<" * Type "<<Types[j]<<" : ";
+ int NumberOfElements = mySupport->getNumberOfElements(Types[j]) ;
+ int * Number = mySupport->getNumber(Types[j]) ;
+ for (int k=0; k<NumberOfElements;k++)
+ cout << Number[k] << " ";
+ cout << endl ;
+ }
+ } else
+ cout << " Is on all entities !"<< endl;
+}
+
+
+void affiche_famille(FAMILY * myFamily)
+{
+ affiche_support(myFamily);
+ cout << " - Identifier : "<<myFamily->getIdentifier()<<endl ;
+ int NumberOfAttributes = myFamily->getNumberOfAttributes() ;
+ cout << " - Attributes ("<<NumberOfAttributes<<") :"<<endl;
+ for (int j=1;j<NumberOfAttributes+1;j++)
+ cout << " * "<<myFamily->getAttributeIdentifier(j)<<" : "<<myFamily->getAttributeValue(j)<<", "<<myFamily->getAttributeDescription(j).c_str()<<endl ;
+ int NumberOfGroups = myFamily->getNumberOfGroups() ;
+ cout << " - Groups ("<<NumberOfGroups<<") :"<<endl;
+ for (int j=1;j<NumberOfGroups+1;j++)
+ cout << " * "<<myFamily->getGroupName(j).c_str()<<endl ;
+}
+
+void affiche_groupe(GROUP * myGroup)
+{
+ affiche_support(myGroup);
+ int NumberOfFamillies = myGroup->getNumberOfFamilies() ;
+ cout << " - Families ("<<NumberOfFamillies<<") :"<<endl;
+ for (int j=1;j<NumberOfFamillies+1;j++)
+ cout << " * "<<myGroup->getFamily(j)->getName().c_str()<<endl ;
+}
+
+int main (int argc, char ** argv) {
+
+ int read;
+
+ if (argc !=3) {
+ cerr << "Usage : " << argv[0]
+ << " filename meshname" << endl << endl;
+ exit(-1);
+ }
+
+ string filename = argv[1] ;
+ string meshname = argv[2] ;
+
+ MESH * myMesh= new MESH() ;
+ myMesh->setName(meshname);
+ MED_MESH_RDONLY_DRIVER myMeshDriver(filename,myMesh) ;
+ myMeshDriver.setMeshName(meshname);
+ myMeshDriver.open() ;
+ myMeshDriver.read() ;
+ myMeshDriver.close() ;
+
+ GROUP * myGroup = myMesh->getGroup(MED_NODE,1);
+ cout << "Show Group :"<<endl ;
+ affiche_groupe(myGroup);
+ GROUP * myGroup2 = new GROUP(* myGroup);
+ delete myGroup;
+ affiche_groupe(myGroup2);
+ delete myGroup2;
+
+ return 0;
+}
--- /dev/null
+using namespace std;
+/* Programme de test du constructeur de copies de la classe MEDARRAY de MEDMEM
+ jroy - 16/12/2002 */
+
+#include <string>
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "MEDMEM_Exception.hxx"
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Family.hxx"
+#include "MEDMEM_Group.hxx"
+
+#include "MEDMEM_MedMeshDriver.hxx"
+#include "MEDMEM_MedFieldDriver.hxx"
+#include "MEDMEM_Support.hxx"
+#include "MEDMEM_Field.hxx"
+#include "MEDMEM_define.hxx"
+
+
+void affiche_medarray(MEDARRAY<double> & myMedArray)
+{
+ int numberof ;
+ MESSAGE("Show all 1 :");
+ numberof = myMedArray.getLeadingValue() ;
+ for (int i=1; i<=myMedArray.getLengthValue() ; i++) {
+ double * node = myMedArray.getI(MED_FULL_INTERLACE,i) ;
+ cout << " - " ;
+ for (int j=0;j<numberof;j++)
+ cout << node[j] << " " ;
+ cout << endl ;
+ }
+ MESSAGE("Show all 2 :");
+ numberof = myMedArray.getLengthValue() ;
+ for (int i=1; i<=myMedArray.getLeadingValue() ; i++) {
+ double * node = myMedArray.getI(MED_NO_INTERLACE,i) ;
+ cout << " - " ;
+ for (int j=0;j<numberof;j++)
+ cout << node[j] << " " ;
+ cout << endl ;
+ }
+ MESSAGE("Show all 3 :");
+ numberof = myMedArray.getLeadingValue() ;
+ for (int i=1; i<=myMedArray.getLengthValue() ; i++) {
+ cout << " - " ;
+ for (int j=1;j<numberof+1;j++)
+ cout << myMedArray.getIJ(i,j) << " " ;
+ cout << endl ;
+ }
+
+ MESSAGE("Show all 0 :");
+ numberof = myMedArray.getLeadingValue() ;
+ int length = myMedArray.getLengthValue() ;
+ double * NoInterlaceArray = myMedArray.get(MED_NO_INTERLACE) ;
+ for (int i=0; i<length ; i++) {
+ cout << " - " ;
+ for (int j=0;j<numberof;j++)
+ cout << NoInterlaceArray[j*length+i] << " " ;
+ cout << endl ;
+ }
+
+
+ /*
+ cout << "Nombre de lignes : " << myMedArray.getLengthValue() << endl;
+ cout << "Nombre de colonnes : " << myMedArray.getLeadingValue() << endl;
+ cout << "Mode d'écriture en mémoire : " << myMedArray.getMode() << endl;
+ cout << "Valeurs (_valuesDefault) :" << endl;
+
+ for (med_int i=1; i<=myMedArray.getLengthValue(); i++) {
+ for (med_int j=1; j<=myMedArray.getLeadingValue(); j++)
+ cout << i << " " << j << " " << myMedArray.getIJ(i,j) << " " << endl;
+ }
+ */
+}
+
+
+int main (int argc, char ** argv) {
+
+ /*
+ if ((argc !=3) && (argc != 4)) {
+ cerr << "Usage : " << argv[0]
+ << " filename meshname fieldname" << endl << endl;
+ exit(-1);
+ }
+ */
+ const med_int nb_noeuds = 8;
+ const med_int dimension = 3;
+ const medModeSwitch mode = MED_NO_INTERLACE;
+
+
+ MEDARRAY<double> * myMedArray = new MEDARRAY<double>(dimension,nb_noeuds,mode);
+ for (med_int i=1; i<=myMedArray->getLengthValue(); i++) {
+ for (med_int j=1; j<=myMedArray->getLeadingValue(); j++)
+ myMedArray->setIJ(i,j,(double) random());
+ };
+
+ affiche_medarray(* myMedArray);
+ MEDARRAY<double> * myMedArray2 = new MEDARRAY<double>(* myMedArray);
+ delete myMedArray;
+ affiche_medarray(* myMedArray2);
+ delete myMedArray2;
+
+ return 0;
+}
--- /dev/null
+using namespace std;
+#include<string>
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "MEDMEM_Exception.hxx"
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Family.hxx"
+#include "MEDMEM_Group.hxx"
+
+#include "MEDMEM_MedMeshDriver.hxx"
+#include "MEDMEM_MedFieldDriver.hxx"
+#include "MEDMEM_Support.hxx"
+#include "MEDMEM_Field.hxx"
+#include "MEDMEM_define.hxx"
+
+
+void affiche_support(SUPPORT * mySupport)
+{
+ cout << " - Name : "<<mySupport->getName().c_str()<<endl ;
+ cout << " - Description : "<<mySupport->getDescription().c_str()<<endl ;
+ cout << " - Entity : "<<mySupport->getEntity()<<endl ;
+ cout << " - Entities list : "<<endl ;
+ if (!(mySupport->isOnAllElements())) {
+ int NumberOfTypes = mySupport->getNumberOfTypes() ;
+ cout<<" - NumberOfTypes : "<<NumberOfTypes<<endl;
+ medGeometryElement * Types = mySupport->getTypes() ;
+ for (int j=0;j<NumberOfTypes;j++) {
+ cout<<" * Type "<<Types[j]<<" : ";
+ int NumberOfElements = mySupport->getNumberOfElements(Types[j]) ;
+ int * Number = mySupport->getNumber(Types[j]) ;
+ for (int k=0; k<NumberOfElements;k++)
+ cout << Number[k] << " ";
+ cout << endl ;
+ }
+ } else
+ cout << " Is on all entities !"<< endl;
+}
+
+
+void affiche_famille(MESH *myMesh,medEntityMesh Entity)
+{
+ int NumberOfFamilies = myMesh->getNumberOfFamilies(Entity) ;
+ cout << "NumberOfFamilies : "<<NumberOfFamilies<<endl;
+ for (int i=1; i<NumberOfFamilies+1;i++) {
+ FAMILY* myFamily = myMesh->getFamily(Entity,i);
+ affiche_support(myFamily);
+ cout << " - Identifier : "<<myFamily->getIdentifier()<<endl ;
+ int NumberOfAttributes = myFamily->getNumberOfAttributes() ;
+ cout << " - Attributes ("<<NumberOfAttributes<<") :"<<endl;
+ for (int j=1;j<NumberOfAttributes+1;j++)
+ cout << " * "<<myFamily->getAttributeIdentifier(j)<<" : "<<myFamily->getAttributeValue(j)<<", "<<myFamily->getAttributeDescription(j).c_str()<<endl ;
+ int NumberOfGroups = myFamily->getNumberOfGroups() ;
+ cout << " - Groups ("<<NumberOfGroups<<") :"<<endl;
+ for (int j=1;j<NumberOfGroups+1;j++)
+ cout << " * "<<myFamily->getGroupName(j).c_str()<<endl ;
+ }
+}
+
+void affiche_groupe(MESH *myMesh,medEntityMesh Entity)
+{
+ int NumberOfGroups = myMesh->getNumberOfGroups(Entity) ;
+ cout << "NumberOfGroups : "<<NumberOfGroups<<endl;
+ for (int i=1; i<NumberOfGroups+1;i++) {
+ GROUP* myGroup = myMesh->getGroup(Entity,i);
+ affiche_support(myGroup);
+ int NumberOfFamillies = myGroup->getNumberOfFamilies() ;
+ cout << " - Families ("<<NumberOfFamillies<<") :"<<endl;
+ for (int j=1;j<NumberOfFamillies+1;j++)
+ cout << " * "<<myGroup->getFamily(j)->getName().c_str()<<endl ;
+ }
+}
+
+int main (int argc, char ** argv) {
+
+ int read;
+
+ if (argc !=3) {
+ cerr << "Usage : " << argv[0]
+ << " filename meshname" << endl << endl;
+ exit(-1);
+ }
+
+ string filename = argv[1] ;
+ string meshname = argv[2] ;
+
+ MESH * myMesh= new MESH() ;
+ myMesh->setName(meshname);
+ MED_MESH_RDONLY_DRIVER myMeshDriver(filename,myMesh) ;
+ myMeshDriver.setMeshName(meshname);
+ myMeshDriver.open() ;
+ myMeshDriver.read() ;
+ myMeshDriver.close() ;
+
+ //Construction d'un support total
+ SUPPORT * mySupport = new SUPPORT(myMesh,"Support on CELLs",MED_CELL);
+
+ cout << "Show Support on all :"<<endl ;
+ affiche_support(mySupport);
+ SUPPORT * mySupport2 = new SUPPORT(* mySupport);
+ delete mySupport;
+ affiche_support(mySupport2);
+ delete mySupport2;
+
+ //Construction d'un support partiel
+ mySupport = new SUPPORT(myMesh,"Support on CELLs",MED_CELL);
+ mySupport->setAll(false);
+
+ // int NumberOfGeometricType = 1;
+ int NumberOfGeometricType = 0;
+ // int TotalNumberOfEntity = 2;
+ // medGeometryElement * GeometricTypePartial = new medGeometryElement[NumberOfGeometricType];
+ // GeometricTypePartial[0] = MED_HEXA8;
+ medGeometryElement * GeometricType = myMesh->getTypes(MED_CELL);
+ int TotalNumberOfEntity = 0;
+ int * NumberOfEntity = new int[myMesh->getNumberOfTypes(MED_CELL)];
+ // NumberOfEntity[0] = 2;
+ // int * NumberValue = new int[TotalNumberOfEntity];
+ int * NumberValue = new int[myMesh->getGlobalNumberingIndex(MED_CELL)[myMesh->getNumberOfTypes(MED_CELL)]-1];
+ // NumberValue[0] = 14;
+ // NumberValue[1] = 15;
+ int cmp = 0;
+ medGeometryElement * GeometricTypePartial = new medGeometryElement[myMesh->getNumberOfTypes(MED_CELL)];
+ for (int i=0;i<myMesh->getNumberOfTypes(MED_CELL);i=i+2)
+ {
+ NumberOfGeometricType=NumberOfGeometricType+1;
+ TotalNumberOfEntity=TotalNumberOfEntity+myMesh->getNumberOfElements(MED_CELL,GeometricType[i]);
+ NumberOfEntity[i/2]=myMesh->getNumberOfElements(MED_CELL,GeometricType[i]);
+ for (int j=0;j<myMesh->getNumberOfElements(MED_CELL,GeometricType[i]);j++)
+ {
+ NumberValue[cmp]=myMesh->getGlobalNumberingIndex(MED_CELL)[i]+j;
+ cmp=cmp+1;
+ }
+ GeometricTypePartial[i/2]=GeometricType[i];
+ }
+
+ mySupport->setpartial("Support partiel",NumberOfGeometricType,TotalNumberOfEntity,GeometricTypePartial,NumberOfEntity,NumberValue);
+
+ cout << "Show Partial Support :"<<endl ;
+ affiche_support(mySupport);
+ mySupport2 = new SUPPORT(* mySupport);
+ delete mySupport;
+ affiche_support(mySupport2);
+ delete mySupport2;
+
+ /*
+ cout << "Show Family :"<<endl ;
+ affiche_famille(myMesh,MED_NODE);
+ affiche_famille(myMesh,MED_CELL);
+ affiche_famille(myMesh,MED_FACE);
+ affiche_famille(myMesh,MED_EDGE);
+
+ cout << "Show Group :"<<endl ;
+ affiche_groupe(myMesh,MED_NODE);
+ affiche_groupe(myMesh,MED_CELL);
+ affiche_groupe(myMesh,MED_FACE);
+ affiche_groupe(myMesh,MED_EDGE);
+ */
+ return 0;
+}
--- /dev/null
+using namespace std;
+#include "MEDMEM_SWIG_MedFieldDoubleDriver.hxx"
+
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+MED_FIELDDOUBLE_DRIVER::MED_FIELDDOUBLE_DRIVER() : MED_FIELD_DRIVER<double>()
+{
+ BEGIN_OF("Default Constructor (for Python API) MED_FIELDDOUBLE_DRIVER");
+
+ END_OF("Default Constructor (for Python API) MED_FIELDDOUBLE_DRIVER");
+}
+//=============================================================================
+/*!
+ * Constructor with arguments
+ */
+//=============================================================================
+MED_FIELDDOUBLE_DRIVER::MED_FIELDDOUBLE_DRIVER(const string & fileName,
+ FIELDDOUBLE * ptrField,
+ med_mode_acces accessMode) :
+ MED_FIELD_DRIVER<double>(fileName,(FIELD<double> *) ptrField,accessMode)
+{
+ BEGIN_OF("Constructor with arguments (for Python API) MED_FIELDDOUBLE_DRIVER");
+
+ END_OF("Constructor with arguments (for Python API) MED_FIELDDOUBLE_DRIVER");
+}
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+MED_FIELDDOUBLE_DRIVER::~MED_FIELDDOUBLE_DRIVER()
+{
+ BEGIN_OF("Default Destructor (for Python API) MED_FIELDDOUBLE_DRIVER");
+
+ END_OF("Default Destructor (for Python API) MED_FIELDDOUBLE_DRIVER");
+}
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+MED_FIELDDOUBLE_RDONLY_DRIVER::MED_FIELDDOUBLE_RDONLY_DRIVER() :
+ MED_FIELD_RDONLY_DRIVER<double>()
+{
+ BEGIN_OF("Default Constructor (for Python API) MED_FIELDDOUBLE_RDONLY_DRIVER");
+
+ END_OF("Default Constructor (for Python API) MED_FIELDDOUBLE_RDONLY_DRIVER");
+}
+//=============================================================================
+/*!
+ * Constructor with arguments
+ */
+//=============================================================================
+MED_FIELDDOUBLE_RDONLY_DRIVER::MED_FIELDDOUBLE_RDONLY_DRIVER(const string & fileName,
+ FIELDDOUBLE * ptrField) :
+ MED_FIELD_RDONLY_DRIVER<double>(fileName,(FIELD<double> *) ptrField)
+{
+ BEGIN_OF("Constructor with arguments (for Python API) MED_FIELDDOUBLE_RDONLY_DRIVER");
+
+ END_OF("Constructor with arguments (for Python API) MED_FIELDDOUBLE_RDONLY_DRIVER");
+}
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+MED_FIELDDOUBLE_RDONLY_DRIVER::~MED_FIELDDOUBLE_RDONLY_DRIVER()
+{
+ BEGIN_OF("Default Destructor (for Python API) MED_FIELDDOUBLE_RDONLY_DRIVER");
+
+ END_OF("Default Destructor (for Python API) MED_FIELDDOUBLE_RDONLY_DRIVER");
+}
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+MED_FIELDDOUBLE_WRONLY_DRIVER::MED_FIELDDOUBLE_WRONLY_DRIVER() :
+ MED_FIELD_WRONLY_DRIVER<double>()
+{
+ BEGIN_OF("Default Constructor (for Python API) MED_FIELDDOUBLE_WRONLY_DRIVER");
+
+ END_OF("Default Constructor (for Python API) MED_FIELDDOUBLE_WRONLY_DRIVER");
+}
+//=============================================================================
+/*!
+ * Constructor with arguments
+ */
+//=============================================================================
+MED_FIELDDOUBLE_WRONLY_DRIVER::MED_FIELDDOUBLE_WRONLY_DRIVER(const string & fileName,
+ FIELDDOUBLE * ptrField) :
+ MED_FIELD_WRONLY_DRIVER<double>(fileName,(FIELD<double> *) ptrField)
+{
+ BEGIN_OF("Constructor with arguments (for Python API) MED_FIELDDOUBLE_WRONLY_DRIVER");
+
+ END_OF("Constructor with arguments (for Python API) MED_FIELDDOUBLE_WRONLY_DRIVER");
+}
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+MED_FIELDDOUBLE_WRONLY_DRIVER::~MED_FIELDDOUBLE_WRONLY_DRIVER()
+{
+ BEGIN_OF("Default Destructor (for Python API) MED_FIELDDOUBLE_WRONLY_DRIVER");
+
+ END_OF("Default Destructor (for Python API) MED_FIELDDOUBLE_WRONLY_DRIVER");
+}
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+MED_FIELDDOUBLE_RDWR_DRIVER::MED_FIELDDOUBLE_RDWR_DRIVER() :
+ MED_FIELD_RDWR_DRIVER<double>()
+{
+ BEGIN_OF("Default Constructor (for Python API) MED_FIELDDOUBLE_RDWR_DRIVER");
+
+ END_OF("Default Constructor (for Python API) MED_FIELDDOUBLE_RDWR_DRIVER");
+}
+//=============================================================================
+/*!
+ * Constructor with arguments
+ */
+//=============================================================================
+MED_FIELDDOUBLE_RDWR_DRIVER::MED_FIELDDOUBLE_RDWR_DRIVER(const string & fileName,
+ FIELDDOUBLE * ptrField) :
+ MED_FIELD_RDWR_DRIVER<double>(fileName,(FIELD<double> *) ptrField)
+{
+ BEGIN_OF("Constructor with arguments (for Python API) MED_FIELDDOUBLE_RDWR_DRIVER");
+
+ END_OF("Constructor with arguments (for Python API) MED_FIELDDOUBLE_RDWR_DRIVER");
+}
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+MED_FIELDDOUBLE_RDWR_DRIVER::~MED_FIELDDOUBLE_RDWR_DRIVER()
+{
+ BEGIN_OF("Default Destructor (for Python API) MED_FIELDDOUBLE_RDWR_DRIVER");
+
+ END_OF("Default Destructor (for Python API) MED_FIELDDOUBLE_RDWR_DRIVER");
+}
--- /dev/null
+#ifndef MEDMEM_SWIG_MEDFIELDDOUBLEDRIVER_HXX_
+#define MEDMEM_SWIG_MEDFIELDDOUBLEDRIVER_HXX_
+
+#include "MEDMEM_MedFieldDriver.hxx"
+#include "MEDMEM_SWIG_FieldDouble.hxx"
+
+class MED_FIELDDOUBLE_DRIVER : public MED_FIELD_DRIVER<double>
+{
+public:
+ MED_FIELDDOUBLE_DRIVER();
+
+ MED_FIELDDOUBLE_DRIVER(const string & fileName, FIELDDOUBLE * ptrField,
+ med_mode_acces accessMode);
+
+ ~MED_FIELDDOUBLE_DRIVER();
+};
+
+class MED_FIELDDOUBLE_RDONLY_DRIVER : public MED_FIELD_RDONLY_DRIVER<double>
+{
+public:
+ MED_FIELDDOUBLE_RDONLY_DRIVER();
+
+ MED_FIELDDOUBLE_RDONLY_DRIVER(const string & fileName,
+ FIELDDOUBLE * ptrField);
+
+ ~MED_FIELDDOUBLE_RDONLY_DRIVER();
+};
+
+class MED_FIELDDOUBLE_WRONLY_DRIVER : public MED_FIELD_WRONLY_DRIVER<double>
+{
+public:
+ MED_FIELDDOUBLE_WRONLY_DRIVER();
+
+ MED_FIELDDOUBLE_WRONLY_DRIVER(const string & fileName,
+ FIELDDOUBLE * ptrField);
+
+ ~MED_FIELDDOUBLE_WRONLY_DRIVER();
+};
+
+class MED_FIELDDOUBLE_RDWR_DRIVER : public MED_FIELD_RDWR_DRIVER<double>
+{
+public:
+ MED_FIELDDOUBLE_RDWR_DRIVER();
+
+ MED_FIELDDOUBLE_RDWR_DRIVER(const string & fileName,
+ FIELDDOUBLE * ptrField);
+
+ ~MED_FIELDDOUBLE_RDWR_DRIVER();
+};
+
+#endif /* MEDMEM_SWIG_MEDFIELDDOUBLEDRIVER_HXX_ */
--- /dev/null
+using namespace std;
+#include "MEDMEM_SWIG_MedFieldIntDriver.hxx"
+
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+MED_FIELDINT_DRIVER::MED_FIELDINT_DRIVER() : MED_FIELD_DRIVER<int>()
+{
+ BEGIN_OF("Default Constructor (for Python API) MED_FIELDINT_DRIVER");
+
+ END_OF("Default Constructor (for Python API) MED_FIELDINT_DRIVER");
+}
+//=============================================================================
+/*!
+ * Constructor with arguments
+ */
+//=============================================================================
+MED_FIELDINT_DRIVER::MED_FIELDINT_DRIVER(const string & fileName,
+ FIELDINT * ptrField,
+ med_mode_acces accessMode) :
+ MED_FIELD_DRIVER<int>(fileName,(FIELD<int> *) ptrField,accessMode)
+{
+ BEGIN_OF("Constructor with arguments (for Python API) MED_FIELDINT_DRIVER");
+
+ END_OF("Constructor with arguments (for Python API) MED_FIELDINT_DRIVER");
+}
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+MED_FIELDINT_DRIVER::~MED_FIELDINT_DRIVER()
+{
+ BEGIN_OF("Default Destructor (for Python API) MED_FIELDINT_DRIVER");
+
+ END_OF("Default Destructor (for Python API) MED_FIELDINT_DRIVER");
+}
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+MED_FIELDINT_RDONLY_DRIVER::MED_FIELDINT_RDONLY_DRIVER() :
+ MED_FIELD_RDONLY_DRIVER<int>()
+{
+ BEGIN_OF("Default Constructor (for Python API) MED_FIELDINT_RDONLY_DRIVER");
+
+ END_OF("Default Constructor (for Python API) MED_FIELDINT_RDONLY_DRIVER");
+}
+//=============================================================================
+/*!
+ * Constructor with arguments
+ */
+//=============================================================================
+MED_FIELDINT_RDONLY_DRIVER::MED_FIELDINT_RDONLY_DRIVER(const string & fileName,
+ FIELDINT * ptrField) :
+ MED_FIELD_RDONLY_DRIVER<int>(fileName,(FIELD<int> *) ptrField)
+{
+ BEGIN_OF("Constructor with arguments (for Python API) MED_FIELDINT_RDONLY_DRIVER");
+
+ END_OF("Constructor with arguments (for Python API) MED_FIELDINT_RDONLY_DRIVER");
+}
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+MED_FIELDINT_RDONLY_DRIVER::~MED_FIELDINT_RDONLY_DRIVER()
+{
+ BEGIN_OF("Default Destructor (for Python API) MED_FIELDINT_RDONLY_DRIVER");
+
+ END_OF("Default Destructor (for Python API) MED_FIELDINT_RDONLY_DRIVER");
+}
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+MED_FIELDINT_WRONLY_DRIVER::MED_FIELDINT_WRONLY_DRIVER() :
+ MED_FIELD_WRONLY_DRIVER<int>()
+{
+ BEGIN_OF("Default Constructor (for Python API) MED_FIELDINT_WRONLY_DRIVER");
+
+ END_OF("Default Constructor (for Python API) MED_FIELDINT_WRONLY_DRIVER");
+}
+//=============================================================================
+/*!
+ * Constructor with arguments
+ */
+//=============================================================================
+MED_FIELDINT_WRONLY_DRIVER::MED_FIELDINT_WRONLY_DRIVER(const string & fileName,
+ FIELDINT * ptrField) :
+ MED_FIELD_WRONLY_DRIVER<int>(fileName,(FIELD<int> *) ptrField)
+{
+ BEGIN_OF("Constructor with arguments (for Python API) MED_FIELDINT_WRONLY_DRIVER");
+
+ END_OF("Constructor with arguments (for Python API) MED_FIELDINT_WRONLY_DRIVER");
+}
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+MED_FIELDINT_WRONLY_DRIVER::~MED_FIELDINT_WRONLY_DRIVER()
+{
+ BEGIN_OF("Default Destructor (for Python API) MED_FIELDINT_WRONLY_DRIVER");
+
+ END_OF("Default Destructor (for Python API) MED_FIELDINT_WRONLY_DRIVER");
+}
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+MED_FIELDINT_RDWR_DRIVER::MED_FIELDINT_RDWR_DRIVER() :
+ MED_FIELD_RDWR_DRIVER<int>()
+{
+ BEGIN_OF("Default Constructor (for Python API) MED_FIELDINT_RDWR_DRIVER");
+
+ END_OF("Default Constructor (for Python API) MED_FIELDINT_RDWR_DRIVER");
+}
+//=============================================================================
+/*!
+ * Constructor with arguments
+ */
+//=============================================================================
+MED_FIELDINT_RDWR_DRIVER::MED_FIELDINT_RDWR_DRIVER(const string & fileName,
+ FIELDINT * ptrField) :
+ MED_FIELD_RDWR_DRIVER<int>(fileName,(FIELD<int> *) ptrField)
+{
+ BEGIN_OF("Constructor with arguments (for Python API) MED_FIELDINT_RDWR_DRIVER");
+
+ END_OF("Constructor with arguments (for Python API) MED_FIELDINT_RDWR_DRIVER");
+}
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+MED_FIELDINT_RDWR_DRIVER::~MED_FIELDINT_RDWR_DRIVER()
+{
+ BEGIN_OF("Default Destructor (for Python API) MED_FIELDINT_RDWR_DRIVER");
+
+ END_OF("Default Destructor (for Python API) MED_FIELDINT_RDWR_DRIVER");
+}
--- /dev/null
+#ifndef MEDMEM_SWIG_MEDFIELDINTDRIVER_HXX_
+#define MEDMEM_SWIG_MEDFIELDINTDRIVER_HXX_
+
+#include "MEDMEM_MedFieldDriver.hxx"
+#include "MEDMEM_SWIG_FieldInt.hxx"
+
+class MED_FIELDINT_DRIVER : public MED_FIELD_DRIVER<int>
+{
+public:
+ MED_FIELDINT_DRIVER();
+
+ MED_FIELDINT_DRIVER(const string & fileName, FIELDINT * ptrField,
+ med_mode_acces accessMode);
+
+ ~MED_FIELDINT_DRIVER();
+};
+
+class MED_FIELDINT_RDONLY_DRIVER : public MED_FIELD_RDONLY_DRIVER<int>
+{
+public:
+ MED_FIELDINT_RDONLY_DRIVER();
+
+ MED_FIELDINT_RDONLY_DRIVER(const string & fileName,
+ FIELDINT * ptrField);
+
+ ~MED_FIELDINT_RDONLY_DRIVER();
+};
+
+class MED_FIELDINT_WRONLY_DRIVER : public MED_FIELD_WRONLY_DRIVER<int>
+{
+public:
+ MED_FIELDINT_WRONLY_DRIVER();
+
+ MED_FIELDINT_WRONLY_DRIVER(const string & fileName,
+ FIELDINT * ptrField);
+
+ ~MED_FIELDINT_WRONLY_DRIVER();
+};
+
+class MED_FIELDINT_RDWR_DRIVER : public MED_FIELD_RDWR_DRIVER<int>
+{
+public:
+ MED_FIELDINT_RDWR_DRIVER();
+
+ MED_FIELDINT_RDWR_DRIVER(const string & fileName,
+ FIELDINT * ptrField);
+
+ ~MED_FIELDINT_RDWR_DRIVER();
+};
+
+#endif /* MEDMEM_SWIG_MEDFIELDINTDRIVER_HXX_ */