+using namespace std;
//=============================================================================
// File : MedGUI.cxx
// Project : SALOME
#include "QAD_Tools.h"
#include "QAD_FileDlg.h"
+//#include "SMESH_TypeFilter.hxx"
+
// QT Includes
#include <qinputdialog.h>
SCRUTE(file);
try
{
- medgen->readStructFile(file.latin1(),myStudyName);
+// medgen->readStructFile(file.latin1(),myStudyName);
+ medgen->readStructFileWithFieldType(file.latin1(),myStudyName);
if (myActiveStudy->getStudyDocument()->GetProperties()->IsLocked()) {
QAD_MessageBox::warn1 ((QWidget*)QAD_Application::getDesktop(),
QObject::tr("WRN_WARNING"),
aMesh = SALOME_MED::MESH::_narrow( _orb->string_to_object(anIOR->Value()) );
if ( aMesh->_is_nil() )
{
- // aM = SMESH::SMESH_Mesh::_narrow(_orb->string_to_object(anIOR->Value()));
- // if ( aM->_is_nil() )
- // {
- // QAD_MessageBox::warn1
- // ( QAD_Application::getDesktop(),
- // tr ("MED_WRN_WARNING"),
- // tr ("MED_INF_NOTIMPL"),
- // tr ("MED_BUT_OK") );
- // break;
- // }
- // aMesh = aM->GetMEDMesh();
+ // aM = SMESH::SMESH_Mesh::_narrow(_orb->string_to_object(anIOR->Value()));
+ // if ( aM->_is_nil() )
+ // {
+ // QAD_MessageBox::warn1
+ // ( QAD_Application::getDesktop(),
+ // tr ("MED_WRN_WARNING"),
+ // tr ("MED_INF_NOTIMPL"),
+ // tr ("MED_BUT_OK") );
+ // break;
+ // }
+ // aMesh = aM->GetMEDMesh();
if ( aMesh->_is_nil() )
{
QAD_MessageBox::warn1
tr ("MED_BUT_OK") );
break;
}
- }
- DumpMesh( aMesh );
+ }
+ DumpMesh( aMesh );
//Sel->ClearFilters() ;
}
else
{
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
// aSubM = SMESH::SMESH_subMesh::_narrow( _orb->string_to_object(anIOR->Value()) );
- // if ( aSubM->_is_nil() )
- // {
- // aFam=SALOME_MED::FAMILY::_narrow( _orb->string_to_object(anIOR->Value()));
- // if ( aFam->_is_nil() )
- // {
- // QAD_MessageBox::warn1
- // ( QAD_Application::getDesktop(),
- // tr ("MED_WRN_WARNING"),
- // tr ("MED_INF_NOTIMPL"),
- // tr ("MED_BUT_OK") );
- // break;
- // }
- // DumpSubMesh( aFam );
- // }
- // else
- // {
- // DumpSubMesh( aSubM );
- //Sel->ClearFilters() ;
- // }
+ // if ( aSubM->_is_nil() )
+ // {
+ // aFam=SALOME_MED::FAMILY::_narrow( _orb->string_to_object(anIOR->Value()));
+ // if ( aFam->_is_nil() )
+ // {
+ // QAD_MessageBox::warn1
+ // ( QAD_Application::getDesktop(),
+ // tr ("MED_WRN_WARNING"),
+ // tr ("MED_INF_NOTIMPL"),
+ // tr ("MED_BUT_OK") );
+ // break;
+ // }
+ // DumpSubMesh( aFam );
+ // }
+ // else
+ // {
+ // DumpSubMesh( aSubM );
+ //Sel->ClearFilters() ;
+ // }
}
else
{
*
*/
//=============================================================================
-//bool MedGUI::DumpSubMesh( SMESH::SMESH_subMesh_ptr aSubMesh )
-//{
-// if ( aSubMesh->_is_nil() )
-// return false;
-//
-// SALOME_MED::FAMILY_var Fam = aSubMesh->GetFamily();
-// if ( Fam->_is_nil() )
-// return false;
-//
-// Engines::long_array_var tabnoeuds=Fam->getNumber(SALOME_MED::MED_NONE);
-// for (int l=0;l<tabnoeuds->length();l++)
-// SCRUTE(tabnoeuds[l]);
-//
-// return true;
-//}
+// bool MedGUI::DumpSubMesh( SMESH::SMESH_subMesh_ptr aSubMesh )
+// {
+// if ( aSubMesh->_is_nil() )
+// return false;
+
+// SALOME_MED::FAMILY_var Fam = aSubMesh->GetFamily();
+// if ( Fam->_is_nil() )
+// return false;
+
+// Engines::long_array_var tabnoeuds=Fam->getNumber(SALOME_MED::MED_NONE);
+// for (int l=0;l<tabnoeuds->length();l++)
+// SCRUTE(tabnoeuds[l]);
+
+// return true;
+// }
//=============================================================================
/*!
*
#include "MEDMEM_Exception.hxx"
#include "MEDMEM_define.hxx"
+#include "MEDMEM_PointerOf.hxx"
#include "utilities.h"
using namespace MED_EN;
// for our purpose in the MED++ library
{
private :
- med_int _ld_values ; // leading dimension of value (example : space dimension with coordinates)
- med_int _length_values ; // length of values (example : number of nodes with coordinates)
- medModeSwitch _mode; // data access mode:
- // MED_FULL_INTERLACE (default mode)
- // or MED_NO_INTERLACE
- T * _valuesDefault ; // in _mode representation
- T * _valuesOther ; // in other _mode
+ med_int _ldValues; // leading dimension of value (example : space dimension with coordinates)
+ med_int _lengthValues; // length of values (example : number of nodes with coordinates)
+ medModeSwitch _mode; // data access mode:
+ // MED_FULL_INTERLACE (default mode)
+ // or MED_NO_INTERLACE
+ PointerOf <T> _valuesDefault; // in _mode representation
+ PointerOf <T> _valuesOther; // in other _mode representation
public :
- MEDARRAY():_ld_values(0),_length_values(0),_mode(MED_FULL_INTERLACE),_valuesDefault((T*)NULL),_valuesOther((T*)NULL)
+ MEDARRAY(): _ldValues(0), _lengthValues(0), _mode(MED_FULL_INTERLACE),
+ _valuesDefault(), _valuesOther()
{
};
~MEDARRAY()
{
- if (_valuesDefault)
- delete [] _valuesDefault ;
- if (_valuesOther)
- delete [] _valuesOther ;
};
MEDARRAY( T*values, const med_int ld_values,
const med_int length_values, const medModeSwitch mode=MED_FULL_INTERLACE) ;
- inline med_int getLeadingValue() ; // as Space Dimension with coordinates
- inline med_int getLengthValue() ; // as Number of Nodes with coordinates
+ MEDARRAY(MEDARRAY const &m );
+
+ inline med_int getLeadingValue() const; // as Space Dimension with coordinates
+ inline med_int getLengthValue() const; // as Number of Nodes with coordinates
- T * const get(medModeSwitch mode) ;
- T* const getI(medModeSwitch mode,med_int i) ;
- T getIJ(med_int i, med_int j) const ;
+ T * const get (const medModeSwitch mode) ;
+ T * const getI (const medModeSwitch mode, const med_int i) ;
+ T const getIJ (const med_int i, const med_int j) const;
// need by write, to get default mode !
inline medModeSwitch getMode() const ;
- void set(medModeSwitch mode, T* value);
- void setI(medModeSwitch mode, med_int i, T* value);
- void setIJ(med_int i, med_int j, T value);
+ void set (medModeSwitch mode, T* value);
+ void setI (medModeSwitch mode, med_int i, T* value);
+ void setIJ (med_int i, med_int j, T value);
private:
void calculateOther() ;
template <class T> MEDARRAY<T>::MEDARRAY(const med_int ld_values,
const med_int length_values,
- const medModeSwitch mode = MED_FULL_INTERLACE): _ld_values(ld_values),_length_values(length_values),_mode(mode),_valuesOther((T*)NULL)
+ const medModeSwitch mode):
+ _ldValues(ld_values),
+ _lengthValues(length_values),
+ _mode(mode),
+ _valuesOther(),
+ _valuesDefault(length_values*ld_values)
{
- BEGIN_OF("constructor MEDARRAY<T>::MEDARRAY(const med_int , const med_int, const medModeSwitch (= MED_FULL_INTERLACE))");
-
- // if could not allocate ?
- if ((ld_values<1)|(length_values<1))
- throw MEDEXCEPTION( LOCALIZED("MEDARRAY<T>::MEDARRAY(const med_int, const med_int, const medModeSwitch) : dimension < 1 !"));
- _valuesDefault = new T[ld_values*length_values] ;
-
- SCRUTE(_valuesDefault);
+ BEGIN_OF("constructor MEDARRAY<T>::MEDARRAY(const med_int, const med_int, const medModeSwitch(= MED_FULL_INTERLACE))");
- SCRUTE(_valuesOther);
+ // if could not allocate
- SCRUTE(_ld_values);
-
- SCRUTE(_length_values);
+ if ((ld_values<1)|(length_values<1))
+ {
+ throw MEDEXCEPTION(LOCALIZED("MEDARRAY<T>::MEDARRAY(const med_int, const med_int, const medModeSwitch) : dimension < 1 !"));
+ }
+ SCRUTE((T*)_valuesDefault);
+ SCRUTE((T*)_valuesOther);
+ SCRUTE(_ldValues);
+ SCRUTE(_lengthValues);
SCRUTE(_mode);
- END_OF("constructor MEDARRAY<T>::MEDARRAY(const med_int , const med_int, const medModeSwitch (= MED_FULL_INTERLACE))");
+ END_OF("constructor MEDARRAY<T>::MEDARRAY(const med_int, const med_int, const medModeSwitch (= MED_FULL_INTERLACE))");
}
template <class T> MEDARRAY<T>::MEDARRAY( T*values,
const med_int ld_values,
const med_int length_values,
- const medModeSwitch mode=MED_FULL_INTERLACE): _ld_values(ld_values),_length_values(length_values),_mode(mode),_valuesOther((T*)NULL)
+ const medModeSwitch mode):
+ _ldValues(ld_values),
+ _lengthValues(length_values),
+ _mode(mode),
+ _valuesOther()
{
- _valuesDefault = values;
+ _valuesDefault.set(values);
}
-template <class T> inline med_int MEDARRAY<T>::getLeadingValue() {
- return _ld_values ;
+template <class T> MEDARRAY<T>::MEDARRAY(MEDARRAY<T> const & m ):
+ _ldValues(m._ldValues),
+ _lengthValues(m._lengthValues),
+ _mode(m._mode),
+ _valuesDefault((int)m._ldValues*m._lengthValues)
+{
+ if ( m._ldValues*m._lengthValues >= 0 )
+ {
+ memcpy((T*)_valuesDefault,(const T* const)m._valuesDefault,m._ldValues*m._lengthValues*sizeof(T));
+ }
+ if ((const T* const)(m._valuesOther) != NULL)
+ {
+ _valuesOther.set(m._ldValues*m._lengthValues);
+ memcpy((T*)_valuesOther,(const T* const)m._valuesOther,m._ldValues*m._lengthValues*sizeof(T));
+ }
+ else
+ {
+ _valuesOther.set(0);
+ }
+}
+
+template <class T> inline med_int MEDARRAY<T>::getLeadingValue() const
+{
+ return _ldValues ;
};
-template <class T> inline med_int MEDARRAY<T>::getLengthValue() {
- return _length_values ;
+
+template <class T> inline med_int MEDARRAY<T>::getLengthValue() const
+{
+ return _lengthValues ;
};
-template <class T> T* const MEDARRAY<T>::get(medModeSwitch mode)
+template <class T> T* const MEDARRAY<T>::get(const medModeSwitch mode)
{
- if (_valuesDefault != NULL)
- if (mode == _mode) {
- return _valuesDefault;
- }
- else {
- calculateOther() ;
- return _valuesOther ;
- }
+ if ((T*)_valuesDefault != NULL)
+ if (mode == _mode)
+ {
+ return _valuesDefault;
+ }
+ else
+ {
+ calculateOther() ;
+ return _valuesOther ;
+ }
throw MEDEXCEPTION("MEDARRAY::get(mode) : No values defined !");
}
-template <class T> T* const MEDARRAY<T>::getI(medModeSwitch mode,med_int i)
+template <class T> T* const MEDARRAY<T>::getI(const medModeSwitch mode,const med_int i)
{
- // 1<=i<=_length_values and return an array of _ld_values length
+ // 1<=i<=_lengthValues and return an array of _ldValues length
// if MED_FULL_INTERLACE
- // 1<=i<=_ld_values and return an array of _length_values length
+ // 1<=i<=_ldValues and return an array of _lengthValues length
// if MED_NO_INTERLACE
- if (_valuesDefault != NULL) {
+ if (i<=0)
+ throw MEDEXCEPTION("MEDARRAY::getI(mode,i) : argument i must be > 0");
+
+ if (( T* )_valuesDefault != NULL)
+ {
// if mode = MED_FULL_INTERLACE :
- int first = _ld_values ;
- int second = _length_values;
+ int first = _ldValues ;
+ int second = _lengthValues;
+
// else :
- if (mode == MED_NO_INTERLACE) {
- first = _length_values ;
- second = _ld_values ;
+ if (mode == MED_NO_INTERLACE)
+ {
+ first = _lengthValues ;
+ second = _ldValues ;
}
- if (i<=0)
- throw MEDEXCEPTION("MEDARRAY::getI(mode,i) : argument i must be > 0");
+
if (i>second)
throw MEDEXCEPTION("MEDARRAY::getI(mode,i) : argument i must be <= second");
+
if (mode == _mode)
return _valuesDefault + (i-1)*first ;
- else {
+ else
+ {
calculateOther() ;
return _valuesOther + (i-1)*first ;
- // return _valuesOther + (i-1)*second ;
}
}
throw MEDEXCEPTION("MEDARRAY::getI(mode,i) : No values defined !");
}
-template <class T> T MEDARRAY<T>::getIJ(med_int i, med_int j) const
+template <class T> T const MEDARRAY<T>::getIJ(const med_int i,const med_int j) const
{
- // 1<=i<=_length_values and 1<j<_ld_values
+ // 1<=i<=_lengthValues and 1<j<_ldValues
if (i<1)
throw MEDEXCEPTION("MEDARRAY::getIJ(i,j) : argument i must be >= 1");
- if (i>_length_values)
- throw MEDEXCEPTION("MEDARRAY::getIJ(i,j) : argument i must be <= _length_values");
+ if (i>_lengthValues)
+ throw MEDEXCEPTION("MEDARRAY::getIJ(i,j) : argument i must be <= _lengthValues");
if (j<1)
throw MEDEXCEPTION("MEDARRAY::getIJ(i,j) : argument j must be >= 1");
- if (j>_ld_values)
- throw MEDEXCEPTION("MEDARRAY::getIJ(i,j) : argument j must be <= _ld_values");
+ if (j>_ldValues)
+ throw MEDEXCEPTION("MEDARRAY::getIJ(i,j) : argument j must be <= _ldValues");
- if (_valuesDefault != NULL) {
+ if ( (const T* const)_valuesDefault != NULL)
+ {
switch (_mode)
- {
- case MED_FULL_INTERLACE :
+ {
+ case MED_FULL_INTERLACE :
{
- return _valuesDefault[(i-1)*_ld_values+j-1];
+ return _valuesDefault[(i-1)*_ldValues+j-1];
}
- case MED_NO_INTERLACE :
+ case MED_NO_INTERLACE :
{
- return _valuesDefault[(j-1)*_length_values+i-1];
+ return _valuesDefault[(j-1)*_lengthValues+i-1];
}
- }
- } else
- throw MEDEXCEPTION("MEDARRAY::getIJ(i,j) : No value in array !");
+ }
+ }
+ else
+ throw MEDEXCEPTION("MEDARRAY::getIJ(i,j) : No value in array !");
}
template <class T> inline medModeSwitch MEDARRAY<T>::getMode() const
BEGIN_OF("MEDARRAY<T>::set(mode,i,value)");
- _mode = mode ;
-
- SCRUTE(_ld_values);
- SCRUTE(_length_values);
- SCRUTE(_valuesDefault);
- SCRUTE(_valuesOther);
+ SCRUTE(_ldValues);
+ SCRUTE(_lengthValues);
+ SCRUTE((T*)_valuesDefault);
+ SCRUTE((T*)_valuesOther);
SCRUTE(_mode);
SCRUTE(mode);
SCRUTE(value);
- if (_valuesDefault != NULL)
- if (mode == _mode) {
- _valuesDefault = value ;
- if (_valuesOther != NULL) calculateOther() ;
- // if (_valuesOther != NULL) _valuesOther = value;
- }
- else {
- allocateOther() ;
- _valuesOther = value ;
- updateDefault() ;
- }
- else throw MEDEXCEPTION("MEDARRAY::set(mode,value) : No values defined !");
+ if ((T*)_valuesDefault != NULL)
+ {
+ if (mode == _mode)
+ {
+ _valuesDefault = value ;
+ if ((T*)_valuesOther != NULL) calculateOther() ;
+ }
+ else
+ {
+ allocateOther() ;
+ _valuesOther = value ;
+ updateDefault() ;
+ }
+ }
+ else
+ {
+ throw MEDEXCEPTION("MEDARRAY::set(mode,value) : No values defined !");
+ }
- END_OF("MEDARRAY<T>::set(mode,i,value)");
+ END_OF("MEDARRAY<T>::set(mode,i,value)");
}
template <class T> void MEDARRAY<T>::setI(medModeSwitch mode, med_int i, T* value)
{
BEGIN_OF("MEDARRAY<T>::setI(mode,i,value)");
- _mode = mode ;
-
SCRUTE(i);
- SCRUTE(_ld_values);
- SCRUTE(_length_values);
- SCRUTE(_valuesDefault);
- SCRUTE(_valuesOther);
+ SCRUTE(_ldValues);
+ SCRUTE(_lengthValues);
+ SCRUTE((T*)_valuesDefault);
+ SCRUTE((T*)_valuesOther);
SCRUTE(_mode);
SCRUTE(mode);
- // 1<=i<=_length_values and return an array of _ld_values length
+ // 1<=i<=_lengthValues and return an array of _ldValues length
// if MED_FULL_INTERLACE
- // 1<=i<=_ld_values and return an array of _length_values length
+ // 1<=i<=_ldValues and return an array of _lengthValues length
// if MED_NO_INTERLACE
- if (_valuesDefault != NULL) {
- // if mode = MED_FULL_INTERLACE :
- int first = _ld_values ;
- int second = _length_values;
- // else :
- if (mode == MED_NO_INTERLACE) {
- first = _length_values ;
- second = _ld_values ;
+ if (i<=0)
+ {
+ throw MEDEXCEPTION("MEDARRAY::setI(mode,i,value) : argument i must be > 0");
+ }
+ if ((T*)_valuesDefault != NULL)
+ {
+ int first = _ldValues;
+ int second = _lengthValues;
+
+ if (mode == MED_NO_INTERLACE)
+ {
+ first = _lengthValues;
+ second = _ldValues;
}
SCRUTE(second);
- if (i<=0)
- throw MEDEXCEPTION("MEDARRAY::setI(mode,i,value) : argument i must be > 0");
- if (i>second) {
+
+ if ( i > second)
+ {
SCRUTE(i);
SCRUTE(second);
- throw MEDEXCEPTION("MEDARRAY::setI(mode,i,value) : argument i must be <= second");}
+ throw MEDEXCEPTION("MEDARRAY::setI(mode,i,value) : argument i must be <= second");
+ }
if (mode == _mode)
- {
- // _valuesDefault + (i-1)*first = value ;
+ {
for (int k =0;k<first;k++)
- // _valuesDefault[(i-1)*second+k] = value[k];
- (_valuesDefault + (i-1)*first)[k] = value[k];
- if (_valuesOther != NULL)
- for (int k =0;k<first;k++) {
- _valuesOther[k*second+i-1] = value[k];
+ {
+ (_valuesDefault + (i-1)*first)[k] = value[k];
}
- }
+ if ((T*)_valuesOther != NULL)
+ for (int k =0;k<first;k++)
+ {
+ _valuesOther[k*second+i-1] = value[k];
+ }
+ }
else
- {
+ {
allocateOther() ;
// return _valuesOther + (i-1)*first = &value ;
- for (int k =0;k<second;k++) {
+ for (int k =0;k<second;k++)
+ {
_valuesOther[(i-1)*first+k-1] = value[k];
- _valuesDefault[k*second+i-1] = value[k];
+ _valuesDefault[k*second+i-1] = value[k];
}
- }
+ }
+ }
+ else
+ {
+ throw MEDEXCEPTION("MEDARRAY::setI(mode,i,value) : No values defined !");
}
- else throw MEDEXCEPTION("MEDARRAY::setI(mode,i,value) : No values defined !");
- SCRUTE(_valuesDefault);
- SCRUTE( _valuesOther);
+ SCRUTE((T*) _valuesDefault);
+ SCRUTE((T*) _valuesOther);
END_OF("MEDARRAY::setI(mode,i,value)");
}
template <class T> void MEDARRAY<T>::setIJ(med_int i, med_int j, T value)
{
- // 1<=i<=_length_values and 1<j<_ld_values
+ // 1<=i<=_lengthValues and 1<=j<=_ldValues
if (i<1)
throw MEDEXCEPTION("MEDARRAY::setIJ(i,j,value) : argument i must be >= 1");
- if (i>_length_values)
- throw MEDEXCEPTION("MEDARRAY::setIJ(i,j,value) : argument i must be <= _length_values");
+ if (i>_lengthValues)
+ throw MEDEXCEPTION("MEDARRAY::setIJ(i,j,value) : argument i must be <= _lengthValues");
if (j<1)
throw MEDEXCEPTION("MEDARRAY::setIJ(i,j,value) : argument j must be >= 1");
- if (j>_ld_values)
- throw MEDEXCEPTION("MEDARRAY::setIJ(i,j,value) : argument j must be <= _ld_values");
+ if (j>_ldValues)
+ throw MEDEXCEPTION("MEDARRAY::setIJ(i,j,value) : argument j must be <= _ldValues");
- if (_valuesDefault != NULL) {
+ if ((T*)_valuesDefault != NULL)
+ {
switch (_mode)
- {
+ {
case MED_FULL_INTERLACE :
- {
- _valuesDefault[(i-1)*_ld_values+j-1] = value;
+ {
+ _valuesDefault[(i-1)*_ldValues+j-1] = value;
break;
- }
+ }
case MED_NO_INTERLACE :
- {
- _valuesDefault[(j-1)*_length_values+i-1] = value;
+ {
+ _valuesDefault[(j-1)*_lengthValues+i-1] = value;
break;
- }
}
- } else
+ }
+ }
+ else
+ {
throw MEDEXCEPTION("MEDARRAY::setIJ(i,j,value) : No value in array !");
+ }
}
template <class T> void MEDARRAY<T>::calculateOther()
{
- if (_valuesDefault != NULL) {
- //we allocate _valuesOther if needed
- if (_valuesOther == NULL) _valuesOther = new T[_ld_values*_length_values] ;
- // we set _valuesOther
- // if mode = MED_FULL_INTERLACE :
- int first = _ld_values ;
- int second = _length_values;
- // else :
- if (_mode == MED_NO_INTERLACE) {
- first = _length_values ;
- second = _ld_values;
- }
+ BEGIN_OF("MEDARRAY<T>::calculateOther()") ;
+ SCRUTE((T*)_valuesDefault);
+ SCRUTE((T*)_valuesOther);
+ if ((T*)_valuesDefault != NULL)
+ {
+ //we allocate _valuesOther if needed
+ if ((T*)_valuesOther == NULL)
+ {
+ _valuesOther.set(_ldValues*_lengthValues);
+ }
- for (int i=0; i<first;i++)
- for (int j=0; j<second; j++)
- _valuesOther[i*second+j] = _valuesDefault[j*first+i];
+ // we set _valuesOther
+ int first = _ldValues ;
+ int second = _lengthValues;
+ if (_mode == MED_NO_INTERLACE)
+ {
+ first = _lengthValues ;
+ second = _ldValues;
+ }
+ for (int i=0; i<first;i++)
+ for (int j=0; j<second; j++)
+ _valuesOther[i*second+j] = _valuesDefault[j*first+i];
}
else
- throw MEDEXCEPTION("MEDARRAY::calculateOther() : No values defined !");
+ {
+ throw MEDEXCEPTION("MEDARRAY::calculateOther() : No values defined !");
+ }
+ END_OF("MEDARRAY<T>::calculateOther()") ;
}
template <class T> void MEDARRAY<T>::allocateOther()
{
- if (_valuesDefault != NULL) {
- if (_valuesOther == NULL) {
- // we set _valuesOther
- _valuesOther = new T[_ld_values*_length_values] ;
+ if ((T*)_valuesDefault != NULL)
+ {
+ if ((T*)_valuesOther == NULL)
+ {
+ // we set _valuesOther
+ _valuesOther.set(_ldValues*_lengthValues);
}
}
else
{
BEGIN_OF("MEDARRAY<T>::updateDefault()");
- if (_valuesDefault != NULL) {
- if (_valuesOther != NULL) {
+ if ((T*)_valuesDefault != NULL)
+ {
+ if ((T*)_valuesOther != NULL)
+ {
// we update _valuesDefault with _valuesOther
// if mode = MED_FULL_INTERLACE :
- int first = _ld_values ;
- int second = _length_values;
+ int first = _ldValues ;
+ int second = _lengthValues;
// else :
- if (_mode == MED_NO_INTERLACE) {
- first = _length_values ;
- second = _ld_values;
+ if (_mode == MED_NO_INTERLACE)
+ {
+ first = _lengthValues ;
+ second = _ldValues;
}
for (int i=0; i<first;i++)
for (int j=0; j<second; j++)
_valuesDefault[j*first+i] = _valuesOther[i*second+j];
}
else
+ {
throw MEDEXCEPTION("MEDARRAY<T>::updateDefault() : No valuesOther defined !");
+ }
}
else
+ {
throw MEDEXCEPTION("MEDARRAY<T>::updateDefault() : No values defined !");
+ }
END_OF("MEDARRAY<T>::updateDefault()");
}
+using namespace std;
/*
File MEDMEM_CellModel.cxx
$Header$
CELLMODEL::CELLMODEL(medGeometryElement t)
{
+ // init first all to nothing
+ _dimension=0 ;
+ _numberOfNodes=0 ;
+ _numberOfVertexes=0 ;
+ _numberOfConstituentsDimension=0 ;
+ _numberOfConstituents=(int*)NULL ;
+ _numberOfNodeOfEachConstituent=(int**)NULL ;
+ _constituents=(int***)NULL ;
+ //_numberOfonstituentsType=(int*)NULL ;
+ _constituentsType=(medGeometryElement**)NULL ;
+
MESSAGE("CELLMODEL : constructeur pour le type " << t);
switch (t)
{
_numberOfVertexes=2;
_numberOfNodes=2;
// constituent are POINT1 and we have no need to define _constituents vector
- vector<medGeometryElement> vector_type(2,MED_POINT1) ;
- vector<medGeometryElement> __constituents_type[]={vector_type};
- vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+1) ;
- _constituentsType = _constituents_type ;
+// vector<medGeometryElement> vector_type(2,MED_POINT1) ;
+// vector<medGeometryElement> __constituents_type[]={vector_type};
+// vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+1) ;
+// _constituentsType = _constituents_type ;
+ //_constituentsType[2][1]={{MED_POINT1,MED_POINT1}} ;
+ _numberOfConstituentsDimension=1 ;
+ _numberOfConstituents=new int[1] ;
+ _numberOfConstituents[0]=2 ;
+ _numberOfNodeOfEachConstituent=new (int*)[1] ;
+ _numberOfNodeOfEachConstituent[0]=new (int)[2] ;
+ _numberOfNodeOfEachConstituent[0][0]=1 ;
+ _numberOfNodeOfEachConstituent[0][1]=1 ;
+
+ _constituents = new (int**)[1] ;
+ _constituents[0] = new (int*)[2] ;
+ _constituents[0][0] = new int[1] ;
+ _constituents[0][0][0] = 1 ;
+ _constituents[0][1] = new int[1] ;
+ _constituents[0][1][0] = 2 ;
+
+ medGeometryElement * tmpConstituentsType1 = new medGeometryElement[2] ;
+ tmpConstituentsType1[0] = MED_POINT1 ;
+ tmpConstituentsType1[1] = MED_POINT1 ;
+ _constituentsType = new medGeometryElement*[1] ;
+ _constituentsType[0]=tmpConstituentsType1 ;
break;
}
case MED_SEG3 : {
_numberOfVertexes=2;
_numberOfNodes=3;
// constituent are POINT1 and we have no need to define _constituents vector
- vector<medGeometryElement> vector_type(3,MED_POINT1) ;
- vector<medGeometryElement> __constituents_type[]={vector_type};
- vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+1) ;
- _constituentsType = _constituents_type ;
+// vector<medGeometryElement> vector_type(3,MED_POINT1) ;
+// vector<medGeometryElement> __constituents_type[]={vector_type};
+// vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+1) ;
+// _constituentsType = _constituents_type ;
+ _numberOfConstituentsDimension=1 ;
+ _numberOfConstituents=new int[1] ;
+ _numberOfConstituents[0]=3 ;
+ _numberOfNodeOfEachConstituent=new (int*)[1] ;
+ _numberOfNodeOfEachConstituent[0]=new (int)[3] ;
+ _numberOfNodeOfEachConstituent[0][0]=1 ;
+ _numberOfNodeOfEachConstituent[0][1]=1 ;
+ _numberOfNodeOfEachConstituent[0][2]=1 ;
+
+ _constituents = new (int**)[1] ;
+ _constituents[0] = new (int*)[3] ;
+ _constituents[0][0] = new int[1] ;
+ _constituents[0][0][0] = 1 ;
+ _constituents[0][1] = new int[1] ;
+ _constituents[0][1][0] = 2 ;
+ _constituents[0][2] = new int[1] ;
+ _constituents[0][2][0] = 3 ;
+
+ medGeometryElement * tmpConstituentsType1 = new medGeometryElement[3] ;
+ tmpConstituentsType1[0] = MED_POINT1 ;
+ tmpConstituentsType1[1] = MED_POINT1 ;
+ tmpConstituentsType1[2] = MED_POINT1 ;
+ _constituentsType = new medGeometryElement*[1] ;
+ _constituentsType[0]=tmpConstituentsType1 ;
break;
}
case MED_TRIA3 : {
_dimension=2;
_numberOfVertexes=3;
_numberOfNodes=3;
- int _edge1[]={1,2} ;
- int _edge2[]={2,3} ;
- int _edge3[]={3,1} ;
- vector<int> edge1(_edge1,_edge1+2) ;
- vector<int> edge2(_edge2,_edge2+2) ;
- vector<int> edge3(_edge3,_edge3+2) ;
- vector<int> _vector_edge[]={edge1,edge2,edge3};
- vector< vector<int> > vector_edge(_vector_edge,_vector_edge+3) ;
- vector< vector<int> > __constituents__[]={vector_edge};
- vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+1) ;
- _constituents = _constituents_ ;
- vector<medGeometryElement> vector_edge_type(3,MED_SEG2) ;
- vector<medGeometryElement> vector_type(3,MED_POINT1) ;
- vector<medGeometryElement> __constituents_type[]={vector_edge_type,vector_type};
- vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
- _constituentsType = _constituents_type ;
+
+ _numberOfConstituentsDimension=1 ;
+ _numberOfConstituents=new int[1] ;
+ _numberOfConstituents[0]=3 ;
+ _numberOfNodeOfEachConstituent=new (int*)[1] ;
+ _numberOfNodeOfEachConstituent[0]=new (int)[3] ;
+ _numberOfNodeOfEachConstituent[0][0]=2 ;
+ _numberOfNodeOfEachConstituent[0][1]=2 ;
+ _numberOfNodeOfEachConstituent[0][2]=2 ;
+
+ int* _edge1=new int[2];
+ _edge1[0]=1;
+ _edge1[1]=2;
+ int* _edge2=new int[2];
+ _edge2[0]=2;
+ _edge2[1]=3;
+ int* _edge3=new int[2];
+ _edge3[0]=3;
+ _edge3[1]=1;
+ int ** tmpConstituents1 = new (int*)[3];
+ tmpConstituents1[0]=_edge1 ;
+ tmpConstituents1[1]=_edge2 ;
+ tmpConstituents1[2]=_edge3 ;
+ _constituents = new int**[1] ;
+ _constituents[0]=tmpConstituents1 ;
+
+ medGeometryElement * tmpConstituentsType1 = new medGeometryElement[3] ;
+ tmpConstituentsType1[0] = MED_SEG2 ;
+ tmpConstituentsType1[1] = MED_SEG2 ;
+ tmpConstituentsType1[2] = MED_SEG2 ;
+ medGeometryElement * tmpConstituentsType2 = new medGeometryElement[3] ;
+ tmpConstituentsType2[0] = MED_POINT1 ;
+ tmpConstituentsType2[1] = MED_POINT1 ;
+ tmpConstituentsType2[2] = MED_POINT1 ;
+ _constituentsType = new medGeometryElement*[2] ;
+ _constituentsType[0]=tmpConstituentsType1 ;
+ _constituentsType[1]=tmpConstituentsType2 ;
+ // Well, point are defined, but could not be acces because we have
+ // only 1 numberOfConstituentsDimension !
+
break;
}
case MED_TRIA6 : {
_dimension=2;
_numberOfVertexes=3;
_numberOfNodes=6;
- int _edge1[]={1,2,4} ;
- int _edge2[]={2,3,5} ;
- int _edge3[]={3,1,6} ;
- vector<int> edge1(_edge1,_edge1+3) ;
- vector<int> edge2(_edge2,_edge2+3) ;
- vector<int> edge3(_edge3,_edge3+3) ;
- vector<int> _vector_edge[]={edge1,edge2,edge3};
- vector< vector<int> > vector_edge(_vector_edge,_vector_edge+3) ;
- vector< vector<int> > __constituents__[]={vector_edge};
- vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+1) ;
- _constituents = _constituents_ ;
- vector<medGeometryElement> vector_edge_type(3,MED_SEG3) ;
- vector<medGeometryElement> vector_type(6,MED_POINT1) ;
- vector<medGeometryElement> __constituents_type[]={vector_edge_type,vector_type};
- vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
- _constituentsType = _constituents_type ;
+// int _edge1[]={1,2,4} ;
+// int _edge2[]={2,3,5} ;
+// int _edge3[]={3,1,6} ;
+// vector<int> edge1(_edge1,_edge1+3) ;
+// vector<int> edge2(_edge2,_edge2+3) ;
+// vector<int> edge3(_edge3,_edge3+3) ;
+// vector<int> _vector_edge[]={edge1,edge2,edge3};
+// vector< vector<int> > vector_edge(_vector_edge,_vector_edge+3) ;
+// vector< vector<int> > __constituents__[]={vector_edge};
+// vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+1) ;
+// _constituents = _constituents_ ;
+ _numberOfConstituentsDimension=1 ;
+ _numberOfConstituents=new int[1] ;
+ _numberOfConstituents[0]=3 ;
+ _numberOfNodeOfEachConstituent=new (int*)[1] ;
+ _numberOfNodeOfEachConstituent[0]=new (int)[3] ;
+ _numberOfNodeOfEachConstituent[0][0]=3 ;
+ _numberOfNodeOfEachConstituent[0][1]=3 ;
+ _numberOfNodeOfEachConstituent[0][2]=3 ;
+
+ int* _edge1=new int[3];
+ _edge1[0]=1;
+ _edge1[1]=2;
+ _edge1[2]=4;
+ int* _edge2=new int[3];
+ _edge2[0]=2;
+ _edge2[1]=3;
+ _edge2[2]=5;
+ int* _edge3=new int[3];
+ _edge3[0]=3;
+ _edge3[1]=1;
+ _edge3[2]=6;
+ int ** tmpConstituents1 = new (int*)[3];
+ tmpConstituents1[0]=_edge1 ;
+ tmpConstituents1[1]=_edge2 ;
+ tmpConstituents1[2]=_edge3 ;
+ _constituents = new int**[1] ;
+ _constituents[0]=tmpConstituents1 ;
+// vector<medGeometryElement> vector_edge_type(3,MED_SEG3) ;
+// vector<medGeometryElement> vector_type(6,MED_POINT1) ;
+// vector<medGeometryElement> __constituents_type[]={vector_edge_type,vector_type};
+// vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
+// _constituentsType = _constituents_type ;
+ //_constituentsType={{MED_SEG3,MED_SEG3,MED_SEG3},{MED_POINT1,MED_POINT1,MED_POINT1,MED_POINT1,MED_POINT1,MED_POINT1}} ;
+ medGeometryElement * tmpConstituentsType1 = new medGeometryElement[3] ;
+ tmpConstituentsType1[0] = MED_SEG3 ;
+ tmpConstituentsType1[1] = MED_SEG3 ;
+ tmpConstituentsType1[2] = MED_SEG3 ;
+ medGeometryElement * tmpConstituentsType2 = new medGeometryElement[6] ;
+ tmpConstituentsType2[0] = MED_POINT1 ;
+ tmpConstituentsType2[1] = MED_POINT1 ;
+ tmpConstituentsType2[2] = MED_POINT1 ;
+ tmpConstituentsType2[3] = MED_POINT1 ;
+ tmpConstituentsType2[4] = MED_POINT1 ;
+ tmpConstituentsType2[5] = MED_POINT1 ;
+ _constituentsType = new medGeometryElement*[2] ;
+ _constituentsType[0]=tmpConstituentsType1 ;
+ _constituentsType[1]=tmpConstituentsType2 ;
+ // Well, point are defined, but could not be acces because we have
+ // only 1 numberOfConstituentsDimension !
+
break;
}
case MED_QUAD4 : {
_dimension=2;
_numberOfVertexes=4;
_numberOfNodes=4;
- int _edge1[]={1,2} ;
- int _edge2[]={2,3} ;
- int _edge3[]={3,4} ;
- int _edge4[]={4,1} ;
- vector<int> edge1(_edge1,_edge1+2) ;
- vector<int> edge2(_edge2,_edge2+2) ;
- vector<int> edge3(_edge3,_edge3+2) ;
- vector<int> edge4(_edge4,_edge4+2) ;
- vector<int> _vector_edge[]={edge1,edge2,edge3,edge4};
- vector< vector<int> > vector_edge(_vector_edge,_vector_edge+4) ;
- vector< vector<int> > __constituents__[]={vector_edge};
- vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+1) ;
- _constituents = _constituents_ ;
- vector<medGeometryElement> vector_edge_type(4,MED_SEG2) ;
- vector<medGeometryElement> vector_type(4,MED_POINT1) ;
- vector<medGeometryElement> __constituents_type[]={vector_edge_type,vector_type};
- vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
- _constituentsType = _constituents_type ;
+// int _edge1[]={1,2} ;
+// int _edge2[]={2,3} ;
+// int _edge3[]={3,4} ;
+// int _edge4[]={4,1} ;
+// vector<int> edge1(_edge1,_edge1+2) ;
+// vector<int> edge2(_edge2,_edge2+2) ;
+// vector<int> edge3(_edge3,_edge3+2) ;
+// vector<int> edge4(_edge4,_edge4+2) ;
+// vector<int> _vector_edge[]={edge1,edge2,edge3,edge4};
+// vector< vector<int> > vector_edge(_vector_edge,_vector_edge+4) ;
+// vector< vector<int> > __constituents__[]={vector_edge};
+// vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+1) ;
+// _constituents = _constituents_ ;
+ //_constituents={{{1,2},{2,3},{3,4},{4,1}}} ;
+ _numberOfConstituentsDimension=1 ;
+ _numberOfConstituents=new int[1] ;
+ _numberOfConstituents[0]=4 ;
+ _numberOfNodeOfEachConstituent=new (int*)[1] ;
+ _numberOfNodeOfEachConstituent[0]=new (int)[4] ;
+ _numberOfNodeOfEachConstituent[0][0]=2 ;
+ _numberOfNodeOfEachConstituent[0][1]=2 ;
+ _numberOfNodeOfEachConstituent[0][2]=2 ;
+ _numberOfNodeOfEachConstituent[0][3]=2 ;
+
+ int* _edge1=new int[2];
+ _edge1[0]=1;
+ _edge1[1]=2;
+ int* _edge2=new int[2];
+ _edge2[0]=2;
+ _edge2[1]=3;
+ int* _edge3=new int[2];
+ _edge3[0]=3;
+ _edge3[1]=4;
+ int* _edge4=new int[2];
+ _edge4[0]=4;
+ _edge4[1]=1;
+ int ** tmpConstituents1 = new (int*)[4];
+ tmpConstituents1[0]=_edge1 ;
+ tmpConstituents1[1]=_edge2 ;
+ tmpConstituents1[2]=_edge3 ;
+ tmpConstituents1[3]=_edge4 ;
+ _constituents = new int**[1] ;
+ _constituents[0]=tmpConstituents1 ;
+// vector<medGeometryElement> vector_edge_type(4,MED_SEG2) ;
+// vector<medGeometryElement> vector_type(4,MED_POINT1) ;
+// vector<medGeometryElement> __constituents_type[]={vector_edge_type,vector_type};
+// vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
+// _constituentsType = _constituents_type ;
+ //_constituentsType={{MED_SEG2,MED_SEG2,MED_SEG2,MED_SEG2},{MED_POINT1,MED_POINT1,MED_POINT1,MED_POINT1}} ;
+ medGeometryElement * tmpConstituentsType1 = new medGeometryElement[4] ;
+ tmpConstituentsType1[0] = MED_SEG2 ;
+ tmpConstituentsType1[1] = MED_SEG2 ;
+ tmpConstituentsType1[2] = MED_SEG2 ;
+ tmpConstituentsType1[3] = MED_SEG2 ;
+ medGeometryElement * tmpConstituentsType2 = new medGeometryElement[4] ;
+ tmpConstituentsType2[0] = MED_POINT1 ;
+ tmpConstituentsType2[1] = MED_POINT1 ;
+ tmpConstituentsType2[2] = MED_POINT1 ;
+ tmpConstituentsType2[3] = MED_POINT1 ;
+ _constituentsType = new medGeometryElement*[2] ;
+ _constituentsType[0]=tmpConstituentsType1 ;
+ _constituentsType[1]=tmpConstituentsType2 ;
+ // Well, point are defined, but could not be acces because we have
+ // only 1 numberOfConstituentsDimension !
+
break;
}
case MED_QUAD8 : {
_dimension=2;
_numberOfVertexes=4;
_numberOfNodes=8;
- int _edge1[]={1,2,5} ;
- int _edge2[]={2,3,6} ;
- int _edge3[]={3,4,7} ;
- int _edge4[]={4,1,8} ;
- vector<int> edge1(_edge1,_edge1+3) ;
- vector<int> edge2(_edge2,_edge2+3) ;
- vector<int> edge3(_edge3,_edge3+3) ;
- vector<int> edge4(_edge4,_edge4+3) ;
- vector<int> _vector_edge[]={edge1,edge2,edge3,edge4};
- vector< vector<int> > vector_edge(_vector_edge,_vector_edge+4) ;
- vector< vector<int> > __constituents__[]={vector_edge};
- vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+1) ;
- _constituents = _constituents_ ;
- vector<medGeometryElement> vector_edge_type(4,MED_SEG3) ;
- vector<medGeometryElement> vector_type(8,MED_POINT1) ;
- vector<medGeometryElement> __constituents_type[]={vector_edge_type,vector_type};
- vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
- _constituentsType = _constituents_type ;
+// int _edge1[]={1,2,5} ;
+// int _edge2[]={2,3,6} ;
+// int _edge3[]={3,4,7} ;
+// int _edge4[]={4,1,8} ;
+// vector<int> edge1(_edge1,_edge1+3) ;
+// vector<int> edge2(_edge2,_edge2+3) ;
+// vector<int> edge3(_edge3,_edge3+3) ;
+// vector<int> edge4(_edge4,_edge4+3) ;
+// vector<int> _vector_edge[]={edge1,edge2,edge3,edge4};
+// vector< vector<int> > vector_edge(_vector_edge,_vector_edge+4) ;
+// vector< vector<int> > __constituents__[]={vector_edge};
+// vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+1) ;
+// _constituents = _constituents_ ;
+ //_constituents={{{1,2,5},{2,3,6},{3,4,7},{4,1,8}}} ;
+ _numberOfConstituentsDimension=1 ;
+ _numberOfConstituents=new int[1] ;
+ _numberOfConstituents[0]=4 ;
+ _numberOfNodeOfEachConstituent=new (int*)[1] ;
+ _numberOfNodeOfEachConstituent[0]=new (int)[4] ;
+ _numberOfNodeOfEachConstituent[0][0]=3 ;
+ _numberOfNodeOfEachConstituent[0][1]=3 ;
+ _numberOfNodeOfEachConstituent[0][2]=3 ;
+ _numberOfNodeOfEachConstituent[0][3]=3 ;
+
+ int* _edge1=new int[3];
+ _edge1[0]=1;
+ _edge1[1]=2;
+ _edge1[2]=5;
+ int* _edge2=new int[3];
+ _edge2[0]=2;
+ _edge2[1]=3;
+ _edge2[2]=6;
+ int* _edge3=new int[3];
+ _edge3[0]=3;
+ _edge3[1]=4;
+ _edge3[2]=7;
+ int* _edge4=new int[3];
+ _edge4[0]=4;
+ _edge4[1]=1;
+ _edge4[2]=8;
+ int ** tmpConstituents1 = new (int*)[4];
+ tmpConstituents1[0]=_edge1 ;
+ tmpConstituents1[1]=_edge2 ;
+ tmpConstituents1[2]=_edge3 ;
+ tmpConstituents1[3]=_edge4 ;
+ _constituents = new int**[1] ;
+ _constituents[0]=tmpConstituents1 ;
+// vector<medGeometryElement> vector_edge_type(4,MED_SEG3) ;
+// vector<medGeometryElement> vector_type(8,MED_POINT1) ;
+// vector<medGeometryElement> __constituents_type[]={vector_edge_type,vector_type};
+// vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
+// _constituentsType = _constituents_type ;
+ //_constituentsType={{MED_SEG3,MED_SEG3,MED_SEG3,MED_SEG3},{MED_POINT1,MED_POINT1,MED_POINT1,MED_POINT1,MED_POINT1,MED_POINT1,MED_POINT1,MED_POINT1} ;
+ medGeometryElement * tmpConstituentsType1 = new medGeometryElement[4] ;
+ tmpConstituentsType1[0] = MED_SEG3 ;
+ tmpConstituentsType1[1] = MED_SEG3 ;
+ tmpConstituentsType1[2] = MED_SEG3 ;
+ tmpConstituentsType1[3] = MED_SEG3 ;
+ medGeometryElement * tmpConstituentsType2 = new medGeometryElement[4] ;
+ tmpConstituentsType2[0] = MED_POINT1 ;
+ tmpConstituentsType2[1] = MED_POINT1 ;
+ tmpConstituentsType2[2] = MED_POINT1 ;
+ tmpConstituentsType2[3] = MED_POINT1 ;
+ tmpConstituentsType2[4] = MED_POINT1 ;
+ tmpConstituentsType2[5] = MED_POINT1 ;
+ tmpConstituentsType2[6] = MED_POINT1 ;
+ tmpConstituentsType2[7] = MED_POINT1 ;
+ _constituentsType = new medGeometryElement*[2] ;
+ _constituentsType[0]=tmpConstituentsType1 ;
+ _constituentsType[1]=tmpConstituentsType2 ;
+ // Well, point are defined, but could not be acces because we have
+ // only 1 numberOfConstituentsDimension !
+
break;
}
case MED_TETRA4 : {
_dimension=3;
_numberOfVertexes=4;
_numberOfNodes=4;
- int _edge1[]={1,2} ;
- int _edge2[]={2,3} ;
- int _edge3[]={3,1} ;
- int _edge4[]={1,4} ;
- int _edge5[]={2,4} ;
- int _edge6[]={3,4} ;
- vector<int> edge1(_edge1,_edge1+2) ;
- vector<int> edge2(_edge2,_edge2+2) ;
- vector<int> edge3(_edge3,_edge3+2) ;
- vector<int> edge4(_edge4,_edge4+2) ;
- vector<int> edge5(_edge5,_edge5+2) ;
- vector<int> edge6(_edge6,_edge6+2) ;
- vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6};
- vector< vector<int> > vector_edge(_vector_edge,_vector_edge+6) ;
- int _face1[]={1,2,3} ;
- int _face2[]={1,4,2} ;
- int _face3[]={2,4,3} ;
- int _face4[]={3,4,1} ;
- vector<int> face1(_face1,_face1+3) ;
- vector<int> face2(_face2,_face2+3) ;
- vector<int> face3(_face3,_face3+3) ;
- vector<int> face4(_face4,_face4+3) ;
- vector<int> _vector_face[] = {face1,face2,face3,face4} ;
- vector< vector<int> > vector_face(_vector_face,_vector_face+4) ;
- vector< vector<int> > __constituents__[]={vector_face,vector_edge};
- vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
- _constituents = _constituents_ ;
- vector<medGeometryElement> vector_edge_type(6,MED_SEG2) ;
- vector<medGeometryElement> vector_face_type(4,MED_TRIA3) ;
- vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
- vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
- _constituentsType = _constituents_type ;
+// int _edge1[]={1,2} ;
+// int _edge2[]={2,3} ;
+// int _edge3[]={3,1} ;
+// int _edge4[]={1,4} ;
+// int _edge5[]={2,4} ;
+// int _edge6[]={3,4} ;
+// vector<int> edge1(_edge1,_edge1+2) ;
+// vector<int> edge2(_edge2,_edge2+2) ;
+// vector<int> edge3(_edge3,_edge3+2) ;
+// vector<int> edge4(_edge4,_edge4+2) ;
+// vector<int> edge5(_edge5,_edge5+2) ;
+// vector<int> edge6(_edge6,_edge6+2) ;
+// vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6};
+// vector< vector<int> > vector_edge(_vector_edge,_vector_edge+6) ;
+// int _face1[]={1,2,3} ;
+// int _face2[]={1,4,2} ;
+// int _face3[]={2,4,3} ;
+// int _face4[]={3,4,1} ;
+// vector<int> face1(_face1,_face1+3) ;
+// vector<int> face2(_face2,_face2+3) ;
+// vector<int> face3(_face3,_face3+3) ;
+// vector<int> face4(_face4,_face4+3) ;
+// vector<int> _vector_face[] = {face1,face2,face3,face4} ;
+// vector< vector<int> > vector_face(_vector_face,_vector_face+4) ;
+// vector< vector<int> > __constituents__[]={vector_face,vector_edge};
+// vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
+// _constituents = _constituents_ ;
+ //_constituents={{{1,2,3},{1,4,2},{2,4,3},{3,4,1}},{{1,2},{2,3},{3,1},{1,4},{2,4},{3,4}}} ;
+ _numberOfConstituentsDimension=2 ;
+ _numberOfConstituents=new int[2] ;
+ _numberOfConstituents[0]=4 ;
+ _numberOfConstituents[1]=6 ;
+ _numberOfNodeOfEachConstituent=new (int*)[2] ;
+ _numberOfNodeOfEachConstituent[0]=new (int)[4] ;
+ _numberOfNodeOfEachConstituent[0][0]=3 ;
+ _numberOfNodeOfEachConstituent[0][1]=3 ;
+ _numberOfNodeOfEachConstituent[0][2]=3 ;
+ _numberOfNodeOfEachConstituent[0][3]=3 ;
+ _numberOfNodeOfEachConstituent[1]=new (int)[6] ;
+ _numberOfNodeOfEachConstituent[1][0]=2 ;
+ _numberOfNodeOfEachConstituent[1][1]=2 ;
+ _numberOfNodeOfEachConstituent[1][2]=2 ;
+ _numberOfNodeOfEachConstituent[1][3]=2 ;
+ _numberOfNodeOfEachConstituent[1][4]=2 ;
+ _numberOfNodeOfEachConstituent[1][5]=2 ;
+
+ int* _face1=new int[3];
+ _face1[0]=1;
+ _face1[1]=2;
+ _face1[2]=3;
+ int* _face2=new int[3];
+ _face2[0]=1;
+ _face2[1]=4;
+ _face2[2]=2;
+ int* _face3=new int[3];
+ _face3[0]=2;
+ _face3[1]=4;
+ _face3[2]=3;
+ int* _face4=new int[3];
+ _face4[0]=3;
+ _face4[1]=4;
+ _face4[2]=1;
+ int* _edge1=new int[2];
+ _edge1[0]=1;
+ _edge1[1]=2;
+ int* _edge2=new int[2];
+ _edge2[0]=2;
+ _edge2[1]=3;
+ int* _edge3=new int[2];
+ _edge3[0]=3;
+ _edge3[1]=1;
+ int* _edge4=new int[2];
+ _edge4[0]=1;
+ _edge4[1]=4;
+ int* _edge5=new int[2];
+ _edge5[0]=2;
+ _edge5[1]=4;
+ int* _edge6=new int[2];
+ _edge6[0]=3;
+ _edge6[1]=4;
+ int ** tmpConstituents1 = new (int*)[4];
+ tmpConstituents1[0]=_face1 ;
+ tmpConstituents1[1]=_face2 ;
+ tmpConstituents1[2]=_face3 ;
+ tmpConstituents1[3]=_face4 ;
+ int ** tmpConstituents2 = new (int*)[6];
+ tmpConstituents2[0]=_edge1 ;
+ tmpConstituents2[1]=_edge2 ;
+ tmpConstituents2[2]=_edge3 ;
+ tmpConstituents2[3]=_edge4 ;
+ tmpConstituents2[4]=_edge5 ;
+ tmpConstituents2[5]=_edge6 ;
+ _constituents = new int**[2] ;
+ _constituents[0]=tmpConstituents1 ;
+ _constituents[1]=tmpConstituents2 ;
+// vector<medGeometryElement> vector_edge_type(6,MED_SEG2) ;
+// vector<medGeometryElement> vector_face_type(4,MED_TRIA3) ;
+// vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
+// vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
+// _constituentsType = _constituents_type ;
+ //_constituentsType={{MED_TRIA3,MED_TRIA3,MED_TRIA3,MED_TRIA3}{MED_SEG2,MED_SEG2,MED_SEG2,MED_SEG2,MED_SEG2,MED_SEG2}} ;
+ medGeometryElement * tmpConstituentsType1 = new medGeometryElement[4] ;
+ tmpConstituentsType1[0] = MED_TRIA3 ;
+ tmpConstituentsType1[1] = MED_TRIA3 ;
+ tmpConstituentsType1[2] = MED_TRIA3 ;
+ tmpConstituentsType1[3] = MED_TRIA3 ;
+ medGeometryElement * tmpConstituentsType2 = new medGeometryElement[6] ;
+ tmpConstituentsType2[0] = MED_SEG2 ;
+ tmpConstituentsType2[1] = MED_SEG2 ;
+ tmpConstituentsType2[2] = MED_SEG2 ;
+ tmpConstituentsType2[3] = MED_SEG2 ;
+ tmpConstituentsType2[4] = MED_SEG2 ;
+ tmpConstituentsType2[5] = MED_SEG2 ;
+ _constituentsType = new medGeometryElement*[2] ;
+ _constituentsType[0]=tmpConstituentsType1 ;
+ _constituentsType[1]=tmpConstituentsType2 ;
break;
}
case MED_TETRA10 : {
_dimension=3;
_numberOfVertexes=4;
_numberOfNodes=10;
- int _edge1[]={1,2,5} ;
- int _edge2[]={2,3,6} ;
- int _edge3[]={3,1,7} ;
- int _edge4[]={1,4,8} ;
- int _edge5[]={2,4,9} ;
- int _edge6[]={3,4,10} ;
- vector<int> edge1(_edge1,_edge1+3) ;
- vector<int> edge2(_edge2,_edge2+3) ;
- vector<int> edge3(_edge3,_edge3+3) ;
- vector<int> edge4(_edge4,_edge4+3) ;
- vector<int> edge5(_edge5,_edge5+3) ;
- vector<int> edge6(_edge6,_edge6+3) ;
- vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6};
- vector< vector<int> > vector_edge(_vector_edge,_vector_edge+6) ;
- int _face1[]={1,2,3,5,6,7} ;
- int _face2[]={1,4,2,8,9,5} ;
- int _face3[]={2,4,3,9,10,6} ;
- int _face4[]={3,4,1,10,8,7} ;
- vector<int> face1(_face1,_face1+6) ;
- vector<int> face2(_face2,_face2+6) ;
- vector<int> face3(_face3,_face3+6) ;
- vector<int> face4(_face4,_face4+6) ;
- vector<int> _vector_face[] = {face1,face2,face3,face4} ;
- vector< vector<int> > vector_face(_vector_face,_vector_face+4) ;
- vector< vector<int> > __constituents__[]={vector_face,vector_edge};
- vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
- _constituents = _constituents_ ;
- vector<medGeometryElement> vector_edge_type(6,MED_SEG3) ;
- vector<medGeometryElement> vector_face_type(4,MED_TRIA6) ;
- vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
- vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
- _constituentsType = _constituents_type ;
+// int _edge1[]={1,2,5} ;
+// int _edge2[]={2,3,6} ;
+// int _edge3[]={3,1,7} ;
+// int _edge4[]={1,4,8} ;
+// int _edge5[]={2,4,9} ;
+// int _edge6[]={3,4,10} ;
+// vector<int> edge1(_edge1,_edge1+3) ;
+// vector<int> edge2(_edge2,_edge2+3) ;
+// vector<int> edge3(_edge3,_edge3+3) ;
+// vector<int> edge4(_edge4,_edge4+3) ;
+// vector<int> edge5(_edge5,_edge5+3) ;
+// vector<int> edge6(_edge6,_edge6+3) ;
+// vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6};
+// vector< vector<int> > vector_edge(_vector_edge,_vector_edge+6) ;
+// int _face1[]={1,2,3,5,6,7} ;
+// int _face2[]={1,4,2,8,9,5} ;
+// int _face3[]={2,4,3,9,10,6} ;
+// int _face4[]={3,4,1,10,8,7} ;
+// vector<int> face1(_face1,_face1+6) ;
+// vector<int> face2(_face2,_face2+6) ;
+// vector<int> face3(_face3,_face3+6) ;
+// vector<int> face4(_face4,_face4+6) ;
+// vector<int> _vector_face[] = {face1,face2,face3,face4} ;
+// vector< vector<int> > vector_face(_vector_face,_vector_face+4) ;
+// vector< vector<int> > __constituents__[]={vector_face,vector_edge};
+// vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
+// _constituents = _constituents_ ;
+ //_constituents={{{1,2,3,5,6,7},{1,4,2,8,9,5},{2,4,3,9,10,6},{3,4,1,10,8,7}},{{1,2,5},{2,3,6},{3,1,7},{1,4,8},{2,4,9},{3,4,10}}} ;
+ _numberOfConstituentsDimension=2 ;
+ _numberOfConstituents=new int[2] ;
+ _numberOfConstituents[0]=4 ;
+ _numberOfConstituents[1]=6 ;
+ _numberOfNodeOfEachConstituent=new (int*)[2] ;
+ _numberOfNodeOfEachConstituent[0]=new (int)[4] ;
+ _numberOfNodeOfEachConstituent[0][0]=6 ;
+ _numberOfNodeOfEachConstituent[0][1]=6 ;
+ _numberOfNodeOfEachConstituent[0][2]=6 ;
+ _numberOfNodeOfEachConstituent[0][3]=6 ;
+ _numberOfNodeOfEachConstituent[1]=new (int)[6] ;
+ _numberOfNodeOfEachConstituent[1][0]=3 ;
+ _numberOfNodeOfEachConstituent[1][1]=3 ;
+ _numberOfNodeOfEachConstituent[1][2]=3 ;
+ _numberOfNodeOfEachConstituent[1][3]=3 ;
+ _numberOfNodeOfEachConstituent[1][4]=3 ;
+ _numberOfNodeOfEachConstituent[1][5]=3 ;
+
+ int* _face1=new int[6];
+ _face1[0]=1;
+ _face1[1]=2;
+ _face1[2]=3;
+ _face1[3]=5;
+ _face1[4]=6;
+ _face1[5]=7;
+ int* _face2=new int[6];
+ _face2[0]=1;
+ _face2[1]=4;
+ _face2[2]=2;
+ _face2[3]=8;
+ _face2[4]=9;
+ _face2[5]=5;
+ int* _face3=new int[6];
+ _face3[0]=2;
+ _face3[1]=4;
+ _face3[2]=3;
+ _face3[3]=9;
+ _face3[4]=10;
+ _face3[5]=6;
+ int* _face4=new int[6];
+ _face4[0]=3;
+ _face4[1]=4;
+ _face4[2]=1;
+ _face4[3]=10;
+ _face4[4]=8;
+ _face4[5]=7;
+ int* _edge1=new int[3];
+ _edge1[0]=1;
+ _edge1[1]=2;
+ _edge1[2]=5;
+ int* _edge2=new int[3];
+ _edge2[0]=2;
+ _edge2[1]=3;
+ _edge2[2]=6;
+ int* _edge3=new int[3];
+ _edge3[0]=3;
+ _edge3[1]=1;
+ _edge3[2]=7;
+ int* _edge4=new int[3];
+ _edge4[0]=1;
+ _edge4[1]=4;
+ _edge4[2]=8;
+ int* _edge5=new int[3];
+ _edge5[0]=2;
+ _edge5[1]=4;
+ _edge5[2]=9;
+ int* _edge6=new int[3];
+ _edge6[0]=3;
+ _edge6[1]=4;
+ _edge6[2]=10;
+ int ** tmpConstituents1 = new (int*)[4];
+ tmpConstituents1[0]=_face1 ;
+ tmpConstituents1[1]=_face2 ;
+ tmpConstituents1[2]=_face3 ;
+ tmpConstituents1[3]=_face4 ;
+ int ** tmpConstituents2 = new (int*)[6];
+ tmpConstituents2[0]=_edge1 ;
+ tmpConstituents2[1]=_edge2 ;
+ tmpConstituents2[2]=_edge3 ;
+ tmpConstituents2[3]=_edge4 ;
+ tmpConstituents2[4]=_edge5 ;
+ tmpConstituents2[5]=_edge6 ;
+ _constituents = new int**[2] ;
+ _constituents[0]=tmpConstituents1 ;
+ _constituents[1]=tmpConstituents2 ;
+// vector<medGeometryElement> vector_edge_type(6,MED_SEG3) ;
+// vector<medGeometryElement> vector_face_type(4,MED_TRIA6) ;
+// vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
+// vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
+// _constituentsType = _constituents_type ;
+ //_constituentsType={{MED_TRIA6,MED_TRIA6,MED_TRIA6,MED_TRIA6}{MED_SEG3,MED_SEG3,MED_SEG3,MED_SEG3,MED_SEG3,MED_SEG3}} ;
+ medGeometryElement * tmpConstituentsType1 = new medGeometryElement[4] ;
+ tmpConstituentsType1[0] = MED_TRIA6 ;
+ tmpConstituentsType1[1] = MED_TRIA6 ;
+ tmpConstituentsType1[2] = MED_TRIA6 ;
+ tmpConstituentsType1[3] = MED_TRIA6 ;
+ medGeometryElement * tmpConstituentsType2 = new medGeometryElement[6] ;
+ tmpConstituentsType2[0] = MED_SEG3 ;
+ tmpConstituentsType2[1] = MED_SEG3 ;
+ tmpConstituentsType2[2] = MED_SEG3 ;
+ tmpConstituentsType2[3] = MED_SEG3 ;
+ tmpConstituentsType2[4] = MED_SEG3 ;
+ tmpConstituentsType2[5] = MED_SEG3 ;
+ _constituentsType = new medGeometryElement*[2] ;
+ _constituentsType[0]=tmpConstituentsType1 ;
+ _constituentsType[1]=tmpConstituentsType2 ;
break;
}
case MED_HEXA8 : {
_dimension=3;
_numberOfVertexes=8;
_numberOfNodes=8;
- int _edge1[]={1,2} ;
- int _edge2[]={2,3} ;
- int _edge3[]={3,4} ;
- int _edge4[]={4,1} ;
- int _edge5[]={5,6} ;
- int _edge6[]={6,7} ;
- int _edge7[]={7,8} ;
- int _edge8[]={8,5} ;
- int _edge9[]={1,5} ;
- int _edge10[]={2,6} ;
- int _edge11[]={3,7} ;
- int _edge12[]={4,8} ;
- vector<int> edge1(_edge1,_edge1+2) ;
- vector<int> edge2(_edge2,_edge2+2) ;
- vector<int> edge3(_edge3,_edge3+2) ;
- vector<int> edge4(_edge4,_edge4+2) ;
- vector<int> edge5(_edge5,_edge5+2) ;
- vector<int> edge6(_edge6,_edge6+2) ;
- vector<int> edge7(_edge7,_edge7+2) ;
- vector<int> edge8(_edge8,_edge8+2) ;
- vector<int> edge9(_edge9,_edge9+2) ;
- vector<int> edge10(_edge10,_edge10+2) ;
- vector<int> edge11(_edge11,_edge11+2) ;
- vector<int> edge12(_edge12,_edge12+2) ;
- vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9,edge10,edge11,edge12};
- vector< vector<int> > vector_edge(_vector_edge,_vector_edge+12) ;
- int _face1[]={1,2,3,4} ;
- int _face2[]={5,8,7,6} ;
- int _face3[]={1,5,6,2} ;
- int _face4[]={2,6,7,3} ;
- int _face5[]={3,7,8,4} ;
- int _face6[]={4,8,5,1} ;
- vector<int> face1(_face1,_face1+4) ;
- vector<int> face2(_face2,_face2+4) ;
- vector<int> face3(_face3,_face3+4) ;
- vector<int> face4(_face4,_face4+4) ;
- vector<int> face5(_face5,_face5+4) ;
- vector<int> face6(_face6,_face6+4) ;
- vector<int> _vector_face[] = {face1,face2,face3,face4,face5,face6} ;
- vector< vector<int> > vector_face(_vector_face,_vector_face+6) ;
- vector< vector<int> > __constituents__[]={vector_face,vector_edge};
- vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
- _constituents = _constituents_ ;
- vector<medGeometryElement> vector_edge_type(12,MED_SEG2) ;
- vector<medGeometryElement> vector_face_type(6,MED_QUAD4) ;
- vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
- vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2);
- _constituentsType = _constituents_type ;
+// int _edge1[]={1,2} ;
+// int _edge2[]={2,3} ;
+// int _edge3[]={3,4} ;
+// int _edge4[]={4,1} ;
+// int _edge5[]={5,6} ;
+// int _edge6[]={6,7} ;
+// int _edge7[]={7,8} ;
+// int _edge8[]={8,5} ;
+// int _edge9[]={1,5} ;
+// int _edge10[]={2,6} ;
+// int _edge11[]={3,7} ;
+// int _edge12[]={4,8} ;
+// vector<int> edge1(_edge1,_edge1+2) ;
+// vector<int> edge2(_edge2,_edge2+2) ;
+// vector<int> edge3(_edge3,_edge3+2) ;
+// vector<int> edge4(_edge4,_edge4+2) ;
+// vector<int> edge5(_edge5,_edge5+2) ;
+// vector<int> edge6(_edge6,_edge6+2) ;
+// vector<int> edge7(_edge7,_edge7+2) ;
+// vector<int> edge8(_edge8,_edge8+2) ;
+// vector<int> edge9(_edge9,_edge9+2) ;
+// vector<int> edge10(_edge10,_edge10+2) ;
+// vector<int> edge11(_edge11,_edge11+2) ;
+// vector<int> edge12(_edge12,_edge12+2) ;
+// vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9,edge10,edge11,edge12};
+// vector< vector<int> > vector_edge(_vector_edge,_vector_edge+12) ;
+ _numberOfConstituentsDimension=2 ;
+ _numberOfConstituents=new int[2] ;
+ _numberOfConstituents[0]=6 ;
+ _numberOfConstituents[1]=12 ;
+ _numberOfNodeOfEachConstituent=new (int*)[2] ;
+ _numberOfNodeOfEachConstituent[0]=new (int)[6] ;
+ _numberOfNodeOfEachConstituent[0][0]=4 ;
+ _numberOfNodeOfEachConstituent[0][1]=4 ;
+ _numberOfNodeOfEachConstituent[0][2]=4 ;
+ _numberOfNodeOfEachConstituent[0][3]=4 ;
+ _numberOfNodeOfEachConstituent[0][4]=4 ;
+ _numberOfNodeOfEachConstituent[0][5]=4 ;
+ _numberOfNodeOfEachConstituent[1]=new (int)[12] ;
+ _numberOfNodeOfEachConstituent[1][0]=2 ;
+ _numberOfNodeOfEachConstituent[1][1]=2 ;
+ _numberOfNodeOfEachConstituent[1][2]=2 ;
+ _numberOfNodeOfEachConstituent[1][3]=2 ;
+ _numberOfNodeOfEachConstituent[1][4]=2 ;
+ _numberOfNodeOfEachConstituent[1][5]=2 ;
+ _numberOfNodeOfEachConstituent[1][6]=2 ;
+ _numberOfNodeOfEachConstituent[1][7]=2 ;
+ _numberOfNodeOfEachConstituent[1][8]=2 ;
+ _numberOfNodeOfEachConstituent[1][9]=2 ;
+ _numberOfNodeOfEachConstituent[1][10]=2 ;
+ _numberOfNodeOfEachConstituent[1][11]=2 ;
+
+ int* _edge1=new int[2];
+ _edge1[0]=1;
+ _edge1[1]=2;
+ int* _edge2=new int[2];
+ _edge2[0]=2;
+ _edge2[1]=3;
+ int* _edge3=new int[2];
+ _edge3[0]=3;
+ _edge3[1]=4;
+ int* _edge4=new int[2];
+ _edge4[0]=4;
+ _edge4[1]=1;
+ int* _edge5=new int[2];
+ _edge5[0]=5;
+ _edge5[1]=6;
+ int* _edge6=new int[2];
+ _edge6[0]=6;
+ _edge6[1]=7;
+ int* _edge7=new int[2];
+ _edge7[0]=7;
+ _edge7[1]=8;
+ int* _edge8=new int[2];
+ _edge8[0]=8;
+ _edge8[1]=5;
+ int* _edge9=new int[2];
+ _edge9[0]=1;
+ _edge9[1]=5;
+ int* _edge10=new int[2];
+ _edge10[0]=2;
+ _edge10[1]=6;
+ int* _edge11=new int[2];
+ _edge11[0]=3;
+ _edge11[1]=7;
+ int* _edge12=new int[2];
+ _edge12[0]=4;
+ _edge12[1]=8;
+// int _face1[]={1,2,3,4} ;
+// int _face2[]={5,8,7,6} ;
+// int _face3[]={1,5,6,2} ;
+// int _face4[]={2,6,7,3} ;
+// int _face5[]={3,7,8,4} ;
+// int _face6[]={4,8,5,1} ;
+// vector<int> face1(_face1,_face1+4) ;
+// vector<int> face2(_face2,_face2+4) ;
+// vector<int> face3(_face3,_face3+4) ;
+// vector<int> face4(_face4,_face4+4) ;
+// vector<int> face5(_face5,_face5+4) ;
+// vector<int> face6(_face6,_face6+4) ;
+// vector<int> _vector_face[] = {face1,face2,face3,face4,face5,face6} ;
+// vector< vector<int> > vector_face(_vector_face,_vector_face+6) ;
+// vector< vector<int> > __constituents__[]={vector_face,vector_edge};
+// vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
+// _constituents = _constituents_ ;
+ int* _face1=new int[4];
+ _face1[0]=1;
+ _face1[1]=2;
+ _face1[2]=3;
+ _face1[3]=4;
+ int* _face2=new int[4];
+ _face2[0]=5;
+ _face2[1]=8;
+ _face2[2]=7;
+ _face2[3]=6;
+ int* _face3=new int[4];
+ _face3[0]=1;
+ _face3[1]=5;
+ _face3[2]=6;
+ _face3[3]=2;
+ int* _face4=new int[4];
+ _face4[0]=2;
+ _face4[1]=6;
+ _face4[2]=7;
+ _face4[3]=3;
+ int* _face5=new int[4];
+ _face5[0]=3;
+ _face5[1]=7;
+ _face5[2]=8;
+ _face5[3]=4;
+ int* _face6=new int[4];
+ _face6[0]=4;
+ _face6[1]=8;
+ _face6[2]=5;
+ _face6[3]=1;
+ int ** tmpConstituents1 = new (int*)[6];
+ tmpConstituents1[0]=_face1 ;
+ tmpConstituents1[1]=_face2 ;
+ tmpConstituents1[2]=_face3 ;
+ tmpConstituents1[3]=_face4 ;
+ tmpConstituents1[4]=_face5 ;
+ tmpConstituents1[5]=_face6 ;
+ int ** tmpConstituents2 = new (int*)[12];
+ tmpConstituents2[0]=_edge1 ;
+ tmpConstituents2[1]=_edge2 ;
+ tmpConstituents2[2]=_edge3 ;
+ tmpConstituents2[3]=_edge4 ;
+ tmpConstituents2[4]=_edge5 ;
+ tmpConstituents2[5]=_edge6 ;
+ tmpConstituents2[6]=_edge7 ;
+ tmpConstituents2[7]=_edge8 ;
+ tmpConstituents2[8]=_edge9 ;
+ tmpConstituents2[9]=_edge10;
+ tmpConstituents2[10]=_edge11;
+ tmpConstituents2[11]=_edge12;
+ _constituents = new int**[2] ;
+ _constituents[0]=tmpConstituents1 ;
+ _constituents[1]=tmpConstituents2 ;
+// vector<medGeometryElement> vector_edge_type(12,MED_SEG2) ;
+// vector<medGeometryElement> vector_face_type(6,MED_QUAD4) ;
+// vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
+// vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2);
+// _constituentsType = _constituents_type ;
+ medGeometryElement * tmpConstituentsType1 = new medGeometryElement[6] ;
+ tmpConstituentsType1[0] = MED_QUAD4 ;
+ tmpConstituentsType1[1] = MED_QUAD4 ;
+ tmpConstituentsType1[2] = MED_QUAD4 ;
+ tmpConstituentsType1[3] = MED_QUAD4 ;
+ tmpConstituentsType1[4] = MED_QUAD4 ;
+ tmpConstituentsType1[5] = MED_QUAD4 ;
+ medGeometryElement * tmpConstituentsType2 = new medGeometryElement[12] ;
+ tmpConstituentsType2[0] = MED_SEG2 ;
+ tmpConstituentsType2[1] = MED_SEG2 ;
+ tmpConstituentsType2[2] = MED_SEG2 ;
+ tmpConstituentsType2[3] = MED_SEG2 ;
+ tmpConstituentsType2[4] = MED_SEG2 ;
+ tmpConstituentsType2[5] = MED_SEG2 ;
+ tmpConstituentsType2[6] = MED_SEG2 ;
+ tmpConstituentsType2[7] = MED_SEG2 ;
+ tmpConstituentsType2[8] = MED_SEG2 ;
+ tmpConstituentsType2[9] = MED_SEG2 ;
+ tmpConstituentsType2[10] = MED_SEG2 ;
+ tmpConstituentsType2[11] = MED_SEG2 ;
+ _constituentsType = new medGeometryElement*[2] ;
+ _constituentsType[0]=tmpConstituentsType1 ;
+ _constituentsType[1]=tmpConstituentsType2 ;
break;
}
case MED_HEXA20 : {
_numberOfVertexes=8;
_numberOfNodes=20;
- int _edge1[]={1,2,9} ;
- int _edge2[]={2,3,10} ;
- int _edge3[]={3,4,11} ;
- int _edge4[]={4,1,12} ;
- int _edge5[]={5,6,13} ;
- int _edge6[]={6,7,14};
- int _edge7[]={7,8,15} ;
- int _edge8[]={8,5,16} ;
- int _edge9[]={1,5,17} ;
- int _edge10[]={2,6,18} ;
- int _edge11[]={3,7,19} ;
- int _edge12[]={4,8,20} ;
-
- vector<int> edge1(_edge1,_edge1+3) ;
- vector<int> edge2(_edge2,_edge2+3) ;
- vector<int> edge3(_edge3,_edge3+3) ;
- vector<int> edge4(_edge4,_edge4+3) ;
- vector<int> edge5(_edge5,_edge5+3) ;
- vector<int> edge6(_edge6,_edge6+3) ;
- vector<int> edge7(_edge7,_edge7+3) ;
- vector<int> edge8(_edge8,_edge8+3) ;
- vector<int> edge9(_edge9,_edge9+3) ;
- vector<int> edge10(_edge10,_edge10+3) ;
- vector<int> edge11(_edge11,_edge11+3) ;
- vector<int> edge12(_edge12,_edge12+3) ;
- vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9,edge10, edge11,edge12};
- vector< vector<int> > vector_edge(_vector_edge,_vector_edge+12) ;
-
- int _face1[]={1,2,3,4,9,10,11,12} ;
- int _face2[]={5,8,7,6,16,15,14,13} ;
- int _face3[]={1,5,6,2,17,13,18,9} ;
- int _face4[]={2,6,7,3,18,14,19,10} ;
- int _face5[]={3,7,8,4,19,15,20,11} ;
- int _face6[]={4,8,5,1,20,16,17,12} ;
- vector<int> face1(_face1,_face1+8);
- vector<int> face2(_face2,_face2+8);
- vector<int> face3(_face3,_face3+8);
- vector<int> face4(_face4,_face4+8);
- vector<int> face5(_face5,_face5+8);
- vector<int> face6(_face6,_face6+8);
- vector<int> _vector_face[]= {face1,face2,face3,face4,face5,face6} ;
- vector< vector<int> > vector_face(_vector_face,_vector_face+6);
-
- vector< vector<int> > __constituents__[]={vector_face,vector_edge};
- vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
- _constituents = _constituents_ ;
- vector<medGeometryElement> vector_edge_type(12,MED_SEG3) ;
- vector<medGeometryElement> vector_face_type(6,MED_QUAD8) ;
- vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
- vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
- _constituentsType = _constituents_type ;
+// int _edge1[]={1,2,9} ;
+// int _edge2[]={2,3,10} ;
+// int _edge3[]={3,4,11} ;
+// int _edge4[]={4,1,12} ;
+// int _edge5[]={5,6,13} ;
+// int _edge6[]={6,7,14};
+// int _edge7[]={7,8,15} ;
+// int _edge8[]={8,5,16} ;
+// int _edge9[]={1,5,17} ;
+// int _edge10[]={2,6,18} ;
+// int _edge11[]={3,7,19} ;
+// int _edge12[]={4,8,20} ;
+
+// vector<int> edge1(_edge1,_edge1+3) ;
+// vector<int> edge2(_edge2,_edge2+3) ;
+// vector<int> edge3(_edge3,_edge3+3) ;
+// vector<int> edge4(_edge4,_edge4+3) ;
+// vector<int> edge5(_edge5,_edge5+3) ;
+// vector<int> edge6(_edge6,_edge6+3) ;
+// vector<int> edge7(_edge7,_edge7+3) ;
+// vector<int> edge8(_edge8,_edge8+3) ;
+// vector<int> edge9(_edge9,_edge9+3) ;
+// vector<int> edge10(_edge10,_edge10+3) ;
+// vector<int> edge11(_edge11,_edge11+3) ;
+// vector<int> edge12(_edge12,_edge12+3) ;
+// vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9,edge10, edge11,edge12};
+// vector< vector<int> > vector_edge(_vector_edge,_vector_edge+12) ;
+
+// int _face1[]={1,2,3,4,9,10,11,12} ;
+// int _face2[]={5,8,7,6,16,15,14,13} ;
+// int _face3[]={1,5,6,2,17,13,18,9} ;
+// int _face4[]={2,6,7,3,18,14,19,10} ;
+// int _face5[]={3,7,8,4,19,15,20,11} ;
+// int _face6[]={4,8,5,1,20,16,17,12} ;
+// vector<int> face1(_face1,_face1+8);
+// vector<int> face2(_face2,_face2+8);
+// vector<int> face3(_face3,_face3+8);
+// vector<int> face4(_face4,_face4+8);
+// vector<int> face5(_face5,_face5+8);
+// vector<int> face6(_face6,_face6+8);
+// vector<int> _vector_face[]= {face1,face2,face3,face4,face5,face6} ;
+// vector< vector<int> > vector_face(_vector_face,_vector_face+6);
+
+// vector< vector<int> > __constituents__[]={vector_face,vector_edge};
+// vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
+// _constituents = _constituents_ ;
+ _numberOfConstituentsDimension=2 ;
+ _numberOfConstituents=new int[2] ;
+ _numberOfConstituents[0]=6 ;
+ _numberOfConstituents[1]=12 ;
+ _numberOfNodeOfEachConstituent=new (int*)[2] ;
+ _numberOfNodeOfEachConstituent[0]=new (int)[6] ;
+ _numberOfNodeOfEachConstituent[0][0]=8 ;
+ _numberOfNodeOfEachConstituent[0][1]=8 ;
+ _numberOfNodeOfEachConstituent[0][2]=8 ;
+ _numberOfNodeOfEachConstituent[0][3]=8 ;
+ _numberOfNodeOfEachConstituent[0][4]=8 ;
+ _numberOfNodeOfEachConstituent[0][5]=8 ;
+ _numberOfNodeOfEachConstituent[1]=new (int)[12] ;
+ _numberOfNodeOfEachConstituent[1][0]=3 ;
+ _numberOfNodeOfEachConstituent[1][1]=3 ;
+ _numberOfNodeOfEachConstituent[1][2]=3 ;
+ _numberOfNodeOfEachConstituent[1][3]=3 ;
+ _numberOfNodeOfEachConstituent[1][4]=3 ;
+ _numberOfNodeOfEachConstituent[1][5]=3 ;
+ _numberOfNodeOfEachConstituent[1][6]=3 ;
+ _numberOfNodeOfEachConstituent[1][7]=3 ;
+ _numberOfNodeOfEachConstituent[1][8]=3 ;
+ _numberOfNodeOfEachConstituent[1][9]=3 ;
+ _numberOfNodeOfEachConstituent[1][10]=3 ;
+ _numberOfNodeOfEachConstituent[1][11]=3 ;
+
+ int* _edge1=new int[3];
+ _edge1[0]=1;
+ _edge1[1]=2;
+ _edge1[1]=9;
+ int* _edge2=new int[3];
+ _edge2[0]=2;
+ _edge2[1]=3;
+ _edge2[1]=10;
+ int* _edge3=new int[3];
+ _edge3[0]=3;
+ _edge3[1]=4;
+ _edge3[2]=11;
+ int* _edge4=new int[3];
+ _edge4[0]=4;
+ _edge4[1]=1;
+ _edge4[2]=12;
+ int* _edge5=new int[3];
+ _edge5[0]=5;
+ _edge5[1]=6;
+ _edge5[2]=13;
+ int* _edge6=new int[3];
+ _edge6[0]=6;
+ _edge6[1]=7;
+ _edge6[2]=14;
+ int* _edge7=new int[3];
+ _edge7[0]=7;
+ _edge7[1]=8;
+ _edge7[2]=15;
+ int* _edge8=new int[3];
+ _edge8[0]=8;
+ _edge8[1]=5;
+ _edge8[2]=16;
+ int* _edge9=new int[3];
+ _edge9[0]=1;
+ _edge9[1]=5;
+ _edge9[2]=17;
+ int* _edge10=new int[3];
+ _edge10[0]=2;
+ _edge10[1]=6;
+ _edge10[2]=18;
+ int* _edge11=new int[3];
+ _edge11[0]=3;
+ _edge11[1]=7;
+ _edge11[2]=19;
+ int* _edge12=new int[3];
+ _edge12[0]=4;
+ _edge12[1]=8;
+ _edge12[2]=20;
+ int* _face1=new int[8];
+ _face1[0]=1;
+ _face1[1]=2;
+ _face1[2]=3;
+ _face1[3]=4;
+ _face1[4]=9;
+ _face1[5]=10;
+ _face1[6]=11;
+ _face1[7]=12;
+ int* _face2=new int[8];
+ _face2[0]=5;
+ _face2[1]=8;
+ _face2[2]=7;
+ _face2[3]=6;
+ _face2[4]=16;
+ _face2[5]=15;
+ _face2[6]=14;
+ _face2[7]=13;
+ int* _face3=new int[8];
+ _face3[0]=1;
+ _face3[1]=5;
+ _face3[2]=6;
+ _face3[3]=2;
+ _face3[4]=17;
+ _face3[5]=13;
+ _face3[6]=18;
+ _face3[7]=9;
+ int* _face4=new int[8];
+ _face4[0]=2;
+ _face4[1]=6;
+ _face4[2]=7;
+ _face4[3]=3;
+ _face4[4]=18;
+ _face4[5]=14;
+ _face4[6]=19;
+ _face4[7]=10;
+ int* _face5=new int[8];
+ _face5[0]=3;
+ _face5[1]=7;
+ _face5[2]=8;
+ _face5[3]=4;
+ _face5[4]=19;
+ _face5[5]=15;
+ _face5[6]=20;
+ _face5[7]=11;
+ int* _face6=new int[8];
+ _face6[0]=4;
+ _face6[1]=8;
+ _face6[2]=5;
+ _face6[3]=1;
+ _face6[4]=20;
+ _face6[5]=16;
+ _face6[6]=17;
+ _face6[7]=12;
+ int ** tmpConstituents1 = new (int*)[6];
+ tmpConstituents1[0]=_face1 ;
+ tmpConstituents1[1]=_face2 ;
+ tmpConstituents1[2]=_face3 ;
+ tmpConstituents1[3]=_face4 ;
+ tmpConstituents1[4]=_face5 ;
+ tmpConstituents1[5]=_face6 ;
+ int ** tmpConstituents2 = new (int*)[12];
+ tmpConstituents2[0]=_edge1 ;
+ tmpConstituents2[1]=_edge2 ;
+ tmpConstituents2[2]=_edge3 ;
+ tmpConstituents2[3]=_edge4 ;
+ tmpConstituents2[4]=_edge5 ;
+ tmpConstituents2[5]=_edge6 ;
+ tmpConstituents2[6]=_edge7 ;
+ tmpConstituents2[7]=_edge8 ;
+ tmpConstituents2[8]=_edge9 ;
+ tmpConstituents2[9]=_edge10;
+ tmpConstituents2[10]=_edge11;
+ tmpConstituents2[11]=_edge12;
+ _constituents = new int**[2] ;
+ _constituents[0]=tmpConstituents1 ;
+ _constituents[1]=tmpConstituents2 ;
+// vector<medGeometryElement> vector_edge_type(12,MED_SEG3) ;
+// vector<medGeometryElement> vector_face_type(6,MED_QUAD8) ;
+// vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
+// vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
+// _constituentsType = _constituents_type ;
+ medGeometryElement * tmpConstituentsType1 = new medGeometryElement[6] ;
+ tmpConstituentsType1[0] = MED_QUAD8 ;
+ tmpConstituentsType1[1] = MED_QUAD8 ;
+ tmpConstituentsType1[2] = MED_QUAD8 ;
+ tmpConstituentsType1[3] = MED_QUAD8 ;
+ tmpConstituentsType1[4] = MED_QUAD8 ;
+ tmpConstituentsType1[5] = MED_QUAD8 ;
+ medGeometryElement * tmpConstituentsType2 = new medGeometryElement[12] ;
+ tmpConstituentsType2[0] = MED_SEG3 ;
+ tmpConstituentsType2[1] = MED_SEG3 ;
+ tmpConstituentsType2[2] = MED_SEG3 ;
+ tmpConstituentsType2[3] = MED_SEG3 ;
+ tmpConstituentsType2[4] = MED_SEG3 ;
+ tmpConstituentsType2[5] = MED_SEG3 ;
+ tmpConstituentsType2[6] = MED_SEG3 ;
+ tmpConstituentsType2[7] = MED_SEG3 ;
+ tmpConstituentsType2[8] = MED_SEG3 ;
+ tmpConstituentsType2[9] = MED_SEG3 ;
+ tmpConstituentsType2[10] = MED_SEG3 ;
+ tmpConstituentsType2[11] = MED_SEG3 ;
+ _constituentsType = new medGeometryElement*[2] ;
+ _constituentsType[0]=tmpConstituentsType1 ;
+ _constituentsType[1]=tmpConstituentsType2 ;
break;
}
case MED_PENTA6 : {
_numberOfVertexes=6;
_numberOfNodes=6;
- int _edge1[]= {1,2} ;
- int _edge2[]= {2,3} ;
- int _edge3[]= {3,1} ;
- int _edge4[]= {4,5} ;
- int _edge5[]= {5,6} ;
- int _edge6[]= {6,4} ;
- int _edge7[]= {1,4} ;
- int _edge8[]= {2,5} ;
- int _edge9[]= {3,6} ;
-
- vector<int> edge1(_edge1,_edge1+2) ;
- vector<int> edge2(_edge2,_edge2+2) ;
- vector<int> edge3(_edge3,_edge3+2) ;
- vector<int> edge4(_edge4,_edge4+2) ;
- vector<int> edge5(_edge5,_edge5+2) ;
- vector<int> edge6(_edge6,_edge6+2) ;
- vector<int> edge7(_edge7,_edge7+2) ;
- vector<int> edge8(_edge8,_edge8+2) ;
- vector<int> edge9(_edge9,_edge9+2) ;
- vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9};
- vector< vector<int> > vector_edge(_vector_edge,_vector_edge+9) ;
-
- int _face1[]={1,2,3};
- int _face2[]={4,6,5};
- int _face3[]={1,4,5,2};
- int _face4[]={2,5,6,3};
- int _face5[]={3,6,4,1};
- vector<int> face1(_face1,_face1+3);
- vector<int> face2(_face2,_face2+3);
- vector<int> face3(_face3,_face3+4);
- vector<int> face4(_face4,_face4+4);
- vector<int> face5(_face5,_face5+4);
- vector<int> _vector_face[]= {face1,face2,face3,face4,face5} ;
- vector< vector<int> > vector_face(_vector_face,_vector_face+5);
+// int _edge1[]= {1,2} ;
+// int _edge2[]= {2,3} ;
+// int _edge3[]= {3,1} ;
+// int _edge4[]= {4,5} ;
+// int _edge5[]= {5,6} ;
+// int _edge6[]= {6,4} ;
+// int _edge7[]= {1,4} ;
+// int _edge8[]= {2,5} ;
+// int _edge9[]= {3,6} ;
+
+// vector<int> edge1(_edge1,_edge1+2) ;
+// vector<int> edge2(_edge2,_edge2+2) ;
+// vector<int> edge3(_edge3,_edge3+2) ;
+// vector<int> edge4(_edge4,_edge4+2) ;
+// vector<int> edge5(_edge5,_edge5+2) ;
+// vector<int> edge6(_edge6,_edge6+2) ;
+// vector<int> edge7(_edge7,_edge7+2) ;
+// vector<int> edge8(_edge8,_edge8+2) ;
+// vector<int> edge9(_edge9,_edge9+2) ;
+// vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9};
+// vector< vector<int> > vector_edge(_vector_edge,_vector_edge+9) ;
+
+// int _face1[]={1,2,3};
+// int _face2[]={4,6,5};
+// int _face3[]={1,4,5,2};
+// int _face4[]={2,5,6,3};
+// int _face5[]={3,6,4,1};
+// vector<int> face1(_face1,_face1+3);
+// vector<int> face2(_face2,_face2+3);
+// vector<int> face3(_face3,_face3+4);
+// vector<int> face4(_face4,_face4+4);
+// vector<int> face5(_face5,_face5+4);
+// vector<int> _vector_face[]= {face1,face2,face3,face4,face5} ;
+// vector< vector<int> > vector_face(_vector_face,_vector_face+5);
- vector< vector<int> > __constituents__[]={vector_face,vector_edge};
- vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
- _constituents = _constituents_ ;
- vector<medGeometryElement> vector_edge_type(9,MED_SEG2) ;
- vector<medGeometryElement> vector_face_type(5,MED_QUAD4) ;
- vector_face_type[0]=MED_TRIA3 ;
- vector_face_type[1]=MED_TRIA3 ;
- vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
- vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
- _constituentsType = _constituents_type ;
+// vector< vector<int> > __constituents__[]={vector_face,vector_edge};
+// vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
+// _constituents = _constituents_ ;
+ _numberOfConstituentsDimension=2 ;
+ _numberOfConstituents=new int[2] ;
+ _numberOfConstituents[0]=5 ;
+ _numberOfConstituents[1]=9 ;
+ _numberOfNodeOfEachConstituent=new (int*)[2] ;
+ _numberOfNodeOfEachConstituent[0]=new (int)[5] ;
+ _numberOfNodeOfEachConstituent[0][0]=3 ;
+ _numberOfNodeOfEachConstituent[0][1]=3 ;
+ _numberOfNodeOfEachConstituent[0][2]=4 ;
+ _numberOfNodeOfEachConstituent[0][3]=4 ;
+ _numberOfNodeOfEachConstituent[0][4]=4 ;
+ _numberOfNodeOfEachConstituent[1]=new (int)[9] ;
+ _numberOfNodeOfEachConstituent[1][0]=2 ;
+ _numberOfNodeOfEachConstituent[1][1]=2 ;
+ _numberOfNodeOfEachConstituent[1][2]=2 ;
+ _numberOfNodeOfEachConstituent[1][3]=2 ;
+ _numberOfNodeOfEachConstituent[1][4]=2 ;
+ _numberOfNodeOfEachConstituent[1][5]=2 ;
+ _numberOfNodeOfEachConstituent[1][6]=2 ;
+ _numberOfNodeOfEachConstituent[1][7]=2 ;
+ _numberOfNodeOfEachConstituent[1][8]=2 ;
+
+ int* _edge1=new int[2];
+ _edge1[0]=1;
+ _edge1[1]=2;
+ int* _edge2=new int[2];
+ _edge2[0]=2;
+ _edge2[1]=3;
+ int* _edge3=new int[2];
+ _edge3[0]=3;
+ _edge3[1]=1;
+ int* _edge4=new int[2];
+ _edge4[0]=4;
+ _edge4[1]=5;
+ int* _edge5=new int[2];
+ _edge5[0]=5;
+ _edge5[1]=6;
+ int* _edge6=new int[2];
+ _edge6[0]=6;
+ _edge6[1]=4;
+ int* _edge7=new int[2];
+ _edge7[0]=1;
+ _edge7[1]=4;
+ int* _edge8=new int[2];
+ _edge8[0]=2;
+ _edge8[1]=5;
+ int* _edge9=new int[2];
+ _edge9[0]=3;
+ _edge9[1]=6;
+ int* _face1=new int[3];
+ _face1[0]=1;
+ _face1[1]=2;
+ _face1[2]=3;
+ int* _face2=new int[3];
+ _face2[0]=4;
+ _face2[1]=6;
+ _face2[2]=5;
+ int* _face3=new int[4];
+ _face3[0]=1;
+ _face3[1]=4;
+ _face3[2]=5;
+ _face3[3]=2;
+ int* _face4=new int[4];
+ _face4[0]=2;
+ _face4[1]=5;
+ _face4[2]=6;
+ _face4[3]=3;
+ int* _face5=new int[4];
+ _face5[0]=3;
+ _face5[1]=6;
+ _face5[2]=4;
+ _face5[3]=1;
+ int ** tmpConstituents1 = new (int*)[5];
+ tmpConstituents1[0]=_face1 ;
+ tmpConstituents1[1]=_face2 ;
+ tmpConstituents1[2]=_face3 ;
+ tmpConstituents1[3]=_face4 ;
+ tmpConstituents1[4]=_face5 ;
+ int ** tmpConstituents2 = new (int*)[9];
+ tmpConstituents2[0]=_edge1 ;
+ tmpConstituents2[1]=_edge2 ;
+ tmpConstituents2[2]=_edge3 ;
+ tmpConstituents2[3]=_edge4 ;
+ tmpConstituents2[4]=_edge5 ;
+ tmpConstituents2[5]=_edge6 ;
+ tmpConstituents2[6]=_edge7 ;
+ tmpConstituents2[7]=_edge8 ;
+ tmpConstituents2[8]=_edge9 ;
+ _constituents = new int**[2] ;
+ _constituents[0]=tmpConstituents1 ;
+ _constituents[1]=tmpConstituents2 ;
+// vector<medGeometryElement> vector_edge_type(9,MED_SEG2) ;
+// vector<medGeometryElement> vector_face_type(5,MED_QUAD4) ;
+// vector_face_type[0]=MED_TRIA3 ;
+// vector_face_type[1]=MED_TRIA3 ;
+// vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
+// vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
+// _constituentsType = _constituents_type ;
+ medGeometryElement * tmpConstituentsType1 = new medGeometryElement[5] ;
+ tmpConstituentsType1[0] = MED_TRIA3 ;
+ tmpConstituentsType1[1] = MED_TRIA3 ;
+ tmpConstituentsType1[2] = MED_QUAD4 ;
+ tmpConstituentsType1[3] = MED_QUAD4 ;
+ tmpConstituentsType1[4] = MED_QUAD4 ;
+ medGeometryElement * tmpConstituentsType2 = new medGeometryElement[9] ;
+ tmpConstituentsType2[0] = MED_SEG2 ;
+ tmpConstituentsType2[1] = MED_SEG2 ;
+ tmpConstituentsType2[2] = MED_SEG2 ;
+ tmpConstituentsType2[3] = MED_SEG2 ;
+ tmpConstituentsType2[4] = MED_SEG2 ;
+ tmpConstituentsType2[5] = MED_SEG2 ;
+ tmpConstituentsType2[6] = MED_SEG2 ;
+ tmpConstituentsType2[7] = MED_SEG2 ;
+ tmpConstituentsType2[8] = MED_SEG2 ;
+ _constituentsType = new medGeometryElement*[2] ;
+ _constituentsType[0]=tmpConstituentsType1 ;
+ _constituentsType[1]=tmpConstituentsType2 ;
break;
}
case MED_PENTA15 : {
_dimension=3;
_numberOfVertexes=6;
_numberOfNodes=15;
- int _edge1[]={1,2,7} ;
- int _edge2[]={2,3,8} ;
- int _edge3[]={3,1,9} ;
- int _edge4[]={4,5,10} ;
- int _edge5[]={5,6,11} ;
- int _edge6[]={6,4,12} ;
- int _edge7[]={1,4,13} ;
- int _edge8[]={2,5,14} ;
- int _edge9[]={3,6,15} ;
-
- vector<int> edge1(_edge1,_edge1+3) ;
- vector<int> edge2(_edge2,_edge2+3) ;
- vector<int> edge3(_edge3,_edge3+3) ;
- vector<int> edge4(_edge4,_edge4+3) ;
- vector<int> edge5(_edge5,_edge5+3) ;
- vector<int> edge6(_edge6,_edge6+3) ;
- vector<int> edge7(_edge7,_edge7+3) ;
- vector<int> edge8(_edge8,_edge8+3) ;
- vector<int> edge9(_edge9,_edge9+3) ;
- vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9};
- vector< vector<int> > vector_edge(_vector_edge,_vector_edge+9) ;
-
- int _face1[]={1,2,3,7,8,9};
- int _face2[]={4,6,5,12,11,10};
- int _face3[]={1,4,5,2,13,10,14,7};
- int _face4[]={2,5,6,3,14,11,15,8};
- int _face5[]={3,6,4,1,15,12,13,9};
- vector<int> face1(_face1,_face1+6);
- vector<int> face2(_face2,_face2+6);
- vector<int> face3(_face3,_face3+8);
- vector<int> face4(_face4,_face4+8);
- vector<int> face5(_face5,_face5+8);
- vector<int> _vector_face[]= {face1,face2,face3,face4,face5} ;
- vector< vector<int> > vector_face(_vector_face,_vector_face+5);
-
- vector< vector<int> > __constituents__[]={vector_face,vector_edge};
- vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
- _constituents = _constituents_ ;
- vector<medGeometryElement> vector_edge_type(9,MED_SEG3) ;
- vector<medGeometryElement> vector_face_type(5,MED_QUAD8) ;
- vector_face_type[0]=MED_TRIA6 ;
- vector_face_type[1]=MED_TRIA6 ;
- vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
- vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
- _constituentsType = _constituents_type ;
- break;
+// int _edge1[]={1,2,7} ;
+// int _edge2[]={2,3,8} ;
+// int _edge3[]={3,1,9} ;
+// int _edge4[]={4,5,10} ;
+// int _edge5[]={5,6,11} ;
+// int _edge6[]={6,4,12} ;
+// int _edge7[]={1,4,13} ;
+// int _edge8[]={2,5,14} ;
+// int _edge9[]={3,6,15} ;
+
+// vector<int> edge1(_edge1,_edge1+3) ;
+// vector<int> edge2(_edge2,_edge2+3) ;
+// vector<int> edge3(_edge3,_edge3+3) ;
+// vector<int> edge4(_edge4,_edge4+3) ;
+// vector<int> edge5(_edge5,_edge5+3) ;
+// vector<int> edge6(_edge6,_edge6+3) ;
+// vector<int> edge7(_edge7,_edge7+3) ;
+// vector<int> edge8(_edge8,_edge8+3) ;
+// vector<int> edge9(_edge9,_edge9+3) ;
+// vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9};
+// vector< vector<int> > vector_edge(_vector_edge,_vector_edge+9) ;
+
+// int _face1[]={1,2,3,7,8,9};
+// int _face2[]={4,6,5,12,11,10};
+// int _face3[]={1,4,5,2,13,10,14,7};
+// int _face4[]={2,5,6,3,14,11,15,8};
+// int _face5[]={3,6,4,1,15,12,13,9};
+// vector<int> face1(_face1,_face1+6);
+// vector<int> face2(_face2,_face2+6);
+// vector<int> face3(_face3,_face3+8);
+// vector<int> face4(_face4,_face4+8);
+// vector<int> face5(_face5,_face5+8);
+// vector<int> _vector_face[]= {face1,face2,face3,face4,face5} ;
+// vector< vector<int> > vector_face(_vector_face,_vector_face+5);
+
+// vector< vector<int> > __constituents__[]={vector_face,vector_edge};
+// vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
+// _constituents = _constituents_ ;
+ _numberOfConstituentsDimension=2 ;
+ _numberOfConstituents=new int[2] ;
+ _numberOfConstituents[0]=5 ;
+ _numberOfConstituents[1]=9 ;
+ _numberOfNodeOfEachConstituent=new (int*)[2] ;
+ _numberOfNodeOfEachConstituent[0]=new (int)[5] ;
+ _numberOfNodeOfEachConstituent[0][0]=6 ;
+ _numberOfNodeOfEachConstituent[0][1]=6 ;
+ _numberOfNodeOfEachConstituent[0][2]=8 ;
+ _numberOfNodeOfEachConstituent[0][3]=8 ;
+ _numberOfNodeOfEachConstituent[0][4]=8 ;
+ _numberOfNodeOfEachConstituent[1]=new (int)[9] ;
+ _numberOfNodeOfEachConstituent[1][0]=3 ;
+ _numberOfNodeOfEachConstituent[1][1]=3 ;
+ _numberOfNodeOfEachConstituent[1][2]=3 ;
+ _numberOfNodeOfEachConstituent[1][3]=3 ;
+ _numberOfNodeOfEachConstituent[1][4]=3 ;
+ _numberOfNodeOfEachConstituent[1][5]=3 ;
+ _numberOfNodeOfEachConstituent[1][6]=3 ;
+ _numberOfNodeOfEachConstituent[1][7]=3 ;
+ _numberOfNodeOfEachConstituent[1][8]=3 ;
+
+ int* _edge1=new int[3];
+ _edge1[0]=1;
+ _edge1[1]=2;
+ _edge1[2]=7;
+ int* _edge2=new int[3];
+ _edge2[0]=2;
+ _edge2[1]=3;
+ _edge2[2]=8;
+ int* _edge3=new int[3];
+ _edge3[0]=3;
+ _edge3[1]=1;
+ _edge3[2]=9;
+ int* _edge4=new int[3];
+ _edge4[0]=4;
+ _edge4[1]=5;
+ _edge4[2]=10;
+ int* _edge5=new int[3];
+ _edge5[0]=5;
+ _edge5[1]=6;
+ _edge5[2]=11;
+ int* _edge6=new int[3];
+ _edge6[0]=6;
+ _edge6[1]=4;
+ _edge6[2]=12;
+ int* _edge7=new int[3];
+ _edge7[0]=1;
+ _edge7[1]=4;
+ _edge7[2]=13;
+ int* _edge8=new int[3];
+ _edge8[0]=2;
+ _edge8[1]=5;
+ _edge8[2]=14;
+ int* _edge9=new int[3];
+ _edge9[0]=3;
+ _edge9[1]=6;
+ _edge9[2]=15;
+ int* _face1=new int[6];
+ _face1[0]=1;
+ _face1[1]=2;
+ _face1[2]=3;
+ _face1[3]=7;
+ _face1[4]=8;
+ _face1[5]=9;
+ int* _face2=new int[6];
+ _face2[0]=4;
+ _face2[1]=5;
+ _face2[2]=6;
+ _face2[3]=12;
+ _face2[4]=11;
+ _face2[5]=10;
+ int* _face3=new int[8];
+ _face3[0]=1;
+ _face3[1]=4;
+ _face3[2]=5;
+ _face3[3]=2;
+ _face3[4]=13;
+ _face3[5]=10;
+ _face3[6]=14;
+ _face3[7]=7;
+ int* _face4=new int[8];
+ _face4[0]=2;
+ _face4[1]=5;
+ _face4[2]=6;
+ _face4[3]=3;
+ _face4[4]=14;
+ _face4[5]=11;
+ _face4[6]=15;
+ _face4[7]=8;
+ int* _face5=new int[8];
+ _face5[0]=3;
+ _face5[1]=6;
+ _face5[2]=4;
+ _face5[3]=1;
+ _face5[4]=15;
+ _face5[5]=12;
+ _face5[6]=13;
+ _face5[7]=9;
+ int ** tmpConstituents1 = new (int*)[5];
+ tmpConstituents1[0]=_face1 ;
+ tmpConstituents1[1]=_face2 ;
+ tmpConstituents1[2]=_face3 ;
+ tmpConstituents1[3]=_face4 ;
+ tmpConstituents1[4]=_face5 ;
+ int ** tmpConstituents2 = new (int*)[9];
+ tmpConstituents2[0]=_edge1 ;
+ tmpConstituents2[1]=_edge2 ;
+ tmpConstituents2[2]=_edge3 ;
+ tmpConstituents2[3]=_edge4 ;
+ tmpConstituents2[4]=_edge5 ;
+ tmpConstituents2[5]=_edge6 ;
+ tmpConstituents2[6]=_edge7 ;
+ tmpConstituents2[7]=_edge8 ;
+ tmpConstituents2[8]=_edge9 ;
+ _constituents = new (int**)[2] ;
+ _constituents[0]=tmpConstituents1 ;
+ _constituents[1]=tmpConstituents2 ;
+// vector<medGeometryElement> vector_edge_type(9,MED_SEG3) ;
+// vector<medGeometryElement> vector_face_type(5,MED_QUAD8) ;
+// vector_face_type[0]=MED_TRIA6 ;
+// vector_face_type[1]=MED_TRIA6 ;
+// vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
+// vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
+// _constituentsType = _constituents_type ;
+ medGeometryElement * tmpConstituentsType1 = new medGeometryElement[5] ;
+ tmpConstituentsType1[0] = MED_TRIA6 ;
+ tmpConstituentsType1[1] = MED_TRIA6 ;
+ tmpConstituentsType1[2] = MED_QUAD8 ;
+ tmpConstituentsType1[3] = MED_QUAD8 ;
+ tmpConstituentsType1[4] = MED_QUAD8 ;
+ medGeometryElement * tmpConstituentsType2 = new medGeometryElement[9] ;
+ tmpConstituentsType2[0] = MED_SEG3 ;
+ tmpConstituentsType2[1] = MED_SEG3 ;
+ tmpConstituentsType2[2] = MED_SEG3 ;
+ tmpConstituentsType2[3] = MED_SEG3 ;
+ tmpConstituentsType2[4] = MED_SEG3 ;
+ tmpConstituentsType2[5] = MED_SEG3 ;
+ tmpConstituentsType2[6] = MED_SEG3 ;
+ tmpConstituentsType2[7] = MED_SEG3 ;
+ tmpConstituentsType2[8] = MED_SEG3 ;
+ _constituentsType = new (medGeometryElement*)[2] ;
+ _constituentsType[0]=tmpConstituentsType1 ;
+ _constituentsType[1]=tmpConstituentsType2 ;
+ break ;
}
case MED_PYRA5 : {
_name="MED_PYRA5" ;
_dimension=3;
_numberOfVertexes=5;
_numberOfNodes=5;
- int _edge1[]={1,2} ;
- int _edge2[]={2,3} ;
- int _edge3[]={3,4} ;
- int _edge4[]={4,1} ;
- int _edge5[]={1,5} ;
- int _edge6[]={2,5} ;
- int _edge7[]={3,5} ;
- int _edge8[]={4,5} ;
-
- vector<int> edge1(_edge1,_edge1+2) ;
- vector<int> edge2(_edge2,_edge2+2) ;
- vector<int> edge3(_edge3,_edge3+2) ;
- vector<int> edge4(_edge4,_edge4+2) ;
- vector<int> edge5(_edge5,_edge5+2) ;
- vector<int> edge6(_edge6,_edge6+2) ;
- vector<int> edge7(_edge7,_edge7+2) ;
- vector<int> edge8(_edge8,_edge8+2) ;
- vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8};
- vector< vector<int> > vector_edge(_vector_edge,_vector_edge+8) ;
-
- int _face1[]={1,2,3,4} ;
- int _face2[]={1,5,2} ;
- int _face3[]={2,5,3} ;
- int _face4[]={3,5,4} ;
- int _face5[]={4,5,1} ;
- vector<int> face1(_face1,_face1+4);
- vector<int> face2(_face2,_face2+3);
- vector<int> face3(_face3,_face3+3);
- vector<int> face4(_face4,_face4+3);
- vector<int> face5(_face5,_face5+3);
- vector<int> _vector_face[]= {face1,face2,face3,face4,face5} ;
- vector< vector<int> > vector_face(_vector_face,_vector_face+5);
-
- vector< vector<int> > __constituents__[]={vector_face,vector_edge};
- vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
- _constituents = _constituents_ ;
- vector<medGeometryElement> vector_edge_type(8,MED_SEG2) ;
- vector<medGeometryElement> vector_face_type(5,MED_TRIA3) ;
- vector_face_type[0]=MED_QUAD4 ;
- vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
- vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
- _constituentsType = _constituents_type ;
+// int _edge1[]={1,2} ;
+// int _edge2[]={2,3} ;
+// int _edge3[]={3,4} ;
+// int _edge4[]={4,1} ;
+// int _edge5[]={1,5} ;
+// int _edge6[]={2,5} ;
+// int _edge7[]={3,5} ;
+// int _edge8[]={4,5} ;
+
+// vector<int> edge1(_edge1,_edge1+2) ;
+// vector<int> edge2(_edge2,_edge2+2) ;
+// vector<int> edge3(_edge3,_edge3+2) ;
+// vector<int> edge4(_edge4,_edge4+2) ;
+// vector<int> edge5(_edge5,_edge5+2) ;
+// vector<int> edge6(_edge6,_edge6+2) ;
+// vector<int> edge7(_edge7,_edge7+2) ;
+// vector<int> edge8(_edge8,_edge8+2) ;
+// vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8};
+// vector< vector<int> > vector_edge(_vector_edge,_vector_edge+8) ;
+
+// int _face1[]={1,2,3,4} ;
+// int _face2[]={1,5,2} ;
+// int _face3[]={2,5,3} ;
+// int _face4[]={3,5,4} ;
+// int _face5[]={4,5,1} ;
+// vector<int> face1(_face1,_face1+4);
+// vector<int> face2(_face2,_face2+3);
+// vector<int> face3(_face3,_face3+3);
+// vector<int> face4(_face4,_face4+3);
+// vector<int> face5(_face5,_face5+3);
+// vector<int> _vector_face[]= {face1,face2,face3,face4,face5} ;
+// vector< vector<int> > vector_face(_vector_face,_vector_face+5);
+
+// vector< vector<int> > __constituents__[]={vector_face,vector_edge};
+// vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
+// _constituents = _constituents_ ;
+ _numberOfConstituentsDimension=2 ;
+ _numberOfConstituents=new int[2] ;
+ _numberOfConstituents[0]=5 ;
+ _numberOfConstituents[1]=8 ;
+ _numberOfNodeOfEachConstituent=new (int*)[2] ;
+ _numberOfNodeOfEachConstituent[0]=new (int)[5] ;
+ _numberOfNodeOfEachConstituent[0][0]=4 ;
+ _numberOfNodeOfEachConstituent[0][1]=3 ;
+ _numberOfNodeOfEachConstituent[0][2]=3 ;
+ _numberOfNodeOfEachConstituent[0][3]=3 ;
+ _numberOfNodeOfEachConstituent[0][4]=3 ;
+ _numberOfNodeOfEachConstituent[1]=new (int)[8] ;
+ _numberOfNodeOfEachConstituent[1][0]=2 ;
+ _numberOfNodeOfEachConstituent[1][1]=2 ;
+ _numberOfNodeOfEachConstituent[1][2]=2 ;
+ _numberOfNodeOfEachConstituent[1][3]=2 ;
+ _numberOfNodeOfEachConstituent[1][4]=2 ;
+ _numberOfNodeOfEachConstituent[1][5]=2 ;
+ _numberOfNodeOfEachConstituent[1][6]=2 ;
+ _numberOfNodeOfEachConstituent[1][7]=2 ;
+
+ int* _edge1=new int[2];
+ _edge1[0]=1;
+ _edge1[1]=2;
+ int* _edge2=new int[2];
+ _edge2[0]=2;
+ _edge2[1]=3;
+ int* _edge3=new int[2];
+ _edge3[0]=3;
+ _edge3[1]=4;
+ int* _edge4=new int[2];
+ _edge4[0]=4;
+ _edge4[1]=1;
+ int* _edge5=new int[2];
+ _edge5[0]=1;
+ _edge5[1]=5;
+ int* _edge6=new int[2];
+ _edge6[0]=2;
+ _edge6[1]=5;
+ int* _edge7=new int[2];
+ _edge7[0]=3;
+ _edge7[1]=5;
+ int* _edge8=new int[2];
+ _edge8[0]=4;
+ _edge8[1]=5;
+ int* _face1=new int[4];
+ _face1[0]=1;
+ _face1[1]=2;
+ _face1[2]=3;
+ _face1[3]=4;
+ int* _face2=new int[3];
+ _face2[0]=1;
+ _face2[1]=5;
+ _face2[2]=2;
+ int* _face3=new int[3];
+ _face3[0]=2;
+ _face3[1]=5;
+ _face3[2]=3;
+ int* _face4=new int[3];
+ _face4[0]=3;
+ _face4[1]=5;
+ _face4[2]=4;
+ int* _face5=new int[3];
+ _face5[0]=4;
+ _face5[1]=5;
+ _face5[2]=1;
+ int ** tmpConstituents1 = new (int*)[5];
+ tmpConstituents1[0]=_face1 ;
+ tmpConstituents1[1]=_face2 ;
+ tmpConstituents1[2]=_face3 ;
+ tmpConstituents1[3]=_face4 ;
+ tmpConstituents1[4]=_face5 ;
+ int ** tmpConstituents2 = new (int*)[8];
+ tmpConstituents2[0]=_edge1 ;
+ tmpConstituents2[1]=_edge2 ;
+ tmpConstituents2[2]=_edge3 ;
+ tmpConstituents2[3]=_edge4 ;
+ tmpConstituents2[4]=_edge5 ;
+ tmpConstituents2[5]=_edge6 ;
+ tmpConstituents2[6]=_edge7 ;
+ tmpConstituents2[7]=_edge8 ;
+ _constituents = new int**[2] ;
+ _constituents[0]=tmpConstituents1 ;
+ _constituents[1]=tmpConstituents2 ;
+// vector<medGeometryElement> vector_edge_type(8,MED_SEG2) ;
+// vector<medGeometryElement> vector_face_type(5,MED_TRIA3) ;
+// vector_face_type[0]=MED_QUAD4 ;
+// vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
+// vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
+// _constituentsType = _constituents_type ;
+ medGeometryElement * tmpConstituentsType1 = new medGeometryElement[5] ;
+ tmpConstituentsType1[0] = MED_QUAD4 ;
+ tmpConstituentsType1[1] = MED_TRIA3 ;
+ tmpConstituentsType1[2] = MED_TRIA3 ;
+ tmpConstituentsType1[3] = MED_TRIA3 ;
+ tmpConstituentsType1[4] = MED_TRIA3 ;
+ medGeometryElement * tmpConstituentsType2 = new medGeometryElement[8] ;
+ tmpConstituentsType2[0] = MED_SEG2 ;
+ tmpConstituentsType2[1] = MED_SEG2 ;
+ tmpConstituentsType2[2] = MED_SEG2 ;
+ tmpConstituentsType2[3] = MED_SEG2 ;
+ tmpConstituentsType2[4] = MED_SEG2 ;
+ tmpConstituentsType2[5] = MED_SEG2 ;
+ tmpConstituentsType2[6] = MED_SEG2 ;
+ tmpConstituentsType2[7] = MED_SEG2 ;
+ _constituentsType = new medGeometryElement*[2] ;
+ _constituentsType[0]=tmpConstituentsType1 ;
+ _constituentsType[1]=tmpConstituentsType2 ;
break;
}
case MED_PYRA13 : {
_dimension=3;
_numberOfVertexes=5;
_numberOfNodes=13;
- int _edge1[]={1,2,6} ;
- int _edge2[]={2,3,7} ;
- int _edge3[]={3,4,8} ;
- int _edge4[]={4,1,9} ;
- int _edge5[]={1,5,10} ;
- int _edge6[]={2,5,11} ;
- int _edge7[]={3,5,12} ;
- int _edge8[]={4,5,13} ;
-
- vector<int> edge1(_edge1,_edge1+3) ;
- vector<int> edge2(_edge2,_edge2+3) ;
- vector<int> edge3(_edge3,_edge3+3) ;
- vector<int> edge4(_edge4,_edge4+3) ;
- vector<int> edge5(_edge5,_edge5+3) ;
- vector<int> edge6(_edge6,_edge6+3) ;
- vector<int> edge7(_edge7,_edge7+3) ;
- vector<int> edge8(_edge8,_edge8+3) ;
-
-
- vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8};
- vector< vector<int> > vector_edge(_vector_edge,_vector_edge+8) ;
-
- int _face1[]={1,2,3,4,6,7,8,9} ;
- int _face2[]={1,5,2,10,11,6} ;
- int _face3[]={2,5,3,11,12,7} ;
- int _face4[]={3,5,4,12,13,8} ;
- int _face5[]={4,5,1,13,10,9} ;
- vector<int> face1(_face1,_face1+8);
- vector<int> face2(_face2,_face2+6);
- vector<int> face3(_face3,_face3+6);
- vector<int> face4(_face4,_face4+6);
- vector<int> face5(_face5,_face5+6);
- vector<int> _vector_face[]= {face1,face2,face3,face4,face5} ;
- vector< vector<int> > vector_face(_vector_face,_vector_face+5);
-
-
- vector< vector<int> > __constituents__[]={vector_face,vector_edge};
- vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
- _constituents = _constituents_ ;
- vector<medGeometryElement> vector_edge_type(8,MED_SEG3) ;
- vector<medGeometryElement> vector_face_type(5,MED_TRIA6) ;
- vector_face_type[0]=MED_QUAD8 ;
- vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
- vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
-
- _constituentsType = _constituents_type ;
+// int _edge1[]={1,2,6} ;
+// int _edge2[]={2,3,7} ;
+// int _edge3[]={3,4,8} ;
+// int _edge4[]={4,1,9} ;
+// int _edge5[]={1,5,10} ;
+// int _edge6[]={2,5,11} ;
+// int _edge7[]={3,5,12} ;
+// int _edge8[]={4,5,13} ;
+
+// vector<int> edge1(_edge1,_edge1+3) ;
+// vector<int> edge2(_edge2,_edge2+3) ;
+// vector<int> edge3(_edge3,_edge3+3) ;
+// vector<int> edge4(_edge4,_edge4+3) ;
+// vector<int> edge5(_edge5,_edge5+3) ;
+// vector<int> edge6(_edge6,_edge6+3) ;
+// vector<int> edge7(_edge7,_edge7+3) ;
+// vector<int> edge8(_edge8,_edge8+3) ;
+
+
+// vector<int> _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8};
+// vector< vector<int> > vector_edge(_vector_edge,_vector_edge+8) ;
+
+// int _face1[]={1,2,3,4,6,7,8,9} ;
+// int _face2[]={1,5,2,10,11,6} ;
+// int _face3[]={2,5,3,11,12,7} ;
+// int _face4[]={3,5,4,12,13,8} ;
+// int _face5[]={4,5,1,13,10,9} ;
+// vector<int> face1(_face1,_face1+8);
+// vector<int> face2(_face2,_face2+6);
+// vector<int> face3(_face3,_face3+6);
+// vector<int> face4(_face4,_face4+6);
+// vector<int> face5(_face5,_face5+6);
+// vector<int> _vector_face[]= {face1,face2,face3,face4,face5} ;
+// vector< vector<int> > vector_face(_vector_face,_vector_face+5);
+
+
+// vector< vector<int> > __constituents__[]={vector_face,vector_edge};
+// vector< vector< vector<int> > > _constituents_(__constituents__,__constituents__+2) ;
+// _constituents = _constituents_ ;
+ _numberOfConstituentsDimension=2 ;
+ _numberOfConstituents=new int[2] ;
+ _numberOfConstituents[0]=5 ;
+ _numberOfConstituents[1]=8 ;
+ _numberOfNodeOfEachConstituent=new (int*)[2] ;
+ _numberOfNodeOfEachConstituent[0]=new (int)[5] ;
+ _numberOfNodeOfEachConstituent[0][0]=8 ;
+ _numberOfNodeOfEachConstituent[0][1]=6 ;
+ _numberOfNodeOfEachConstituent[0][2]=6 ;
+ _numberOfNodeOfEachConstituent[0][3]=6 ;
+ _numberOfNodeOfEachConstituent[0][4]=6 ;
+ _numberOfNodeOfEachConstituent[1]=new (int)[8] ;
+ _numberOfNodeOfEachConstituent[1][0]=3 ;
+ _numberOfNodeOfEachConstituent[1][1]=3 ;
+ _numberOfNodeOfEachConstituent[1][2]=3 ;
+ _numberOfNodeOfEachConstituent[1][3]=3 ;
+ _numberOfNodeOfEachConstituent[1][4]=3 ;
+ _numberOfNodeOfEachConstituent[1][5]=3 ;
+ _numberOfNodeOfEachConstituent[1][6]=3 ;
+ _numberOfNodeOfEachConstituent[1][7]=3 ;
+
+ int* _edge1=new int[3];
+ _edge1[0]=1;
+ _edge1[1]=2;
+ _edge1[2]=6;
+ int* _edge2=new int[3];
+ _edge2[0]=2;
+ _edge2[1]=3;
+ _edge2[2]=7;
+ int* _edge3=new int[3];
+ _edge3[0]=3;
+ _edge3[1]=4;
+ _edge3[2]=8;
+ int* _edge4=new int[3];
+ _edge4[0]=4;
+ _edge4[1]=1;
+ _edge4[2]=9;
+ int* _edge5=new int[3];
+ _edge5[0]=1;
+ _edge5[1]=5;
+ _edge5[2]=10;
+ int* _edge6=new int[3];
+ _edge6[0]=2;
+ _edge6[1]=5;
+ _edge6[2]=11;
+ int* _edge7=new int[3];
+ _edge7[0]=3;
+ _edge7[1]=5;
+ _edge7[2]=12;
+ int* _edge8=new int[3];
+ _edge8[0]=4;
+ _edge8[1]=5;
+ _edge8[2]=13;
+ int* _face1=new int[8];
+ _face1[0]=1;
+ _face1[1]=2;
+ _face1[2]=3;
+ _face1[3]=4;
+ _face1[4]=6;
+ _face1[5]=7;
+ _face1[6]=8;
+ _face1[7]=9;
+ int* _face2=new int[6];
+ _face2[0]=1;
+ _face2[1]=5;
+ _face2[2]=2;
+ _face2[3]=10;
+ _face2[4]=11;
+ _face2[5]=6;
+ int* _face3=new int[6];
+ _face3[0]=2;
+ _face3[1]=5;
+ _face3[2]=3;
+ _face3[3]=11;
+ _face3[4]=12;
+ _face3[5]=7;
+ int* _face4=new int[6];
+ _face4[0]=3;
+ _face4[1]=5;
+ _face4[2]=4;
+ _face4[3]=12;
+ _face4[4]=13;
+ _face4[5]=8;
+ int* _face5=new int[6];
+ _face5[0]=4;
+ _face5[1]=5;
+ _face5[2]=1;
+ _face5[3]=13;
+ _face5[4]=10;
+ _face5[5]=9;
+ int ** tmpConstituents1 = new (int*)[5];
+ tmpConstituents1[0]=_face1 ;
+ tmpConstituents1[1]=_face2 ;
+ tmpConstituents1[2]=_face3 ;
+ tmpConstituents1[3]=_face4 ;
+ tmpConstituents1[4]=_face5 ;
+ int ** tmpConstituents2 = new (int*)[8];
+ tmpConstituents2[0]=_edge1 ;
+ tmpConstituents2[1]=_edge2 ;
+ tmpConstituents2[2]=_edge3 ;
+ tmpConstituents2[3]=_edge4 ;
+ tmpConstituents2[4]=_edge5 ;
+ tmpConstituents2[5]=_edge6 ;
+ tmpConstituents2[6]=_edge7 ;
+ tmpConstituents2[7]=_edge8 ;
+ _constituents = new int**[2] ;
+ _constituents[0]=tmpConstituents1 ;
+ _constituents[1]=tmpConstituents2 ;
+// vector<medGeometryElement> vector_edge_type(8,MED_SEG3) ;
+// vector<medGeometryElement> vector_face_type(5,MED_TRIA6) ;
+// vector_face_type[0]=MED_QUAD8 ;
+// vector<medGeometryElement> __constituents_type[]={vector_face_type,vector_edge_type};
+// vector< vector<medGeometryElement> > _constituents_type(__constituents_type,__constituents_type+2) ;
+
+// _constituentsType = _constituents_type ;
+ medGeometryElement * tmpConstituentsType1 = new medGeometryElement[5] ;
+ tmpConstituentsType1[0] = MED_QUAD8 ;
+ tmpConstituentsType1[1] = MED_TRIA6 ;
+ tmpConstituentsType1[2] = MED_TRIA6 ;
+ tmpConstituentsType1[3] = MED_TRIA6 ;
+ tmpConstituentsType1[4] = MED_TRIA6 ;
+ medGeometryElement * tmpConstituentsType2 = new medGeometryElement[8] ;
+ tmpConstituentsType2[0] = MED_SEG3 ;
+ tmpConstituentsType2[1] = MED_SEG3 ;
+ tmpConstituentsType2[2] = MED_SEG3 ;
+ tmpConstituentsType2[3] = MED_SEG3 ;
+ tmpConstituentsType2[4] = MED_SEG3 ;
+ tmpConstituentsType2[5] = MED_SEG3 ;
+ tmpConstituentsType2[6] = MED_SEG3 ;
+ tmpConstituentsType2[7] = MED_SEG3 ;
+ _constituentsType = new medGeometryElement*[2] ;
+ _constituentsType[0]=tmpConstituentsType1 ;
+ _constituentsType[1]=tmpConstituentsType2 ;
break;
}
// default :
os << " - dimension : " << my._dimension << endl;
os << " - number of nodes : " << my._numberOfNodes << endl ;
os << " - number of vertexes : " << my._numberOfVertexes << endl ;
- for(int i=0;i<my._constituents.size();i++)
+
+ os << " - number of Constituents Dimension : " << my._numberOfConstituentsDimension << endl ;
+
+ for(int i=0;i<my._numberOfConstituentsDimension;i++)
{
+
os << " - for dimension (-" << i+1 << ") : " << endl ;
- for(int j=0;j<my._constituents[i].size();j++)
+ os << " - number of Constituents for this Dimension : " << my._numberOfConstituents[i] << endl ;
+
+ for(int j=0;j<my._numberOfConstituents[i];j++)
{
- os << " - constituents " << j+1 << " of type "<< my._constituentsType[i][j] <<" : " ;
- for(int k=0;k<my._constituents[i][j].size();k++)
+ os << " - number of node for this constituent : " << my._numberOfNodeOfEachConstituent[i][j] << endl ;
+ os << " - constituents " << j+1 << " of type "<< my._constituentsType[i][j] <<" : " ;
+ for(int k=0;k<my._numberOfNodeOfEachConstituent[i][j];k++)
os << my._constituents[i][j][k] << " " ;
os << endl ;
}
return os;
}
-
-
- // Return number of constituents type (which dimension is _dimension-1).
+// Return number of constituents type (which dimension is _dimension-1).
int CELLMODEL::getNumberOfConstituentsType() const
{
set<medGeometryElement> constituentsTypes ;
- if (_constituentsType.size() > 0 ) {
- vector<medGeometryElement> constituentsType = _constituentsType[0] ;
- vector<medGeometryElement>::iterator itvec ;
- for(itvec=constituentsType.begin();itvec!=constituentsType.end();itvec++)
- constituentsTypes.insert(*itvec);
- }
+// if (_constituentsType.size() > 0 ) {
+// vector<medGeometryElement> constituentsType = _constituentsType[0] ;
+// vector<medGeometryElement>::iterator itvec ;
+// for(itvec=constituentsType.begin();itvec!=constituentsType.end();itvec++)
+// constituentsTypes.insert(*itvec);
+// }
return constituentsTypes.size() ;
}
// Return all types of constituents which dimension is (_dimension-1).
-set <medGeometryElement> CELLMODEL::getAllConstituentsType() const
+set<medGeometryElement> CELLMODEL::getAllConstituentsType() const
{
set<medGeometryElement> constituentsTypes ;
- if (_constituentsType.size() > 0 ) {
- vector<medGeometryElement> constituentsType = _constituentsType[0] ;
- vector<medGeometryElement>::iterator itvec ;
- for(itvec=constituentsType.begin();itvec!=constituentsType.end();itvec++)
- constituentsTypes.insert(*itvec);
- }
+// if (_constituentsType.size() > 0 ) {
+// vector<medGeometryElement> constituentsType = _constituentsType[0] ;
+// vector<medGeometryElement>::iterator itvec ;
+// for(itvec=constituentsType.begin();itvec!=constituentsType.end();itvec++)
+// constituentsTypes.insert(*itvec);
+// }
return constituentsTypes ;
}
// Return number of constituents foreach type (which dimension is _dimension-1).
-map <medGeometryElement,int> CELLMODEL::getNumberOfConstituentsForeachType() const
+map<medGeometryElement,int> CELLMODEL::getNumberOfConstituentsForeachType() const
{
map<medGeometryElement,int> numberOfConstituentsForeachType ;
- map<medGeometryElement,int>::iterator itmap ;
- if (_constituentsType.size() > 0 ) {
- vector<medGeometryElement> constituentsType = _constituentsType[0] ;
- vector<medGeometryElement>::iterator itvec ;
- for(itvec=constituentsType.begin();itvec!=constituentsType.end();itvec++) {
- itmap = numberOfConstituentsForeachType.find(*itvec);
- if (itmap==numberOfConstituentsForeachType.end()) // new element
- numberOfConstituentsForeachType[*itvec]=1 ;
- else
- numberOfConstituentsForeachType[*itvec]++ ;
+// map<medGeometryElement,int>::iterator itmap ;
+// if (_constituentsType.size() > 0 ) {
+// vector<medGeometryElement> constituentsType = _constituentsType[0] ;
+// vector<medGeometryElement>::iterator itvec ;
+// for(itvec=constituentsType.begin();itvec!=constituentsType.end();itvec++) {
+// itmap = numberOfConstituentsForeachType.find(*itvec);
+// if (itmap==numberOfConstituentsForeachType.end()) // new element
+// numberOfConstituentsForeachType[*itvec]=1 ;
+// else
+// numberOfConstituentsForeachType[*itvec]++ ;
+// }
+// }
+ return numberOfConstituentsForeachType ;
+}
+
+void CELLMODEL::init(const CELLMODEL &m)
+{
+ _name=m._name ;
+ _type= m._type ;
+ _dimension = m._dimension ;
+ _numberOfNodes = m._numberOfNodes ;
+ _numberOfVertexes = m._numberOfVertexes ;
+
+ _numberOfConstituentsDimension = m._numberOfConstituentsDimension ;
+
+ _numberOfConstituents = new int[_numberOfConstituentsDimension] ;
+ for(int i=0; i<_numberOfConstituentsDimension; i++)
+ _numberOfConstituents[i]=m._numberOfConstituents[i] ;
+
+ _numberOfNodeOfEachConstituent = new (int*)[_numberOfConstituentsDimension] ;
+ for(int i=0; i<_numberOfConstituentsDimension; i++) {
+ int numberOf = _numberOfConstituents[i] ;
+ int * newArray = new int[numberOf] ;
+ int * oldArray = m._numberOfNodeOfEachConstituent[i] ;
+ for(int j=0; j<numberOf; j++)
+ newArray[j] = oldArray[j] ;
+ _numberOfNodeOfEachConstituent[i] = newArray ;
+ }
+ _constituents = new (int**)[_numberOfConstituentsDimension] ;
+ _constituentsType = new (medGeometryElement*)[_numberOfConstituentsDimension] ;
+ for(int i=0; i<_numberOfConstituentsDimension; i++) {
+ int numberOf = _numberOfConstituents[i] ;
+ int ** tmpArray = new (int*)[numberOf] ;
+ medGeometryElement * newArrayType = new medGeometryElement[numberOf] ;
+ medGeometryElement * oldArrayType = m._constituentsType[i] ;
+
+ for(int j=0; j<numberOf; j++) {
+ int numberOf2 = _numberOfNodeOfEachConstituent[i][j] ;
+ int * newArray = new int[numberOf2] ;
+ int * oldArray = m._constituents[i][j] ;
+ for(int k=0; k<numberOf2; k++)
+ newArray[k] = oldArray[k] ;
+ tmpArray[j] = newArray ;
+ newArrayType[j] = oldArrayType[j] ;
}
+ _constituents[i] = tmpArray ;
+ _constituentsType[i] = newArrayType ;
}
- return numberOfConstituentsForeachType ;
+
+}
+void CELLMODEL::clean()
+{
+ for(int i=0; i<_numberOfConstituentsDimension; i++) {
+ int numberOf = _numberOfConstituents[i] ;
+ for(int j=0; j<numberOf; j++) {
+ if (NULL!=_constituents[i][j])
+ delete[] _constituents[i][j] ;
+ }
+ if (NULL!=_constituentsType[i])
+ delete[] _constituentsType[i] ;
+ if (NULL!=_constituents[i])
+ delete[] _constituents[i] ;
+ if (NULL!=_numberOfNodeOfEachConstituent[i])
+ delete[] _numberOfNodeOfEachConstituent[i] ;
+ }
+ if (NULL!=_numberOfConstituents)
+ delete[]_numberOfConstituents ;
+ if (NULL!=_constituentsType)
+ delete[] _constituentsType ;
+ if (NULL!=_constituents)
+ delete[] _constituents ;
+ if (NULL!=_numberOfNodeOfEachConstituent)
+ delete[] _numberOfNodeOfEachConstituent ;
}
/*
- File CellModel.hxx
+ File MEDMEM_CellModel.hxx
$Header$
*/
#ifndef CELLMODEL_HXX
#define CELLMODEL_HXX
-#include <vector>
+//#include <vector>
#include <set>
#include <map>
#include <string>
#include "MEDMEM_define.hxx"
+using namespace std ;
+
using namespace MED_EN;
-class CELLMODEL
-{
+class CELLMODEL {
+
+private:
+ // use in constructor and operator=
+ void init(const CELLMODEL &m) ;
+ // use in operator= and destructor
+ void clean() ;
-protected :
+protected:
string _name ;
medGeometryElement _type ;
int _dimension ; // Cell _dimension (!= space _dimension)
int _numberOfNodes ;
int _numberOfVertexes ;
- vector< vector< vector<int> > > _constituents ;
- // define local connectivity for each constituents
- // composing it (
- // first vector : for each cell _dimension
- // (first : dim-1, second if any : dim-2)
- // second vector : for each constituents of this _dimension,
- // third vector : list of local nodes
- vector< vector<medGeometryElement> > _constituentsType ;
+ int _numberOfConstituentsDimension ; // 2 in 3D, 1 in 2D
+ // Array of size _numberOfConstituentsDimension
+ int* _numberOfConstituents ;
+ // Array of size _numberOfConstituentsDimensionx_numberOfConstituents[i]
+ int** _numberOfNodeOfEachConstituent ;
+ // Define nodal local connectivity for each constituent for each dimension
+ int*** _constituents ;
+ // define local connectivity for each constituents
+ // composing it (
+ // first vector : for each cell _dimension
+ // (first : dim-1, second if any : dim-2)
+ // second vector : for each constituents of this _dimension,
+ // third vector : list of local nodes
+ medGeometryElement** _constituentsType ;
public :
- CELLMODEL(){
- _type=MED_NONE ;
- _dimension = 0 ;
- _numberOfNodes = 0 ;
- _numberOfVertexes = 0 ;
+ CELLMODEL():
+ _type(MED_NONE),
+ _dimension(0),
+ _numberOfNodes(0),
+ _numberOfVertexes(0),
+ _numberOfConstituentsDimension(0),
+ _numberOfConstituents((int*)NULL),
+ _numberOfNodeOfEachConstituent((int**)NULL),
+ _constituents((int***)NULL),
+ _constituentsType((medGeometryElement**)NULL)
+ {
}
CELLMODEL(medGeometryElement t) ;
CELLMODEL(const CELLMODEL &m){
- _name= m._name ;
- _type= m._type ;
- _dimension = m._dimension ;
- _numberOfNodes = m._numberOfNodes ;
- _numberOfVertexes = m._numberOfVertexes ;
- _constituents = m._constituents ;
- _constituentsType = m._constituentsType ;
+ init(m) ;
}
~CELLMODEL() {
+ clean() ;
};
CELLMODEL & operator=(const CELLMODEL &m) {
- _name=m._name ;
- _type= m._type ;
- _dimension = m._dimension ;
- _numberOfNodes = m._numberOfNodes ;
- _numberOfVertexes = m._numberOfVertexes ;
- _constituents = m._constituents ;
- _constituentsType = m._constituentsType ;
+ clean() ;
+ init(m) ;
return *this ;
}
friend ostream & operator<<(ostream &os,const CELLMODEL &my);
inline medGeometryElement getType() const;
// Return all constituents which dimension is _dimension-dim.
- vector< vector<int> > getConstituents(int dim) const;
+ // vector< vector<int> > getConstituents(int dim) const;
+ int** getConstituents(int dim) const;
// Return number of constituents which dimension is _dimension-dim.
int getNumberOfConstituents(int dim) const;
// Return local nodes numbers vector for num-th constituent which dimension is _dimension-dim.
- vector<int> getNodesConstituent(int dim,int num) const;
+ int* getNodesConstituent(int dim,int num) const;
// Return local node number of nodes_index-th node for num-th constituent which dimension is _dimension-dim.
int getNodeConstituent(int dim,int num,int nodes_index);
// Return types of each constituents which dimension is _dimension-dim.
- vector <medGeometryElement> getConstituentsType(int dim) const;
+ medGeometryElement* getConstituentsType(int dim) const;
// Return type of num-th constituent which dimension is _dimension-dim.
medGeometryElement getConstituentType(int dim,int num) const;
int getNumberOfConstituentsType() const;
// Return all types of constituents which dimension is (_dimension-1).
- set <medGeometryElement> getAllConstituentsType() const;
+ set<medGeometryElement> getAllConstituentsType() const;
// Return number of constituents foreach type (which dimension is _dimension-1).
- map <medGeometryElement,int> getNumberOfConstituentsForeachType() const;
+ map<medGeometryElement,int> getNumberOfConstituentsForeachType() const;
};
inline string CELLMODEL::getName() const
{
- return _name ;
+ return _name ;
}
inline int CELLMODEL::getNumberOfVertexes() const
{
- return _numberOfVertexes;
+ return _numberOfVertexes;
}
inline int CELLMODEL::getNumberOfNodes() const
{
- return _numberOfNodes;
+ return _numberOfNodes;
}
inline int CELLMODEL::getDimension() const
{
- return _dimension;
+ return _dimension;
}
inline medGeometryElement CELLMODEL::getType() const
{
- return _type;
+ return _type;
}
-inline vector< vector<int> > CELLMODEL::getConstituents(int dim) const
+//inline vector< vector<int> > CELLMODEL::getConstituents(int dim) const
+inline int** CELLMODEL::getConstituents(int dim) const
{
return _constituents[dim-1] ;
}
inline int CELLMODEL::getNumberOfConstituents(int dim) const
{
- return _constituents[dim-1].size() ;
+ return _numberOfConstituents[dim-1] ;
+ //return _constituents[dim-1].size() ;
}
-inline vector<int> CELLMODEL::getNodesConstituent(int dim,int num) const
+//inline vector<int> CELLMODEL::getNodesConstituent(int dim,int num) const
+inline int* CELLMODEL::getNodesConstituent(int dim,int num) const
{
return _constituents[dim-1][num-1];
}
{
return _constituents[dim-1][num-1][nodesNumber-1] ;
}
-inline vector<medGeometryElement> CELLMODEL::getConstituentsType(int dim) const
+//inline vector<medGeometryElement> CELLMODEL::getConstituentsType(int dim) const
+inline medGeometryElement* CELLMODEL::getConstituentsType(int dim) const
{
return _constituentsType[dim-1];
}
+using namespace std;
#include "MEDMEM_Connectivity.hxx"
#include "MEDMEM_Family.hxx"
#include "MEDMEM_CellModel.hxx"
#include "MEDMEM_STRING.hxx"
//------------------------------------------------------//
-CONNECTIVITY::CONNECTIVITY(medEntityMesh Entity=MED_CELL):
+CONNECTIVITY::CONNECTIVITY(medEntityMesh Entity/*=MED_CELL*/):
//------------------------------------------------------//
_entity(Entity),
_typeConnectivity(MED_NODAL),
}
//-------------------------------------------------------------------------//
-CONNECTIVITY::CONNECTIVITY(int numberOfTypes,medEntityMesh Entity=MED_CELL):
+CONNECTIVITY::CONNECTIVITY(int numberOfTypes,medEntityMesh Entity/*=MED_CELL*/):
//-------------------------------------------------------------------------//
_entity(Entity),
_typeConnectivity(MED_NODAL),
_count = new int[numberOfTypes];
}
+//-------------------------------------------------------------------------//
+CONNECTIVITY::CONNECTIVITY(CONNECTIVITY & m)
+//-------------------------------------------------------------------------//
+{
+ _entity = m._entity;
+ _typeConnectivity = m._typeConnectivity;
+ _numberOfTypes = m._numberOfTypes;
+ if (m._geometricTypes != NULL)
+ {
+ _geometricTypes = new medGeometryElement[m._numberOfTypes];
+ memcpy(_geometricTypes,m._geometricTypes,m._numberOfTypes*sizeof(medGeometryElement));
+ }
+ else
+ _geometricTypes = (medGeometryElement *) NULL;
+ if (m._type != NULL)
+ _type = new CELLMODEL(* m._type);
+ else
+ _type = (CELLMODEL *) NULL;
+ _entityDimension = m._entityDimension;
+ _numberOfNodes = m._numberOfNodes;
+ if (m._count != NULL)
+ {
+ _count = new med_int[m._numberOfTypes+1];
+ memcpy(_count,m._count,(m._numberOfTypes+1)*sizeof(med_int));
+ }
+ else
+ _count = (med_int *) NULL;
+ if (m._nodal != NULL)
+ _nodal = new MEDSKYLINEARRAY(* m._nodal);
+ else
+ _nodal = (MEDSKYLINEARRAY *) NULL;
+ if (m._descending != NULL)
+ _descending = new MEDSKYLINEARRAY(* m._descending);
+ else
+ _descending = (MEDSKYLINEARRAY *) NULL;
+ if (m._reverseNodalConnectivity != NULL)
+ _reverseNodalConnectivity = new MEDSKYLINEARRAY(* m._reverseNodalConnectivity);
+ else
+ _reverseNodalConnectivity = (MEDSKYLINEARRAY *) NULL;
+ if (m._reverseDescendingConnectivity != NULL)
+ _reverseDescendingConnectivity = new MEDSKYLINEARRAY(* m._reverseDescendingConnectivity);
+ else
+ _reverseDescendingConnectivity = (MEDSKYLINEARRAY *) NULL;
+ if (m._neighbourhood != NULL)
+ _neighbourhood = new MEDSKYLINEARRAY(* m._neighbourhood);
+ else
+ _neighbourhood = (MEDSKYLINEARRAY *) NULL;
+ if (m._constituent != NULL)
+ _constituent = new CONNECTIVITY(* m._constituent);
+ else
+ _constituent = (CONNECTIVITY *) NULL;
+}
+
//----------------------------//
CONNECTIVITY::~CONNECTIVITY()
//----------------------------//
return ;
}
+ for(int i=0; i<numberOfFamilies; i++) {
+ FAMILY * myFamily = myFamilies[i] ;
+ MESSAGE(LOC<<"updating the family (BEGIN) : " << *myFamily);
+ }
+
// well we could go !
CONNECTIVITY * oldConstituent = _constituent ;
_constituent = (CONNECTIVITY *)NULL ;
int * oldConstituentValue = oldConstituent->_nodal->getValue() ;
int * oldConstituentIndex = oldConstituent->_nodal->getIndex() ;
+ SCRUTE(oldNumberOfFace);
+
calculateDescendingConnectivity() ;
// if (oldConstituent->_nodal != NULL) {
int * newConstituentValue = _constituent->_nodal->getValue() ;
int * newConstituentIndex = _constituent->_nodal->getIndex() ;
+ SCRUTE(newNumberOfFace);
+
int * newReverseDescendingIndex =
_reverseDescendingConnectivity->getIndex();
int * newReverseDescendingValue =
int index1 = 0;
int indexm1 = 0;
+ _constituent->calculateReverseNodalConnectivity() ;
+
for (int iOldFace=0;iOldFace<oldNumberOfFace;iOldFace++)
{
int index = 0;
-
-// renumberingFromOldToNew[iOldFace] = 999999;
+ renumberingFromOldToNew[iOldFace] = iOldFace+1;
+
+ // renumberingFromOldToNew[iOldFace] = 999999;
+
int face_it_beginOld = oldConstituentIndex[iOldFace];
int face_it_endOld = oldConstituentIndex[iOldFace+1];
int face_size_itOld = face_it_endOld - face_it_beginOld;
+
+ int* NodesLists = oldConstituentValue + (face_it_beginOld-1) ;
int face_size_itNew;
- MEDMODULUSARRAY modulusArrayOld(face_size_itOld,oldConstituentValue+face_it_beginOld-1);
+ int * reverseFaceNodal = _constituent->getReverseNodalConnectivity() ;
+ int * reverseFaceNodalIndex = _constituent->getReverseNodalConnectivityIndex() ;
+
+ // set an array wich contains faces numbers arround first node
+ int BeginIndexFaceArrayFirstNode=reverseFaceNodalIndex[NodesLists[0]-1] ;
+ int EndIndexFaceArrayFirstNode=reverseFaceNodalIndex[NodesLists[0]] ;
+ int NumberOfFacesInList=EndIndexFaceArrayFirstNode-BeginIndexFaceArrayFirstNode;
+
+ int * FacesList = new int[NumberOfFacesInList] ;
+ for (int l=BeginIndexFaceArrayFirstNode; l<EndIndexFaceArrayFirstNode; l++)
+ FacesList[l-BeginIndexFaceArrayFirstNode]=reverseFaceNodal[l-1] ;
- for (int iNewFace=0;iNewFace<newNumberOfFace && index == 0;
- iNewFace++)
+ // foreach node in sub cell, we search elements which are in common
+ // at the end, we must have only one !
+
+ for (int nodeFaceOld=1; nodeFaceOld<face_size_itOld; nodeFaceOld++)
{
- int face_it_beginNew = newConstituentIndex[iNewFace];
- int face_it_endNew = newConstituentIndex[iNewFace+1];
- face_size_itNew = face_it_endNew - face_it_beginNew;
- if (face_size_itNew == face_size_itOld)
- {
- MEDMODULUSARRAY modulusArrayNew(face_size_itNew,newConstituentValue+face_it_beginNew-1);
-
- int retCompareNewOld = modulusArrayNew.compare(modulusArrayOld);
-
- // Real new face found
-
- if(retCompareNewOld == 1)
- {
- renumberingFromOldToNew[iOldFace] = iNewFace+1;
- index = 1;
- index1++;
- }
-
- // Reverse new face found
-
- if(retCompareNewOld == -1)
- {
- renumberingFromOldToNew[iOldFace] = iNewFace+1;
- index = 1;
- indexm1++;
-
- int face_it_begin = newReverseDescendingIndex[iNewFace];
- int face_it_end = newReverseDescendingIndex[iNewFace+1];
- int face_size_it = face_it_end - face_it_begin;
-
- if (face_size_it == 1)
- throw MED_EXCEPTION(LOCALIZED(STRING(LOC)<<"This is a boundary face/edge, it should not be renumbered and it is wrongly oriented."));
-
- if (face_size_it > 2)
- throw MED_EXCEPTION(LOCALIZED(STRING(LOC)<<"This face/edge should not be a (d-1) cell because it has "<<face_size_it<<" neighbouring"));
-
- // we have always 2 neighbourings
- int cell1 = newReverseDescendingValue[face_it_begin-1];
- int cell2 = newReverseDescendingValue[face_it_begin];
-
- // PROVISOIRE : en attendant que le SKYLINEARRAY de ReverseDescending soit correct (sans le zero)
-// if (cell2 == 0)
-// throw MED_EXCEPTION(LOCALIZED(STRING(LOC)<<"This is a boundary face/edge, it should not be renumbered and it is wrongly oriented."));
-
- if (cell2 != 0) { // we are not on border !!!!
-
- newReverseDescendingValue[face_it_begin-1] = cell2;
- // Updating _constituent->_nodal because of reversity
- int * oldArray = oldConstituentValue+face_it_beginOld-1;
- int * newArray = newConstituentValue+face_it_beginNew-1;
- for(int iarray=0;iarray<face_size_itNew;iarray++)
- newArray[iarray] = oldArray[iarray] ;
-
-
- // Updating _reverseDescendingConnectivity
-
-
- newReverseDescendingValue[face_it_begin] = cell1;
-
- // Updating _descending for cell1 and cell2
- for(int iface=newDescendingIndex[cell1-1];iface<newDescendingIndex[cell1];iface++)
- if (newDescendingValue[iface-1]==iNewFace+1)
- newDescendingValue[iface-1]=-iNewFace-1 ;
- else if (newDescendingValue[iface-1]==-iNewFace-1)
- newDescendingValue[iface-1]=iNewFace+1 ;
-
- for(int iface=newDescendingIndex[cell2-1];iface<newDescendingIndex[cell2];iface++)
- if (newDescendingValue[iface-1]==iNewFace+1)
- newDescendingValue[iface-1]=-iNewFace-1 ;
- else if (newDescendingValue[iface-1]==-iNewFace-1)
- newDescendingValue[iface-1]=iNewFace+1 ;
- } else {// else we are on border and we do nothing !!!!!!!!
- INFOS("WARNING,WARNING,WARNING,WARNING,WARNING,WARNING");
- INFOS(LOC<<" Boudary FACE "<<iOldFace+1<<" are wrong oriented !") ;
- INFOS("WARNING,WARNING,WARNING,WARNING,WARNING,WARNING");
- }
- }
+ int NewNumberOfFacesInList = 0 ;
+ int * NewFacesList = new int[NumberOfFacesInList] ;
+
+ for (int l1=0; l1<NumberOfFacesInList; l1++) {
+ for (int l2=reverseFaceNodalIndex[NodesLists[nodeFaceOld]-1]; l2<reverseFaceNodalIndex[NodesLists[nodeFaceOld]]; l2++) {
+ if (FacesList[l1]<reverseFaceNodal[l2-1])
+ // increasing order : FacesList[l1] are not in elements list of node l
+ break ;
+ if (FacesList[l1]==reverseFaceNodal[l2-1]) {
+ // we have found one
+ NewFacesList[NewNumberOfFacesInList]=FacesList[l1];
+ NewNumberOfFacesInList++;
+ break;
+ }
}
+ }
+ NumberOfFacesInList = NewNumberOfFacesInList;
+ delete [] FacesList ;
+ FacesList = NewFacesList;
}
-
- if(index == 0)
+
+
+ if (!NumberOfFacesInList==0)
{
- INFOS(LOC<<"Renumbering problem with the Face connectivity given by the User and the new Connectivity computed");
- throw MED_EXCEPTION(LOCALIZED(STRING(LOC)<<"We have a Face connectivity problem"));
+ if (NumberOfFacesInList>1)
+ throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"More than one face found ("<<NumberOfFacesInList<<") ! " <<FacesList[0]<<" "<<FacesList[1] ));
+
+ MEDMODULUSARRAY modulusArrayOld(face_size_itOld,NodesLists);
+
+ SCRUTE(NumberOfFacesInList);
+ SCRUTE(FacesList);
+ SCRUTE(newConstituentIndex);
+
+ int face_it_beginNew = newConstituentIndex[FacesList[0]-1];
+ int face_it_endNew = newConstituentIndex[FacesList[0]];
+ face_size_itNew = face_it_endNew - face_it_beginNew;
+
+ int * newNodesLists = newConstituentValue+newConstituentIndex[FacesList[0]-1]-1 ;
+ MEDMODULUSARRAY modulusArrayNew(face_size_itOld,newNodesLists);
+
+ int retCompareNewOld = modulusArrayNew.compare(modulusArrayOld);
+
+ // Real new face found
+
+ if(retCompareNewOld == 1)
+ {
+ renumberingFromOldToNew[iOldFace] = FacesList[0] ;
+
+ MESSAGE("Renumbering index " << iOldFace << " val "<< FacesList[0]);
+
+ index = 1;
+ index1++;
+ }
+
+ // Reverse new face found
+
+ if(retCompareNewOld == -1)
+ {
+ renumberingFromOldToNew[iOldFace] = FacesList[0];
+
+ MESSAGE("Renumbering index " << iOldFace << " val "<< FacesList[0]);
+
+ index = 1;
+ indexm1++;
+
+ int face_it_begin = newReverseDescendingIndex[FacesList[0]-1];
+ int face_it_end = newReverseDescendingIndex[FacesList[0]];
+ int face_size_it = face_it_end - face_it_begin;
+
+ if (face_size_it == 1)
+ throw MED_EXCEPTION(LOCALIZED(STRING(LOC)<<"This is a boundary face/edge, it should not be renumbered and it is wrongly oriented."));
+
+ if (face_size_it > 2)
+ throw MED_EXCEPTION(LOCALIZED(STRING(LOC)<<"This face/edge should not be a (d-1) cell because it has "<<face_size_it<<" neighbouring"));
+
+ // we have always 2 neighbourings
+ int cell1 = newReverseDescendingValue[face_it_begin-1];
+ int cell2 = newReverseDescendingValue[face_it_begin];
+
+ // PROVISOIRE : en attendant que le SKYLINEARRAY de ReverseDescending soit correct (sans le zero)
+ // if (cell2 == 0)
+ // throw MED_EXCEPTION(LOCALIZED(STRING(LOC)<<"This is a boundary face/edge, it should not be renumbered and it is wrongly oriented."));
+
+ if (cell2 != 0) { // we are not on border !!!!
+
+ newReverseDescendingValue[face_it_begin-1] = cell2;
+ // Updating _constituent->_nodal because of reversity
+ int * oldArray = oldConstituentValue+face_it_beginOld-1;
+ int * newArray = newConstituentValue+face_it_beginNew-1;
+ for(int iarray=0;iarray<face_size_itNew;iarray++)
+ newArray[iarray] = oldArray[iarray] ;
+
+
+ // Updating _reverseDescendingConnectivity
+
+
+ newReverseDescendingValue[face_it_begin] = cell1;
+
+ // Updating _descending for cell1 and cell2
+ for(int iface=newDescendingIndex[cell1-1];iface<newDescendingIndex[cell1];iface++)
+ if (newDescendingValue[iface-1]==FacesList[0])
+ newDescendingValue[iface-1]=-FacesList[0] ;
+ else if (newDescendingValue[iface-1]==-FacesList[0])
+ newDescendingValue[iface-1]=FacesList[0] ;
+
+ for(int iface=newDescendingIndex[cell2-1];iface<newDescendingIndex[cell2];iface++)
+ if (newDescendingValue[iface-1]==FacesList[0])
+ newDescendingValue[iface-1]=-FacesList[0] ;
+ else if (newDescendingValue[iface-1]==-FacesList[0])
+ newDescendingValue[iface-1]=FacesList[0] ;
+ } else {// else we are on border and we do nothing !!!!!!!!
+ INFOS("WARNING,WARNING,WARNING,WARNING,WARNING,WARNING");
+ INFOS(LOC<<" Boudary FACE "<<iOldFace+1<<" are wrong oriented !") ;
+ INFOS("WARNING,WARNING,WARNING,WARNING,WARNING,WARNING");
+ }
+ }
+
+ if(index == 0)
+ {
+ INFOS(LOC<<"Renumbering problem with the Face connectivity given by the User and the new Connectivity computed");
+ throw MED_EXCEPTION(LOCALIZED(STRING(LOC)<<"We have a Face connectivity problem"));
+ }
}
}
int length_skyline = myFamily->getnumber()->getLength();
int * value_skyline = myFamily->getnumber()->getValue();
- for (int i=0;i<length_skyline;i++)
+ for (int i=0;i<length_skyline;i++) {
+ MESSAGE("OLD " << value_skyline[i] << " NEW " << renumberingFromOldToNew[value_skyline[i]-1]);
value_skyline[i] = renumberingFromOldToNew[value_skyline[i]-1];
+ }
+ MESSAGE(LOC<<"updating the family (END) : " << *myFamily);
}
}
if (Entity==_entity) {
if (ConnectivityType==MED_NODAL)
- Connectivity=_nodal;
+ {
+ calculateNodalConnectivity();
+ Connectivity=_nodal;
+ }
else
- Connectivity=_descending;
+ {
+ calculateDescendingConnectivity() ;
+ Connectivity=_descending;
+ }
if (Connectivity!=NULL)
if (Type==MED_ALL_ELEMENTS)
if (Entity==_entity) {
if (Type==MED_NONE)
- throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<" : medGeometryElement must be different of MED_NONE"));
+ return 0 ; // not defined !
+ //throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<" : medGeometryElement must be different of MED_NONE"));
if (Type==MED_ALL_ELEMENTS)
return _count[_numberOfTypes]-1;
for (med_int i=0; i<_numberOfTypes; i++)
if (_constituent != NULL)
return _constituent->getNumberOf(Entity,Type);
- return 0 ; // valid if they are nothing !
+ return 0 ; // valid if they are nothing else !
//throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<" : Entity not defined !")) ;
}
med_int* CONNECTIVITY::getReverseDescendingConnectivity()
//------------------------------------------------------//
{
- // it is in _constituent connectivity only if we are in MED_CELL
- if (_entity==MED_CELL) {
- // we want descending connectivity
- calculateDescendingConnectivity();
- return _reverseDescendingConnectivity->getValue();
- }
- throw MEDEXCEPTION("CONNECTIVITY::getReverseDescendingConnectivity : Error Only in MED_CELL connectivity");
+ // it is in _constituent connectivity only if we are in MED_CELL
+ // (we could not for instance calculate face-edge connectivity !)
+ if (_entity!=MED_CELL)
+ throw MEDEXCEPTION("CONNECTIVITY::getReverseDescendingConnectivity : Error Only in MED_CELL connectivity");
+
+ // we need descending connectivity
+ calculateDescendingConnectivity();
+ return _reverseDescendingConnectivity->getValue();
}
/*! calculate the reverse descending Connectivity
//-----------------------------------------------------------//
{
// it is in _constituent connectivity only if we are in MED_CELL
- if (_entity==MED_CELL) {
- // we want descending connectivity
- calculateDescendingConnectivity();
- return _reverseDescendingConnectivity->getIndex();
- }
- throw MEDEXCEPTION("CONNECTIVITY::getReverseDescendingConnectivityIndex : Error Only in MED_CELL connectivity");
+ if (_entity!=MED_CELL)
+ throw MEDEXCEPTION("CONNECTIVITY::getReverseDescendingConnectivityIndex : Error Only in MED_CELL connectivity");
+
+ // we need descending connectivity
+ calculateDescendingConnectivity();
+ return _reverseDescendingConnectivity->getIndex();
}
/*! A DOCUMENTER (et a finir ???) */
int ReverseNodalConnectivityIndex_0 = ReverseNodalConnectivityIndex[NodesLists[0]-1] ;
int ReverseNodalConnectivityIndex_1 = ReverseNodalConnectivityIndex[NodesLists[0]] ;
int NumberOfCellsInList = ReverseNodalConnectivityIndex_1-ReverseNodalConnectivityIndex_0 ;
- int * CellsList = new int[NumberOfCellsInList] ;
- for (int l=ReverseNodalConnectivityIndex_0; l<ReverseNodalConnectivityIndex_1; l++)
- CellsList[l-ReverseNodalConnectivityIndex_0]=ReverseNodalConnectivityValue[l-1] ;
+
+ if (NumberOfCellsInList > 0) { // we could have no element !
+ int * CellsList = new int[NumberOfCellsInList] ;
+ for (int l=ReverseNodalConnectivityIndex_0; l<ReverseNodalConnectivityIndex_1; l++)
+ CellsList[l-ReverseNodalConnectivityIndex_0]=ReverseNodalConnectivityValue[l-1] ;
- // foreach node in sub cell, we search elements which are in common
- // at the end, we must have only one !
-
- for (int l=1; l<NumberOfNodesPerConstituent; l++) {
- int NewNumberOfCellsInList = 0 ;
- int * NewCellsList = new int[NumberOfCellsInList] ;
- for (int l1=0; l1<NumberOfCellsInList; l1++)
- for (int l2=ReverseNodalConnectivityIndex[NodesLists[l]-1]; l2<ReverseNodalConnectivityIndex[NodesLists[l]]; l2++) {
- if (CellsList[l1]<ReverseNodalConnectivityValue[l2-1])
- // increasing order : CellsList[l1] are not in elements list of node l
- break ;
- if ((CellsList[l1]==ReverseNodalConnectivityValue[l2-1])&(CellsList[l1]!=j)) {
- // we have found one
- NewCellsList[NewNumberOfCellsInList]=CellsList[l1];
- NewNumberOfCellsInList++;
- break;
+ // foreach node in sub cell, we search elements which are in common
+ // at the end, we must have only one !
+
+ for (int l=1; l<NumberOfNodesPerConstituent; l++) {
+ int NewNumberOfCellsInList = 0 ;
+ int * NewCellsList = new int[NumberOfCellsInList] ;
+ for (int l1=0; l1<NumberOfCellsInList; l1++)
+ for (int l2=ReverseNodalConnectivityIndex[NodesLists[l]-1]; l2<ReverseNodalConnectivityIndex[NodesLists[l]]; l2++) {
+ if (CellsList[l1]<ReverseNodalConnectivityValue[l2-1])
+ // increasing order : CellsList[l1] are not in elements list of node l
+ break ;
+ if ((CellsList[l1]==ReverseNodalConnectivityValue[l2-1])&(CellsList[l1]!=j)) {
+ // we have found one
+ NewCellsList[NewNumberOfCellsInList]=CellsList[l1];
+ NewNumberOfCellsInList++;
+ break;
+ }
}
- }
- NumberOfCellsInList = NewNumberOfCellsInList;
- delete [] CellsList ;
- CellsList = NewCellsList;
- }
-
- int CellNumber = CellsList[0] ;
- delete [] CellsList ;
- if (NumberOfCellsInList>1)
- throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"More than one other Cell ("<<NumberOfCellsInList<<") !"));
-
+ NumberOfCellsInList = NewNumberOfCellsInList;
-// int cell_number_1=-1 ;
-// int cell_number_2=-1 ;
-// int cell_number_3=-1 ;
-// bool find = false ;
-// for (int l=ReverseNodalConnectivityIndex[NodesLists[0]-1]; l<ReverseNodalConnectivityIndex[NodesLists[0]]; l++) { // first node
-// cell_number_1 = ReverseNodalConnectivityValue[l-1] ;
-// if (cell_number_1 != j)
-// for (int m=ReverseNodalConnectivityIndex[NodesLists[1]-1]; m<ReverseNodalConnectivityIndex[NodesLists[1]]; m++) { //second node
-// cell_number_2 = ReverseNodalConnectivityValue[m-1] ;
-// if ((cell_number_2 != j) && (cell_number_2 == cell_number_1))
-// for (int n=ReverseNodalConnectivityIndex[NodesLists[2]-1]; n<ReverseNodalConnectivityIndex[NodesLists[2]]; n++) { //third node
-// cell_number_3 = ReverseNodalConnectivityValue[n-1] ;
-// if ((cell_number_3 != j) && (cell_number_3 == cell_number_1)) { // we found element which have three node in it
-// find = true ;
-// break ;
-// }
-// if (find)
-// break ;
-// }
-// if (find)
-// break ;
-// }
-// if (find)
-// break ;
-// }
-
-
-// if (find) {
- if (NumberOfCellsInList==1) {
- ReverseDescendingConnectivityValue[(TotalNumberOfSubCell-1)*2+1]=CellNumber ;
- // we search sub cell number in this cell to not calculate it another time
- // which type ?
- CELLMODEL Type2 ;
- for (int l=0; l<_numberOfTypes; l++)
- if (CellNumber < _count[l+1]) {
- Type2=_type[l] ;
- break ;
- }
- //int sub_cell_count2 = Type2.get_entities_count(1) ;
- //int nodes_cell_count2 = Type2.get_nodes_count() ;
- bool find2 = false ;
- for (int l=1; l<=Type2.getNumberOfConstituents(1) ;l++) { // on all sub cell
- int counter = 0 ;
- for (int m=1; m<=Type2.getConstituentType(1,l)%100; m++)
- for (int n=1; n<=Type.getConstituentType(1,k)%100; n++) {
- if (_nodal->getIJ(CellNumber,Type2.getNodeConstituent(1,l,m)) == NodesLists[n-1])
- counter++ ;
+ delete [] CellsList ;
+ CellsList = NewCellsList;
+ }
+
+ if (NumberOfCellsInList > 0) { // We have found some elements !
+ int CellNumber = CellsList[0] ;
+ delete [] CellsList ;
+ if (NumberOfCellsInList>1)
+ throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"More than one other Cell ("<<NumberOfCellsInList<<") !"));
+
+ if (NumberOfCellsInList==1) {
+ ReverseDescendingConnectivityValue[(TotalNumberOfSubCell-1)*2+1]=CellNumber ;
+
+ // we search sub cell number in this cell to not calculate it another time
+ // which type ?
+ CELLMODEL Type2 ;
+ for (int l=0; l<_numberOfTypes; l++)
+ if (CellNumber < _count[l+1]) {
+ Type2=_type[l] ;
+ break ;
+ }
+ //int sub_cell_count2 = Type2.get_entities_count(1) ;
+ //int nodes_cell_count2 = Type2.get_nodes_count() ;
+ bool find2 = false ;
+ for (int l=1; l<=Type2.getNumberOfConstituents(1) ;l++) { // on all sub cell
+ int counter = 0 ;
+ for (int m=1; m<=Type2.getConstituentType(1,l)%100; m++)
+ for (int n=1; n<=Type.getConstituentType(1,k)%100; n++) {
+ if (_nodal->getIJ(CellNumber,Type2.getNodeConstituent(1,l,m)) == NodesLists[n-1])
+ counter++ ;
+ }
+ if (counter==Type.getConstituentType(1,k)%100) {
+ descend_connectivity[descend_connectivity_index[CellNumber-1]+l-2]=-1*TotalNumberOfSubCell; // because, see it in other side !
+ find2 = true ;
+ }
+ if (find2)
+ break ;
}
- if (counter==Type.getConstituentType(1,k)%100) {
- descend_connectivity[descend_connectivity_index[CellNumber-1]+l-2]=-1*TotalNumberOfSubCell; // because, see it in other side !
- find2 = true ;
- }
- if (find2)
- break ;
+ if (!find2)
+ INFOS(LOC<<"ERROR ERROR ERROR ERROR ERROR : we find any subcell !!!") ; // exception ?
+ }
+ } else {
+ ReverseDescendingConnectivityValue[(TotalNumberOfSubCell-1)*2+1]=0 ;
}
- if (!find2)
- INFOS(LOC<<"ERROR ERROR ERROR ERROR ERROR : we find any subcell !!!") ; // exception ?
- } else
- ReverseDescendingConnectivityValue[(TotalNumberOfSubCell-1)*2+1]=0 ;
-
+ }
delete[] NodesLists ;
}
}
/*! does nothing if already exists, else
evaluates from _descending */
// void calculateReverseDescendingConnectivity(CONNECTIVITY *myConnectivity) ;
+
+ med_int* getReverseNodalConnectivity () ;
+ med_int* getReverseNodalConnectivityIndex () ;
+ med_int* getReverseDescendingConnectivity () ;
+ med_int* getReverseDescendingConnectivityIndex () ;
+
/*! does nothing if already exists, else
evaluates _neighbourhood from _descending */
void calculateNeighbourhood(CONNECTIVITY &myConnectivity) ;
CONNECTIVITY(medEntityMesh Entity=MED_CELL);
CONNECTIVITY(int numberOfTypes, medEntityMesh Entity=MED_CELL);
+ CONNECTIVITY(CONNECTIVITY & m);
~CONNECTIVITY();
inline bool existConnectivity (medConnectivity connectivityType, medEntityMesh Entity) const ;
med_int getNumberOfNodesInType (medGeometryElement Type) const;
med_int getNumberOfSubCellInType (medGeometryElement Type) const;
- med_int getNumberOf (medEntityMesh Entity, medGeometryElement Type) const;
+ med_int getNumberOf (medEntityMesh Entity, medGeometryElement Type) const;
med_int* getValue (medConnectivity TypeConnectivity, medGeometryElement Type) ;
med_int* getValueIndex (medConnectivity TypeConnectivity) ;
- med_int* getReverseNodalConnectivity () ;
- med_int* getReverseNodalConnectivityIndex () ;
- med_int* getReverseDescendingConnectivity () ;
- med_int* getReverseDescendingConnectivityIndex () ;
+
+ inline med_int* getReverseConnectivity (medConnectivity ConnectivityType, medEntityMesh Entity=MED_CELL) ;
+ inline med_int* getReverseConnectivityIndex(medConnectivity ConnectivityType, medEntityMesh Entity=MED_CELL) ;
+
med_int* getNeighbourhood() const;
} ;
throw MEDEXCEPTION("CONNECTIVITY::getCellsTypes(medEntityMesh) : Not found Entity !");
}
+inline med_int* CONNECTIVITY::getReverseConnectivity(medConnectivity ConnectivityType, medEntityMesh Entity)
+{
+ if(_entity==Entity)
+ if (ConnectivityType==MED_NODAL)
+ return getReverseNodalConnectivity() ;
+ else if (ConnectivityType==MED_DESCENDING)
+ return getReverseDescendingConnectivity() ;
+ else
+ throw MEDEXCEPTION("MESH::getReverseConnectivity : connectivity mode not supported !");
+
+ // other entity :
+ if (NULL==_constituent)
+ calculateDescendingConnectivity() ;
+ return _constituent->getReverseConnectivity(ConnectivityType,Entity) ;
+}
+
+inline med_int* CONNECTIVITY::getReverseConnectivityIndex(medConnectivity ConnectivityType, medEntityMesh Entity)
+{
+ if(_entity==Entity)
+ if (ConnectivityType==MED_NODAL)
+ return getReverseNodalConnectivityIndex() ;
+ else if (ConnectivityType==MED_DESCENDING)
+ return getReverseDescendingConnectivityIndex() ;
+ else
+ throw MEDEXCEPTION("MESH::getReverseConnectivityIndex : connectivity mode not supported !");
+
+ // other entity :
+ if (NULL==_constituent)
+ calculateDescendingConnectivity() ;
+ return _constituent->getReverseConnectivityIndex(ConnectivityType,Entity) ;
+}
+
#endif /* CONNECTIVITY_HXX */
+using namespace std;
#include "MEDMEM_Coordinate.hxx"
#include "utilities.h"
/*! This class contains coordinates of the nodes */
//----------------------------------------------------------//
-COORDINATE::COORDINATE():_coordinate((MEDARRAY<double>*)NULL),
- _coordinateName((string*)NULL),
- _coordinateUnit((string*)NULL),
- _nodeNumber((int*)NULL)
+COORDINATE::COORDINATE():_coordinate(),
+ _coordinateName(),
+ _coordinateUnit(),
+ _coordinateSystem(""),
+ _nodeNumber()
//----------------------------------------------------------//
{
BEGIN_OF("Default Constructor COORDINATE");
}
//------------------------------------------------------------------------------//
-COORDINATE::COORDINATE(medModeSwitch Mode,int SpaceDimension, int NumberOfNodes):
- _nodeNumber((int*)NULL)
+COORDINATE::COORDINATE(medModeSwitch Mode, int SpaceDimension, int NumberOfNodes):
+ _nodeNumber(),_coordinateUnit(SpaceDimension),
+ _coordinateSystem(""),
+ _coordinateName(SpaceDimension)
//------------------------------------------------------------------------------//
{
BEGIN_OF("Constructor COORDINATE");
- _coordinateName = new string[SpaceDimension] ;
- _coordinateUnit = new string[SpaceDimension] ;
_coordinate = new MEDARRAY<double>(SpaceDimension,NumberOfNodes,Mode);
}
+
+//------------------------------------------------------------------------------//
+COORDINATE::COORDINATE(const COORDINATE & m):
+ _coordinateSystem(m._coordinateSystem)
+//------------------------------------------------------------------------------//
+{
+ BEGIN_OF("Copy Constructor COORDINATE");
+ int spaceDimension;
+ int numberOfNodes;
+ if (m._coordinate != NULL)
+ {
+ spaceDimension = (int) m._coordinate->getLeadingValue();
+ numberOfNodes = (int) m._coordinate->getLengthValue();
+ _coordinate = new MEDARRAY<double>(*m._coordinate);
+ }
+ else
+ {
+ _coordinate = (MEDARRAY<double>*) NULL;
+ spaceDimension = 0;
+ numberOfNodes = 0;
+ }
+
+ _coordinateName.set(spaceDimension);
+ for (int i=0; i<spaceDimension; i++)
+ {
+ _coordinateName[i]=m._coordinateName[i];
+ }
+
+ _coordinateUnit.set(spaceDimension);
+ for (int i=0; i<spaceDimension; i++)
+ {
+ _coordinateUnit[i]=m._coordinateUnit[i];
+ }
+
+ // PN A VERIFIER
+ _nodeNumber.set(numberOfNodes);
+ if (m._nodeNumber != NULL)
+ {
+ memcpy(_nodeNumber,m._nodeNumber,numberOfNodes*sizeof(int));
+ }
+}
+
+
//----------------------//
COORDINATE::~COORDINATE()
//----------------------//
{
- MESSAGE("Debut Destructeur COORDINATE");
- if (_coordinate!=NULL)
+ MESSAGE("~COORDINATE()");
+ if (_coordinate!=NULL)
+ {
+ MESSAGE("deleting _coordinate" ) ;
delete _coordinate ;
- if (_coordinateName!=NULL)
- delete[] _coordinateName ;
- if (_coordinateUnit!=NULL)
- delete[] _coordinateUnit ;
- if (_nodeNumber!=NULL)
- delete[] _nodeNumber ;
- }
+ }
+ // all other attribut are object (not pointer)
+}
/*! set the attribute _coordinate with Coordinate */
//----------------------------------------------------------//
void COORDINATE::setCoordinates(MEDARRAY<double> *Coordinate)
//----------------------------------------------------------//
{
- _coordinate=Coordinate ;
+//PN a voir ...
+ if ((_coordinate!=NULL) )
+ {
+ MESSAGE("deleting old _coordinate" ) ;
+ delete _coordinate ;
+ }
+ _coordinate=Coordinate ;
}
/*! set the attribute _coordinateName with CoordinateName */
void COORDINATE::setCoordinatesUnits(string * CoordinateUnit)
//----------------------------------------------------------//
{
- _coordinateUnit=CoordinateUnit ;
+ _coordinateUnit.set( CoordinateUnit ) ;
+}
+
+/*! set the attribute _coordinateSystem with CoordinateSystem */
+//----------------------------------------------------------//
+void COORDINATE::setCoordinatesSystem(string CoordinateSystem)
+//----------------------------------------------------------//
+{
+ _coordinateSystem=CoordinateSystem;
}
/*! set the attribute _nodeNumber with NodeNumber */
void COORDINATE::setNodesNumbers(int * NodeNumber)
//------------------------------------------------//
{
- _nodeNumber=NodeNumber ;
+ _nodeNumber.set(NodeNumber) ;
}
/*! returns the number of nodes defined in the mesh*/
//-------------------------------------------------//
-int * COORDINATE::getNodesNumbers() const
+int * COORDINATE::getNodesNumbers()
//-------------------------------------------------//
{
- return _nodeNumber;
+ return _nodeNumber;
}
/*! returns the mode of coordinates (FULL_INTERLACE or NO_INTERLACE) */
#include <string>
+#include "MEDMEM_PointerOf.hxx"
#include "MEDMEM_Exception.hxx"
#include "MEDMEM_define.hxx"
//using namespace MED_EN;
// int _numberOfNodes;
/*! array of size spaceDimension*NumberOfNodes */
- MEDARRAY<double>* _coordinate;
+ //PointerOf< MEDARRAY<double> > _coordinate;
+ //bool _allocateCoordinate;
+ MEDARRAY<double>* _coordinate;
+
/*! array of size spaceDimension */
- string * _coordinateName;
+ PointerOf<string> _coordinateName;
+ //string * _coordinateName;
+
/*! array of size spaceDimension */
- string * _coordinateUnit;
+ PointerOf<string> _coordinateUnit;
+ //string * _coordinateUnit;
+
/*! array of size NumberOfNodes : optionnal nodes numbers */
- int * _nodeNumber;
+ PointerOf<int> _nodeNumber;
+ //int * _nodeNumber;
+
public :
COORDINATE();
COORDINATE(medModeSwitch Mode,int SpaceDimension, int NumberOfNodes);
+ COORDINATE(const COORDINATE & m);
~COORDINATE();
void setCoordinates(MEDARRAY<double> *Coordinate);
void setCoordinatesNames(string * CoordinateName);
void setCoordinatesUnits(string * CoordinateUnit);
+ void setCoordinatesSystem(string CoordinateSystem);
void setNodesNumbers(int * NodeNumber);
int* getNodesNumbers() const;
+ int* getNodesNumbers() ;
string getCoordinatesSystem() const;
const double * getCoordinates(medModeSwitch Mode);
double getCoordinate(int Number,int Axis);
+using namespace std;
#include "MEDMEM_DriversDef.hxx"
namespace MED_FR {
+using namespace std;
/*
File MedException.cxx
$Header$
char *newText = 0 ;
ASSERT(text) ;
- const size_t l1 = 1+strlen(text) ;
- ASSERT(l1>1) ;
+ const size_t l1 = strlen(text) ;
const char* prefix = "MED Exception" ;
- const size_t l0 = 2+strlen(prefix) ;
+ const size_t l0 = strlen(prefix) ;
if ( fileName )
{
- const size_t l2 = 4+strlen(fileName) ;
- ASSERT(l2>4) ;
+ const size_t l2 = strlen(fileName) ;
ASSERT(lineNumber>=1) ;
- const size_t l3 = 4+int(log10(float(lineNumber))) ;
-
- newText = new char [ 1+l0+l1+l2+l3 ] ;
+ const size_t l3 = 1+int(log10(float(lineNumber))) ;
+
+ const size_t l4 = l0+l1+l2+l3+10+1 ;
+ newText = new char [ l4 ] ;
sprintf( newText , "%s in %s [%u] : %s" , prefix, fileName, lineNumber, text ) ;
+ ASSERT(newText[l4-1] == '\0' );
+
}
else
{
- newText = new char [ 1+l0+l1 ] ;
+ newText = new char [ l0+l1+3+1 ] ;
sprintf( newText , "%s : %s" , prefix, text ) ;
}
ASSERT(newText) ;
MED_DRIVER_NOT_FOUND_EXCEPTION::MED_DRIVER_NOT_FOUND_EXCEPTION
(
- const char *text, const char *fileName=0,
- const unsigned int lineNumber=0
+ const char *text, const char *fileName/*=0*/,
+ const unsigned int lineNumber/*=0*/
) : MEDEXCEPTION(text, fileName, lineNumber) {};
MED_DRIVER_NOT_FOUND_EXCEPTION::~MED_DRIVER_NOT_FOUND_EXCEPTION() throw (){};
+using namespace std;
/*
File MEDMEM_Family.cxx
$Header$
}
};
+FAMILY::FAMILY(FAMILY & m):SUPPORT(m)
+{
+ _identifier = m._identifier;
+ _numberOfAttribute = m._numberOfAttribute;
+ if (m._attributeIdentifier != NULL)
+ {
+ _attributeIdentifier = new int[m._numberOfAttribute];
+ memcpy(_attributeIdentifier,m._attributeIdentifier,m._numberOfAttribute*sizeof(int));
+ }
+ else
+ _attributeIdentifier = (int *) NULL;
+ if (m._attributeValue != NULL)
+ {
+ _attributeValue = new int[m._numberOfAttribute];
+ memcpy(_attributeValue,m._attributeValue,m._numberOfAttribute*sizeof(int));
+ }
+ else
+ _attributeValue = (int *) NULL;
+ if (m._attributeDescription != NULL)
+ {
+ _attributeDescription = new string[m._numberOfAttribute];
+ for (int i=0;i<m._numberOfAttribute;i++)
+ _attributeDescription[i] = m._attributeDescription[i];
+ }
+ else
+ _attributeDescription = (string *) NULL;
+ _numberOfGroup = m._numberOfGroup;
+ if (m._groupName != NULL)
+ {
+ _groupName = new string[m._numberOfGroup];
+ for (int i=0;i<m._numberOfGroup;i++)
+ _groupName[i]=m._groupName[i];
+ }
+ else
+ _groupName = (string *) NULL;
+};
+
FAMILY::~FAMILY()
{
MESSAGE("~FAMILY()");
// constructor to use with med driver
FAMILY(MESH* Mesh, int Identifier, string Name, int NumberOfAttribute,int *AttributeIdentifier,int *AttributeValue,string AttributeDescription,int NumberOfGroup,string GroupName) ;
+ FAMILY(FAMILY & m);
+
~FAMILY();
FAMILY & operator=(const FAMILY &fam);
+using namespace std;
#include "MEDMEM_Field.hxx"
// ---------------------------------
_description = m._description;
_support = m._support;
_numberOfComponents = m._numberOfComponents;
- _componentsTypes = m._componentsTypes;
- _componentsNames = m._componentsNames;
- _componentsDescriptions = m._componentsDescriptions;
- _componentsUnits = m._componentsUnits;
- _MEDComponentsUnits = m._MEDComponentsUnits;
+
+ if (m._componentsTypes != NULL)
+ {
+ _componentsTypes = new int[m._numberOfComponents] ;
+ memcpy(_componentsTypes,m._componentsTypes,sizeof(int)*m._numberOfComponents);
+ /*
+ _componentsTypes = new int[m._numberOfComponents] ;
+ for(int i=0;i<m._numberOfComponents;i++) {
+ _componentsTypes[i] = m._componentsTypes[i] ;
+ }
+ */
+ }
+ else _componentsTypes = (int *) NULL;
+
+ _componentsNames = new string[m._numberOfComponents];
+ for (int i=0; i<m._numberOfComponents; i++)
+ {_componentsNames[i]=m._componentsNames[i];}
+ _componentsDescriptions = new string[m._numberOfComponents];
+ for (int i=0; i<m._numberOfComponents; i++)
+ {_componentsDescriptions[i]=m._componentsDescriptions[i];}
+ _componentsUnits = new UNIT[m._numberOfComponents];
+ for (int i=0; i<m._numberOfComponents; i++)
+ {_componentsUnits[i] = m._componentsUnits[i];}
+ // L'operateur '=' est defini dans la classe UNIT
+ _MEDComponentsUnits = new string[m._numberOfComponents];
+ for (int i=0; i<m._numberOfComponents; i++)
+ {_MEDComponentsUnits[i] = m._MEDComponentsUnits[i];}
_iterationNumber = m._iterationNumber;
_time = m._time;
_orderNumber = m._orderNumber;
const string & driverFieldName) {} ;
int FIELD_::addDriver (GENDRIVER & driver) {};
void FIELD_::write (const GENDRIVER &) {};
+void FIELD_::read (const GENDRIVER &) {};
// void FIELD_::setValueType(med_type_champ ValueType) {};
// med_type_champ FIELD_::getValueType() {};
#include "MEDMEM_GenDriver.hxx"
#include "MEDMEM_MedFieldDriver.hxx"
-
-// template <class T> class MED_FIELD_RDONLY_DRIVER;
-// template <class T> class MED_FIELD_WRONLY_DRIVER;
-// template <class T> class MED_FIELD_RDWR_DRIVER;
+#include "MEDMEM_MedMedDriver.hxx"
using namespace MED_EN;
virtual int addDriver(driverTypes driverType,
const string & fileName,
const string & driverFieldName) ;
- virtual int addDriver(GENDRIVER & driver);
+ virtual int addDriver( GENDRIVER & driver);
virtual void write(const GENDRIVER &);
+ virtual void read (const GENDRIVER &);
// virtual void getValueType (MED_FR::med_type_champ ValueType) ;
// virtual void setValueType (/*MED_EN::*/med_type_champ ValueType) ;
public:
FIELD();
- FIELD(const FIELD &m); // A FAIRE
+ FIELD(const FIELD &m);
FIELD & operator=(const FIELD &m); // A FAIRE
FIELD(const SUPPORT * Support, const int NumberOfComponents); // Ajout NB Constructeur FIELD avec allocation de memoire de tous ses attribut
- FIELD(driverTypes driverType, const string & fileName="",
- const string & fieldName="");
+ FIELD(const SUPPORT * Support, driverTypes driverType,
+ const string & fileName="", const string & fieldName="");
~FIELD();
friend class MED_FIELD_RDONLY_DRIVER<T>;
void deallocValue();
inline void read(int index=0);
+ inline void read(const GENDRIVER & genDriver);
inline void write(int index=0, const string & driverName = "");
inline void write(const GENDRIVER &);
{
}
-template <class T> FIELD<T>::FIELD(const FIELD &m):
+template <class T> FIELD<T>::FIELD(const FIELD & m):
FIELD_((FIELD_) m)
{
- _value = m._value;
+ if (m._value != NULL)
+ {
+ _value = new MEDARRAY<T>::MEDARRAY(* m._value);
+ }
+ else
+ _value = (MEDARRAY<T> *) NULL;
_drivers = m._drivers;
}
{
}
-template <class T> FIELD<T>::FIELD(driverTypes driverType,
- const string & fileName="",
- const string & fieldName="")
+template <class T> FIELD<T>::FIELD(const SUPPORT * Support,
+ driverTypes driverType,
+ const string & fileName/*=""*/,
+ const string & fieldDriverName/*=""*/)
{
+ const char * LOC = "template <class T> FIELD<T>::FIELD(const SUPPORT * Support, driverTypes driverType, const string & fileName="", const string & fieldName="") : ";
+
+ int current;
+
+ BEGIN_OF(LOC);
+
+ init();
+
+ _support = Support;
+ _value = (MEDARRAY<T>*)NULL;
+
+ current = addDriver(driverType,fileName,fieldDriverName);
+ switch(_drivers[current]->getAccessMode() ) {
+ case MED_RDONLY : {
+ MESSAGE("MESH::MESH(driverTypes driverType, .....) : driverType must have a MED_RDWR accessMode");
+ rmDriver(current);
+ break;}
+ default : {
+ }
+ }
+ _drivers[current]->open();
+ _drivers[current]->read();
+ _drivers[current]->close();
+ END_OF(LOC);
+
}
template <class T> FIELD<T>::~FIELD()
template <class T> int FIELD<T>::addDriver(driverTypes driverType,
- const string & fileName="Default File Name.med",
- const string & driverName="Default Field Name")
+ const string & fileName/*="Default File Name.med"*/,
+ const string & driverName/*="Default Field Name"*/)
{
const char * LOC = "FIELD<T>::addDriver(driverTypes driverType, const string & fileName=\"Default File Name.med\",const string & driverName=\"Default Field Name\") : ";
}
+
template <class T> inline int FIELD<T>::addDriver (GENDRIVER & driver )
{
const char * LOC = "FIELD<T>::addDriver(GENDRIVER &) : ";
BEGIN_OF(LOC);
-
+
_drivers.push_back(&driver);
return _drivers.size() -1 ;
-
+
END_OF(LOC);
};
-template <class T> void FIELD<T>::rmDriver (int index=0)
+template <class T> void FIELD<T>::rmDriver (int index/*=0*/)
{
const char * LOC = "FIELD<T>::rmDriver (int index=0): ";
BEGIN_OF(LOC);
END_OF(LOC);
}
-template <class T> inline void FIELD<T>::read(int index=0)
+template <class T> inline void FIELD<T>::read(int index/*=0*/)
{
const char * LOC = "FIELD<T>::read(int index=0) : ";
BEGIN_OF(LOC);
END_OF(LOC);
}
-template <class T> inline void FIELD<T>::write(int index=0, const string & driverName = "")
+template <class T> inline void FIELD<T>::write(int index/*=0*/, const string & driverName /*= ""*/)
{
const char * LOC = "FIELD<T>::write(int index=0, const string & driverName = \"\") : ";
BEGIN_OF(LOC);
}
+template <class T> inline void FIELD<T>::read(const GENDRIVER & genDriver)
+{
+ const char * LOC = " FIELD<T>::read(const GENDRIVER &) : ";
+ BEGIN_OF(LOC);
+
+ for (int index=0; index < _drivers.size(); index++ )
+ if ( *_drivers[index] == genDriver ) {
+ _drivers[index]->open();
+ _drivers[index]->read();
+ _drivers[index]->close();
+ }
+
+ END_OF(LOC);
+
+}
+
template <class T> inline void FIELD<T>::setValue(MEDARRAY<T> *Value)
{
_value=Value ;
+using namespace std;
#include "MEDMEM_GenDriver.hxx"
+#include "MEDMEM_STRING.hxx"
+#include "MEDMEM_Exception.hxx"
-GENDRIVER::GENDRIVER(): _fileName(""),_accessMode((med_mode_acces)MED_INVALID),_status(MED_INVALID),_driverType(NO_DRIVER) {}
+GENDRIVER::GENDRIVER(): _id(MED_INVALID),
+ _fileName(""),
+ _accessMode( (med_mode_acces) MED_INVALID ),
+ _status(MED_INVALID),
+ _driverType(NO_DRIVER) {}
GENDRIVER::GENDRIVER(const string & fileName,
- med_mode_acces accessMode=(med_mode_acces) MED_INVALID): _fileName(fileName),
+ med_mode_acces accessMode=(med_mode_acces) MED_INVALID): _id(MED_INVALID),
+ _fileName(fileName),
_accessMode(accessMode),
_status(MED_CLOSED),
_driverType(NO_DRIVER) {}
-GENDRIVER::GENDRIVER(const GENDRIVER & genDriver):_fileName(genDriver._fileName),
+GENDRIVER::GENDRIVER(const GENDRIVER & genDriver):_id(MED_INVALID), _fileName(genDriver._fileName),
_accessMode(genDriver._accessMode),
_status(genDriver._status),_driverType(NO_DRIVER) {}
GENDRIVER::~GENDRIVER() {}
GENDRIVER & GENDRIVER::operator=(const GENDRIVER & genDriver) {
+ const char * LOC = " GENDRIVER & GENDRIVER::operator=(const GENDRIVER & genDriver) : ";
+
+ BEGIN_OF(LOC);
+
_fileName = genDriver._fileName;
_accessMode = genDriver._accessMode;
_status = genDriver._status;
-
+ _id = genDriver._id;
return *this;
+
+ END_OF(LOC);
}
void GENDRIVER::writeFrom ( void ) {};
void GENDRIVER::setMeshName (const string & meshName) {};
void GENDRIVER::setFieldName (const string & fieldName) {};
+void GENDRIVER::setId ( int id ) {
+ const char * LOC = "void GENDRIVER::setId ( int id ) : ";
+
+ BEGIN_OF(LOC);
+
+ if ( id >= 0 ) _id=id; else _id = MED_INVALID ;
+
+ END_OF(LOC);
+};
+
+int GENDRIVER::getId ( void) const {
+ const char * LOC = "int GENDRIVER::getId ( void) const ";
+
+ BEGIN_OF(LOC);
+
+ return _id ;
+
+ END_OF(LOC);
+};
+
string GENDRIVER::getFileName() const {
+
+ const char * LOC = "string GENDRIVER::getFileName() const : ";
+ BEGIN_OF(LOC);
+
return _fileName;
+
+ END_OF(LOC);
}
-
+
+
void GENDRIVER::setFileName(const string & fileName) {
- _fileName = fileName;
+
+ const char * LOC = "void GENDRIVER::setFileName(const string & fileName) : ";
+ BEGIN_OF(LOC);
+
+ if ( _status == MED_OPENED )
+ throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<" File |" << _fileName
+ << "| is still openned, close it before openning : | " << fileName << "|"));
+ else
+ _fileName = fileName;
+
+ END_OF(LOC);
}
+
+
med_mode_acces GENDRIVER::getAccessMode() const {
+
+ const char * LOC = "med_mode_acces GENDRIVER::getAccessMode() const : ";
+
+ BEGIN_OF(LOC);
+
return _accessMode;
+
+ END_OF(LOC);
}
ostream & operator<<(ostream &os,const GENDRIVER & drv)
return os;
}
+// Test if this driver has been created from MED driver
bool GENDRIVER::operator ==(const GENDRIVER &genDriver) const {
+ const char * LOC = "bool GENDRIVER::operator ==(const GENDRIVER &genDriver) const : ";
+
+ BEGIN_OF(LOC);
+
return ( _id == genDriver._id ) &&
- ( _fileName == genDriver._fileName ) &&
( _driverType == genDriver._driverType );
+ END_OF(LOC);
+
};
// FIELD related Part
virtual void setFieldName ( const string & fieldName);
+ void setId ( int id = MED_INVALID );
+ int getId ( void ) const ;
string getFileName () const;
- void setFileName (const string & fileName);
+ void setFileName ( const string & fileName);
med_mode_acces getAccessMode() const;
};
+using namespace std;
/*
File Group.cxx
$Header$
return *this;
};
-GROUP::GROUP(const string & name, const list<FAMILY*> & families)
+GROUP::GROUP(const string & name, const list<FAMILY*> & families) throw (MEDEXCEPTION)
{
const char * LOC = "GROUP( const string & , const list<FAMILY*> & ) : " ;
BEGIN_OF(LOC);
MESSAGE(LOC<<name);
+
+ int numberOfFamilies = families.size();
_name = name ;
// description : none !
// first FAMILY to set all !
FAMILY * myFamily = families.front() ;
_mesh = myFamily->getMesh() ;
_entity = myFamily->getEntity() ;
+ bool isOnAllElts = myFamily->isOnAllElements() ;
+ if ((numberOfFamilies==1)&(isOnAllElts))
+ {
+ _numberOfFamilies = numberOfFamilies;
+ _isOnAllElts = false ;
+ _family.resize(_numberOfFamilies) ;
+ _family[0] = myFamily;
+ return;
+ }
+ else if ((!(numberOfFamilies==1))&(isOnAllElts))
+ throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "building of a GROUP object from several FAMILY, and one of them is on all entities" )) ;
+
_numberOfGeometricType = myFamily->getNumberOfTypes() ;
_geometricType = new medGeometryElement[_numberOfGeometricType];
//_geometricTypeNumber = new int[_numberOfGeometricType] ;
END_OF(LOC);
};
-void GROUP::init(const list<FAMILY*> & families)
+GROUP::GROUP(GROUP & m):SUPPORT(m)
{
- const char * LOC = "GROUP::init( const list<FAMILY*> & ) : " ;
+ _numberOfFamilies = m._numberOfFamilies;
+ _family = m._family;
+};
+
+// void GROUP::init(const list<FAMILY*> & families)
+// {
+// const char * LOC = "GROUP::init( const list<FAMILY*> & ) : " ;
- BEGIN_OF(LOC);
+// BEGIN_OF(LOC);
- FAMILY * myFamily = families.front() ;
- _mesh = myFamily->getMesh() ;
- _entity = myFamily->getEntity() ;
- _numberOfGeometricType = myFamily->getNumberOfTypes() ;
- _geometricType = new medGeometryElement[_numberOfGeometricType];
- //_geometricTypeNumber = new int[_numberOfGeometricType] ;
- _numberOfGaussPoint = new int[_numberOfGeometricType] ;
- _numberOfEntities = new int[_numberOfGeometricType] ;
- medGeometryElement * geometricType = myFamily->getTypes() ;
- //int * geometricTypeNumber = myFamily->getGeometricTypeNumber() ;
- int * numberOfGaussPoint = myFamily->getNumberOfGaussPoint() ;
- for (int i=0 ; i<_numberOfGeometricType; i++) {
- _geometricType[i]= geometricType[i] ;
- // _geometricTypeNumber[i] = geometricTypeNumber[i] ;
- _numberOfGaussPoint[i] = numberOfGaussPoint[i] ;
- _numberOfEntities[i]=myFamily->getNumberOfElements(geometricType[i]);
- }
- _isOnAllElts = false ;
- _totalNumberOfEntities = myFamily->getNumberOfElements(MED_ALL_ELEMENTS) ;
- _number = new MEDSKYLINEARRAY(*myFamily->getnumber()) ;
+// FAMILY * myFamily = families.front() ;
+// _mesh = myFamily->getMesh() ;
+
+// _isOnAllElts = myFamily->isOnAllElements() ;
+
+// SCRUTE(_mesh);
+
+// SCRUTE(_isOnAllElts);
+
+// _entity = myFamily->getEntity() ;
+
+// SCRUTE(_mesh->getNumberOfTypes(_entity));
+
+// _numberOfGeometricType = myFamily->getNumberOfTypes() ;
+// _geometricType = new medGeometryElement[_numberOfGeometricType];
+// //_geometricTypeNumber = new int[_numberOfGeometricType] ;
+// _numberOfGaussPoint = new int[_numberOfGeometricType] ;
+// _numberOfEntities = new int[_numberOfGeometricType] ;
+// medGeometryElement * geometricType = myFamily->getTypes() ;
+// //int * geometricTypeNumber = myFamily->getGeometricTypeNumber() ;
+// int * numberOfGaussPoint = myFamily->getNumberOfGaussPoint() ;
+// for (int i=0 ; i<_numberOfGeometricType; i++) {
+// _geometricType[i]= geometricType[i] ;
+// // _geometricTypeNumber[i] = geometricTypeNumber[i] ;
+// _numberOfGaussPoint[i] = numberOfGaussPoint[i] ;
+// _numberOfEntities[i]=myFamily->getNumberOfElements(geometricType[i]);
+// }
+// _isOnAllElts = false ;
+// _totalNumberOfEntities = myFamily->getNumberOfElements(MED_ALL_ELEMENTS) ;
+// _number = new MEDSKYLINEARRAY(*myFamily->getnumber()) ;
- _numberOfFamilies = families.size();
- _family.resize(_numberOfFamilies) ;
- list<FAMILY*>::const_iterator liIni = families.begin() ;
- _family[0]=(*liIni);
- liIni++;
- list<FAMILY*>::const_iterator li ;
- int it = 1 ;
- for (li=liIni;li!=families.end();li++) {
- blending(*li);
- _family[it] = (*li) ;
- it++ ;
- }
+// _numberOfFamilies = families.size();
+// _family.resize(_numberOfFamilies) ;
+// list<FAMILY*>::const_iterator liIni = families.begin() ;
+// _family[0]=(*liIni);
+// liIni++;
+// list<FAMILY*>::const_iterator li ;
+// int it = 1 ;
+// for (li=liIni;li!=families.end();li++) {
+// blending(*li);
+// _family[it] = (*li) ;
+// it++ ;
+// }
- END_OF(LOC);
-};
+// END_OF(LOC);
+// };
public:
GROUP();
- GROUP(const string & name, const list<FAMILY*> & family);
+ GROUP(const string & name, const list<FAMILY*> & family) throw (MEDEXCEPTION) ;
+ GROUP(GROUP & m);
~GROUP();
GROUP & operator=(const GROUP &group);
inline vector<FAMILY*> getFamilies() const ;
inline FAMILY * getFamily(int i) const ;
- void init(const list<FAMILY*> & family);
+// void init(const list<FAMILY*> & family);
};
// inline method :
+using namespace std;
# include "MEDMEM_Med.hxx"
# include "MEDMEM_STRING.hxx"
BEGIN_OF(LOC);
driver = instances[driverType]->run(fileName, this) ;
- _drivers.push_back(driver);
+ driver->setId(current);
current = _drivers.size()-1;
- // _drivers[current]->set...
+ driver->setId(current);
END_OF(LOC);
return current;
}
+/*! Add an existing MESH driver. */
+int MED::addDriver(GENDRIVER & driver) {
+ const char * LOC = "MED::addDriver(GENDRIVER &) : ";
+ int current;
+
+ BEGIN_OF(LOC);
+
+ _drivers.push_back(&driver);
+ current = _drivers.size()-1;
+ driver.setId(current);
+
+ return current;
+
+ END_OF(LOC);
+}
-void MED::rmDriver (int index=0) {
+void MED::rmDriver (int index/*=0*/) {
const char * LOC = "MED::rmDriver (int index=0): ";
BEGIN_OF(LOC);
}
-void MED::writeFrom (int index=0)
+void MED::writeFrom (int index/*=0*/)
{
const char * LOC = "MED::write (int index=0): ";
BEGIN_OF(LOC);
};
-void MED::write (int index=0)
+void MED::write (int index/*=0*/)
{
const char * LOC = "MED::writeAll (int index=0): ";
BEGIN_OF(LOC);
};
-void MED::readFileStruct (int index=0) {
+void MED::readFileStruct (int index/*=0*/) {
const char * LOC = "MED::readFileStruct (int index=0): ";
BEGIN_OF(LOC);
// CONTAINNED WITHIN A FILE <fileName> OF TYPE GIVEN BY THE <driverType> PARAMETER
// - IN THE SECOND CASE THE USER BEGINS HIS WORK WITH A MESH OR A FIELD,
// ?? GET A MED POINTER THEN CAN ADD MESHes OR FIELDs ??
-
+//
class MED
{
friend class MED_MED_DRIVER;
public:
int addDriver (driverTypes driverType, const string & fileName);
+ int addDriver (GENDRIVER & driver);
void rmDriver (int index=0);
void readFileStruct(int index=0);
// void read (int index=0);
#include "MEDMEM_STRING.hxx"
#include "MEDMEM_Exception.hxx"
#include "MEDMEM_Unit.hxx"
+#include "MEDMEM_Array.hxx"
+#include "MEDMEM_Support.hxx"
//#include "MEDMEM_Field.hxx"
//using namespace MED_FR ;
MED_FR::med_int err = 0;
if (_status == MED_OPENED) {
err=MED_FR::MEDfermer(_medIdt);
- H5close();
+ H5close(); // If we call H5close() all the files are closed.
_status = MED_CLOSED;
_medIdt = MED_INVALID;
MESSAGE(" MED_FIELD_DRIVER::close() : MEDfermer : _medIdt= " << _medIdt );
+using namespace std;
# include <string>
# include "MEDMEM_MedMedDriver.hxx"
using namespace MED_FR;
MED_MED_DRIVER::MED_MED_DRIVER(): GENDRIVER(),
- _ptrMed((MED * const)MED_NULL),
- _medIdt(MED_INVALID)
+ _ptrMed((MED * const)MED_NULL),_medIdt(MED_INVALID)
{}
MED_MED_DRIVER::MED_MED_DRIVER(const string & fileName, MED * const ptrMed):
GENDRIVER(fileName,MED_EN::MED_RDWR), _ptrMed(ptrMed), _medIdt(MED_INVALID)
-{}
+{
+ _ptrMed->addDriver(*this); // OU RECUPERER L'ID.
+}
MED_MED_DRIVER::MED_MED_DRIVER(const string & fileName,
MED * const ptrMed,
MED_EN::med_mode_acces accessMode):
GENDRIVER(fileName,accessMode), _ptrMed(ptrMed), _medIdt(MED_INVALID)
-{}
-
+{
+}
//REM : As t'on besoin du champ _status : _medIdt <-> _status ? Oui
MESSAGE(LOC<<": Mesh n°"<<i<<" nammed "<<meshName);
ptrMesh = new MESH();
- // NO : create a MED_MESH_RDWR_DRIVER with the currently used
- // _medIdt which remains VALID as long as _fileName is openned
- // NO: then as long as the MED driver remains open
MED_MESH_RDWR_DRIVER * _ptrDriver = new MED_MESH_RDWR_DRIVER(_fileName, ptrMesh);
- _ptrDriver->setMeshName(meshName);
+ _ptrDriver->setId ( getId() );
+ _ptrDriver->setMeshName ( meshName );
ptrMesh->addDriver(*_ptrDriver);
_ptrMed->_meshes[meshName] = ptrMesh;
// we create all global support (for each entity type :
MESSAGE("timeStepNumber :"<<timeStepNumber<<",orderNumber :"<<orderNumber);
ptrField->setIterationNumber ( timeStepNumber); // A ajouter dans la classe FIELD
ptrField->setOrderNumber ( orderNumber);
- ptrField->setTime ( timeStep);
+ ptrField->setTime ( timeStep);
// Create a driver for this (field n°dt,n°it)
-
+ ptrDriver->setId ( getId() );
MESSAGE("###### ptrDriver->setFieldName : #"<<fieldName<<"#");
ptrDriver->setFieldName(fieldName);
-
ptrField->addDriver(*ptrDriver);
DT_IT_ dtIt;
}
+// This method ask the drivers of all MESH/FIELD objects created from this MED driver
+// to read themselves
void MED_MED_DRIVER::read( void ) {
const char * LOC = "MED_MED_DRIVER::read() : ";
BEGIN_OF(LOC);
- MESSAGE("METHODE PAS ENCORE IMPLEMENTEE !!! ");
+ const map<MESH_NAME_, MESH*> & _meshes = const_cast<const map<MESH_NAME_, MESH*>& > (_ptrMed->_meshes);
+ map<MESH_NAME_,MESH*>::const_iterator currentMesh;
+
+ const map<FIELD_ *, MESH_NAME_> & _meshName = const_cast<const map<FIELD_ *, MESH_NAME_>& > (_ptrMed->_meshName);
+ map<FIELD_ *, MESH_NAME_>::const_iterator currentField;
+
+ for ( currentMesh=_meshes.begin();currentMesh != _meshes.end(); currentMesh++ )
+ (*currentMesh).second->read(*this);
+
+ for ( currentField =_meshName.begin(); currentField != _meshName.end(); currentField++ )
+ (*currentField).first->read(*this);
+
END_OF(LOC);
}
+// This method ask the drivers of all MESH/FIELD objects created from this MED driver
+// to write themselves
void MED_MED_DRIVER::writeFrom( void) const {
const char * LOC = "MED_MED_DRIVER::writeFrom() : ";
}
catch ( const MED_DRIVER_NOT_FOUND_EXCEPTION & ex ) {
continue;
- }
- // catch (const MED_EXCEPTION & ex) {
- // throw ex; // DOIT-ON CREER UNE NOUVELLE EXCEPTION AVEC UN MESSAGE INDIQUANT LA PILE
- // }
+}
}
for ( currentField=_meshName.begin();currentField != _meshName.end(); currentField++ ) {
void MED_MED_DRIVER::write(void ) const {
const char * LOC = "MED_MED_DRIVER::write() : ";
+ int current;
BEGIN_OF(LOC);
- // BCLE SUR LES DRIVERS AVEC APPELS WriteFrom
+ // BCLE SUR LES OBJETS AVEC AJOUT DE DRIVER ET APPELS write
+
+ const map<MESH_NAME_, MESH*> & _meshes = const_cast<const map<MESH_NAME_, MESH*>& > (_ptrMed->_meshes);
+ map<MESH_NAME_,MESH*>::const_iterator currentMesh;
+
+ const map<FIELD_ *, MESH_NAME_> & _meshName = const_cast<const map<FIELD_ *, MESH_NAME_>& > (_ptrMed->_meshName);
+ map<FIELD_ *, MESH_NAME_>::const_iterator currentField;
+
+ for ( currentMesh=_meshes.begin();currentMesh != _meshes.end(); currentMesh++ ) {
+ current = (*currentMesh).second->addDriver(MED_DRIVER,_fileName);
+ (*currentMesh).second->_drivers[current]->setId( getId() );
+ }
+
+ // for ( currentField=_meshName.begin();currentField != _meshName.end(); currentField++ ) {
+ // current = (*currentField).first->addDriver(MED_DRIVER,_fileName);
+ // (*currentField).first->_drivers[current]->setId( getId() );
+ // }
+
+ // *this.writeFrom();
+
END_OF(LOC);
}
void MED_MED_RDWR_DRIVER::close() {
BEGIN_OF("MED_MED_RDWR_DRIVER::close()");
MED_MED_DRIVER::close();
- END_OF("MED_MED_RDWR_DRIVER::clode()");
+ END_OF("MED_MED_RDWR_DRIVER::close()");
}
void MED_MED_RDWR_DRIVER::read(void) {
+using namespace std;
#include "MEDMEM_MedMeshDriver.hxx"
#include "MEDMEM_DriversDef.hxx"
buildAllGroups(_ptrMesh->_groupEdge,_ptrMesh->_familyEdge) ;
_ptrMesh->_numberOfEdgesGroups = _ptrMesh->_groupEdge.size() ;
+ MESSAGE(LOC<<"Checking of CellModel !!!!!!!");
+
+ int nbOfTypes = _ptrMesh->_connectivity->_numberOfTypes;
+ for(int i=0;i<nbOfTypes;i++)
+ {
+ MESSAGE(LOC << _ptrMesh->_connectivity->_type[i]) ;
+ }
+
END_OF(LOC);
}
map< string,list<FAMILY*> >::const_iterator currentGroup ;
int it = 0 ;
for(currentGroup=groupsNames.begin();currentGroup!=groupsNames.end();currentGroup++) {
- // GROUP * myGroup = new GROUP((*currentGroup).first,(*currentGroup).second) ;
- GROUP * myGroup = new GROUP() ;
- myGroup->setName((*currentGroup).first);
- SCRUTE(myGroup->getName());
- //myGroup->setMesh(_ptrMesh);
- myGroup->init((*currentGroup).second);
+ GROUP * myGroup = new GROUP((*currentGroup).first,(*currentGroup).second) ;
+// GROUP * myGroup = new GROUP() ;
+// myGroup->setName((*currentGroup).first);
+// SCRUTE(myGroup->getName());
+// //myGroup->setMesh(_ptrMesh);
+// myGroup->init((*currentGroup).second);
Groups[it]=myGroup;
//SCRUTE(it);
it++;
BEGIN_OF(LOC);
// we must first create mesh !!
- MESSAGE(LOC<< "MeshName : "<< _meshName <<"FileName : "<<_fileName<<" MedIdt : "<< _medIdt);
+ MESSAGE(LOC << "MeshName : |" << _meshName << "| FileName : |"<<_fileName<<"| MedIdt : | "<< _medIdt << "|");
if (writeCoordinates()!=MED_VALID)
throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "ERROR in writeCoordinates()" )) ;
int dim = MEDdimLire(_medIdt, const_cast <char *> (_meshName.c_str()) );
if (dim < MED_VALID)
if (MEDmaaCr(_medIdt,const_cast <char *> (_meshName.c_str()),_ptrMesh->_spaceDimension) != 0 )
- throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Unable to create Mesh"));
+ throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Unable to create Mesh : |" << _meshName << "|"));
else
{
MESSAGE(LOC<<"Mesh "<<_meshName<<" created in file "<<_fileName<<" !");
for (int j=0 ; j<numberOfElements; j++) {
for (int k=0; k<numberOfNodes; k++)
connectivityArray[j*(numberOfNodes+multi)+k]=connectivity[j*numberOfNodes+k] ;
- connectivityArray[j*(numberOfNodes+multi)+numberOfNodes]=0;
+ if (multi>0)
+ connectivityArray[j*(numberOfNodes+multi)+numberOfNodes]=0;
}
err = MEDconnEcr( _medIdt, const_cast <char *> ( _meshName.c_str()), _ptrMesh->_spaceDimension,
connectivityArray, MED_FR::MED_FULL_INTERLACE , numberOfElements,
int numberOfTypes = _ptrMesh->getNumberOfTypes (entity) ;
medGeometryElement * types = _ptrMesh->getTypes (entity) ;
- for (int i=0; i<numberOfTypes; i++) {
-
- int numberOfElements = _ptrMesh->getNumberOfElements (entity,types[i]);
- int * connectivity = _ptrMesh->getConnectivity(MED_EN::MED_FULL_INTERLACE, MED_DESCENDING, entity, types[i]);
-
- // Pour l'instant la class utilise le multi.....
- err = MEDconnEcr( _medIdt, const_cast <char *> ( _meshName.c_str()), _ptrMesh->_spaceDimension,
- connectivity, MED_FR::MED_FULL_INTERLACE , numberOfElements,
- MED_FR::MED_REMP,
- (MED_FR::med_entite_maillage ) entity,
- (MED_FR::med_geometrie_element) types[i], MED_DESC );
-
- if (err<0) // ETENDRE LES EXPLICATIONS
- throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't write connectivities of mesh |" << _meshName.c_str() << "| in file |" << _fileName
- << "| with dimension |" << _ptrMesh->_spaceDimension <<"| and"
- )) ;
- }
- }
- // Connctivity descending :
- if ( _ptrMesh->existConnectivity(MED_DESCENDING,entity) ) {
-
- int numberOfTypes = _ptrMesh->getNumberOfTypes (entity) ;
- medGeometryElement * types = _ptrMesh->getTypes (entity) ;
-
for (int i=0; i<numberOfTypes; i++) {
int numberOfElements = _ptrMesh->getNumberOfElements (entity,types[i]);
med_int err = 0;
if ( _status == MED_OPENED) {
err=MED_FR::MEDfermer(_medIdt);
- H5close();
+ H5close(); // If we call H5close() all the files are closed.
if (err != 0)
throw MEDEXCEPTION( LOCALIZED(STRING(LOC)
<<" Error when closing file !"
+using namespace std;
/*
File Mesh.cxx
$Header$
/*! Add a MESH driver of type (MED_DRIVER, ....) associated with file <fileName>. The meshname used in the file
is <driverName>. addDriver returns an int handler. */
int MESH::addDriver(driverTypes driverType,
- const string & fileName="Default File Name.med",const string & driverName="Default Mesh Name") {
+ const string & fileName/*="Default File Name.med"*/,const string & driverName/*="Default Mesh Name"*/) {
const char * LOC = "MESH::addDriver(driverTypes driverType, const string & fileName=\"Default File Name.med\",const string & driverName=\"Default Mesh Name\") : ";
}
/*! Add an existing MESH driver. */
-int MESH::addDriver(GENDRIVER & driver) {
+int MESH::addDriver(MED_MESH_DRIVER & driver) {
const char * LOC = "MESH::addDriver(GENDRIVER &) : ";
BEGIN_OF(LOC);
- // A FAIRE VERIFIER QUE LE DRIVER EST DE TYPE MESH !!
+ // A faire : Vérifier que le driver est de type MESH.
_drivers.push_back(&driver);
return _drivers.size()-1;
}
/*! Remove an existing MESH driver. */
-void MESH::rmDriver (int index=0) {
+void MESH::rmDriver (int index/*=0*/) {
const char * LOC = "MESH::rmDriver (int index=0): ";
BEGIN_OF(LOC);
/*! Create a MESH object using a MESH driver of type (MED_DRIVER, ....) associated with file <fileName>.
The meshname <driverName> must already exists in the file.*/
-MESH::MESH(driverTypes driverType, const string & fileName="", const string & driverName="") {
+MESH::MESH(driverTypes driverType, const string & fileName/*=""*/, const string & driverName/*=""*/) {
const char * LOC ="MESH::MESH(driverTypes driverType, const string & fileName="", const string & driverName="") : ";
int current;
}
/*!
- Get global number of element which have same connectivity than connectivity argument
+ Get global number of element which have same connectivity than connectivity argument.
+
+ It do not take care of connectivity order (3,4,7,10 is same as 7,3,10,4).
+
+ Return -1 if not found.
*/
int MESH::getElementNumber(medConnectivity ConnectivityType, medEntityMesh Entity, medGeometryElement Type, int * connectivity)
{
else
numberOfValue = myType.getNumberOfNodes() ; // nodes
- int * myReverseConnectivityValue = getReverseConnectivity(ConnectivityType) ;
- int * myReverseConnectivityIndex = getReverseConnectivityIndex(ConnectivityType) ;
+ int * myReverseConnectivityValue = getReverseConnectivity(ConnectivityType,Entity) ;
+ int * myReverseConnectivityIndex = getReverseConnectivityIndex(ConnectivityType,Entity) ;
// First node or face/edge
int indexBegin = myReverseConnectivityIndex[connectivity[0]-1] ;
mySupport->setNumberOfGeometricType(numberOfGeometricType) ;
mySupport->setGeometricType(geometricType) ;
mySupport->setNumberOfGaussPoint(numberOfGaussPoint) ;
- mySupport->setGeometricTypeNumber(geometricTypeNumber) ;
+ // mySupport->setGeometricTypeNumber(geometricTypeNumber) ;
mySupport->setNumberOfEntities(numberOfEntities) ;
mySupport->setTotalNumberOfEntities(size) ;
mySupport->setNumber(mySkyLineArray) ;
#include "MEDMEM_Connectivity.hxx"
#include "MEDMEM_MedMeshDriver.hxx"
+#include "MEDMEM_MedMedDriver.hxx"
class CELLMODEL;
class FAMILY;
friend class MED_MESH_RDONLY_DRIVER;
friend class MED_MESH_WRONLY_DRIVER;
+ friend class MED_MED_DRIVER;
void init();
MESH();
friend ostream & operator<<(ostream &os, MESH &my) ;
int addDriver(driverTypes driverType,
- const string & fileName ="Default File Name.med",
+ const string & fileName ="Default File Name.med",
const string & driverName="Default Mesh Name");
- int addDriver(GENDRIVER & driver);
+ int addDriver(MED_MESH_DRIVER & driver);
void rmDriver(int index=0);
inline void read(int index=0);
+ inline void read(const MED_MED_DRIVER & genDriver);
inline void write(int index=0, const string & driverName = "");
- inline void write(const GENDRIVER &);
+ inline void write(const MED_MED_DRIVER & genDriver);
inline int * getMEDArrayNodeFamily() ;
inline int ** getMEDArrayCellFamily() ;
inline int * getConnectivity(medModeSwitch Mode,medConnectivity ConnectivityType,medEntityMesh Entity, medGeometryElement Type);
inline int * getConnectivityIndex(medConnectivity ConnectivityType,medEntityMesh Entity);
int getElementNumber(medConnectivity ConnectivityType, medEntityMesh Entity, medGeometryElement Type, int * connectivity) ;
- inline int * getReverseConnectivity(medConnectivity ConnectivityType);
- inline int * getReverseConnectivityIndex(medConnectivity ConnectivityType);
+ inline int * getReverseConnectivity(medConnectivity ConnectivityType,medEntityMesh Entity=MED_CELL);
+ inline int * getReverseConnectivityIndex(medConnectivity ConnectivityType,medEntityMesh Entity=MED_CELL);
inline int getNumberOfFamilies(medEntityMesh Entity);
inline vector<FAMILY*> getFamilies(medEntityMesh Entity);
inline int getNumberOfGroups(medEntityMesh Entity);
inline vector<GROUP*> getGroups(medEntityMesh Entity);
inline GROUP* getGroup(medEntityMesh Entity,int i);
-
-
+ inline CONNECTIVITY* getConnectivityptr();
SUPPORT * getBoundaryElements(medEntityMesh Entity) throw (MEDEXCEPTION) ;
// Node DonneBarycentre(const Cell &m) const;
// Methodes Inline
// ---------------------------------------
-inline void MESH::read(int index=0)
+inline CONNECTIVITY* MESH::getConnectivityptr() {return _connectivity;}
+
+inline void MESH::read(int index/*=0*/)
{
const char * LOC = "MESH::read(int index=0) : ";
BEGIN_OF(LOC);
}
/*! Write all the content of the MESH using driver referenced by the handler <index>*/
-inline void MESH::write(int index=0, const string & driverName = "")
+inline void MESH::write(int index/*=0*/, const string & driverName/* = ""*/)
{
const char * LOC = "MESH::write(int index=0, const string & driverName = \"\") : ";
BEGIN_OF(LOC);
// This method is MED specific : don't use it
// must be private.
-inline void MESH::write(const GENDRIVER & genDriver)
+inline void MESH::write(const MED_MED_DRIVER & genDriver)
{
- const char * LOC = "MESH::write(const GENDRIVER & genDriver): ";
+ const char * LOC = "MESH::write(const MED_MED_DRIVER & genDriver): ";
BEGIN_OF(LOC);
for (int index=0; index < _drivers.size(); index++ )
}
+// This method is MED specific : don't use it
+// must be private.
+inline void MESH::read(const MED_MED_DRIVER & genDriver)
+{
+ const char * LOC = "MESH::read(const MED_MED_DRIVER & genDriver): ";
+ BEGIN_OF(LOC);
+
+ for (int index=0; index < _drivers.size(); index++ )
+ if ( *_drivers[index] == genDriver ) {
+ _drivers[index]->open();
+ _drivers[index]->read();
+ _drivers[index]->close();
+ // ? FINALEMENT PAS BESOIN DE L'EXCEPTION ?
+ }
+
+ END_OF(LOC);
+
+}
+
/*! Set the MESH name */
inline void MESH::setName(string name)
{
// }
/*! Get the number of different geometric types for a given entity type.
- For exemple getNumberOfTypes(MED_CELL) would return 2 is the MESH have some MED_TETRA4 and MED_HEXA6 in it.
- medEntityMesh entity : MED_CELL, MED_FACE, MED_EDGE, MED_NODE, MED_ALL_ENTITIES
+
+ For exemple getNumberOfTypes(MED_CELL) would return 3 is the MESH
+ have some MED_TETRA4, MED_PYRA5 and MED_HEXA6 in it.
+
+ medEntityMesh entity : MED_CELL, MED_FACE, MED_EDGE, MED_NODE, MED_ALL_ENTITIES
+
+ If entity is not defined, return 0.
+
+ If there is no connectivity, return an exception.
*/
inline int MESH::getNumberOfTypes(medEntityMesh entity)
{
/*!
Get the list of geometric types used by a given entity.
medEntityMesh entity : MED_CELL, MED_FACE, MED_EDGE, MED_ALL_ENTITIES
+
REM : Don't use MED_NODE
+
+ If entity is not defined, return an exception.
*/
inline medGeometryElement * MESH::getTypes(medEntityMesh entity)
{
if (entity == MED_NODE)
throw MEDEXCEPTION(LOCALIZED("MESH::getTypes( medEntityMesh ) : No medGeometryElement with MED_NODE entity !"));
-
+ // return un tableau de taille 1 contenant MED_NONE, comme les supports pour etre coherent avec getNumberOfTypes ???? PG
+
if (_connectivity != NULL)
return _connectivity->getGeometricTypes(entity) ;
throw MEDEXCEPTION(LOCALIZED("MESH::getTypes( medEntityMesh ) : Connectivity not defined !"));
/*!
Get the whole list of CELLMODEL used by cells of given type (medEntityMesh).
+
REMARK : Don't use MED_NODE as medEntityMesh
*/
inline CELLMODEL * MESH::getCellsTypes(medEntityMesh Entity)
throw MEDEXCEPTION(LOCALIZED("MESH::getCellsTypes( medEntityMesh ) : Connectivity not defined !"));
}
-/*! Since informations related with an entity type are stored in independent arrays, the only way to
- get a uniq index is to call this method.
- For exemple if you want the global numbers of your ... ????? size ?????
+/*! Return an array of size NumbreOfTypes+1 which contains, for each
+ geometric type of the given entity, the first global element number
+ of this type.
+
+ For exemple, if we have a mesh with 5 triangles and 4 quadrangle :
+ - size of GlobalNumberingIndex is 3
+ - GlobalNumberingIndex[0]=1 (the first type)
+ - GlobalNumberingIndex[1]=6 (the second type)
+ - GlobalNumberingIndex[2]=10
*/
inline int * MESH::getGlobalNumberingIndex(medEntityMesh entity)
{
return _connectivity->getGlobalNumberingIndex(entity);
throw MEDEXCEPTION(LOCALIZED("MESH::getNumberOfTypes( medEntityMesh ) : Connectivity not defined !"));
}
+/*!
+ Return the number of element of given geometric type of given entity. Return 0 if query is not defined.
+
+ Example :
+ - getNumberOfElements(MED_NODE,MED_NONE) : number of node
+ - getNumberOfElements(MED_NODE,MED_TRIA3) : return 0 (not defined)
+ - getNumberOfElements(MED_FACE,MED_TRIA3) : return number of triangles
+ elements defined in face entity (0 if not defined)
+ - getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS) : return total number
+ of elements defined in cell entity
+ */
inline int MESH::getNumberOfElements(medEntityMesh entity, medGeometryElement Type)
{
const char * LOC = "MESH::getNumberOfElements(medEntityMesh,medGeometryElement) : " ;
return 0 ;
//throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"connectivity not defined !"));
}
+/*!
+ Return true if the wanted connectivity exist, else return false
+ (to use before a getSomething method).
+ */
inline bool MESH::existConnectivity(medConnectivity connectivityType, medEntityMesh entity)
{
if (_connectivity==(CONNECTIVITY*)NULL)
return _connectivity->existConnectivity(connectivityType,entity) ;
}
/*!
- Return the geometric type of element Number of entity Entity.
+ Return the geometric type of global element Number of entity Entity.
Throw an exception if Entity is not defined or Number are wrong (too big).
*/
throw MEDEXCEPTION("MESH::getElementType(medEntityMesh,int) : no connectivity defined !");
return _connectivity->getElementType(Entity,Number) ;
}
+/*!
+ Calculate the ask connectivity. Return an exception if this could not be
+ done. Do nothing if connectivity already exist.
+ */
+
inline void MESH::calculateConnectivity(medModeSwitch Mode,medConnectivity ConnectivityType,medEntityMesh entity)
{
if (Mode==MED_FULL_INTERLACE)
else
throw MEDEXCEPTION(LOCALIZED("MESH::calculateConnectivity : only for MED_FULL_INTERLACE mode"));
}
+/*!
+ Return the required connectivity in the right mode for the given
+ geometric type of the given entity.
+
+ To get connectivity for all geometric type, use Mode=MED_FULL_INTERLACE
+ and Type=MED_ALL_ELEMENTS.
+ You must also get the corresponding index array.
+ */
inline int * MESH::getConnectivity(medModeSwitch Mode,medConnectivity ConnectivityType,medEntityMesh entity, medGeometryElement Type)
{
if (Mode==MED_FULL_INTERLACE)
return _connectivity->getConnectivity(ConnectivityType,entity,Type) ;
throw MEDEXCEPTION(LOCALIZED("MESH::getConnectivity : only for MED_FULL_INTERLACE mode"));
}
+/*!
+ Return the required index array for a connectivity received in
+ MED_FULL_ENTERLACE mode and MED_ALL_ELEMENTS type.
+
+ This array allow to find connectivity of each elements.
+
+ Example : Connectivity of i^{th} elements (1<=i<=NumberOfElement) begin
+ at index ConnectivityIndex[i-1] and end at index ConnectivityIndex[i]-1
+ in Connectivity array (Connectivity[ConnectivityIndex[i-1]-1] is the
+ first value)
+ */
inline int * MESH::getConnectivityIndex(medConnectivity ConnectivityType,medEntityMesh entity)
{
return _connectivity->getConnectivityIndex(ConnectivityType, entity) ;
}
-inline int * MESH::getReverseConnectivity(medConnectivity ConnectivityType)
+/*!
+ Return the reverse connectivity required by ConnectivityType :
+ - If ConnectivityType=MED_NODAL : return connectivity node-cell
+ - If ConnectivityType=MED_DESCENDING : return connectivity face-cell
+
+ You must get ReverseConnectivityIndex array to use it.
+ */
+inline int * MESH::getReverseConnectivity(medConnectivity ConnectivityType,medEntityMesh Entity/*=MED_CELL*/)
{
- if (ConnectivityType==MED_NODAL)
- return _connectivity->getReverseNodalConnectivity() ;
- else if (ConnectivityType==MED_DESCENDING)
- return _connectivity->getReverseDescendingConnectivity() ;
- throw MEDEXCEPTION("MESH::getReverseConnectivity : connectivity mode not supported !");
+ if (NULL==_connectivity)
+ throw MEDEXCEPTION("MESH::getReverseConnectivity : no connectivity defined in MESH !");
+
+ return _connectivity->getReverseConnectivity(ConnectivityType,Entity) ;
}
-inline int * MESH::getReverseConnectivityIndex(medConnectivity ConnectivityType)
+/*!
+ Return the index array required by ConnectivityType.
+
+ This array allow to find reverse connectivity of each elements.
+
+ Example : Reverse connectivity of i^{th} elements (1<=i<=NumberOfElement)
+ begin at index ReverseConnectivityIndex[i-1] and end at index
+ ReverseConnectivityIndex[i]-1
+ in ReverseConnectivity array (
+ ReverseConnectivity[ReverseConnectivityIndex[i-1]-1]
+ is the first value)
+ */
+inline int * MESH::getReverseConnectivityIndex(medConnectivity ConnectivityType,medEntityMesh Entity/*=MED_CELL*/)
{
- if (ConnectivityType==MED_NODAL)
- return _connectivity->getReverseNodalConnectivityIndex() ;
- else if (ConnectivityType==MED_DESCENDING)
- return _connectivity->getReverseDescendingConnectivityIndex() ;
- throw MEDEXCEPTION("MESH::getReverseConnectivityIndex : connectivity mode not supported !");
+ if (NULL==_connectivity)
+ throw MEDEXCEPTION("MESH::getReverseConnectivityIndex : no connectivity defined in MESH !");
+
+ return _connectivity->getReverseConnectivityIndex(ConnectivityType,Entity) ;
}
--- /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__ ) */
# define STRING_HXX
# include <string>
-# include <sstream>
+//# include <sstream>
+# include <strstream>
using namespace std;
class STRING : public string
{
+
private :
- ostringstream _s ;
+ // ostringstream _s ;
+ ostrstream _s ;
+
public :
- operator const char*() const
- {
- return _s.str().c_str() ;
- }
- STRING() : _s()
- {
- }
- template <class T> STRING( const T &valeur ) : _s()
- {
- _s << valeur ;
- }
- template <class T> STRING &operator<<( const T &valeur )
- {
- _s << valeur ;
- return *this ;
- }
+
+ operator const char * () const {
+ return const_cast <const char *> (this->c_str()) ;
+ }
+
+ ~STRING()
+ {
+ _s.freeze(false);
+ }
+
+ STRING() :string() , _s()
+ {
+ }
+
+ template <class T> STRING( const T &valeur ) : string() , _s()
+ {
+ _s.freeze(false);
+ _s << valeur ;
+ this->string::operator =( _s.str()); // freeze is true by now
+ }
+
+ template <class T> STRING &operator<<( const T &valeur )
+ {
+ _s.freeze(false);
+ _s << valeur ;
+ this->string::operator = ( _s.str()) ; // freeze is true by now
+ return *this ;
+ }
} ;
// Exemple d'utilisation avec les exceptions SALOME
+using namespace std;
#include "MEDMEM_SkyLineArray.hxx"
#include "utilities.h"
MESSAGE("Constructeur MEDSKYLINEARRAY sans parametre");
}
-MEDSKYLINEARRAY::MEDSKYLINEARRAY(const MEDSKYLINEARRAY &myArray)
+MEDSKYLINEARRAY::MEDSKYLINEARRAY(const MEDSKYLINEARRAY &myArray):
+ _count(myArray._count),_length(myArray._length),
+ _index(_count+1),_value(_length)
{
- MESSAGE("MEDSKYLINEARRAY(const MEDSKYLINEARRAY &)");
- _count = myArray._count ;
- _length = myArray._length ;
- _index = new med_int[_count+1] ;
- _value = new med_int[_length] ;
- memcpy(_index,myArray._index,sizeof(med_int)*(_count+1));
- memcpy(_value,myArray._value,sizeof(med_int)*_length);
+ BEGIN_OF("MEDSKYLINEARRAY(const MEDSKYLINEARRAY &)");
+ memcpy(_index,myArray._index,sizeof(med_int)*(_count+1));
+ memcpy(_value,myArray._value,sizeof(med_int)*_length);
+ END_OF("MEDSKYLINEARRAY(const MEDSKYLINEARRAY &)");
}
MEDSKYLINEARRAY::~MEDSKYLINEARRAY()
{
MESSAGE("Destructeur ~MEDSKYLINEARRAY");
- if (_index != NULL) delete [] _index;
- if (_value != NULL) delete [] _value;
+ //if (_index != NULL) delete [] _index;
+ //if (_value != NULL) delete [] _value;
}
MEDSKYLINEARRAY::MEDSKYLINEARRAY(const med_int count , const med_int length ) :
- _count(count), _length(length)
+ _count(count), _length(length),
+ _index(_count+1),_value(_length)
{
- MESSAGE("Constructeur MEDSKYLINEARRAY(count="<<count<<", length="<<length<<") avec parametres");
-
- _index = new med_int[count+1] ;
- _value = new med_int[length] ;
+ MESSAGE("Constructeur MEDSKYLINEARRAY(count="<<count<<", length="<<length<<") avec parametres");
}
void MEDSKYLINEARRAY::setMEDSKYLINEARRAY( const med_int count , const med_int length, med_int* index , med_int* value )
_count = count ;
_length = length ;
- if (_index != NULL) delete [] _index;
- if (_value != NULL) delete [] _value;
+ //if (_index != NULL) delete [] _index;
+ //if (_value != NULL) delete [] _value;
- _index = index;
- _value = value;
+ _index.set(index);
+ _value.set(value);
}
#include "MEDMEM_Exception.hxx"
+#include "MEDMEM_PointerOf.hxx"
#include "MEDMEM_define.hxx"
using MED_EN::med_int ;
private :
med_int _count ;
med_int _length ;
- med_int * _index ; // array of size _count+1 : _index[0]=1 and
- // _index[_count]=length+1
- med_int * _value ; // array of size _length
+ PointerOf <med_int> _index ; // array of size _count+1 : _index[0]=1 and
+ // _index[_count]=length+1
+ PointerOf <med_int> _value ; // array of size _length
public :
MEDSKYLINEARRAY();
inline med_int getNumberOf() const;
inline med_int getLength() const;
- inline med_int* getIndex() const;
- inline med_int* getValue() const;
+ inline med_int* getIndex() ;
+ inline med_int* getValue() ;
inline med_int getNumberOfI(int i) const throw (MEDEXCEPTION) ;
- inline med_int* getI(int i) const throw (MEDEXCEPTION) ;
+ inline med_int* getI(int i) throw (MEDEXCEPTION) ;
inline med_int getIJ(int i, int j) const throw (MEDEXCEPTION) ;
} ;
{
return _length ;
};
-inline med_int* MEDSKYLINEARRAY::getIndex() const
+inline med_int* MEDSKYLINEARRAY::getIndex()
{
- return _index ;
+ return (med_int*)_index ;
} ;
-inline med_int* MEDSKYLINEARRAY::getValue() const
+inline med_int* MEDSKYLINEARRAY::getValue()
{
- return _value ;
+ return (med_int*)_value ;
} ;
inline med_int MEDSKYLINEARRAY::getNumberOfI(int i) const throw (MEDEXCEPTION)
{
throw MEDEXCEPTION("MEDSKYLINEARRAY::getNumberOfI : argument is out of range");
return _index[i]-_index[i-1] ;
} ;
-inline med_int* MEDSKYLINEARRAY::getI(int i) const throw (MEDEXCEPTION)
+inline med_int* MEDSKYLINEARRAY::getI(int i) throw (MEDEXCEPTION)
{
if (i<1)
throw MEDEXCEPTION("MEDSKYLINEARRAY::getI : argument must be >= 1");
+using namespace std;
/*
File Support.cxx
$Header$
};
//--------------------------------------------------------------------------
-SUPPORT::SUPPORT(MESH* Mesh, string Name="", medEntityMesh Entity=MED_CELL):
+SUPPORT::SUPPORT(MESH* Mesh, string Name/*=""*/, medEntityMesh Entity/*=MED_CELL*/):
_name(Name), _description(""), _mesh(Mesh), _entity(Entity),
_numberOfGeometricType(0),
_geometricType((medGeometryElement*)NULL),
}
};
+//--------------------------------------------------------------------------
+SUPPORT::SUPPORT(SUPPORT & m)
+//--------------------------------------------------------------------------
+{
+ const char * LOC = "SUPPORT::SUPPORT(SUPPORT & m) : " ;
+ BEGIN_OF(LOC) ;
+
+ _name = m._name;
+ _description = m._description;
+ _mesh = m._mesh; // on recopie uniquement l'adresse
+ _entity = m._entity;
+ _numberOfGeometricType = m._numberOfGeometricType;
+ if (m._geometricType != NULL)
+ {
+ _geometricType = new medGeometryElement[m._numberOfGeometricType];
+ memcpy(_geometricType,m._geometricType,m._numberOfGeometricType*sizeof(medGeometryElement));
+ }
+ else
+ _geometricType = (medGeometryElement *) NULL;
+ if (m._numberOfGaussPoint != NULL)
+ {
+ _numberOfGaussPoint = new int[m._numberOfGeometricType];
+ memcpy(_numberOfGaussPoint,m._numberOfGaussPoint,m._numberOfGeometricType*sizeof(int));
+ }
+ else
+ _numberOfGaussPoint = (int *) NULL;
+ if (m._geometricTypeNumber != NULL)
+ {
+ _geometricTypeNumber = new int[m._numberOfGeometricType];
+ memcpy(_geometricTypeNumber,m._geometricTypeNumber,m._numberOfGeometricType*sizeof(int));
+ }
+ else
+ _geometricTypeNumber = (int *) NULL;
+ _isOnAllElts = m._isOnAllElts;
+ if (m._numberOfEntities != NULL)
+ {
+ _numberOfEntities = new int[m._numberOfGeometricType];
+ memcpy(_numberOfEntities,m._numberOfEntities,m._numberOfGeometricType*sizeof(int));
+ }
+ else
+ _numberOfEntities = (int *) NULL;
+ _totalNumberOfEntities = m._totalNumberOfEntities;
+ if (m._isOnAllElts == false)
+ _number = new MEDSKYLINEARRAY(* m._number);
+ else
+ _number = (MEDSKYLINEARRAY *) NULL;
+
+ END_OF(LOC) ;
+};
+
//-----------------
SUPPORT::~SUPPORT()
//-----------------
os << "ERROR : Mesh not defined !" << endl ;
else
os << my._mesh->getName() << endl ;
+ os << "Entity : "<< my._entity << endl;
+ os << "Entity list : "<< endl;
+ if (!(my._isOnAllElts)) {
+ int NumberOfTypes = my._numberOfGeometricType ;
+ os << "NumberOfTypes : "<<NumberOfTypes<<endl;
+ medGeometryElement * Types = my._geometricType ;
+ for (int j=0;j<NumberOfTypes;j++) {
+ os << " * Type "<<Types[j]<<" : ";
+ int NumberOfElements = my._numberOfEntities[j] ;
+ int * Number = my._number->getI(j+1) ;
+ for (int k=0; k<NumberOfElements;k++)
+ os << Number[k] << " ";
+ os << endl ;
+ }
+ } else
+ os << "Is on all entities !"<< endl;
+
return os ;
}
const char * LOC = "SUPPORT::blending() : " ;
BEGIN_OF(LOC) ;
+ MESSAGE(LOC<< "SUPPORT entry : " << *mySupport) ;
+
// on same entity :
if ( _entity != mySupport->getEntity() )
throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"Entities are different !"));
int * number1 = getNumber(myType[i]) ;
int * number2 = mySupport->getNumber(myType[i]) ;
+ SCRUTE(number1);
+ SCRUTE(number2);
+
int numberOfElements1 = numberOfEntities[i] ;
int numberOfElements2 = mySupport->getNumberOfElements(myType[i]) ;
+ SCRUTE(numberOfElements1);
+ SCRUTE(numberOfElements2);
+
for(int j=0;j<numberOfElements1;j++){
elementList.insert(number1[j]) ;
}
for(int j=0;j<numberOfElements2;j++){
+ SCRUTE(number2[j]);
elementList.insert(number2[j]) ;
}
public:
SUPPORT();
SUPPORT(MESH* Mesh, string Name="", medEntityMesh Entity=MED_CELL);
+ SUPPORT(SUPPORT & m);
~SUPPORT();
friend ostream & operator<<(ostream &os,const SUPPORT &my);
inline void setNumberOfGeometricType(int NumberOfGeometricType);
inline void setGeometricType(medGeometryElement *GeometricType);
inline void setNumberOfGaussPoint(int *NumberOfGaussPoint);
- inline void setGeometricTypeNumber(int *GeometricTypeNumber);
+ // inline void setGeometricTypeNumber(int *GeometricTypeNumber);
inline void setNumberOfEntities(int *NumberOfEntities);
inline void setTotalNumberOfEntities(int TotalNumberOfEntities);
inline void setNumber(MEDSKYLINEARRAY * Number);
inline medGeometryElement* getTypes() const ;
inline int * getNumberOfGaussPoint() const throw (MEDEXCEPTION);
inline int getNumberOfGaussPoint(medGeometryElement geomElement) const throw (MEDEXCEPTION);
- inline int * getGeometricTypeNumber() const;
+ //inline int * getGeometricTypeNumber() const;
// inline int getNumberOfTotalEntity() const;
inline int getNumberOfElements(medGeometryElement GeometricType) const throw (MEDEXCEPTION);
inline MEDSKYLINEARRAY * getnumber() const throw (MEDEXCEPTION);
/*! set the attribute _geometricTypeNumber to GeometricTypeNumber */
//-------------------------------------------------------------------
-inline void SUPPORT::setGeometricTypeNumber(int *GeometricTypeNumber)
+//inline void SUPPORT::setGeometricTypeNumber(int *GeometricTypeNumber)
//-------------------------------------------------------------------
-{
- _geometricTypeNumber=GeometricTypeNumber;
-}
+//{
+// _geometricTypeNumber=GeometricTypeNumber;
+//}
/*! set the attribute _numberOfEntities to NumberOfEntities */
//----------------------------------------------------------
}
//---------------------------------------------------
-inline int * SUPPORT::getGeometricTypeNumber() const
+//inline int * SUPPORT::getGeometricTypeNumber() const
//---------------------------------------------------
-{
- const char * LOC = "SUPPORT::getGeometricTypeNumber() : ";
- if (_isOnAllElts)
- throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"Not defined (is on all elements) !"));
- if (_geometricTypeNumber==NULL)
- throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"Not defined !"));
- return _geometricTypeNumber;
-}
+// {
+// const char * LOC = "SUPPORT::getGeometricTypeNumber() : ";
+// if (_isOnAllElts)
+// throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"Not defined (is on all elements) !"));
+// if (_geometricTypeNumber==NULL)
+// throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"Not defined !"));
+// return _geometricTypeNumber;
+// }
#endif /* SUPPORT_HXX */
+using namespace std;
/*
File MEDMEM_Unit.cxx
$Header$
+using namespace std;
#include "MEDMEM_VtkMedDriver.hxx"
#include "MEDMEM_Med.hxx"
#define DEFINE_HXX
#include <stdio.h>
-#include <iostream.h>
-#include <string.h>
+#include <iostream>
+#include <string>
#include <assert.h>
// UTILE AUX DEUX NAMESPACES
EXPORT_HEADERS = \
+MEDMEM_PointerOf.hxx \
MEDMEM_CellModel.hxx \
MEDMEM_Connectivity.hxx \
MEDMEM_Coordinate.hxx \
# Executables targets
-BIN = duplicateMED med_test duplicateMEDMESH
+BIN = duplicateMED med_test duplicateMEDMESH
BIN_SRC =
BIN_SERVER_IDL =
BIN_CLIENT_IDL =
-TEST_PROGS = test_MEDMEM_ModulusArray test_MEDMEM_Array test_MEDMEM_SkyLineArray test_MEDMEM_CellModel
+TEST_PROGS = test_MEDMEM_ModulusArray test_MEDMEM_Array test_MEDMEM_SkyLineArray test_MEDMEM_CellModel test_copie_field_ test_copie_fieldT test_copie_coordinate test_copie_medarray test_copie_connectivity test_copie_support test_copie_family test_copie_group test_affect_medarray
+#TEST_PROGS = test_MEDMEM_ModulusArray test_MEDMEM_Array test_MEDMEM_SkyLineArray test_MEDMEM_CellModel testUCoordinate testUUnit testUGeoNameMeshEntities testUMedException testUModulusArray testUSkyLineArray testUArray testUCellModel readEntete readCoordinate test_copie_field_ test_copie_fieldT test_copie_coordinate test_copie_medarray test_copie_connectivity test_copie_support test_copie_family test_copie_group test_affect_medarray
+
+# testUCellModel -> a revoir car l'API a changee (plus de vector)
CPPFLAGS+=$(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS+=-ftemplate-depth-42 -I${KERNEL_ROOT_DIR}/include/salome
+using namespace std;
#include<string>
#include<deque>
#include "MEDMEM_Support.hxx"
#include "MEDMEM_Field.hxx"
-#include "MEDMEM_GenDriver.hxx"
-#include "MEDMEM_MedMedDriver.hxx"
-#include "MEDMEM_MedMeshDriver.hxx"
-#include "MEDMEM_MedFieldDriver.hxx"
-
void usage(char * name)
{
+using namespace std;
#include<string>
#include<deque>
+using namespace std;
#include<string>
#include <math.h>
void affiche_support(SUPPORT * mySupport)
{
- MESSAGE( " - Name : "<<mySupport->getName().c_str());
- MESSAGE( " - Description : "<<mySupport->getDescription().c_str());
- MESSAGE( " - Entity : "<<mySupport->getEntity());
- MESSAGE( " - Entities list : ");
+ 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() ;
- MESSAGE(" - NumberOfTypes : "<<NumberOfTypes);
+ cout<<" - NumberOfTypes : "<<NumberOfTypes<<endl;
medGeometryElement * Types = mySupport->getTypes() ;
for (int j=0;j<NumberOfTypes;j++) {
- MESSAGE( " * Type "<<Types[j]<<" : " );
+ cout << " * Type "<<Types[j]<<" : " ;
int NumberOfElements = mySupport->getNumberOfElements(Types[j]) ;
int * Number = mySupport->getNumber(Types[j]) ;
for (int k=0; k<NumberOfElements;k++)
- MESSAGE( Number[k] << " ");
- MESSAGE("");
+ cout << Number[k] << " ";
+ cout << endl ;
}
} else
- MESSAGE( " Is on all entities !");
+ cout << " Is on all entities !"<< endl;
}
void affiche_famille(MESH *myMesh,medEntityMesh Entity)
{
int NumberOfFamilies = myMesh->getNumberOfFamilies(Entity) ;
- MESSAGE( "NumberOfFamilies : "<<NumberOfFamilies);
+ cout << "NumberOfFamilies : "<<NumberOfFamilies<<endl;
for (int i=1; i<NumberOfFamilies+1;i++) {
FAMILY* myFamily = myMesh->getFamily(Entity,i);
affiche_support(myFamily);
- MESSAGE( " - Identifier : "<<myFamily->getIdentifier());
+ cout << " - Identifier : "<<myFamily->getIdentifier()<<endl ;
int NumberOfAttributes = myFamily->getNumberOfAttributes() ;
- MESSAGE( " - Attributes ("<<NumberOfAttributes<<") :");
+ cout << " - Attributes ("<<NumberOfAttributes<<") :"<<endl;
for (int j=1;j<NumberOfAttributes+1;j++)
- MESSAGE( " * "<<myFamily->getAttributeIdentifier(j)<<" : "<<myFamily->getAttributeValue(j)<<", "<<myFamily->getAttributeDescription(j).c_str());
+ cout << " * "<<myFamily->getAttributeIdentifier(j)<<" : "<<myFamily->getAttributeValue(j)<<", "<<myFamily->getAttributeDescription(j).c_str()<<endl ;
int NumberOfGroups = myFamily->getNumberOfGroups() ;
- MESSAGE( " - Groups ("<<NumberOfGroups<<") :");
+ cout << " - Groups ("<<NumberOfGroups<<") :"<<endl;
for (int j=1;j<NumberOfGroups+1;j++)
- MESSAGE( " * "<<myFamily->getGroupName(j).c_str());
+ cout << " * "<<myFamily->getGroupName(j).c_str()<<endl ;
}
}
void affiche_groupe(MESH *myMesh,medEntityMesh Entity)
{
int NumberOfGroups = myMesh->getNumberOfGroups(Entity) ;
- MESSAGE( "NumberOfGroups : "<<NumberOfGroups);
+ 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() ;
- MESSAGE( " - Families ("<<NumberOfFamillies<<") :");
+ cout << " - Families ("<<NumberOfFamillies<<") :"<<endl;
for (int j=1;j<NumberOfFamillies+1;j++)
- MESSAGE( " * "<<myGroup->getFamily(j)->getName().c_str());
+ cout << " * "<<myGroup->getFamily(j)->getName().c_str()<<endl ;
}
}
int MeshDimension = myMesh->getMeshDimension() ;
int NumberOfNodes = myMesh->getNumberOfNodes() ;
- MESSAGE( "Space Dimension : " << SpaceDimension << endl );
+ cout << "Space Dimension : " << SpaceDimension << endl << endl ;
- MESSAGE( "Mesh Dimension : " << MeshDimension << endl );
+ cout << "Mesh Dimension : " << MeshDimension << endl << endl ;
const double * Coordinates = myMesh->getCoordinates(MED_FULL_INTERLACE) ;
- MESSAGE( "Show Nodes Coordinates : " );
+ cout << "Show Nodes Coordinates : " << endl ;
- MESSAGE( "Name :" );
+ cout << "Name :" << endl ;
string * CoordinatesNames = myMesh->getCoordinatesNames() ;
for(int i=0; i<SpaceDimension ; i++) {
- MESSAGE( " - " << CoordinatesNames[i] );
+ cout << " - " << CoordinatesNames[i] << endl ;
}
- MESSAGE( "Unit :" );
+ cout << "Unit :" << endl ;
string * CoordinatesUnits = myMesh->getCoordinatesUnits() ;
for(int i=0; i<SpaceDimension ; i++) {
- MESSAGE( " - " << CoordinatesUnits[i] );
+ cout << " - " << CoordinatesUnits[i] << endl ;
}
for(int i=0; i<NumberOfNodes ; i++) {
- MESSAGE( "Nodes " << i+1 << " : " );
+ cout << "Nodes " << i+1 << " : " ;
for (int j=0; j<SpaceDimension ; j++)
- MESSAGE( Coordinates[i*SpaceDimension+j] << " " );
- MESSAGE("");
+ cout << Coordinates[i*SpaceDimension+j] << " " ;
+ cout << endl ;
}
int NumberOfTypes = myMesh->getNumberOfTypes(MED_CELL) ;
medGeometryElement * Types = myMesh->getTypes(MED_CELL) ;
- MESSAGE( "Show Connectivity (Nodal) :" );
+ cout << "Show Connectivity (Nodal) :" << endl ;
for (int i=0; i<NumberOfTypes; i++) {
- MESSAGE( "For type " << Types[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++){
- MESSAGE( "Element "<< j+1 <<" : " );
+ cout << "Element "<< j+1 <<" : " ;
for (int k=0;k<NomberOfNodesPerCell;k++)
- MESSAGE( connectivity[j*NomberOfNodesPerCell+k]<<" ");
- MESSAGE("");
+ cout << connectivity[j*NomberOfNodesPerCell+k]<<" ";
+ cout << endl ;
}
}
- MESSAGE( "Show Family :");
+ cout << "Show Family :"<<endl ;
affiche_famille(myMesh,MED_NODE);
affiche_famille(myMesh,MED_CELL);
affiche_famille(myMesh,MED_FACE);
affiche_famille(myMesh,MED_EDGE);
- MESSAGE( "Show Group :");
+ cout << "Show Group :"<<endl ;
affiche_groupe(myMesh,MED_NODE);
affiche_groupe(myMesh,MED_CELL);
affiche_groupe(myMesh,MED_FACE);
affiche_groupe(myMesh,MED_EDGE);
- MESSAGE( "Show Reverse Nodal Connectivity :" );
+ 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++) {
- MESSAGE( "Node "<<i+1<<" : " );
+ cout << "Node "<<i+1<<" : " ;
for (int j=ReverseNodalConnectivityIndex[i];j<ReverseNodalConnectivityIndex[i+1];j++)
- MESSAGE( ReverseNodalConnectivity[j-1] << " " );
- MESSAGE("");
+ cout << ReverseNodalConnectivity[j-1] << " " ;
+ cout << endl ;
}
- MESSAGE( "Show Connectivity (Descending) :" );
+ cout << "Show Connectivity (Descending) :" << endl ;
int NumberOfElements ;
int * connectivity ;
int * connectivity_index ;
connectivity_index = myMesh->getConnectivityIndex(MED_DESCENDING,MED_CELL);
}
catch (MEDEXCEPTION m) {
- MESSAGE( m.what() );
+ cout << m.what() << endl ;
exit (-1) ;
}
for (int j=0;j<NumberOfElements;j++) {
- MESSAGE( "Element "<<j+1<<" : " );
+ cout << "Element "<<j+1<<" : " ;
for (int k=connectivity_index[j];k<connectivity_index[j+1];k++)
- MESSAGE( connectivity[k-1]<<" ");
- MESSAGE("");
+ cout << connectivity[k-1]<<" ";
+ cout << endl ;
}
- MESSAGE( "Show Reverse Descending Connectivity :" );
+ cout << "Show Reverse Descending Connectivity :" << endl ;
int * ReverseDescendingConnectivity = myMesh->getReverseConnectivity(MED_DESCENDING) ;
int * ReverseDescendingConnectivityIndex = myMesh->getReverseConnectivityIndex(MED_DESCENDING) ;
} else {
NumberOfConstituents = myMesh->getNumberOfElements (constituentEntity,MED_ALL_ELEMENTS);
for (int i=0; i<NumberOfConstituents; i++) {
- MESSAGE( constituent <<i+1<<" : " );
+ cout << constituent <<i+1<<" : " ;
for (int j=ReverseDescendingConnectivityIndex[i];j<ReverseDescendingConnectivityIndex[i+1];j++)
- MESSAGE( ReverseDescendingConnectivity[j-1] << " " );
- MESSAGE("");
+ cout << ReverseDescendingConnectivity[j-1] << " " ;
+ cout << endl ;
}
}
- MESSAGE( "Show "<<constituent<<" Connectivity (Nodal) :" );
+ 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++) {
- MESSAGE( constituent <<i+1<<" : " );
+ cout << constituent <<i+1<<" : " ;
for (int j=face_connectivity_index[i];j<face_connectivity_index[i+1];j++)
- MESSAGE( face_connectivity[j-1]<<" ");
- MESSAGE("");
+ cout << face_connectivity[j-1]<<" ";
+ cout << endl ;
}
/* test of normal, area, volume, barycenter */
string support_name = "Support on all " ;
support_name+=constituent;
support1 = new SUPPORT(myMesh,support_name,constituentEntity);
- MESSAGE( "Building of the Support on all cells dimensionned (Meshdim-1) of the mesh :");
- MESSAGE( "Face in 3D or Edge in 2D" );
+ cout << "Building of the Support on all cells dimensionned (Meshdim-1) of the mesh :"<< endl ;
+ cout << "Face in 3D or Edge in 2D" << endl;
- MESSAGE( "Getting the normal of each face of this support !" );
+ cout << "Getting the normal of each face of this support !" << endl ;
normal = myMesh->getNormal(support1);
double tmp_value ;
for (int i = 1; i<=NumberOfConstituents;i++) {
normal_square = 0. ;
- MESSAGE( "Normal " << i << " " );
+ cout << "Normal " << i << " " ;
for (int j=1; j<=SpaceDimension; j++) {
tmp_value = normal->getValueIJ(i,j) ;
normal_square += tmp_value*tmp_value ;
- MESSAGE( tmp_value << " " );
+ cout << tmp_value << " " ;
}
norm = sqrt(normal_square);
maxnorm = dmax(maxnorm,norm);
minnorm = dmin(minnorm,norm);
- MESSAGE( ", Norm = " << norm );
+ cout << ", Norm = " << norm << endl;
}
- MESSAGE( "Max Norm " << maxnorm << " Min Norm " << minnorm );
+ cout << "Max Norm " << maxnorm << " Min Norm " << minnorm << endl;
if (SpaceDimension == 2)
{
- MESSAGE( "Getting the length of each edge !" );
+ cout << "Getting the length of each edge !" << endl ;
length = myMesh->getLength(support1);
for (int i = 1; i<=NumberOfConstituents;i++)
{
length_value = length->getValueIJ(i,1) ;
- MESSAGE( "Length " << i << " " << length_value );
+ cout << "Length " << i << " " << length_value << endl;
maxlength = dmax(maxlength,length_value);
minlength = dmin(minlength,length_value);
}
- MESSAGE( "Max Length " << maxlength << " Min Length " << minlength );
+ cout << "Max Length " << maxlength << " Min Length " << minlength << endl;
}
- MESSAGE( "Building of the Support on all space-dimensionned cells of the mesh :");
+ cout << "Building of the Support on all space-dimensionned cells of the mesh :"<< endl ;
SUPPORT * support = new SUPPORT(myMesh);
- MESSAGE( "Getting the barycenter of each element of this support !" );
+ cout << "Getting the barycenter of each element of this support !" << endl ;
FIELD<double>* barycenter = new FIELD<double>::FIELD();
for (int i = 1; i<=NumberOfElements;i++)
{
if (SpaceDimension == 3)
- MESSAGE( "Barycenter " << i << " " << barycenter->getValueIJ(i,1) << " " << barycenter->getValueIJ(i,2) << " " << barycenter->getValueIJ(i,3) );
+ cout << "Barycenter " << i << " " << barycenter->getValueIJ(i,1) << " " << barycenter->getValueIJ(i,2) << " " << barycenter->getValueIJ(i,3) << endl;
if (SpaceDimension == 2)
- MESSAGE( "Barycenter " << i << " " << barycenter->getValueIJ(i,1) << " " << barycenter->getValueIJ(i,2) );
+ cout << "Barycenter " << i << " " << barycenter->getValueIJ(i,1) << " " << barycenter->getValueIJ(i,2) << endl;
}
FIELD<double>* volume = new FIELD<double>::FIELD();
if (SpaceDimension == 3)
{
- MESSAGE( "Getting the Volume of each element of this support which is a 3D one !" );
+ cout << "Getting the Volume of each element of this support which is a 3D one !" << endl;
volume = myMesh->getVolume(support);
voltot = 0.0;
for (int i = 1; i<=NumberOfElements;i++)
{
- MESSAGE( "Volume " << i << " " << volume->getValueIJ(i,1) );
+ cout << "Volume " << i << " " << volume->getValueIJ(i,1) << endl;
maxvol = dmax(maxvol,volume->getValueIJ(i,1));
minvol = dmin(minvol,volume->getValueIJ(i,1));
voltot = voltot + volume->getValueIJ(i,1);
}
- MESSAGE( "Max Volume " << maxvol << " Min Volume " << minvol );
- MESSAGE( "Support Volume " << voltot );
+ cout << "Max Volume " << maxvol << " Min Volume " << minvol << endl;
+ cout << "Support Volume " << voltot << endl;
}
else if (SpaceDimension == 2)
{
- MESSAGE( "Getting the Area of each element of this support which is a 2D one !" );
+ cout << "Getting the Area of each element of this support which is a 2D one !" << endl;
area = myMesh->getArea(support);
- // MESSAGE( "nb of comp "<< area->getNumberOfComponents() << " length " << area->getSupport()->getNumberOfElements(MED_ALL_ELEMENTS) );
+ // cout << "nb of comp "<< area->getNumberOfComponents() << " length " << area->getSupport()->getNumberOfElements(MED_ALL_ELEMENTS) << endl;
double maxarea,minarea,areatot;
maxarea = -infty;
areatot = 0.0;
for (int i = 1; i<=NumberOfElements;i++)
{
- MESSAGE( "Area " << i << " " << area->getValueIJ(i,1) );
+ cout << "Area " << i << " " << area->getValueIJ(i,1) << endl;
maxarea = dmax(maxarea,area->getValueIJ(i,1));
minarea = dmin(minarea,area->getValueIJ(i,1));
areatot = areatot + area->getValueIJ(i,1);
}
- MESSAGE( "Max Area " << maxarea << " Min Area " << minarea );
- MESSAGE( "Support Area " << areatot );
+ cout << "Max Area " << maxarea << " Min Area " << minarea << endl;
+ cout << "Support Area " << areatot << endl;
}
if (barycenter != NULL) delete barycenter;
myFieldDriver.close() ;
- MESSAGE( "Field "<< myField->getName() << " : " <<myField->getDescription() );
+ cout << "Field "<< myField->getName() << " : " <<myField->getDescription() << endl ;
int NumberOfComponents = myField->getNumberOfComponents() ;
- MESSAGE( "- Nombre de composantes : "<< NumberOfComponents );
+ cout << "- Nombre de composantes : "<< NumberOfComponents << endl ;
for (int i=1; i<NumberOfComponents+1; i++) {
- MESSAGE( " - composante "<<i<<" :");
- MESSAGE( " - nom : "<<myField->getComponentName(i));
- MESSAGE( " - description : "<<myField->getComponentDescription(i) );
- MESSAGE( " - units : "<<myField->getMEDComponentUnit(i) );
+ cout << " - composante "<<i<<" :"<<endl ;
+ cout << " - nom : "<<myField->getComponentName(i)<< endl;
+ cout << " - description : "<<myField->getComponentDescription(i) << endl;
+ cout << " - units : "<<myField->getMEDComponentUnit(i) << endl;
}
- MESSAGE( "- iteration :" );
- MESSAGE( " - numero : " << myField->getIterationNumber());
- MESSAGE( " - ordre : " << myField->getOrderNumber());
- MESSAGE( " - temps : " << myField->getTime());
+ cout << "- iteration :" << endl ;
+ cout << " - numero : " << myField->getIterationNumber()<< endl ;
+ cout << " - ordre : " << myField->getOrderNumber()<< endl ;
+ cout << " - temps : " << myField->getTime()<< endl ;
- MESSAGE( "- Valeurs :");
+ cout << "- Valeurs :"<<endl;
int NumberOf = mySupport->getNumberOfElements(MED_ALL_ELEMENTS);
// for (int i=1; i<NumberOfComponents+1; i++) {
// double * value = myField->getValueI(MED_NO_INTERLACE,i) ;
// for (int j=0; j<NumberOf; j++)
- // MESSAGE( value[j]<< " ");
- // MESSAGE();
+ // cout << value[j]<< " ";
+ // cout<<endl;
// }
for (int i=1; i<NumberOf+1; i++) {
double * value = myField->getValueI(MED_FULL_INTERLACE,i) ;
for (int j=0; j<NumberOfComponents; j++)
- MESSAGE( value[j]<< " ");
- MESSAGE("");
+ cout << value[j]<< " ";
+ cout<<endl;
}
+using namespace std;
#include "utilities.h"
#include "MEDMEM_Array.hxx"
numberof = myArray->getLeadingValue() ;
for (int i=1; i<=myArray->getLengthValue() ; i++) {
int * node = myArray->getI(MED_FULL_INTERLACE,i) ;
- MESSAGE( " - " );
+ cout << " - " ;
for (int j=0;j<numberof;j++)
- MESSAGE( node[j] << " " );
- MESSAGE("");
+ cout << node[j] << " " ;
+ cout << endl ;
}
MESSAGE("Show all 2 :");
numberof = myArray->getLengthValue() ;
for (int i=1; i<=myArray->getLeadingValue() ; i++) {
int * node = myArray->getI(MED_NO_INTERLACE,i) ;
- MESSAGE( " - " );
+ cout << " - " ;
for (int j=0;j<numberof;j++)
- MESSAGE( node[j] << " " );
- MESSAGE("");
+ cout << node[j] << " " ;
+ cout << endl ;
}
MESSAGE("Show all 3 :");
numberof = myArray->getLeadingValue() ;
for (int i=1; i<=myArray->getLengthValue() ; i++) {
- MESSAGE( " - " );
+ cout << " - " ;
for (int j=1;j<numberof+1;j++)
- MESSAGE( myArray->getIJ(i,j) << " " );
- MESSAGE("");
+ cout << myArray->getIJ(i,j) << " " ;
+ cout << endl ;
}
MESSAGE("Show all 0 :");
int length = myArray->getLengthValue() ;
int * NoInterlaceArray = myArray->get(MED_NO_INTERLACE) ;
for (int i=0; i<length ; i++) {
- MESSAGE( " - " );
+ cout << " - " ;
for (int j=0;j<numberof;j++)
- MESSAGE( NoInterlaceArray[j*length+i] << " " );
- MESSAGE("");
+ cout << NoInterlaceArray[j*length+i] << " " ;
+ cout << endl ;
}
return 0 ;
}
+using namespace std;
#include "utilities.h"
#include "MEDMEM_CellModel.hxx"
#include "MEDMEM_DriversDef.hxx"
for(itGeomList=geomList.begin();itGeomList!=geomList.end();itGeomList++) {
CELLMODEL myCellModel((MED_EN::medGeometryElement)(*itGeomList)) ;
+ cout << "First CellModel :" << endl << endl ;
+
cout << myCellModel << endl ;
cout << "Number of constituents type : "<<myCellModel.getNumberOfConstituentsType() << endl ;
cout << " - " << (*myMapIt).second << " constituent(s) of type " << (*myMapIt).first << endl ;
cout << endl;
+ cout << "Second CellModel :" << endl << endl ;
+ CELLMODEL myCellModel2=myCellModel ;
+ cout << myCellModel2 << endl ;
+
+ cout << "Third CellModel :" << endl << endl ;
+ CELLMODEL myCellModel3 ;
+ myCellModel3=myCellModel ;
+ cout << myCellModel3 << endl ;
}
}
+using namespace std;
#include "utilities.h"
+
#include "MEDMEM_ModulusArray.hxx"
int main (int argc, char ** argv) {
+ using namespace std ;
+
int array[5]={0,1,2,1,4} ;
MEDMODULUSARRAY modulusArray(5,array);
- MESSAGE("ModuloArray :");
+ cout<<"ModuloArray :"<<endl;
for(int i=-10;i<15;i++)
- MESSAGE(" - A["<<i<<"]="<<modulusArray[i]);
- MESSAGE("");
+ cout <<" - A["<<i<<"]="<<modulusArray[i]<<endl;
+ cout <<endl;
// test compare
int ret ;
int array2[5]={1,4,0,1,2} ;
MEDMODULUSARRAY modulusArray2(5,array2) ;
- MESSAGE("Same arrays, same order ... ");
+ cout<<"Same arrays, same order ... ";
if ((ret=modulusArray2.compare(modulusArray))!=1)
- MESSAGE( "Error : two arrays must be identical !"<<ret)
+ cout << "Error : two arrays must be identical !"<<ret<<endl;
else
- MESSAGE( "OK" )
+ cout << "OK" <<endl;
int array3[5]={1,2,1,0,4} ;
MEDMODULUSARRAY modulusArray3(5,array3) ;
- MESSAGE("Same arrays, reverse order ... ");
+ cout<<"Same arrays, reverse order ... ";
if ((ret=modulusArray3.compare(modulusArray))!=-1)
- MESSAGE( "Error : two arrays are in reverse order !"<<ret)
+ cout << "Error : two arrays are in reverse order !"<<ret<<endl;
else
- MESSAGE( "OK" )
+ cout << "OK" <<endl;
int array4[6]={1,2,1,0} ;
MEDMODULUSARRAY modulusArray4(4,array4) ;
- MESSAGE("Different arrays size ... ");
+ cout<<"Different arrays size ... ";
if ((ret=modulusArray4.compare(modulusArray))!=0)
- MESSAGE( "Error : two arrays have different size !"<<ret)
+ cout << "Error : two arrays have different size !"<<ret<<endl;
else
- MESSAGE( "OK" )
+ cout << "OK" <<endl;
int array5[5]={1,2,1,0,1} ;
MEDMODULUSARRAY modulusArray5(5,array5) ;
- MESSAGE("Different array, same size ... ");
+ cout<<"Different array, same size ... ";
if ((ret=modulusArray5.compare(modulusArray))!=0)
- MESSAGE( "Error : two arrays are not be identical !"<<ret)
+ cout << "Error : two arrays are not be identical !"<<ret<<endl;
else
- MESSAGE( "OK" )
+ cout << "OK" <<endl;
// test small array :
int array6[1]={1} ;
MEDMODULUSARRAY modulusArray6(1,array6);
- MESSAGE("ModuloArray 1 :");
+ cout<<"ModuloArray 1 :"<<endl;
for(int i=-10;i<15;i++)
- MESSAGE(" - A["<<i<<"]="<<modulusArray6[i]);
- MESSAGE("");
+ cout <<" - A["<<i<<"]="<<modulusArray6[i]<<endl;
+ cout <<endl;
int array7[1]={1} ;
MEDMODULUSARRAY modulusArray7(1,array7);
- MESSAGE("Same arrays, same order ... ");
+ cout<<"Same arrays, same order ... ";
if ((ret=modulusArray6.compare(modulusArray7))!=1)
- MESSAGE( "Error : two arrays are identical !"<<ret)
+ cout << "Error : two arrays are identical !"<<ret<<endl;
else
- MESSAGE( "OK" )
-
+ cout << "OK" <<endl;
int array8[1]={2} ;
MEDMODULUSARRAY modulusArray8(1,array8);
- MESSAGE("Different arrays ... ");
+ cout<<"Different arrays ... ";
if ((ret=modulusArray6.compare(modulusArray8))!=0)
- MESSAGE( "Error : two arrays are different !"<<ret)
+ cout << "Error : two arrays are different !"<<ret<<endl;
else
- MESSAGE( "OK" )
+ cout << "OK" <<endl;
// 2
int array60[2]={1,2} ;
MEDMODULUSARRAY modulusArray60(2,array60);
- MESSAGE("ModuloArray 2 :");
+ cout<<"ModuloArray 2 :"<<endl;
for(int i=-10;i<15;i++)
- MESSAGE(" - A["<<i<<"]="<<modulusArray60[i]);
- MESSAGE("");
+ cout <<" - A["<<i<<"]="<<modulusArray60[i]<<endl;
+ cout <<endl;
int array70[2]={1,2} ;
MEDMODULUSARRAY modulusArray70(2,array70);
- MESSAGE("Same arrays, same order ... ");
+ cout<<"Same arrays, same order ... ";
if ((ret=modulusArray60.compare(modulusArray70))!=1)
- MESSAGE( "Error : two arrays are identical !"<<ret)
+ cout << "Error : two arrays are identical !"<<ret<<endl;
else
- MESSAGE( "OK" );
+ cout << "OK" <<endl;
int array80[2]={2,2} ;
MEDMODULUSARRAY modulusArray80(2,array80);
- MESSAGE("Different arrays ... ");
+ cout<<"Different arrays ... ";
if ((ret=modulusArray60.compare(modulusArray80))!=0)
- MESSAGE( "Error : two arrays are different !"<<ret)
+ cout << "Error : two arrays are different !"<<ret<<endl;
else
- MESSAGE( "OK" )
+ cout << "OK" <<endl;
int array90[2]={2,1} ;
MEDMODULUSARRAY modulusArray90(2,array90);
- MESSAGE("Same arrays, reverse order ... ");
+ cout<<"Same arrays, reverse order ... ";
if ((ret=modulusArray60.compare(modulusArray90))!=-1)
- MESSAGE( "Error : two arrays are in reverse order !"<<ret)
+ cout << "Error : two arrays are in reverse order !"<<ret<<endl;
else
- MESSAGE( "OK" )
+ cout << "OK" <<endl;
+using namespace std;
#include "utilities.h"
#include "MEDMEM_SkyLineArray.hxx"
value[9]=6;
// value[]=; // forth
- MESSAGE( "Show all 1 :" );
+ cout << "Show all 1 :" << endl ;
for (int i=1; i<NumberOfCell+1 ; i++) {
int * cell = myArray->getI(i) ;
int numberof = myArray->getNumberOfI(i) ;
- MESSAGE( " - " );
+ cout << " - " ;
for (int j=0;j<numberof;j++)
- MESSAGE( cell[j] << " " );
- MESSAGE("");
+ cout << cell[j] << " " ;
+ cout << endl ;
}
- MESSAGE( "Show all 2 :" );
+ cout << "Show all 2 :" << endl ;
for (int i=1; i<NumberOfCell+1 ; i++) {
- MESSAGE( " - " );
+ cout << " - " ;
int numberof = myArray->getNumberOfI(i) ;
for (int j=1;j<numberof+1;j++)
- MESSAGE( myArray->getIJ(i,j) << " " );
- MESSAGE("");
+ cout << myArray->getIJ(i,j) << " " ;
+ cout << endl ;
}
MEDSKYLINEARRAY * myArray2 = new MEDSKYLINEARRAY(*myArray) ;
delete myArray ;
- MESSAGE( "Show all 3 :" );
+ cout << "Show all 3 :" << endl ;
for (int i=1; i<NumberOfCell+1 ; i++) {
int * cell = myArray2->getI(i) ;
int numberof = myArray2->getNumberOfI(i) ;
- MESSAGE( " - " );
+ cout << " - " ;
for (int j=0;j<numberof;j++)
- MESSAGE( cell[j] << " " );
- MESSAGE("");
+ cout << cell[j] << " " ;
+ cout << endl ;
}
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>();
+ * 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;
+}
+using namespace std;
#include "MEDMEM_SWIG_FieldDouble.hxx"
//=============================================================================
END_OF("Constructor with arguments (for Python API) FIELDDOUBLE");
}
-/*
-FIELDDOUBLE::FIELDDOUBLE(FIELD_ *field)
- : FIELD<double> ( * (FIELD<double> *)(field))
+//=============================================================================
+/*!
+ * Another constructor with arguments
+ */
+//=============================================================================
+FIELDDOUBLE::FIELDDOUBLE(const SUPPORT * Support, driverTypes driverType,
+ const string & fileName,
+ const string & fieldName) :
+ FIELD<double>(Support, driverType, fileName, fieldName)
{
- BEGIN_OF("Constructor (for Python API) FIELDDOUBLE avec parametre");
-
- SCRUTE(_value);
+ BEGIN_OF("Another constructor with arguments (for Python API) FIELDDOUBLE");
- END_OF("Constructor(for Python API) FIELDDOUBLE avec parametre");
+ END_OF("Another constructor with arguments (for Python API) FIELDDOUBLE");
}
-*/
//=============================================================================
/*!
* Destructor
public:
FIELDDOUBLE();
FIELDDOUBLE(const SUPPORT * Support, const int NumberOfComponents);
+ FIELDDOUBLE(const SUPPORT * Support, driverTypes driverType,
+ const string & fileName="", const string & fieldName="");
~FIELDDOUBLE();
};
+using namespace std;
#include "MEDMEM_SWIG_FieldInt.hxx"
//=============================================================================
END_OF("Constructor with arguments (for Python API) FIELDINT");
}
-/*
-FIELDINT::FIELDINT(FIELD_ * field)
- : FIELD<int> ( * (FIELD<int> *) (field))
+//=============================================================================
+/*!
+ * Another constructor with arguments
+ */
+//=============================================================================
+FIELDINT::FIELDINT(const SUPPORT * Support, driverTypes driverType,
+ const string & fileName,
+ const string & fieldName) :
+ FIELD<int>(Support, driverType, fileName, fieldName)
{
- BEGIN_OF("Constructor (for Python API) FIELDINT avec parametre");
+ BEGIN_OF("Another constructor with arguments (for Python API) FIELDINT");
- END_OF("Constructor (for Python API) FIELDINT avec parametre");
+ END_OF("Another constructor with arguments (for Python API) FIELDINT");
}
-*/
//=============================================================================
/*!
* Destructor
public:
FIELDINT();
FIELDINT(const SUPPORT * Support, const int NumberOfComponents);
+ FIELDINT(const SUPPORT * Support, driverTypes driverType,
+ const string & fileName="", const string & fieldName="");
~FIELDINT();
};
--- /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_ */
libMEDMEM_Swig.i \
my_typemap.i \
MEDMEM_SWIG_FieldDouble.hxx \
- MEDMEM_SWIG_FieldInt.hxx
+ MEDMEM_SWIG_FieldInt.hxx \
+ MEDMEM_SWIG_MedFieldDoubleDriver.hxx \
+ MEDMEM_SWIG_MedFieldIntDriver.hxx
# Libraries targets
LIB = libMEDMEM_Swigcmodule.la
LIB_SRC = MEDMEM_SWIG_FieldDouble.cxx \
- MEDMEM_SWIG_FieldInt.cxx
+ MEDMEM_SWIG_FieldInt.cxx \
+ MEDMEM_SWIG_MedFieldDoubleDriver.cxx \
+ MEDMEM_SWIG_MedFieldIntDriver.cxx
+
SWIG_DEF = libMEDMEM_Swig.i
#include "MEDMEM_MedMedDriver.hxx"
#include "MEDMEM_SWIG_FieldDouble.hxx"
#include "MEDMEM_SWIG_FieldInt.hxx"
+#include "MEDMEM_SWIG_MedFieldDoubleDriver.hxx"
+#include "MEDMEM_SWIG_MedFieldIntDriver.hxx"
%}
/*
typedef struct { int dt; int it; } DT_IT_;
-%extend DT_IT_ {
+%addmethods DT_IT_ {
int getdt()
{
return self->dt;
Class et methodes du MED++ que l'on utilise dans l'API Python
*/
-class CELLMODEL;
+class CELLMODEL
+{
+ public:
+ medGeometryElement getType();
+
+ int getNumberOfNodes();
+
+ %addmethods {
+ char * getName()
+ {
+ string tmp_str = self->getName();
+ char * tmp = new char[strlen(tmp_str.c_str())+1];
+ strcpy(tmp,tmp_str.c_str());
+ return tmp;
+ }
+ }
+};
class SUPPORT
{
void setGeometricType(medGeometryElement *GeometricType);
- void setGeometricTypeNumber(int *GeometricTypeNumber);
+ /* void setGeometricTypeNumber(int *GeometricTypeNumber); */
void setNumberOfEntities(int *NumberOfEntities);
void setTotalNumberOfEntities(int TotalNumberOfEntities);
- %extend {
+ %addmethods {
SUPPORT(MESH* Mesh, char * Name="", medEntityMesh Entity=MED_CELL)
{
return new SUPPORT(Mesh,string(Name),Entity);
return Py_BuildValue("O", py_list);
}
+ /*
PyObject * getGeometricTypeNumber()
{
PyObject *py_list;
}
return Py_BuildValue("O", py_list);
}
+ */
PyObject * getNumber(medGeometryElement GeometricType)
{
int getNumberOfGroups() const;
/* string * getGroupsNames() const;*/
- %extend {
+ %addmethods {
FAMILY(MESH* Mesh, int Identifier, char * Name, int NumberOfAttribute,
int *AttributeIdentifier, int *AttributeValue,
char * AttributeDescription, int NumberOfGroup,
void setNumberOfComponents(int NumberOfComponents);
int getNumberOfComponents() const;
- %extend {
+ %addmethods {
int addDriver(driverTypes driverType,
char * fileName="Default File Name.med",
char * driverName="Default Field Name")
FIELDDOUBLE(const SUPPORT * Support, const int NumberOfComponents);
+ /*
+ WARNING:
+ other constructor of FIELDDOUBLE (C++ FIELD<double>) object.
+ Only one constructor could be wrapped and
+ the others commented out when using
+ SWIG with a version lesser than 1.3
+ */
+
+ //FIELDDOUBLE();
+
void read(int index=0);
double getValueIJ(int i,int j) const;
void deallocValue();
- %extend {
+ %addmethods {
/*
- FIELDDOUBLE(FIELD_ * field)
+ FIELDDOUBLE (const SUPPORT * Support, driverTypes driverType,
+ char * fileName, char * fieldName)
{
- MESSAGE("Constructor (pour API Python) FIELDDOUBLE avec parameters");
- return (FIELDDOUBLE *) field;
+ return new FIELDDOUBLE(Support, driverType, string(fileName),
+ string(fieldName));
}
- */
+ <*/
void write(int index=0, char * driverName="")
{
FIELDINT(const SUPPORT * Support, const int NumberOfComponents);
+ /*
+ WARNING:
+ other constructor of FIELDINT (C++ FIELD<int>) object.
+ other constructor of MED object.
+ Only one constructor could be wrapped and
+ the others commented out when using
+ SWIG with a version lesser than 1.3
+ */
+
+ /*
+ FIELDINT();
+ */
+
void read(int index=0);
int getValueIJ(int i,int j) const;
void deallocValue();
- %extend {
+ %addmethods {
/*
- FIELDINT(FIELD_ * field)
+ FIELDINT(const SUPPORT * Support, driverTypes driverType,
+ char * fileName, char * fieldName)
{
- MESSAGE("Constructor (pour API Python) FIELDINT avec parameters");
- return (FIELDINT *) field;
+ return new FIELDDOUBLE(Support, driverType, string(fileName),
+ string(fieldName));
}
*/
class MESH
{
- public :
+public :
+ /*
+ WARNING:
+ other constructor of MESH object.
+ Only one constructor could be wrapped and
+ the others commented out when using
+ SWIG with a version lesser than 1.3
+ */
+
+ // MESH();
+
void rmDriver(int index=0);
void read(int index=0);
int getElementNumber(medConnectivity ConnectivityType, medEntityMesh Entity, medGeometryElement Type, int * connectivity);
+ CELLMODEL * getCellsTypes(medEntityMesh Entity);
+
FAMILY* getFamily(medEntityMesh Entity,int i);
int getNumberOfGroups(medEntityMesh Entity);
SUPPORT * getBoundaryElements(medEntityMesh Entity) ;
- %extend {
+ %addmethods {
+ CELLMODEL getCellType(medEntityMesh Entity,int i)
+ {
+ return self->getCellsTypes(Entity)[i];
+ };
+
+ MESH (driverTypes driverType, char * fileName, char * meshName)
+ {
+ return new MESH(driverType, string(fileName), string(meshName));
+ }
+
int addDriver(driverTypes driverType,
char * fileName="Default File Name.med",
char * driverName="Default Mesh Name")
strcpy(tmp,tmp_str.c_str());
return tmp;
}
+
+ PyObject * getCoordinatesNames()
+ {
+ PyObject *py_list;
+ string * array = self->getCoordinatesNames();
+ int size = self->getSpaceDimension();
+ py_list = PyList_New(size);
+ for (int i=0; i < size; i++)
+ {
+ int err = PyList_SetItem(py_list, i,
+ Py_BuildValue("s", array[i].c_str()));
+ if(err)
+ {
+ char * message = "Error in MESH::getCoordinatesNames";
+ PyErr_SetString(PyExc_RuntimeError, message);
+ return NULL;
+ }
+ }
+ return Py_BuildValue("O", py_list);
+ }
+
+ PyObject * getCoordinatesUnits()
+ {
+ PyObject *py_list;
+ string * array = self->getCoordinatesUnits();
+ int size = self->getSpaceDimension();
+ py_list = PyList_New(size);
+ for (int i=0; i < size; i++)
+ {
+ int err = PyList_SetItem(py_list, i,
+ Py_BuildValue("s", array[i].c_str()));
+ if(err)
+ {
+ char * message = "Error in MESH::getCoordinatesUnits";
+ PyErr_SetString(PyExc_RuntimeError, message);
+ return NULL;
+ }
+ }
+ return Py_BuildValue("O", py_list);
+ }
+
PyObject * getCoordinates(medModeSwitch Mode)
{
PyObject *py_list;
~MED();
+ void rmDriver (int index=0);
+
int getNumberOfMeshes ( void ) const;
int getNumberOfFields ( void ) const;
void updateSupport ( void ) ;
- %extend {
+ void write (int index=0);
+
+ %addmethods {
+ /*
+ WARNING:
+ other constructor of MED object.
+ Only one constructor could be wrapped and
+ the others commented out when using
+ SWIG with a version lesser than 1.3
+ */
+ /*
+ MED(driverTypes driverType, char * fileName)
+ {
+ return new MED(driverType,string(fileName));
+ }
+ */
+ int addDriver(driverTypes driverType,
+ char * fileName="Default File Name.med")
+ {
+ return self->addDriver(driverType,string(fileName));
+ }
+
const char * getMeshName(int i)
{
deque<string> list_string = self->getMeshNames();
virtual void read ( void ) ;
virtual void readFileStruct ( void ) ;
- %extend {
+ %addmethods {
MED_MED_DRIVER(char * fileName, MED * ptrMed)
{
return new MED_MED_DRIVER(string(fileName), ptrMed);
void read ( void ) ;
void readFileStruct ( void ) ;
- %extend {
+ %addmethods {
MED_MED_RDONLY_DRIVER(char * fileName, MED * ptrMed)
{
return new MED_MED_RDONLY_DRIVER(string(fileName), ptrMed);
void write ( void ) const ;
void writeFrom ( void ) const ;
- %extend {
+ %addmethods {
MED_MED_WRONLY_DRIVER(char * fileName, MED * ptrMed)
{
return new MED_MED_WRONLY_DRIVER(string(fileName), ptrMed);
void read ( void ) ;
void readFileStruct ( void ) ;
- %extend {
+ %addmethods {
MED_MED_RDWR_DRIVER(char * fileName, MED * ptrMed)
{
return new MED_MED_RDWR_DRIVER(string(fileName), ptrMed);
/*
class MED_MESH_DRIVER
{
- public :
- // MED_MESH_DRIVER();
-
- // MED_MESH_DRIVER(const string & fileName, MESH * ptrMesh, med_mode_acces accessMode);
+public :
void open();
+
void close();
- // virtual void write( void ) const = 0;
- // virtual void read ( void ) = 0;
-
- // void setMeshName(const string & meshName) ;
- // string getMeshName() const ;
+ virtual void write( void ) const = 0 ;
+
+ virtual void read ( void ) = 0 ;
- %extend {
+ %addmethods {
MED_MESH_DRIVER(char * fileName, MESH * ptrMesh,
med_mode_acces accessMode)
{
};
*/
-class MED_MESH_RDONLY_DRIVER
-// : public virtual MED_MESH_DRIVER
+class MED_MESH_RDONLY_DRIVER : public virtual MED_MESH_DRIVER
{
public :
int getFAMILY();
+ void open();
+
+ void close();
+
void write( void ) ;
void read ( void ) ;
- %extend {
+ %addmethods {
MED_MESH_RDONLY_DRIVER(char * fileName, MESH * ptrMesh)
{
return new MED_MESH_RDONLY_DRIVER(string(fileName), ptrMesh);
}
+
+ void setMeshName(char * meshName)
+ {
+ self->setMeshName(string(meshName));
+ }
+
+ char * getMeshName()
+ {
+ string tmp_str = self->getMeshName();
+ char * tmp = new char[strlen(tmp_str.c_str())];
+ strcat(tmp,tmp_str.c_str());
+ return tmp;
+ }
}
};
-class MED_MESH_WRONLY_DRIVER
-// : public virtual MED_MESH_DRIVER
+class MED_MESH_WRONLY_DRIVER : public virtual MED_MESH_DRIVER
{
public :
~MED_MESH_WRONLY_DRIVER();
void write( void ) const ;
+
void read ( void ) ;
+ void open();
+
+ void close();
+
int writeCoordinates () const;
+
int writeConnectivities (medEntityMesh entity) const;
+
int writeFamilyNumbers () const;
+
int writeFamilies (vector<FAMILY*> & families) const;
- %extend {
+ %addmethods {
MED_MESH_WRONLY_DRIVER(char * fileName, MESH * ptrMesh)
{
return new MED_MESH_WRONLY_DRIVER(string(fileName), ptrMesh);
}
+
+ void setMeshName(char * meshName)
+ {
+ self->setMeshName(string(meshName));
+ }
+
+ char * getMeshName()
+ {
+ string tmp_str = self->getMeshName();
+ char * tmp = new char[strlen(tmp_str.c_str())];
+ strcat(tmp,tmp_str.c_str());
+ return tmp;
+ }
}
};
-class MED_MESH_RDWR_DRIVER : public MED_MESH_RDONLY_DRIVER, public MED_MESH_WRONLY_DRIVER
+class MED_MESH_RDWR_DRIVER : public virtual MED_MESH_RDONLY_DRIVER,
+ public virtual MED_MESH_WRONLY_DRIVER
{
public :
~MED_MESH_RDWR_DRIVER();
void write(void) const ;
+
void read (void) ;
- %extend {
+ void open();
+
+ void close();
+
+ %addmethods {
MED_MESH_RDWR_DRIVER(char * fileName, MESH * ptrMesh)
{
return new MED_MESH_RDWR_DRIVER(string(fileName), ptrMesh);
}
+
+ void setMeshName(char * meshName)
+ {
+ self->setMeshName(string(meshName));
+ }
+
+ char * getMeshName()
+ {
+ string tmp_str = self->getMeshName();
+ char * tmp = new char[strlen(tmp_str.c_str())];
+ strcat(tmp,tmp_str.c_str());
+ return tmp;
+ }
+ }
+};
+
+/*
+ API du driver MED_FIELDDOUBLE
+*/
+
+/*
+class MED_FIELDDOUBLE_DRIVER
+{
+public:
+ void open();
+
+ void close();
+
+ %addmethods {
+ MED_FIELDDOUBLE_DRIVER(char * fileName, FIELDDOUBLE * ptrField,
+ med_mode_acces accessMode)
+ {
+ return new MED_FIELDDOUBLE_DRIVER(string(fileName), ptrField,
+ accessMode);
+ }
+
+ void setFieldName(char * fieldName)
+ {
+ self->setFieldName(string(fieldName));
+ }
+
+ char * getFieldName()
+ {
+ string tmp_str = self->getFieldName();
+ char * tmp = new char[strlen(tmp_str.c_str())];
+ strcat(tmp,tmp_str.c_str());
+ return tmp;
+ }
+ }
+};
+*/
+
+class MED_FIELDDOUBLE_RDONLY_DRIVER : public virtual MED_FIELDDOUBLE_DRIVER
+{
+public:
+
+ ~MED_FIELDDOUBLE_RDONLY_DRIVER();
+
+ void open();
+
+ void close();
+
+ void write( void ) const ;
+
+ void read ( void ) ;
+
+ %addmethods {
+ MED_FIELDDOUBLE_RDONLY_DRIVER(char * fileName, FIELDDOUBLE * ptrField)
+ {
+ return new MED_FIELDDOUBLE_RDONLY_DRIVER(string(fileName), ptrField);
+ }
+
+ void setFieldName(char * fieldName)
+ {
+ self->setFieldName(string(fieldName));
+ }
+
+ char * getFieldName()
+ {
+ string tmp_str = self->getFieldName();
+ char * tmp = new char[strlen(tmp_str.c_str())];
+ strcat(tmp,tmp_str.c_str());
+ return tmp;
+ }
+ }
+};
+
+class MED_FIELDDOUBLE_WRONLY_DRIVER : public virtual MED_FIELDDOUBLE_DRIVER
+{
+public:
+
+ ~MED_FIELDDOUBLE_WRONLY_DRIVER();
+
+ void open();
+
+ void close();
+
+ void write( void ) const ;
+
+ void read ( void ) ;
+
+ %addmethods {
+ MED_FIELDDOUBLE_WRONLY_DRIVER(char * fileName, FIELDDOUBLE * ptrField)
+ {
+ return new MED_FIELDDOUBLE_WRONLY_DRIVER(string(fileName), ptrField);
+ }
+
+ void setFieldName(char * fieldName)
+ {
+ self->setFieldName(string(fieldName));
+ }
+
+ char * getFieldName()
+ {
+ string tmp_str = self->getFieldName();
+ char * tmp = new char[strlen(tmp_str.c_str())];
+ strcat(tmp,tmp_str.c_str());
+ return tmp;
+ }
+ }
+};
+
+class MED_FIELDDOUBLE_RDWR_DRIVER : public virtual MED_FIELDDOUBLE_RDONLY_DRIVER, public virtual MED_FIELDDOUBLE_WRONLY_DRIVER
+{
+public:
+
+ ~MED_FIELDDOUBLE_RDWR_DRIVER();
+
+ void open();
+
+ void close();
+
+ void write( void ) const ;
+
+ void read ( void ) ;
+
+ %addmethods {
+ MED_FIELDDOUBLE_RDWR_DRIVER(char * fileName, FIELDDOUBLE * ptrField)
+ {
+ return new MED_FIELDDOUBLE_RDWR_DRIVER(string(fileName), ptrField);
+ }
+
+ void setFieldName(char * fieldName)
+ {
+ self->setFieldName(string(fieldName));
+ }
+
+ char * getFieldName()
+ {
+ string tmp_str = self->getFieldName();
+ char * tmp = new char[strlen(tmp_str.c_str())];
+ strcat(tmp,tmp_str.c_str());
+ return tmp;
+ }
+ }
+};
+
+/*
+ API du driver MED_FIELDINT
+*/
+
+/*
+class MED_FIELDINT_DRIVER
+{
+public:
+ void open();
+
+ void close();
+
+ %addmethods {
+ MED_FIELDINT_DRIVER(char * fileName, FIELDINT * ptrField,
+ med_mode_acces accessMode)
+ {
+ return new MED_FIELDINT_DRIVER(string(fileName), ptrField,
+ accessMode);
+ }
+
+ void setFieldName(char * fieldName)
+ {
+ self->setFieldName(string(fieldName));
+ }
+
+ char * getFieldName()
+ {
+ string tmp_str = self->getFieldName();
+ char * tmp = new char[strlen(tmp_str.c_str())];
+ strcat(tmp,tmp_str.c_str());
+ return tmp;
+ }
+ }
+};
+*/
+
+class MED_FIELDINT_RDONLY_DRIVER : public virtual MED_FIELDINT_DRIVER
+{
+public:
+
+ ~MED_FIELDINT_RDONLY_DRIVER();
+
+ void open();
+
+ void close();
+
+ void write( void ) const ;
+
+ void read ( void ) ;
+
+ %addmethods {
+ MED_FIELDINT_RDONLY_DRIVER(char * fileName, FIELDINT * ptrField)
+ {
+ return new MED_FIELDINT_RDONLY_DRIVER(string(fileName), ptrField);
+ }
+
+ void setFieldName(char * fieldName)
+ {
+ self->setFieldName(string(fieldName));
+ }
+
+ char * getFieldName()
+ {
+ string tmp_str = self->getFieldName();
+ char * tmp = new char[strlen(tmp_str.c_str())];
+ strcat(tmp,tmp_str.c_str());
+ return tmp;
+ }
+ }
+};
+
+class MED_FIELDINT_WRONLY_DRIVER : public virtual MED_FIELDINT_DRIVER
+{
+public:
+
+ ~MED_FIELDINT_WRONLY_DRIVER();
+
+ void open();
+
+ void close();
+
+ void write( void ) const ;
+
+ void read ( void ) ;
+
+ %addmethods {
+ MED_FIELDINT_WRONLY_DRIVER(char * fileName, FIELDINT * ptrField)
+ {
+ return new MED_FIELDINT_WRONLY_DRIVER(string(fileName), ptrField);
+ }
+
+ void setFieldName(char * fieldName)
+ {
+ self->setFieldName(string(fieldName));
+ }
+
+ char * getFieldName()
+ {
+ string tmp_str = self->getFieldName();
+ char * tmp = new char[strlen(tmp_str.c_str())];
+ strcat(tmp,tmp_str.c_str());
+ return tmp;
+ }
+ }
+};
+
+class MED_FIELDINT_RDWR_DRIVER : public virtual MED_FIELDINT_RDONLY_DRIVER, public virtual MED_FIELDINT_WRONLY_DRIVER
+{
+public:
+
+ ~MED_FIELDINT_RDWR_DRIVER();
+
+ void open();
+
+ void close();
+
+ void write( void ) const ;
+
+ void read ( void ) ;
+
+ %addmethods {
+ MED_FIELDINT_RDWR_DRIVER(char * fileName, FIELDINT * ptrField)
+ {
+ return new MED_FIELDINT_RDWR_DRIVER(string(fileName), ptrField);
+ }
+
+ void setFieldName(char * fieldName)
+ {
+ self->setFieldName(string(fieldName));
+ }
+
+ char * getFieldName()
+ {
+ string tmp_str = self->getFieldName();
+ char * tmp = new char[strlen(tmp_str.c_str())];
+ strcat(tmp,tmp_str.c_str());
+ return tmp;
+ }
}
};
%typemap(python,in) double *
{
/* Check if is a list */
- if (PyList_Check($input)) {
- int size = PyList_Size($input);
+ if (PyList_Check($source)) {
+ int size = PyList_Size($source);
int i = 0;
- $1 = (double *) malloc(size*sizeof(double));
+ $target = (double *) malloc(size*sizeof(double));
for (i = 0; i < size; i++) {
- PyObject *o = PyList_GetItem($input,i);
+ PyObject *o = PyList_GetItem($source,i);
if (PyFloat_Check(o))
- $1[i] = PyFloat_AsDouble(PyList_GetItem($input,i));
+ $target[i] = PyFloat_AsDouble(PyList_GetItem($source,i));
else {
PyErr_SetString(PyExc_TypeError,"list must contain floats");
- free($1);
+ free($target);
return NULL;
}
}
%typemap(python,in) int *
{
/* Check if is a list */
- if (PyList_Check($input)) {
- int size = PyList_Size($input);
+ if (PyList_Check($source)) {
+ int size = PyList_Size($source);
int i = 0;
- $1 = (int *) malloc(size*sizeof(int));
+ $target = (int *) malloc(size*sizeof(int));
for (i = 0; i < size; i++) {
- PyObject *o = PyList_GetItem($input,i);
+ PyObject *o = PyList_GetItem($source,i);
if (PyInt_Check(o))
- $1[i] = PyInt_AsLong(PyList_GetItem($input,i));
+ $target[i] = PyInt_AsLong(PyList_GetItem($source,i));
else {
PyErr_SetString(PyExc_TypeError,"list must contain integers");
- free($1);
+ free($target);
return NULL;
}
}
%typemap(python,in) medGeometryElement *
{
/* Check if is a list */
- if (PyList_Check($input)) {
- int size = PyList_Size($input);
+ if (PyList_Check($source)) {
+ int size = PyList_Size($source);
int i = 0;
- $1 = (medGeometryElement *) malloc(size*sizeof(int));
+ $target = (medGeometryElement *) malloc(size*sizeof(int));
for (i = 0; i < size; i++) {
- PyObject *o = PyList_GetItem($input,i);
+ PyObject *o = PyList_GetItem($source,i);
if (PyInt_Check(o))
- $1[i] = (medGeometryElement) PyInt_AsLong(PyList_GetItem($input,i));
+ $target[i] = (medGeometryElement) PyInt_AsLong(PyList_GetItem($source,i));
else {
PyErr_SetString(PyExc_TypeError,"list must contain integers");
- free($1);
+ free($target);
return NULL;
}
}
int i;
list<string>::iterator iL;
- $result = PyList_New($1->size());
- for (i=0, iL=$1->begin(); iL!=$1->end(); i++, iL++)
- PyList_SetItem($result,i,PyString_FromString((*iL).c_str()));
+ $target = PyList_New($source->size());
+ for (i=0, iL=$source->begin(); iL!=$source->end(); i++, iL++)
+ PyList_SetItem($target,i,PyString_FromString((*iL).c_str()));
}
+using namespace std;
//=============================================================================
// File : Family_i.cxx
// Project : SALOME
+using namespace std;
//=============================================================================
// File : Fielddouble_i.hxx
// Project : SALOME
+using namespace std;
//=============================================================================
// File : Fieldint_i.hxx
// Project : SALOME
+using namespace std;
//=============================================================================
// File : Field_i.cxx
// Created : mer fév 20 15:47:57 CET 2002
+using namespace std;
//=============================================================================
// File : Group_i.cxx
// Project : SALOME
+using namespace std;
//=============================================================================
// File : Med_i.cxx
// Project : SALOME
// SUPPORT :
_med->updateSupport() ;
+
+ // we add all group and family in study :
+ // we add all families
+ vector<FAMILY*> familyVector ;
+ vector<FAMILY*>::iterator familyVectorIt ;
+ // we add all groups
+ vector<GROUP*> groupVector ;
+ vector<GROUP*>::iterator groupVectorIt ;
+
+ MED_FR::MESH_ENTITIES::const_iterator currentEntity;
+ for (int i=0; i<numberOfMeshes; i++) {
+ ::MESH * ptrMesh = _med->getMesh(meshesNames[i]) ;
+ for (currentEntity=MED_FR::meshEntities.begin();currentEntity != MED_FR::meshEntities.end(); currentEntity++) {
+ // family :
+ familyVector = ptrMesh->getFamilies((MED_EN::medEntityMesh)(*currentEntity).first) ;
+ for(familyVectorIt=familyVector.begin();familyVectorIt!=familyVector.end();familyVectorIt++) {
+ FAMILY_i * myFamilyI = new FAMILY_i(*familyVectorIt);
+ SALOME_MED::FAMILY_ptr myFamilyIOR = myFamilyI->POA_SALOME_MED::FAMILY::_this() ;
+ myFamilyI->addInStudy(myStudy,myFamilyIOR) ;
+ }
+ // group :
+ groupVector = ptrMesh->getGroups((MED_EN::medEntityMesh)(*currentEntity).first) ;
+ for(groupVectorIt=groupVector.begin();groupVectorIt!=groupVector.end();groupVectorIt++) {
+ GROUP_i * myGroupI = new GROUP_i(*groupVectorIt);
+ SALOME_MED::GROUP_ptr myGroupIOR = myGroupI->POA_SALOME_MED::GROUP::_this() ;
+ myGroupI->addInStudy(myStudy,myGroupIOR) ;
+ }
+ }
+ }
+
for (int i=0; i<numberOfMeshes; i++) {
map<MED_FR::med_entite_maillage,::SUPPORT*> mySupports = _med->getSupports(meshesNames[i]) ;
map<MED_FR::med_entite_maillage,::SUPPORT*>::const_iterator itSupport ;
+using namespace std;
//=============================================================================
// File : Mesh_i.cxx
// Project : SALOME
int * tab=_mesh->getConnectivityIndex(
convertIdlConnToMedConn(mode),
convertIdlEntToMedEnt(entity));
- nbelements = tab[elt1 ] - 1 ;
+ nbelements = elt1*(convertIdlEltToMedElt(geomElement)%100);
+ //nbelements = tab[elt1 ] - 1 ;
}
SCRUTE(entity);
SCRUTE(geomElement);
+using namespace std;
//=============================================================================
// File : Support_i.cxx
// Project : SALOME
+using namespace std;
//=============================================================================
// File : convert.cxx
// Created : mer fév 20 15:47:57 CET 2002