From: nri Date: Tue, 20 May 2003 12:16:39 +0000 (+0000) Subject: NRI : Update 1.1a and New organisation. X-Git-Tag: Start-v1_1a~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f47986dae89cb82ef035b7e73b6190fc5a51bd45;p=modules%2Fmed.git NRI : Update 1.1a and New organisation. --- diff --git a/src/MEDGUI/MedGUI.cxx b/src/MEDGUI/MedGUI.cxx index 052687a3e..d7d863ac3 100644 --- a/src/MEDGUI/MedGUI.cxx +++ b/src/MEDGUI/MedGUI.cxx @@ -1,3 +1,4 @@ +using namespace std; //============================================================================= // File : MedGUI.cxx // Project : SALOME @@ -19,6 +20,8 @@ #include "QAD_Tools.h" #include "QAD_FileDlg.h" +//#include "SMESH_TypeFilter.hxx" + // QT Includes #include @@ -182,7 +185,8 @@ bool MedGUI::OnGUIEvent (int theCommandID, QAD_Desktop* parent) 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"), @@ -224,17 +228,17 @@ bool MedGUI::OnGUIEvent (int theCommandID, QAD_Desktop* parent) 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 @@ -244,8 +248,8 @@ bool MedGUI::OnGUIEvent (int theCommandID, QAD_Desktop* parent) tr ("MED_BUT_OK") ); break; } - } - DumpMesh( aMesh ); + } + DumpMesh( aMesh ); //Sel->ClearFilters() ; } else @@ -286,25 +290,25 @@ bool MedGUI::OnGUIEvent (int theCommandID, QAD_Desktop* parent) { 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 { @@ -487,21 +491,21 @@ bool MedGUI::DumpMesh( SALOME_MED::MESH_var MEDMesh) * */ //============================================================================= -//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;llength();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;llength();l++) +// SCRUTE(tabnoeuds[l]); + +// return true; +// } //============================================================================= /*! * diff --git a/src/MEDMEM/MEDMEM_Array.hxx b/src/MEDMEM/MEDMEM_Array.hxx index 5156e1f85..ac7eec814 100644 --- a/src/MEDMEM/MEDMEM_Array.hxx +++ b/src/MEDMEM/MEDMEM_Array.hxx @@ -3,6 +3,7 @@ #include "MEDMEM_Exception.hxx" #include "MEDMEM_define.hxx" +#include "MEDMEM_PointerOf.hxx" #include "utilities.h" using namespace MED_EN; @@ -19,25 +20,22 @@ template class MEDARRAY // 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 _valuesDefault; // in _mode representation + PointerOf _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 ; }; @@ -50,19 +48,21 @@ public : 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() ; @@ -75,116 +75,157 @@ private: template MEDARRAY::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::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::MEDARRAY(const med_int, const med_int, const medModeSwitch) : dimension < 1 !")); - _valuesDefault = new T[ld_values*length_values] ; - - SCRUTE(_valuesDefault); + BEGIN_OF("constructor MEDARRAY::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::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::MEDARRAY(const med_int , const med_int, const medModeSwitch (= MED_FULL_INTERLACE))"); + END_OF("constructor MEDARRAY::MEDARRAY(const med_int, const med_int, const medModeSwitch (= MED_FULL_INTERLACE))"); } template MEDARRAY::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 inline med_int MEDARRAY::getLeadingValue() { - return _ld_values ; +template MEDARRAY::MEDARRAY(MEDARRAY 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 inline med_int MEDARRAY::getLeadingValue() const +{ + return _ldValues ; }; -template inline med_int MEDARRAY::getLengthValue() { - return _length_values ; + +template inline med_int MEDARRAY::getLengthValue() const +{ + return _lengthValues ; }; -template T* const MEDARRAY::get(medModeSwitch mode) +template T* const MEDARRAY::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 T* const MEDARRAY::getI(medModeSwitch mode,med_int i) +template T* const MEDARRAY::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 T MEDARRAY::getIJ(med_int i, med_int j) const +template T const MEDARRAY::getIJ(const med_int i,const med_int j) const { - // 1<=i<=_length_values and 1= 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 inline medModeSwitch MEDARRAY::getMode() const @@ -197,157 +238,185 @@ template void MEDARRAY::set(medModeSwitch mode, T* value) BEGIN_OF("MEDARRAY::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::set(mode,i,value)"); + END_OF("MEDARRAY::set(mode,i,value)"); } template void MEDARRAY::setI(medModeSwitch mode, med_int i, T* value) { BEGIN_OF("MEDARRAY::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 void MEDARRAY::setIJ(med_int i, med_int j, T value) { - // 1<=i<=_length_values and 1= 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 void MEDARRAY::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::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::calculateOther()") ; } template void MEDARRAY::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 @@ -358,26 +427,33 @@ template void MEDARRAY::updateDefault() { BEGIN_OF("MEDARRAY::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::updateDefault() : No valuesOther defined !"); + } } else + { throw MEDEXCEPTION("MEDARRAY::updateDefault() : No values defined !"); + } END_OF("MEDARRAY::updateDefault()"); } diff --git a/src/MEDMEM/MEDMEM_CellModel.cxx b/src/MEDMEM/MEDMEM_CellModel.cxx index 0f7f7b3a6..d4c66f958 100644 --- a/src/MEDMEM/MEDMEM_CellModel.cxx +++ b/src/MEDMEM/MEDMEM_CellModel.cxx @@ -1,3 +1,4 @@ +using namespace std; /* File MEDMEM_CellModel.cxx $Header$ @@ -8,6 +9,17 @@ 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) { @@ -27,10 +39,31 @@ CELLMODEL::CELLMODEL(medGeometryElement t) _numberOfVertexes=2; _numberOfNodes=2; // constituent are POINT1 and we have no need to define _constituents vector - vector vector_type(2,MED_POINT1) ; - vector __constituents_type[]={vector_type}; - vector< vector > _constituents_type(__constituents_type,__constituents_type+1) ; - _constituentsType = _constituents_type ; +// vector vector_type(2,MED_POINT1) ; +// vector __constituents_type[]={vector_type}; +// vector< vector > _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 : { @@ -40,10 +73,34 @@ CELLMODEL::CELLMODEL(medGeometryElement t) _numberOfVertexes=2; _numberOfNodes=3; // constituent are POINT1 and we have no need to define _constituents vector - vector vector_type(3,MED_POINT1) ; - vector __constituents_type[]={vector_type}; - vector< vector > _constituents_type(__constituents_type,__constituents_type+1) ; - _constituentsType = _constituents_type ; +// vector vector_type(3,MED_POINT1) ; +// vector __constituents_type[]={vector_type}; +// vector< vector > _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 : { @@ -52,22 +109,46 @@ CELLMODEL::CELLMODEL(medGeometryElement t) _dimension=2; _numberOfVertexes=3; _numberOfNodes=3; - int _edge1[]={1,2} ; - int _edge2[]={2,3} ; - int _edge3[]={3,1} ; - vector edge1(_edge1,_edge1+2) ; - vector edge2(_edge2,_edge2+2) ; - vector edge3(_edge3,_edge3+2) ; - vector _vector_edge[]={edge1,edge2,edge3}; - vector< vector > vector_edge(_vector_edge,_vector_edge+3) ; - vector< vector > __constituents__[]={vector_edge}; - vector< vector< vector > > _constituents_(__constituents__,__constituents__+1) ; - _constituents = _constituents_ ; - vector vector_edge_type(3,MED_SEG2) ; - vector vector_type(3,MED_POINT1) ; - vector __constituents_type[]={vector_edge_type,vector_type}; - vector< vector > _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 : { @@ -76,22 +157,67 @@ CELLMODEL::CELLMODEL(medGeometryElement t) _dimension=2; _numberOfVertexes=3; _numberOfNodes=6; - int _edge1[]={1,2,4} ; - int _edge2[]={2,3,5} ; - int _edge3[]={3,1,6} ; - vector edge1(_edge1,_edge1+3) ; - vector edge2(_edge2,_edge2+3) ; - vector edge3(_edge3,_edge3+3) ; - vector _vector_edge[]={edge1,edge2,edge3}; - vector< vector > vector_edge(_vector_edge,_vector_edge+3) ; - vector< vector > __constituents__[]={vector_edge}; - vector< vector< vector > > _constituents_(__constituents__,__constituents__+1) ; - _constituents = _constituents_ ; - vector vector_edge_type(3,MED_SEG3) ; - vector vector_type(6,MED_POINT1) ; - vector __constituents_type[]={vector_edge_type,vector_type}; - vector< vector > _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 edge1(_edge1,_edge1+3) ; +// vector edge2(_edge2,_edge2+3) ; +// vector edge3(_edge3,_edge3+3) ; +// vector _vector_edge[]={edge1,edge2,edge3}; +// vector< vector > vector_edge(_vector_edge,_vector_edge+3) ; +// vector< vector > __constituents__[]={vector_edge}; +// vector< vector< vector > > _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 vector_edge_type(3,MED_SEG3) ; +// vector vector_type(6,MED_POINT1) ; +// vector __constituents_type[]={vector_edge_type,vector_type}; +// vector< vector > _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 : { @@ -100,24 +226,71 @@ CELLMODEL::CELLMODEL(medGeometryElement t) _dimension=2; _numberOfVertexes=4; _numberOfNodes=4; - int _edge1[]={1,2} ; - int _edge2[]={2,3} ; - int _edge3[]={3,4} ; - int _edge4[]={4,1} ; - vector edge1(_edge1,_edge1+2) ; - vector edge2(_edge2,_edge2+2) ; - vector edge3(_edge3,_edge3+2) ; - vector edge4(_edge4,_edge4+2) ; - vector _vector_edge[]={edge1,edge2,edge3,edge4}; - vector< vector > vector_edge(_vector_edge,_vector_edge+4) ; - vector< vector > __constituents__[]={vector_edge}; - vector< vector< vector > > _constituents_(__constituents__,__constituents__+1) ; - _constituents = _constituents_ ; - vector vector_edge_type(4,MED_SEG2) ; - vector vector_type(4,MED_POINT1) ; - vector __constituents_type[]={vector_edge_type,vector_type}; - vector< vector > _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 edge1(_edge1,_edge1+2) ; +// vector edge2(_edge2,_edge2+2) ; +// vector edge3(_edge3,_edge3+2) ; +// vector edge4(_edge4,_edge4+2) ; +// vector _vector_edge[]={edge1,edge2,edge3,edge4}; +// vector< vector > vector_edge(_vector_edge,_vector_edge+4) ; +// vector< vector > __constituents__[]={vector_edge}; +// vector< vector< vector > > _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 vector_edge_type(4,MED_SEG2) ; +// vector vector_type(4,MED_POINT1) ; +// vector __constituents_type[]={vector_edge_type,vector_type}; +// vector< vector > _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 : { @@ -126,24 +299,79 @@ CELLMODEL::CELLMODEL(medGeometryElement t) _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 edge1(_edge1,_edge1+3) ; - vector edge2(_edge2,_edge2+3) ; - vector edge3(_edge3,_edge3+3) ; - vector edge4(_edge4,_edge4+3) ; - vector _vector_edge[]={edge1,edge2,edge3,edge4}; - vector< vector > vector_edge(_vector_edge,_vector_edge+4) ; - vector< vector > __constituents__[]={vector_edge}; - vector< vector< vector > > _constituents_(__constituents__,__constituents__+1) ; - _constituents = _constituents_ ; - vector vector_edge_type(4,MED_SEG3) ; - vector vector_type(8,MED_POINT1) ; - vector __constituents_type[]={vector_edge_type,vector_type}; - vector< vector > _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 edge1(_edge1,_edge1+3) ; +// vector edge2(_edge2,_edge2+3) ; +// vector edge3(_edge3,_edge3+3) ; +// vector edge4(_edge4,_edge4+3) ; +// vector _vector_edge[]={edge1,edge2,edge3,edge4}; +// vector< vector > vector_edge(_vector_edge,_vector_edge+4) ; +// vector< vector > __constituents__[]={vector_edge}; +// vector< vector< vector > > _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 vector_edge_type(4,MED_SEG3) ; +// vector vector_type(8,MED_POINT1) ; +// vector __constituents_type[]={vector_edge_type,vector_type}; +// vector< vector > _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 : { @@ -152,38 +380,122 @@ CELLMODEL::CELLMODEL(medGeometryElement t) _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 edge1(_edge1,_edge1+2) ; - vector edge2(_edge2,_edge2+2) ; - vector edge3(_edge3,_edge3+2) ; - vector edge4(_edge4,_edge4+2) ; - vector edge5(_edge5,_edge5+2) ; - vector edge6(_edge6,_edge6+2) ; - vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6}; - vector< vector > 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 face1(_face1,_face1+3) ; - vector face2(_face2,_face2+3) ; - vector face3(_face3,_face3+3) ; - vector face4(_face4,_face4+3) ; - vector _vector_face[] = {face1,face2,face3,face4} ; - vector< vector > vector_face(_vector_face,_vector_face+4) ; - vector< vector > __constituents__[]={vector_face,vector_edge}; - vector< vector< vector > > _constituents_(__constituents__,__constituents__+2) ; - _constituents = _constituents_ ; - vector vector_edge_type(6,MED_SEG2) ; - vector vector_face_type(4,MED_TRIA3) ; - vector __constituents_type[]={vector_face_type,vector_edge_type}; - vector< vector > _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 edge1(_edge1,_edge1+2) ; +// vector edge2(_edge2,_edge2+2) ; +// vector edge3(_edge3,_edge3+2) ; +// vector edge4(_edge4,_edge4+2) ; +// vector edge5(_edge5,_edge5+2) ; +// vector edge6(_edge6,_edge6+2) ; +// vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6}; +// vector< vector > 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 face1(_face1,_face1+3) ; +// vector face2(_face2,_face2+3) ; +// vector face3(_face3,_face3+3) ; +// vector face4(_face4,_face4+3) ; +// vector _vector_face[] = {face1,face2,face3,face4} ; +// vector< vector > vector_face(_vector_face,_vector_face+4) ; +// vector< vector > __constituents__[]={vector_face,vector_edge}; +// vector< vector< vector > > _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 vector_edge_type(6,MED_SEG2) ; +// vector vector_face_type(4,MED_TRIA3) ; +// vector __constituents_type[]={vector_face_type,vector_edge_type}; +// vector< vector > _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 : { @@ -192,38 +504,140 @@ CELLMODEL::CELLMODEL(medGeometryElement t) _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 edge1(_edge1,_edge1+3) ; - vector edge2(_edge2,_edge2+3) ; - vector edge3(_edge3,_edge3+3) ; - vector edge4(_edge4,_edge4+3) ; - vector edge5(_edge5,_edge5+3) ; - vector edge6(_edge6,_edge6+3) ; - vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6}; - vector< vector > 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 face1(_face1,_face1+6) ; - vector face2(_face2,_face2+6) ; - vector face3(_face3,_face3+6) ; - vector face4(_face4,_face4+6) ; - vector _vector_face[] = {face1,face2,face3,face4} ; - vector< vector > vector_face(_vector_face,_vector_face+4) ; - vector< vector > __constituents__[]={vector_face,vector_edge}; - vector< vector< vector > > _constituents_(__constituents__,__constituents__+2) ; - _constituents = _constituents_ ; - vector vector_edge_type(6,MED_SEG3) ; - vector vector_face_type(4,MED_TRIA6) ; - vector __constituents_type[]={vector_face_type,vector_edge_type}; - vector< vector > _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 edge1(_edge1,_edge1+3) ; +// vector edge2(_edge2,_edge2+3) ; +// vector edge3(_edge3,_edge3+3) ; +// vector edge4(_edge4,_edge4+3) ; +// vector edge5(_edge5,_edge5+3) ; +// vector edge6(_edge6,_edge6+3) ; +// vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6}; +// vector< vector > 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 face1(_face1,_face1+6) ; +// vector face2(_face2,_face2+6) ; +// vector face3(_face3,_face3+6) ; +// vector face4(_face4,_face4+6) ; +// vector _vector_face[] = {face1,face2,face3,face4} ; +// vector< vector > vector_face(_vector_face,_vector_face+4) ; +// vector< vector > __constituents__[]={vector_face,vector_edge}; +// vector< vector< vector > > _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 vector_edge_type(6,MED_SEG3) ; +// vector vector_face_type(4,MED_TRIA6) ; +// vector __constituents_type[]={vector_face_type,vector_edge_type}; +// vector< vector > _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 : { @@ -232,54 +646,192 @@ CELLMODEL::CELLMODEL(medGeometryElement t) _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 edge1(_edge1,_edge1+2) ; - vector edge2(_edge2,_edge2+2) ; - vector edge3(_edge3,_edge3+2) ; - vector edge4(_edge4,_edge4+2) ; - vector edge5(_edge5,_edge5+2) ; - vector edge6(_edge6,_edge6+2) ; - vector edge7(_edge7,_edge7+2) ; - vector edge8(_edge8,_edge8+2) ; - vector edge9(_edge9,_edge9+2) ; - vector edge10(_edge10,_edge10+2) ; - vector edge11(_edge11,_edge11+2) ; - vector edge12(_edge12,_edge12+2) ; - vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9,edge10,edge11,edge12}; - vector< vector > 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 face1(_face1,_face1+4) ; - vector face2(_face2,_face2+4) ; - vector face3(_face3,_face3+4) ; - vector face4(_face4,_face4+4) ; - vector face5(_face5,_face5+4) ; - vector face6(_face6,_face6+4) ; - vector _vector_face[] = {face1,face2,face3,face4,face5,face6} ; - vector< vector > vector_face(_vector_face,_vector_face+6) ; - vector< vector > __constituents__[]={vector_face,vector_edge}; - vector< vector< vector > > _constituents_(__constituents__,__constituents__+2) ; - _constituents = _constituents_ ; - vector vector_edge_type(12,MED_SEG2) ; - vector vector_face_type(6,MED_QUAD4) ; - vector __constituents_type[]={vector_face_type,vector_edge_type}; - vector< vector > _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 edge1(_edge1,_edge1+2) ; +// vector edge2(_edge2,_edge2+2) ; +// vector edge3(_edge3,_edge3+2) ; +// vector edge4(_edge4,_edge4+2) ; +// vector edge5(_edge5,_edge5+2) ; +// vector edge6(_edge6,_edge6+2) ; +// vector edge7(_edge7,_edge7+2) ; +// vector edge8(_edge8,_edge8+2) ; +// vector edge9(_edge9,_edge9+2) ; +// vector edge10(_edge10,_edge10+2) ; +// vector edge11(_edge11,_edge11+2) ; +// vector edge12(_edge12,_edge12+2) ; +// vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9,edge10,edge11,edge12}; +// vector< vector > 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 face1(_face1,_face1+4) ; +// vector face2(_face2,_face2+4) ; +// vector face3(_face3,_face3+4) ; +// vector face4(_face4,_face4+4) ; +// vector face5(_face5,_face5+4) ; +// vector face6(_face6,_face6+4) ; +// vector _vector_face[] = {face1,face2,face3,face4,face5,face6} ; +// vector< vector > vector_face(_vector_face,_vector_face+6) ; +// vector< vector > __constituents__[]={vector_face,vector_edge}; +// vector< vector< vector > > _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 vector_edge_type(12,MED_SEG2) ; +// vector vector_face_type(6,MED_QUAD4) ; +// vector __constituents_type[]={vector_face_type,vector_edge_type}; +// vector< vector > _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 : { @@ -289,57 +841,231 @@ CELLMODEL::CELLMODEL(medGeometryElement t) _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 edge1(_edge1,_edge1+3) ; - vector edge2(_edge2,_edge2+3) ; - vector edge3(_edge3,_edge3+3) ; - vector edge4(_edge4,_edge4+3) ; - vector edge5(_edge5,_edge5+3) ; - vector edge6(_edge6,_edge6+3) ; - vector edge7(_edge7,_edge7+3) ; - vector edge8(_edge8,_edge8+3) ; - vector edge9(_edge9,_edge9+3) ; - vector edge10(_edge10,_edge10+3) ; - vector edge11(_edge11,_edge11+3) ; - vector edge12(_edge12,_edge12+3) ; - vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9,edge10, edge11,edge12}; - vector< vector > 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 face1(_face1,_face1+8); - vector face2(_face2,_face2+8); - vector face3(_face3,_face3+8); - vector face4(_face4,_face4+8); - vector face5(_face5,_face5+8); - vector face6(_face6,_face6+8); - vector _vector_face[]= {face1,face2,face3,face4,face5,face6} ; - vector< vector > vector_face(_vector_face,_vector_face+6); - - vector< vector > __constituents__[]={vector_face,vector_edge}; - vector< vector< vector > > _constituents_(__constituents__,__constituents__+2) ; - _constituents = _constituents_ ; - vector vector_edge_type(12,MED_SEG3) ; - vector vector_face_type(6,MED_QUAD8) ; - vector __constituents_type[]={vector_face_type,vector_edge_type}; - vector< vector > _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 edge1(_edge1,_edge1+3) ; +// vector edge2(_edge2,_edge2+3) ; +// vector edge3(_edge3,_edge3+3) ; +// vector edge4(_edge4,_edge4+3) ; +// vector edge5(_edge5,_edge5+3) ; +// vector edge6(_edge6,_edge6+3) ; +// vector edge7(_edge7,_edge7+3) ; +// vector edge8(_edge8,_edge8+3) ; +// vector edge9(_edge9,_edge9+3) ; +// vector edge10(_edge10,_edge10+3) ; +// vector edge11(_edge11,_edge11+3) ; +// vector edge12(_edge12,_edge12+3) ; +// vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9,edge10, edge11,edge12}; +// vector< vector > 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 face1(_face1,_face1+8); +// vector face2(_face2,_face2+8); +// vector face3(_face3,_face3+8); +// vector face4(_face4,_face4+8); +// vector face5(_face5,_face5+8); +// vector face6(_face6,_face6+8); +// vector _vector_face[]= {face1,face2,face3,face4,face5,face6} ; +// vector< vector > vector_face(_vector_face,_vector_face+6); + +// vector< vector > __constituents__[]={vector_face,vector_edge}; +// vector< vector< vector > > _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 vector_edge_type(12,MED_SEG3) ; +// vector vector_face_type(6,MED_QUAD8) ; +// vector __constituents_type[]={vector_face_type,vector_edge_type}; +// vector< vector > _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 : { @@ -349,51 +1075,161 @@ CELLMODEL::CELLMODEL(medGeometryElement t) _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 edge1(_edge1,_edge1+2) ; - vector edge2(_edge2,_edge2+2) ; - vector edge3(_edge3,_edge3+2) ; - vector edge4(_edge4,_edge4+2) ; - vector edge5(_edge5,_edge5+2) ; - vector edge6(_edge6,_edge6+2) ; - vector edge7(_edge7,_edge7+2) ; - vector edge8(_edge8,_edge8+2) ; - vector edge9(_edge9,_edge9+2) ; - vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9}; - vector< vector > 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 face1(_face1,_face1+3); - vector face2(_face2,_face2+3); - vector face3(_face3,_face3+4); - vector face4(_face4,_face4+4); - vector face5(_face5,_face5+4); - vector _vector_face[]= {face1,face2,face3,face4,face5} ; - vector< vector > 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 edge1(_edge1,_edge1+2) ; +// vector edge2(_edge2,_edge2+2) ; +// vector edge3(_edge3,_edge3+2) ; +// vector edge4(_edge4,_edge4+2) ; +// vector edge5(_edge5,_edge5+2) ; +// vector edge6(_edge6,_edge6+2) ; +// vector edge7(_edge7,_edge7+2) ; +// vector edge8(_edge8,_edge8+2) ; +// vector edge9(_edge9,_edge9+2) ; +// vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9}; +// vector< vector > 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 face1(_face1,_face1+3); +// vector face2(_face2,_face2+3); +// vector face3(_face3,_face3+4); +// vector face4(_face4,_face4+4); +// vector face5(_face5,_face5+4); +// vector _vector_face[]= {face1,face2,face3,face4,face5} ; +// vector< vector > vector_face(_vector_face,_vector_face+5); - vector< vector > __constituents__[]={vector_face,vector_edge}; - vector< vector< vector > > _constituents_(__constituents__,__constituents__+2) ; - _constituents = _constituents_ ; - vector vector_edge_type(9,MED_SEG2) ; - vector vector_face_type(5,MED_QUAD4) ; - vector_face_type[0]=MED_TRIA3 ; - vector_face_type[1]=MED_TRIA3 ; - vector __constituents_type[]={vector_face_type,vector_edge_type}; - vector< vector > _constituents_type(__constituents_type,__constituents_type+2) ; - _constituentsType = _constituents_type ; +// vector< vector > __constituents__[]={vector_face,vector_edge}; +// vector< vector< vector > > _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 vector_edge_type(9,MED_SEG2) ; +// vector vector_face_type(5,MED_QUAD4) ; +// vector_face_type[0]=MED_TRIA3 ; +// vector_face_type[1]=MED_TRIA3 ; +// vector __constituents_type[]={vector_face_type,vector_edge_type}; +// vector< vector > _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 : { @@ -402,52 +1238,189 @@ CELLMODEL::CELLMODEL(medGeometryElement t) _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 edge1(_edge1,_edge1+3) ; - vector edge2(_edge2,_edge2+3) ; - vector edge3(_edge3,_edge3+3) ; - vector edge4(_edge4,_edge4+3) ; - vector edge5(_edge5,_edge5+3) ; - vector edge6(_edge6,_edge6+3) ; - vector edge7(_edge7,_edge7+3) ; - vector edge8(_edge8,_edge8+3) ; - vector edge9(_edge9,_edge9+3) ; - vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9}; - vector< vector > 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 face1(_face1,_face1+6); - vector face2(_face2,_face2+6); - vector face3(_face3,_face3+8); - vector face4(_face4,_face4+8); - vector face5(_face5,_face5+8); - vector _vector_face[]= {face1,face2,face3,face4,face5} ; - vector< vector > vector_face(_vector_face,_vector_face+5); - - vector< vector > __constituents__[]={vector_face,vector_edge}; - vector< vector< vector > > _constituents_(__constituents__,__constituents__+2) ; - _constituents = _constituents_ ; - vector vector_edge_type(9,MED_SEG3) ; - vector vector_face_type(5,MED_QUAD8) ; - vector_face_type[0]=MED_TRIA6 ; - vector_face_type[1]=MED_TRIA6 ; - vector __constituents_type[]={vector_face_type,vector_edge_type}; - vector< vector > _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 edge1(_edge1,_edge1+3) ; +// vector edge2(_edge2,_edge2+3) ; +// vector edge3(_edge3,_edge3+3) ; +// vector edge4(_edge4,_edge4+3) ; +// vector edge5(_edge5,_edge5+3) ; +// vector edge6(_edge6,_edge6+3) ; +// vector edge7(_edge7,_edge7+3) ; +// vector edge8(_edge8,_edge8+3) ; +// vector edge9(_edge9,_edge9+3) ; +// vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8,edge9}; +// vector< vector > 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 face1(_face1,_face1+6); +// vector face2(_face2,_face2+6); +// vector face3(_face3,_face3+8); +// vector face4(_face4,_face4+8); +// vector face5(_face5,_face5+8); +// vector _vector_face[]= {face1,face2,face3,face4,face5} ; +// vector< vector > vector_face(_vector_face,_vector_face+5); + +// vector< vector > __constituents__[]={vector_face,vector_edge}; +// vector< vector< vector > > _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 vector_edge_type(9,MED_SEG3) ; +// vector vector_face_type(5,MED_QUAD8) ; +// vector_face_type[0]=MED_TRIA6 ; +// vector_face_type[1]=MED_TRIA6 ; +// vector __constituents_type[]={vector_face_type,vector_edge_type}; +// vector< vector > _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" ; @@ -455,48 +1428,150 @@ CELLMODEL::CELLMODEL(medGeometryElement t) _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 edge1(_edge1,_edge1+2) ; - vector edge2(_edge2,_edge2+2) ; - vector edge3(_edge3,_edge3+2) ; - vector edge4(_edge4,_edge4+2) ; - vector edge5(_edge5,_edge5+2) ; - vector edge6(_edge6,_edge6+2) ; - vector edge7(_edge7,_edge7+2) ; - vector edge8(_edge8,_edge8+2) ; - vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8}; - vector< vector > 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 face1(_face1,_face1+4); - vector face2(_face2,_face2+3); - vector face3(_face3,_face3+3); - vector face4(_face4,_face4+3); - vector face5(_face5,_face5+3); - vector _vector_face[]= {face1,face2,face3,face4,face5} ; - vector< vector > vector_face(_vector_face,_vector_face+5); - - vector< vector > __constituents__[]={vector_face,vector_edge}; - vector< vector< vector > > _constituents_(__constituents__,__constituents__+2) ; - _constituents = _constituents_ ; - vector vector_edge_type(8,MED_SEG2) ; - vector vector_face_type(5,MED_TRIA3) ; - vector_face_type[0]=MED_QUAD4 ; - vector __constituents_type[]={vector_face_type,vector_edge_type}; - vector< vector > _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 edge1(_edge1,_edge1+2) ; +// vector edge2(_edge2,_edge2+2) ; +// vector edge3(_edge3,_edge3+2) ; +// vector edge4(_edge4,_edge4+2) ; +// vector edge5(_edge5,_edge5+2) ; +// vector edge6(_edge6,_edge6+2) ; +// vector edge7(_edge7,_edge7+2) ; +// vector edge8(_edge8,_edge8+2) ; +// vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8}; +// vector< vector > 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 face1(_face1,_face1+4); +// vector face2(_face2,_face2+3); +// vector face3(_face3,_face3+3); +// vector face4(_face4,_face4+3); +// vector face5(_face5,_face5+3); +// vector _vector_face[]= {face1,face2,face3,face4,face5} ; +// vector< vector > vector_face(_vector_face,_vector_face+5); + +// vector< vector > __constituents__[]={vector_face,vector_edge}; +// vector< vector< vector > > _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 vector_edge_type(8,MED_SEG2) ; +// vector vector_face_type(5,MED_TRIA3) ; +// vector_face_type[0]=MED_QUAD4 ; +// vector __constituents_type[]={vector_face_type,vector_edge_type}; +// vector< vector > _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 : { @@ -505,52 +1580,178 @@ CELLMODEL::CELLMODEL(medGeometryElement t) _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 edge1(_edge1,_edge1+3) ; - vector edge2(_edge2,_edge2+3) ; - vector edge3(_edge3,_edge3+3) ; - vector edge4(_edge4,_edge4+3) ; - vector edge5(_edge5,_edge5+3) ; - vector edge6(_edge6,_edge6+3) ; - vector edge7(_edge7,_edge7+3) ; - vector edge8(_edge8,_edge8+3) ; - - - vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8}; - vector< vector > 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 face1(_face1,_face1+8); - vector face2(_face2,_face2+6); - vector face3(_face3,_face3+6); - vector face4(_face4,_face4+6); - vector face5(_face5,_face5+6); - vector _vector_face[]= {face1,face2,face3,face4,face5} ; - vector< vector > vector_face(_vector_face,_vector_face+5); - - - vector< vector > __constituents__[]={vector_face,vector_edge}; - vector< vector< vector > > _constituents_(__constituents__,__constituents__+2) ; - _constituents = _constituents_ ; - vector vector_edge_type(8,MED_SEG3) ; - vector vector_face_type(5,MED_TRIA6) ; - vector_face_type[0]=MED_QUAD8 ; - vector __constituents_type[]={vector_face_type,vector_edge_type}; - vector< vector > _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 edge1(_edge1,_edge1+3) ; +// vector edge2(_edge2,_edge2+3) ; +// vector edge3(_edge3,_edge3+3) ; +// vector edge4(_edge4,_edge4+3) ; +// vector edge5(_edge5,_edge5+3) ; +// vector edge6(_edge6,_edge6+3) ; +// vector edge7(_edge7,_edge7+3) ; +// vector edge8(_edge8,_edge8+3) ; + + +// vector _vector_edge[]={edge1,edge2,edge3,edge4,edge5,edge6,edge7,edge8}; +// vector< vector > 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 face1(_face1,_face1+8); +// vector face2(_face2,_face2+6); +// vector face3(_face3,_face3+6); +// vector face4(_face4,_face4+6); +// vector face5(_face5,_face5+6); +// vector _vector_face[]= {face1,face2,face3,face4,face5} ; +// vector< vector > vector_face(_vector_face,_vector_face+5); + + +// vector< vector > __constituents__[]={vector_face,vector_edge}; +// vector< vector< vector > > _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 vector_edge_type(8,MED_SEG3) ; +// vector vector_face_type(5,MED_TRIA6) ; +// vector_face_type[0]=MED_QUAD8 ; +// vector __constituents_type[]={vector_face_type,vector_edge_type}; +// vector< vector > _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 : @@ -567,13 +1768,20 @@ ostream & operator<<(ostream &os,const CELLMODEL &my) os << " - dimension : " << my._dimension << endl; os << " - number of nodes : " << my._numberOfNodes << endl ; os << " - number of vertexes : " << my._numberOfVertexes << endl ; - for(int i=0;i constituentsTypes ; - if (_constituentsType.size() > 0 ) { - vector constituentsType = _constituentsType[0] ; - vector::iterator itvec ; - for(itvec=constituentsType.begin();itvec!=constituentsType.end();itvec++) - constituentsTypes.insert(*itvec); - } +// if (_constituentsType.size() > 0 ) { +// vector constituentsType = _constituentsType[0] ; +// vector::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 CELLMODEL::getAllConstituentsType() const +set CELLMODEL::getAllConstituentsType() const { set constituentsTypes ; - if (_constituentsType.size() > 0 ) { - vector constituentsType = _constituentsType[0] ; - vector::iterator itvec ; - for(itvec=constituentsType.begin();itvec!=constituentsType.end();itvec++) - constituentsTypes.insert(*itvec); - } +// if (_constituentsType.size() > 0 ) { +// vector constituentsType = _constituentsType[0] ; +// vector::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 CELLMODEL::getNumberOfConstituentsForeachType() const +map CELLMODEL::getNumberOfConstituentsForeachType() const { map numberOfConstituentsForeachType ; - map::iterator itmap ; - if (_constituentsType.size() > 0 ) { - vector constituentsType = _constituentsType[0] ; - vector::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::iterator itmap ; +// if (_constituentsType.size() > 0 ) { +// vector constituentsType = _constituentsType[0] ; +// vector::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 +//#include #include #include #include #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 > > _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 > _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); @@ -74,19 +83,20 @@ public : inline medGeometryElement getType() const; // Return all constituents which dimension is _dimension-dim. - vector< vector > getConstituents(int dim) const; + // vector< vector > 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 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 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; @@ -96,10 +106,10 @@ public : int getNumberOfConstituentsType() const; // Return all types of constituents which dimension is (_dimension-1). - set getAllConstituentsType() const; + set getAllConstituentsType() const; // Return number of constituents foreach type (which dimension is _dimension-1). - map getNumberOfConstituentsForeachType() const; + map getNumberOfConstituentsForeachType() const; }; @@ -110,33 +120,36 @@ public : 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 > CELLMODEL::getConstituents(int dim) const +//inline vector< vector > 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 CELLMODEL::getNodesConstituent(int dim,int num) const +//inline vector CELLMODEL::getNodesConstituent(int dim,int num) const +inline int* CELLMODEL::getNodesConstituent(int dim,int num) const { return _constituents[dim-1][num-1]; } @@ -144,7 +157,8 @@ inline int CELLMODEL::getNodeConstituent(int dim,int num,int nodesNumber) { return _constituents[dim-1][num-1][nodesNumber-1] ; } -inline vector CELLMODEL::getConstituentsType(int dim) const +//inline vector CELLMODEL::getConstituentsType(int dim) const +inline medGeometryElement* CELLMODEL::getConstituentsType(int dim) const { return _constituentsType[dim-1]; } diff --git a/src/MEDMEM/MEDMEM_Connectivity.cxx b/src/MEDMEM/MEDMEM_Connectivity.cxx index 0bba6d277..8c8b87225 100644 --- a/src/MEDMEM/MEDMEM_Connectivity.cxx +++ b/src/MEDMEM/MEDMEM_Connectivity.cxx @@ -1,3 +1,4 @@ +using namespace std; #include "MEDMEM_Connectivity.hxx" #include "MEDMEM_Family.hxx" #include "MEDMEM_CellModel.hxx" @@ -8,7 +9,7 @@ #include "MEDMEM_STRING.hxx" //------------------------------------------------------// -CONNECTIVITY::CONNECTIVITY(medEntityMesh Entity=MED_CELL): +CONNECTIVITY::CONNECTIVITY(medEntityMesh Entity/*=MED_CELL*/): //------------------------------------------------------// _entity(Entity), _typeConnectivity(MED_NODAL), @@ -28,7 +29,7 @@ CONNECTIVITY::CONNECTIVITY(medEntityMesh Entity=MED_CELL): } //-------------------------------------------------------------------------// -CONNECTIVITY::CONNECTIVITY(int numberOfTypes,medEntityMesh Entity=MED_CELL): +CONNECTIVITY::CONNECTIVITY(int numberOfTypes,medEntityMesh Entity/*=MED_CELL*/): //-------------------------------------------------------------------------// _entity(Entity), _typeConnectivity(MED_NODAL), @@ -47,6 +48,59 @@ CONNECTIVITY::CONNECTIVITY(int numberOfTypes,medEntityMesh Entity=MED_CELL): _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() //----------------------------// @@ -123,6 +177,11 @@ void CONNECTIVITY::updateFamily(vector myFamilies) return ; } + for(int i=0; i myFamilies) int * oldConstituentValue = oldConstituent->_nodal->getValue() ; int * oldConstituentIndex = oldConstituent->_nodal->getIndex() ; + SCRUTE(oldNumberOfFace); + calculateDescendingConnectivity() ; // if (oldConstituent->_nodal != NULL) { @@ -143,6 +204,8 @@ void CONNECTIVITY::updateFamily(vector myFamilies) int * newConstituentValue = _constituent->_nodal->getValue() ; int * newConstituentIndex = _constituent->_nodal->getIndex() ; + SCRUTE(newNumberOfFace); + int * newReverseDescendingIndex = _reverseDescendingConnectivity->getIndex(); int * newReverseDescendingValue = @@ -173,107 +236,163 @@ void CONNECTIVITY::updateFamily(vector myFamilies) int index1 = 0; int indexm1 = 0; + _constituent->calculateReverseNodalConnectivity() ; + for (int iOldFace=0;iOldFacegetReverseNodalConnectivity() ; + 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 2) - throw MED_EXCEPTION(LOCALIZED(STRING(LOC)<<"This face/edge should not be a (d-1) cell because it has "<_nodal because of reversity - int * oldArray = oldConstituentValue+face_it_beginOld-1; - int * newArray = newConstituentValue+face_it_beginNew-1; - for(int iarray=0;iarray1) + throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"More than one face found ("< 2) + throw MED_EXCEPTION(LOCALIZED(STRING(LOC)<<"This face/edge should not be a (d-1) cell because it has "<_nodal because of reversity + int * oldArray = oldConstituentValue+face_it_beginOld-1; + int * newArray = newConstituentValue+face_it_beginNew-1; + for(int iarray=0;iarray myFamilies) int length_skyline = myFamily->getnumber()->getLength(); int * value_skyline = myFamily->getnumber()->getValue(); - for (int i=0;igetNumberOf(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 !")) ; } @@ -524,13 +653,14 @@ med_int* CONNECTIVITY::getReverseNodalConnectivityIndex() 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 @@ -540,12 +670,12 @@ med_int* CONNECTIVITY::getReverseDescendingConnectivityIndex() //-----------------------------------------------------------// { // 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 ???) */ @@ -771,99 +901,77 @@ void CONNECTIVITY::calculateDescendingConnectivity() 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 0) { // we could have no element ! + int * CellsList = new int[NumberOfCellsInList] ; + for (int l=ReverseNodalConnectivityIndex_0; l1) - throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"More than one other Cell ("<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 ("<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 ; } } diff --git a/src/MEDMEM/MEDMEM_Connectivity.hxx b/src/MEDMEM/MEDMEM_Connectivity.hxx index 003e4ca6b..904670e26 100644 --- a/src/MEDMEM/MEDMEM_Connectivity.hxx +++ b/src/MEDMEM/MEDMEM_Connectivity.hxx @@ -93,6 +93,12 @@ private: /*! 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) ; @@ -104,6 +110,7 @@ public: CONNECTIVITY(medEntityMesh Entity=MED_CELL); CONNECTIVITY(int numberOfTypes, medEntityMesh Entity=MED_CELL); + CONNECTIVITY(CONNECTIVITY & m); ~CONNECTIVITY(); inline bool existConnectivity (medConnectivity connectivityType, medEntityMesh Entity) const ; @@ -125,13 +132,13 @@ public: 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; } ; @@ -217,5 +224,37 @@ inline CELLMODEL * CONNECTIVITY::getCellsTypes(medEntityMesh Entity) 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 */ diff --git a/src/MEDMEM/MEDMEM_Coordinate.cxx b/src/MEDMEM/MEDMEM_Coordinate.cxx index 8a5975d6b..8669f1d3b 100644 --- a/src/MEDMEM/MEDMEM_Coordinate.cxx +++ b/src/MEDMEM/MEDMEM_Coordinate.cxx @@ -1,48 +1,97 @@ +using namespace std; #include "MEDMEM_Coordinate.hxx" #include "utilities.h" /*! This class contains coordinates of the nodes */ //----------------------------------------------------------// -COORDINATE::COORDINATE():_coordinate((MEDARRAY*)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(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(*m._coordinate); + } + else + { + _coordinate = (MEDARRAY*) NULL; + spaceDimension = 0; + numberOfNodes = 0; + } + + _coordinateName.set(spaceDimension); + for (int i=0; i *Coordinate) //----------------------------------------------------------// { - _coordinate=Coordinate ; +//PN a voir ... + if ((_coordinate!=NULL) ) + { + MESSAGE("deleting old _coordinate" ) ; + delete _coordinate ; + } + _coordinate=Coordinate ; } /*! set the attribute _coordinateName with CoordinateName */ @@ -58,7 +107,15 @@ void COORDINATE::setCoordinatesNames(string * 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 */ @@ -66,15 +123,15 @@ void COORDINATE::setCoordinatesUnits(string * CoordinateUnit) 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) */ diff --git a/src/MEDMEM/MEDMEM_Coordinate.hxx b/src/MEDMEM/MEDMEM_Coordinate.hxx index c2f1fd916..e65517fc8 100644 --- a/src/MEDMEM/MEDMEM_Coordinate.hxx +++ b/src/MEDMEM/MEDMEM_Coordinate.hxx @@ -8,6 +8,7 @@ #include +#include "MEDMEM_PointerOf.hxx" #include "MEDMEM_Exception.hxx" #include "MEDMEM_define.hxx" //using namespace MED_EN; @@ -27,13 +28,22 @@ protected: // int _numberOfNodes; /*! array of size spaceDimension*NumberOfNodes */ - MEDARRAY* _coordinate; + //PointerOf< MEDARRAY > _coordinate; + //bool _allocateCoordinate; + MEDARRAY* _coordinate; + /*! array of size spaceDimension */ - string * _coordinateName; + PointerOf _coordinateName; + //string * _coordinateName; + /*! array of size spaceDimension */ - string * _coordinateUnit; + PointerOf _coordinateUnit; + //string * _coordinateUnit; + /*! array of size NumberOfNodes : optionnal nodes numbers */ - int * _nodeNumber; + PointerOf _nodeNumber; + //int * _nodeNumber; + public : @@ -43,14 +53,17 @@ public : COORDINATE(); COORDINATE(medModeSwitch Mode,int SpaceDimension, int NumberOfNodes); + COORDINATE(const COORDINATE & m); ~COORDINATE(); void setCoordinates(MEDARRAY *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); diff --git a/src/MEDMEM/MEDMEM_DriversDef.cxx b/src/MEDMEM/MEDMEM_DriversDef.cxx index 6e3aa4efd..aaeb69ba5 100644 --- a/src/MEDMEM/MEDMEM_DriversDef.cxx +++ b/src/MEDMEM/MEDMEM_DriversDef.cxx @@ -1,3 +1,4 @@ +using namespace std; #include "MEDMEM_DriversDef.hxx" namespace MED_FR { diff --git a/src/MEDMEM/MEDMEM_Exception.cxx b/src/MEDMEM/MEDMEM_Exception.cxx index b43b726a3..7f37110a4 100644 --- a/src/MEDMEM/MEDMEM_Exception.cxx +++ b/src/MEDMEM/MEDMEM_Exception.cxx @@ -1,3 +1,4 @@ +using namespace std; /* File MedException.cxx $Header$ @@ -41,26 +42,27 @@ const char *makeText( const char *text, const char *fileName, const unsigned int 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) ; @@ -115,8 +117,8 @@ MED_DRIVER_NOT_FOUND_EXCEPTION::MED_DRIVER_NOT_FOUND_EXCEPTION(const MED_DRIVER_ 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 (){}; diff --git a/src/MEDMEM/MEDMEM_Family.cxx b/src/MEDMEM/MEDMEM_Family.cxx index 9264613a8..22ff834e5 100644 --- a/src/MEDMEM/MEDMEM_Family.cxx +++ b/src/MEDMEM/MEDMEM_Family.cxx @@ -1,3 +1,4 @@ +using namespace std; /* File MEDMEM_Family.cxx $Header$ @@ -358,6 +359,43 @@ FAMILY::FAMILY(MESH* Mesh, int Identifier, string Name, int NumberOfAttribute, } }; +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 _status ? Oui @@ -144,11 +146,9 @@ void MED_MED_DRIVER::readFileStruct( void ) MESSAGE(LOC<<": Mesh n°"<setMeshName(meshName); + _ptrDriver->setId ( getId() ); + _ptrDriver->setMeshName ( meshName ); ptrMesh->addDriver(*_ptrDriver); _ptrMed->_meshes[meshName] = ptrMesh; // we create all global support (for each entity type : @@ -349,13 +349,12 @@ void MED_MED_DRIVER::readFileStruct( void ) MESSAGE("timeStepNumber :"<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 : #"<setFieldName(fieldName); - ptrField->addDriver(*ptrDriver); DT_IT_ dtIt; @@ -382,15 +381,30 @@ void MED_MED_DRIVER::readFileStruct( void ) } +// 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 & _meshes = const_cast& > (_ptrMed->_meshes); + map::const_iterator currentMesh; + + const map & _meshName = const_cast& > (_ptrMed->_meshName); + map::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() : "; @@ -410,10 +424,7 @@ void MED_MED_DRIVER::writeFrom( void) const { } 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++ ) { @@ -432,10 +443,30 @@ void MED_MED_DRIVER::writeFrom( void) const { 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 & _meshes = const_cast& > (_ptrMed->_meshes); + map::const_iterator currentMesh; + + const map & _meshName = const_cast& > (_ptrMed->_meshName); + map::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); } @@ -511,7 +542,7 @@ void MED_MED_RDWR_DRIVER::open() { 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) { diff --git a/src/MEDMEM/MEDMEM_MedMeshDriver.cxx b/src/MEDMEM/MEDMEM_MedMeshDriver.cxx index c5dde7ed0..6871d64fc 100644 --- a/src/MEDMEM/MEDMEM_MedMeshDriver.cxx +++ b/src/MEDMEM/MEDMEM_MedMeshDriver.cxx @@ -1,3 +1,4 @@ +using namespace std; #include "MEDMEM_MedMeshDriver.hxx" #include "MEDMEM_DriversDef.hxx" @@ -71,6 +72,14 @@ void MED_MESH_RDONLY_DRIVER::read(void) 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_connectivity->_type[i]) ; + } + END_OF(LOC); } @@ -869,12 +878,12 @@ void MED_MESH_RDONLY_DRIVER::buildAllGroups(vector & Groups, vector >::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++; @@ -914,7 +923,7 @@ void MED_MESH_WRONLY_DRIVER::write(void) const { 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()" )) ; @@ -995,7 +1004,7 @@ int MED_MESH_WRONLY_DRIVER::writeCoordinates() const { int dim = MEDdimLire(_medIdt, const_cast (_meshName.c_str()) ); if (dim < MED_VALID) if (MEDmaaCr(_medIdt,const_cast (_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<<" !"); @@ -1085,7 +1094,8 @@ int MED_MESH_WRONLY_DRIVER::writeConnectivities(medEntityMesh entity) const { for (int j=0 ; j0) + connectivityArray[j*(numberOfNodes+multi)+numberOfNodes]=0; } err = MEDconnEcr( _medIdt, const_cast ( _meshName.c_str()), _ptrMesh->_spaceDimension, connectivityArray, MED_FR::MED_FULL_INTERLACE , numberOfElements, @@ -1106,30 +1116,6 @@ int MED_MESH_WRONLY_DRIVER::writeConnectivities(medEntityMesh entity) const { int numberOfTypes = _ptrMesh->getNumberOfTypes (entity) ; medGeometryElement * types = _ptrMesh->getTypes (entity) ; - for (int i=0; igetNumberOfElements (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 ( _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; igetNumberOfElements (entity,types[i]); diff --git a/src/MEDMEM/MEDMEM_MedMeshDriver.hxx b/src/MEDMEM/MEDMEM_MedMeshDriver.hxx index 469f22e50..4a04f61aa 100644 --- a/src/MEDMEM/MEDMEM_MedMeshDriver.hxx +++ b/src/MEDMEM/MEDMEM_MedMeshDriver.hxx @@ -60,7 +60,7 @@ public : 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 !" diff --git a/src/MEDMEM/MEDMEM_Mesh.cxx b/src/MEDMEM/MEDMEM_Mesh.cxx index 9f41519e1..e1d079547 100644 --- a/src/MEDMEM/MEDMEM_Mesh.cxx +++ b/src/MEDMEM/MEDMEM_Mesh.cxx @@ -1,3 +1,4 @@ +using namespace std; /* File Mesh.cxx $Header$ @@ -30,7 +31,7 @@ const MESH::INSTANCE * const MESH::instances[] = { &MESH::inst_med } ; /*! Add a MESH driver of type (MED_DRIVER, ....) associated with file . The meshname used in the file is . 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\") : "; @@ -51,11 +52,11 @@ int MESH::addDriver(driverTypes driverType, } /*! 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; @@ -63,7 +64,7 @@ int MESH::addDriver(GENDRIVER & driver) { } /*! 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); @@ -211,7 +212,7 @@ MESH & MESH::operator=(const MESH &m) /*! Create a MESH object using a MESH driver of type (MED_DRIVER, ....) associated with file . The meshname 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; @@ -299,7 +300,11 @@ ostream & operator<<(ostream &os, MESH &myMesh) } /*! - 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) { @@ -313,8 +318,8 @@ int MESH::getElementNumber(medConnectivity ConnectivityType, medEntityMesh Entit 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] ; @@ -463,7 +468,7 @@ SUPPORT * MESH::getBoundaryElements(medEntityMesh Entity) throw (MEDEXCEPTION) mySupport->setNumberOfGeometricType(numberOfGeometricType) ; mySupport->setGeometricType(geometricType) ; mySupport->setNumberOfGaussPoint(numberOfGaussPoint) ; - mySupport->setGeometricTypeNumber(geometricTypeNumber) ; + // mySupport->setGeometricTypeNumber(geometricTypeNumber) ; mySupport->setNumberOfEntities(numberOfEntities) ; mySupport->setTotalNumberOfEntities(size) ; mySupport->setNumber(mySkyLineArray) ; diff --git a/src/MEDMEM/MEDMEM_Mesh.hxx b/src/MEDMEM/MEDMEM_Mesh.hxx index 48b5e0243..75acb39f7 100644 --- a/src/MEDMEM/MEDMEM_Mesh.hxx +++ b/src/MEDMEM/MEDMEM_Mesh.hxx @@ -14,6 +14,7 @@ #include "MEDMEM_Connectivity.hxx" #include "MEDMEM_MedMeshDriver.hxx" +#include "MEDMEM_MedMedDriver.hxx" class CELLMODEL; class FAMILY; @@ -127,6 +128,7 @@ public : friend class MED_MESH_RDONLY_DRIVER; friend class MED_MESH_WRONLY_DRIVER; + friend class MED_MED_DRIVER; void init(); MESH(); @@ -138,14 +140,15 @@ public : 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() ; @@ -183,8 +186,8 @@ public : 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 getFamilies(medEntityMesh Entity); @@ -192,8 +195,7 @@ public : inline int getNumberOfGroups(medEntityMesh Entity); inline vector 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; @@ -209,7 +211,9 @@ public : // 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); @@ -229,7 +233,7 @@ inline void MESH::read(int index=0) } /*! Write all the content of the MESH using driver referenced by the handler */ -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); @@ -251,9 +255,9 @@ inline void MESH::write(int index=0, const string & driverName = "") // 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++ ) @@ -268,6 +272,25 @@ inline void MESH::write(const GENDRIVER & genDriver) } +// 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) { @@ -345,8 +368,15 @@ inline string * MESH::getCoordinatesUnits() // } /*! 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) { @@ -361,13 +391,17 @@ 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 !")); @@ -375,6 +409,7 @@ inline medGeometryElement * MESH::getTypes(medEntityMesh entity) /*! 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) @@ -384,9 +419,15 @@ 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) { @@ -394,6 +435,17 @@ 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) : " ; @@ -410,6 +462,10 @@ inline int MESH::getNumberOfElements(medEntityMesh entity, medGeometryElement Ty 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) @@ -417,7 +473,7 @@ inline bool MESH::existConnectivity(medConnectivity connectivityType, medEntityM 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). */ @@ -427,6 +483,11 @@ inline medGeometryElement MESH::getElementType(medEntityMesh Entity,int Number) 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) @@ -434,31 +495,67 @@ inline void MESH::calculateConnectivity(medModeSwitch Mode,medConnectivity Conne 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) ; } diff --git a/src/MEDMEM/MEDMEM_PointerOf.hxx b/src/MEDMEM/MEDMEM_PointerOf.hxx new file mode 100644 index 000000000..dc5744547 --- /dev/null +++ b/src/MEDMEM/MEDMEM_PointerOf.hxx @@ -0,0 +1,118 @@ +# if ! defined( __PointerOf_HXX__ ) +# define __PointerOf_HXX__ + +#include +#include "utilities.h" + +/*! + The template class PointerOf embedding a standard pointer (_pointer) is in charge of + managing a the pointed memory. +*/ + +template 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& operator=( const PointerOf &pointer ) ; +} ; + +template PointerOf& PointerOf::operator=( const PointerOf &pointer ) +{ + BEGIN_OF("PointerOf::operator=( const PointerOf &pointer )") ; + if ( &pointer != this ) + { + this->set( pointer._pointer ) ; + } + END_OF("PointerOf::operator=( const PointerOf &pointer )") ; + return *this ; +} + +template PointerOf::PointerOf() : _pointer(0), _done(false) +{ +} + +template PointerOf::PointerOf( const int &size ) : _pointer( new T[ size ]), _done(true) +{ +} + +template PointerOf::PointerOf( const T* pointer ) : _pointer( (T*)pointer ), _done(false) +{ +} + +template PointerOf::~PointerOf() +{ + if ( _pointer ) + { + if( _done ) + { + MESSAGE("PointerOf::~PointerOf() --> deleting _pointer") ; + delete [] _pointer ; + _done = false ; + } + else + { + MESSAGE("_pointer is only nullified") ; + } + _pointer = 0 ; + } +} + +template PointerOf::operator T*() +{ + return _pointer ; +} + +template PointerOf::operator const T*() const +{ + return _pointer ; +} + +// template PointerOf::operator T*() const +// { +// return _pointer ; +// } + +template void PointerOf::set( const int &size ) +{ + ASSERT(size>0) ; + if ( _pointer && _done ) + { + delete [] _pointer ; + _pointer=0 ; + } + _pointer = new T[ size ] ; + _done = true ; + return ; +} +template void PointerOf::set( const T *pointer ) +{ + MESSAGE( "PointerOf::set( const T *pointer )" ) ; + SCRUTE(pointer) ; + SCRUTE(_done) ; + if ( _pointer && _done ) + { + MESSAGE("PointerOf::set --> deleting _pointer") ; + delete [] _pointer ; + _pointer=0 ; + _done=false ; + } + _pointer=(T*)pointer ; + _done=false ; + MESSAGE( "PointerOf::set( const T *pointer )" ) ; + return ; +} + +# endif /* # if ! defined( __PointerOf_HXX__ ) */ diff --git a/src/MEDMEM/MEDMEM_STRING.hxx b/src/MEDMEM/MEDMEM_STRING.hxx index 8920f5de3..e53df0db6 100644 --- a/src/MEDMEM/MEDMEM_STRING.hxx +++ b/src/MEDMEM/MEDMEM_STRING.hxx @@ -2,31 +2,47 @@ # define STRING_HXX # include -# include +//# include +# include 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 STRING( const T &valeur ) : _s() - { - _s << valeur ; - } - template STRING &operator<<( const T &valeur ) - { - _s << valeur ; - return *this ; - } + + operator const char * () const { + return const_cast (this->c_str()) ; + } + + ~STRING() + { + _s.freeze(false); + } + + STRING() :string() , _s() + { + } + + template STRING( const T &valeur ) : string() , _s() + { + _s.freeze(false); + _s << valeur ; + this->string::operator =( _s.str()); // freeze is true by now + } + + template 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 diff --git a/src/MEDMEM/MEDMEM_SkyLineArray.cxx b/src/MEDMEM/MEDMEM_SkyLineArray.cxx index e1e5fb60f..160427402 100644 --- a/src/MEDMEM/MEDMEM_SkyLineArray.cxx +++ b/src/MEDMEM/MEDMEM_SkyLineArray.cxx @@ -1,3 +1,4 @@ +using namespace std; #include "MEDMEM_SkyLineArray.hxx" #include "utilities.h" @@ -7,32 +8,29 @@ MEDSKYLINEARRAY::MEDSKYLINEARRAY(): _count(0), _length(0), 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="< _index ; // array of size _count+1 : _index[0]=1 and + // _index[_count]=length+1 + PointerOf _value ; // array of size _length public : MEDSKYLINEARRAY(); @@ -26,10 +27,10 @@ public : 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) ; } ; @@ -45,13 +46,13 @@ inline med_int MEDSKYLINEARRAY::getLength() const { 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) { @@ -61,7 +62,7 @@ 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"); diff --git a/src/MEDMEM/MEDMEM_Support.cxx b/src/MEDMEM/MEDMEM_Support.cxx index 4ba9918b3..7280e9fd2 100644 --- a/src/MEDMEM/MEDMEM_Support.cxx +++ b/src/MEDMEM/MEDMEM_Support.cxx @@ -1,3 +1,4 @@ +using namespace std; /* File Support.cxx $Header$ @@ -31,7 +32,7 @@ SUPPORT::SUPPORT(): _name(""), _description(""), _mesh((MESH*)NULL), }; //-------------------------------------------------------------------------- -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), @@ -50,6 +51,56 @@ SUPPORT::SUPPORT(MESH* Mesh, string Name="", medEntityMesh Entity=MED_CELL): } }; +//-------------------------------------------------------------------------- +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() //----------------- @@ -78,6 +129,23 @@ ostream & operator<<(ostream &os, const SUPPORT &my) 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 : "<getI(j+1) ; + for (int k=0; kgetEntity() ) throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"Entities are different !")); @@ -164,14 +234,21 @@ void SUPPORT::blending(SUPPORT * mySupport) 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 -#include -#include +#include +#include #include // UTILE AUX DEUX NAMESPACES diff --git a/src/MEDMEM/Makefile.in b/src/MEDMEM/Makefile.in index 9e09ab0ba..3e7bf88f4 100644 --- a/src/MEDMEM/Makefile.in +++ b/src/MEDMEM/Makefile.in @@ -19,6 +19,7 @@ EXPORT_PYSCRIPTS = \ EXPORT_HEADERS = \ +MEDMEM_PointerOf.hxx \ MEDMEM_CellModel.hxx \ MEDMEM_Connectivity.hxx \ MEDMEM_Coordinate.hxx \ @@ -68,12 +69,15 @@ MEDMEM_Unit.cxx \ # 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 diff --git a/src/MEDMEM/duplicateMED.cxx b/src/MEDMEM/duplicateMED.cxx index c115b6c15..b20b21118 100644 --- a/src/MEDMEM/duplicateMED.cxx +++ b/src/MEDMEM/duplicateMED.cxx @@ -1,3 +1,4 @@ +using namespace std; #include #include @@ -10,11 +11,6 @@ #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) { diff --git a/src/MEDMEM/duplicateMEDMESH.cxx b/src/MEDMEM/duplicateMEDMESH.cxx index 5deef78eb..e30383ce5 100644 --- a/src/MEDMEM/duplicateMEDMESH.cxx +++ b/src/MEDMEM/duplicateMEDMESH.cxx @@ -1,3 +1,4 @@ +using namespace std; #include #include diff --git a/src/MEDMEM/med_test.cxx b/src/MEDMEM/med_test.cxx index fb8d3596a..9fbf88a8a 100644 --- a/src/MEDMEM/med_test.cxx +++ b/src/MEDMEM/med_test.cxx @@ -1,3 +1,4 @@ +using namespace std; #include #include @@ -23,57 +24,57 @@ double infty = 1.e20; void affiche_support(SUPPORT * mySupport) { - MESSAGE( " - Name : "<getName().c_str()); - MESSAGE( " - Description : "<getDescription().c_str()); - MESSAGE( " - Entity : "<getEntity()); - MESSAGE( " - Entities list : "); + cout << " - Name : "<getName().c_str()<getDescription().c_str()<getEntity()<isOnAllElements())) { int NumberOfTypes = mySupport->getNumberOfTypes() ; - MESSAGE(" - NumberOfTypes : "<getTypes() ; for (int j=0;jgetNumberOfElements(Types[j]) ; int * Number = mySupport->getNumber(Types[j]) ; for (int k=0; kgetNumberOfFamilies(Entity) ; - MESSAGE( "NumberOfFamilies : "<getFamily(Entity,i); affiche_support(myFamily); - MESSAGE( " - Identifier : "<getIdentifier()); + cout << " - Identifier : "<getIdentifier()<getNumberOfAttributes() ; - MESSAGE( " - Attributes ("<getAttributeIdentifier(j)<<" : "<getAttributeValue(j)<<", "<getAttributeDescription(j).c_str()); + cout << " * "<getAttributeIdentifier(j)<<" : "<getAttributeValue(j)<<", "<getAttributeDescription(j).c_str()<getNumberOfGroups() ; - MESSAGE( " - Groups ("<getGroupName(j).c_str()); + cout << " * "<getGroupName(j).c_str()<getNumberOfGroups(Entity) ; - MESSAGE( "NumberOfGroups : "<getGroup(Entity,i); affiche_support(myGroup); int NumberOfFamillies = myGroup->getNumberOfFamilies() ; - MESSAGE( " - Families ("<getFamily(j)->getName().c_str()); + cout << " * "<getFamily(j)->getName().c_str()<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; igetCoordinatesUnits() ; for(int i=0; igetNumberOfTypes(MED_CELL) ; medGeometryElement * Types = myMesh->getTypes(MED_CELL) ; - MESSAGE( "Show Connectivity (Nodal) :" ); + cout << "Show Connectivity (Nodal) :" << endl ; for (int i=0; igetNumberOfElements(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;jgetReverseConnectivity(MED_NODAL) ; int * ReverseNodalConnectivityIndex = myMesh->getReverseConnectivityIndex(MED_NODAL) ; for (int i=0; igetConnectivityIndex(MED_DESCENDING,MED_CELL); } catch (MEDEXCEPTION m) { - MESSAGE( m.what() ); + cout << m.what() << endl ; exit (-1) ; } for (int j=0;jgetReverseConnectivity(MED_DESCENDING) ; int * ReverseDescendingConnectivityIndex = myMesh->getReverseConnectivityIndex(MED_DESCENDING) ; @@ -216,20 +217,20 @@ int main (int argc, char ** argv) { } else { NumberOfConstituents = myMesh->getNumberOfElements (constituentEntity,MED_ALL_ELEMENTS); for (int i=0; igetConnectivity(MED_FULL_INTERLACE,MED_NODAL,constituentEntity,MED_ALL_ELEMENTS); int * face_connectivity_index = myMesh->getConnectivityIndex(MED_NODAL,constituentEntity); for (int i=0; igetNormal(support1); @@ -256,23 +257,23 @@ int main (int argc, char ** argv) { 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); @@ -282,17 +283,17 @@ int main (int argc, char ** argv) { 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* barycenter = new FIELD::FIELD(); @@ -302,10 +303,10 @@ int main (int argc, char ** argv) { 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* volume = new FIELD::FIELD(); @@ -315,7 +316,7 @@ int main (int argc, char ** argv) { 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); @@ -325,22 +326,22 @@ int main (int argc, char ** argv) { 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; @@ -348,14 +349,14 @@ int main (int argc, char ** argv) { 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; @@ -398,33 +399,33 @@ int main (int argc, char ** argv) { myFieldDriver.close() ; - MESSAGE( "Field "<< myField->getName() << " : " <getDescription() ); + cout << "Field "<< myField->getName() << " : " <getDescription() << endl ; int NumberOfComponents = myField->getNumberOfComponents() ; - MESSAGE( "- Nombre de composantes : "<< NumberOfComponents ); + cout << "- Nombre de composantes : "<< NumberOfComponents << endl ; for (int i=1; igetComponentName(i)); - MESSAGE( " - description : "<getComponentDescription(i) ); - MESSAGE( " - units : "<getMEDComponentUnit(i) ); + cout << " - composante "<getComponentName(i)<< endl; + cout << " - description : "<getComponentDescription(i) << endl; + cout << " - units : "<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 :"<getNumberOfElements(MED_ALL_ELEMENTS); // for (int i=1; igetValueI(MED_NO_INTERLACE,i) ; // for (int j=0; jgetValueI(MED_FULL_INTERLACE,i) ; for (int j=0; jgetLeadingValue() ; for (int i=1; i<=myArray->getLengthValue() ; i++) { int * node = myArray->getI(MED_FULL_INTERLACE,i) ; - MESSAGE( " - " ); + cout << " - " ; for (int j=0;jgetLengthValue() ; for (int i=1; i<=myArray->getLeadingValue() ; i++) { int * node = myArray->getI(MED_NO_INTERLACE,i) ; - MESSAGE( " - " ); + cout << " - " ; for (int j=0;jgetLeadingValue() ; for (int i=1; i<=myArray->getLengthValue() ; i++) { - MESSAGE( " - " ); + cout << " - " ; for (int j=1;jgetIJ(i,j) << " " ); - MESSAGE(""); + cout << myArray->getIJ(i,j) << " " ; + cout << endl ; } MESSAGE("Show all 0 :"); @@ -44,10 +45,10 @@ int main (int argc, char ** argv) { int length = myArray->getLengthValue() ; int * NoInterlaceArray = myArray->get(MED_NO_INTERLACE) ; for (int i=0; igetI(i) ; int numberof = myArray->getNumberOfI(i) ; - MESSAGE( " - " ); + cout << " - " ; for (int j=0;jgetNumberOfI(i) ; for (int j=1;jgetIJ(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; igetI(i) ; int numberof = myArray2->getNumberOfI(i) ; - MESSAGE( " - " ); + cout << " - " ; for (int j=0;j + +#include +#include + +#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 & 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 * myMedArray = new MEDARRAY(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 * myMedArray2 = new MEDARRAY(); + * myMedArray2 = * myMedArray; + delete myMedArray; + affiche_medarray(* myMedArray2); + delete myMedArray2; + + return 0; +} diff --git a/src/MEDMEM/test_copie_connectivity.cxx b/src/MEDMEM/test_copie_connectivity.cxx new file mode 100644 index 000000000..4b94dcb17 --- /dev/null +++ b/src/MEDMEM/test_copie_connectivity.cxx @@ -0,0 +1,144 @@ +using namespace std; +/* Programme de test du constructeur de copies de la classe CONNECTIVITY de MEDMEM + jroy - 19/12/2002 */ + +#include + +#include +#include + +#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; igetNumberOfElements(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;jgetReverseConnectivity(MED_NODAL) ; + int * ReverseNodalConnectivityIndex = myMesh->getReverseConnectivityIndex(MED_NODAL) ; + for (int i=0; icalculateConnectivity(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;jgetReverseConnectivity(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; igetConnectivity(MED_FULL_INTERLACE,MED_NODAL,constituentEntity,MED_ALL_ELEMENTS); + int * face_connectivity_index = myMesh->getConnectivityIndex(MED_NODAL,constituentEntity); + for (int i=0; isetName(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; +} diff --git a/src/MEDMEM/test_copie_coordinate.cxx b/src/MEDMEM/test_copie_coordinate.cxx new file mode 100644 index 000000000..56e2ea1e2 --- /dev/null +++ b/src/MEDMEM/test_copie_coordinate.cxx @@ -0,0 +1,110 @@ +using namespace std; +/* Programme de test du constructeur de copies de la classe COORDINATE de MEDMEM + jroy - 17/12/2002 */ + +#include + +#include +#include + +#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; igetLeadingValue(); + //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< * myMedArray = new MEDARRAY(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; isetCoordinates(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; +} diff --git a/src/MEDMEM/test_copie_family.cxx b/src/MEDMEM/test_copie_family.cxx new file mode 100644 index 000000000..047ef2c94 --- /dev/null +++ b/src/MEDMEM/test_copie_family.cxx @@ -0,0 +1,126 @@ +using namespace std; +#include + +#include +#include + +#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 : "<getName().c_str()<getDescription().c_str()<getEntity()<isOnAllElements())) { + int NumberOfTypes = mySupport->getNumberOfTypes() ; + cout<<" - NumberOfTypes : "<getTypes() ; + for (int j=0;jgetNumberOfElements(Types[j]) ; + int * Number = mySupport->getNumber(Types[j]) ; + for (int k=0; kgetIdentifier()<getNumberOfAttributes() ; + cout << " - Attributes ("<getAttributeIdentifier(j)<<" : "<getAttributeValue(j)<<", "<getAttributeDescription(j).c_str()<getNumberOfGroups() ; + cout << " - Groups ("<getGroupName(j).c_str()<getNumberOfGroups(Entity) ; + cout << "NumberOfGroups : "<getGroup(Entity,i); + affiche_support(myGroup); + int NumberOfFamillies = myGroup->getNumberOfFamilies() ; + cout << " - Families ("<getFamily(j)->getName().c_str()<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;isetNumberOfAttributes(NumberOfAttribute); + myFamily->setAttributesIdentifiers (AttributeIdentifier); + myFamily->setAttributesValues (AttributeValue); + myFamily->setAttributesDescriptions (AttributeDescription); + + cout << "Show Family :"< + +#include +#include + +#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() << " : " <getDescription() << endl ; + int NumberOfComponents = myField->getNumberOfComponents() ; + cout << "- Nombre de composantes : "<< NumberOfComponents << endl ; + for (int i=1; igetComponentName(i)<< endl; + cout << " - description : "<getComponentDescription(i) << endl; + cout << " - units : "<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 * myField, const SUPPORT * mySupport) +{ + affiche_field_((FIELD_ *) myField, mySupport); + + cout << "- Valeurs :"<getNumberOfElements(MED_ALL_ELEMENTS); + int NumberOfComponents = myField->getNumberOfComponents() ; + + for (int i=1; igetValueI(MED_FULL_INTERLACE,i) ; + for (int j=0; jsetName(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 * myField = new FIELD() ; + + myField->setName(fieldname); + myField->setSupport(mySupport); + MED_FIELD_RDONLY_DRIVER 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 * myField2 = new FIELD(* myField); + delete myField; + affiche_fieldT(myField2, myField2->getSupport()); + delete myField2; + + return 0; +} diff --git a/src/MEDMEM/test_copie_field_.cxx b/src/MEDMEM/test_copie_field_.cxx new file mode 100644 index 000000000..ac68a0b25 --- /dev/null +++ b/src/MEDMEM/test_copie_field_.cxx @@ -0,0 +1,125 @@ +using namespace std; +/* Programme de test du constructeur de copies de la classe FIELD_ de MEDMEM + jroy - 12/12/2002 */ + +#include + +#include +#include + +#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() << " : " <getDescription() << endl ; + int NumberOfComponents = myField->getNumberOfComponents() ; + cout << "- Nombre de composantes : "<< NumberOfComponents << endl ; + for (int i=1; igetComponentName(i)<< endl; + cout << " - description : "<getComponentDescription(i) << endl; + cout << " - units : "<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 :"<getNumberOfElements(MED_ALL_ELEMENTS); + + for (int i=1; igetValueI(MED_FULL_INTERLACE,i) ; + for (int j=0; jsetName(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 * myField = new FIELD() ; + + myField->setName(fieldname); + myField->setSupport(mySupport); + MED_FIELD_RDONLY_DRIVER 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; +} diff --git a/src/MEDMEM/test_copie_group.cxx b/src/MEDMEM/test_copie_group.cxx new file mode 100644 index 000000000..3238ea150 --- /dev/null +++ b/src/MEDMEM/test_copie_group.cxx @@ -0,0 +1,95 @@ +using namespace std; +#include + +#include +#include + +#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 : "<getName().c_str()<getDescription().c_str()<getEntity()<isOnAllElements())) { + int NumberOfTypes = mySupport->getNumberOfTypes() ; + cout<<" - NumberOfTypes : "<getTypes() ; + for (int j=0;jgetNumberOfElements(Types[j]) ; + int * Number = mySupport->getNumber(Types[j]) ; + for (int k=0; kgetIdentifier()<getNumberOfAttributes() ; + cout << " - Attributes ("<getAttributeIdentifier(j)<<" : "<getAttributeValue(j)<<", "<getAttributeDescription(j).c_str()<getNumberOfGroups() ; + cout << " - Groups ("<getGroupName(j).c_str()<getNumberOfFamilies() ; + cout << " - Families ("<getFamily(j)->getName().c_str()<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 :"< + +#include +#include + +#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 & 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 * myMedArray = new MEDARRAY(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 * myMedArray2 = new MEDARRAY(* myMedArray); + delete myMedArray; + affiche_medarray(* myMedArray2); + delete myMedArray2; + + return 0; +} diff --git a/src/MEDMEM/test_copie_support.cxx b/src/MEDMEM/test_copie_support.cxx new file mode 100644 index 000000000..7256e5e67 --- /dev/null +++ b/src/MEDMEM/test_copie_support.cxx @@ -0,0 +1,161 @@ +using namespace std; +#include + +#include +#include + +#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 : "<getName().c_str()<getDescription().c_str()<getEntity()<isOnAllElements())) { + int NumberOfTypes = mySupport->getNumberOfTypes() ; + cout<<" - NumberOfTypes : "<getTypes() ; + for (int j=0;jgetNumberOfElements(Types[j]) ; + int * Number = mySupport->getNumber(Types[j]) ; + for (int k=0; kgetNumberOfFamilies(Entity) ; + cout << "NumberOfFamilies : "<getFamily(Entity,i); + affiche_support(myFamily); + cout << " - Identifier : "<getIdentifier()<getNumberOfAttributes() ; + cout << " - Attributes ("<getAttributeIdentifier(j)<<" : "<getAttributeValue(j)<<", "<getAttributeDescription(j).c_str()<getNumberOfGroups() ; + cout << " - Groups ("<getGroupName(j).c_str()<getNumberOfGroups(Entity) ; + cout << "NumberOfGroups : "<getGroup(Entity,i); + affiche_support(myGroup); + int NumberOfFamillies = myGroup->getNumberOfFamilies() ; + cout << " - Families ("<getFamily(j)->getName().c_str()<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 :"<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;igetNumberOfTypes(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;jgetNumberOfElements(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 :"< ( * (FIELD *)(field)) +//============================================================================= +/*! + * Another constructor with arguments + */ +//============================================================================= +FIELDDOUBLE::FIELDDOUBLE(const SUPPORT * Support, driverTypes driverType, + const string & fileName, + const string & fieldName) : + FIELD(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 diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.hxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.hxx index 6565c0a24..8f28a842f 100644 --- a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.hxx +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.hxx @@ -8,6 +8,8 @@ class FIELDDOUBLE : public FIELD public: FIELDDOUBLE(); FIELDDOUBLE(const SUPPORT * Support, const int NumberOfComponents); + FIELDDOUBLE(const SUPPORT * Support, driverTypes driverType, + const string & fileName="", const string & fieldName=""); ~FIELDDOUBLE(); }; diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.cxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.cxx index 23ce96aef..da52d1083 100644 --- a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.cxx +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.cxx @@ -1,3 +1,4 @@ +using namespace std; #include "MEDMEM_SWIG_FieldInt.hxx" //============================================================================= @@ -26,15 +27,20 @@ FIELDINT::FIELDINT(const SUPPORT * Support, const int NumberOfComponents) : FIEL END_OF("Constructor with arguments (for Python API) FIELDINT"); } -/* -FIELDINT::FIELDINT(FIELD_ * field) - : FIELD ( * (FIELD *) (field)) +//============================================================================= +/*! + * Another constructor with arguments + */ +//============================================================================= +FIELDINT::FIELDINT(const SUPPORT * Support, driverTypes driverType, + const string & fileName, + const string & fieldName) : + FIELD(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 diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.hxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.hxx index 215578a2b..e84e53466 100644 --- a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.hxx +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.hxx @@ -8,6 +8,8 @@ class FIELDINT : public FIELD public: FIELDINT(); FIELDINT(const SUPPORT * Support, const int NumberOfComponents); + FIELDINT(const SUPPORT * Support, driverTypes driverType, + const string & fileName="", const string & fieldName=""); ~FIELDINT(); }; diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.cxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.cxx new file mode 100644 index 000000000..8b662aee8 --- /dev/null +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.cxx @@ -0,0 +1,147 @@ +using namespace std; +#include "MEDMEM_SWIG_MedFieldDoubleDriver.hxx" + +//============================================================================= +/*! + * Default constructor + */ +//============================================================================= +MED_FIELDDOUBLE_DRIVER::MED_FIELDDOUBLE_DRIVER() : MED_FIELD_DRIVER() +{ + 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(fileName,(FIELD *) 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() +{ + 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(fileName,(FIELD *) 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() +{ + 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(fileName,(FIELD *) 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() +{ + 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(fileName,(FIELD *) 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"); +} diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.hxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.hxx new file mode 100644 index 000000000..65e5d6573 --- /dev/null +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.hxx @@ -0,0 +1,51 @@ +#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 +{ +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 +{ +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 +{ +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 +{ +public: + MED_FIELDDOUBLE_RDWR_DRIVER(); + + MED_FIELDDOUBLE_RDWR_DRIVER(const string & fileName, + FIELDDOUBLE * ptrField); + + ~MED_FIELDDOUBLE_RDWR_DRIVER(); +}; + +#endif /* MEDMEM_SWIG_MEDFIELDDOUBLEDRIVER_HXX_ */ diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.cxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.cxx new file mode 100644 index 000000000..87b25165d --- /dev/null +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.cxx @@ -0,0 +1,147 @@ +using namespace std; +#include "MEDMEM_SWIG_MedFieldIntDriver.hxx" + +//============================================================================= +/*! + * Default constructor + */ +//============================================================================= +MED_FIELDINT_DRIVER::MED_FIELDINT_DRIVER() : MED_FIELD_DRIVER() +{ + 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(fileName,(FIELD *) 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() +{ + 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(fileName,(FIELD *) 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() +{ + 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(fileName,(FIELD *) 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() +{ + 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(fileName,(FIELD *) 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"); +} diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.hxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.hxx new file mode 100644 index 000000000..bb43c893f --- /dev/null +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.hxx @@ -0,0 +1,51 @@ +#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 +{ +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 +{ +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 +{ +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 +{ +public: + MED_FIELDINT_RDWR_DRIVER(); + + MED_FIELDINT_RDWR_DRIVER(const string & fileName, + FIELDINT * ptrField); + + ~MED_FIELDINT_RDWR_DRIVER(); +}; + +#endif /* MEDMEM_SWIG_MEDFIELDINTDRIVER_HXX_ */ diff --git a/src/MEDMEM_SWIG/Makefile.in b/src/MEDMEM_SWIG/Makefile.in index 4d4b0a409..41136298a 100644 --- a/src/MEDMEM_SWIG/Makefile.in +++ b/src/MEDMEM_SWIG/Makefile.in @@ -16,14 +16,19 @@ EXPORT_HEADERS = \ 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 diff --git a/src/MEDMEM_SWIG/libMEDMEM_Swig.i b/src/MEDMEM_SWIG/libMEDMEM_Swig.i index 15550ed89..166f1992d 100644 --- a/src/MEDMEM_SWIG/libMEDMEM_Swig.i +++ b/src/MEDMEM_SWIG/libMEDMEM_Swig.i @@ -26,6 +26,8 @@ #include "MEDMEM_MedMedDriver.hxx" #include "MEDMEM_SWIG_FieldDouble.hxx" #include "MEDMEM_SWIG_FieldInt.hxx" +#include "MEDMEM_SWIG_MedFieldDoubleDriver.hxx" +#include "MEDMEM_SWIG_MedFieldIntDriver.hxx" %} /* @@ -55,7 +57,7 @@ typedef enum {MED_REEL64=6, MED_INT32=24, MED_INT64=26, typedef struct { int dt; int it; } DT_IT_; -%extend DT_IT_ { +%addmethods DT_IT_ { int getdt() { return self->dt; @@ -70,7 +72,23 @@ typedef struct { int dt; int it; } DT_IT_; 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 { @@ -100,13 +118,13 @@ 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); @@ -168,6 +186,7 @@ class SUPPORT return Py_BuildValue("O", py_list); } + /* PyObject * getGeometricTypeNumber() { PyObject *py_list; @@ -189,6 +208,7 @@ class SUPPORT } return Py_BuildValue("O", py_list); } + */ PyObject * getNumber(medGeometryElement GeometricType) { @@ -257,7 +277,7 @@ class FAMILY : public SUPPORT 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, @@ -357,7 +377,7 @@ public: void setNumberOfComponents(int NumberOfComponents); int getNumberOfComponents() const; - %extend { + %addmethods { int addDriver(driverTypes driverType, char * fileName="Default File Name.med", char * driverName="Default Field Name") @@ -440,6 +460,16 @@ public: FIELDDOUBLE(const SUPPORT * Support, const int NumberOfComponents); + /* + WARNING: + other constructor of FIELDDOUBLE (C++ FIELD) 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; @@ -454,14 +484,15 @@ public: 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="") { @@ -531,6 +562,19 @@ public: FIELDINT(const SUPPORT * Support, const int NumberOfComponents); + /* + WARNING: + other constructor of FIELDINT (C++ FIELD) 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; @@ -545,12 +589,13 @@ public: 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)); } */ @@ -631,7 +676,17 @@ public: 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); @@ -654,6 +709,8 @@ class MESH int getElementNumber(medConnectivity ConnectivityType, medEntityMesh Entity, medGeometryElement Type, int * connectivity); + CELLMODEL * getCellsTypes(medEntityMesh Entity); + FAMILY* getFamily(medEntityMesh Entity,int i); int getNumberOfGroups(medEntityMesh Entity); @@ -664,7 +721,17 @@ class MESH 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") @@ -714,6 +781,47 @@ class MESH 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; @@ -927,13 +1035,36 @@ class MED ~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 list_string = self->getMeshNames(); @@ -992,7 +1123,7 @@ class MED_MED_DRIVER 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); @@ -1009,7 +1140,7 @@ class MED_MED_RDONLY_DRIVER : public virtual MED_MED_DRIVER 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); @@ -1026,7 +1157,7 @@ class MED_MED_WRONLY_DRIVER : public virtual MED_MED_DRIVER 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); @@ -1047,7 +1178,7 @@ class MED_MED_RDWR_DRIVER : public virtual MED_MED_RDONLY_DRIVER, 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); @@ -1062,21 +1193,17 @@ class MED_MED_RDWR_DRIVER : public virtual MED_MED_RDONLY_DRIVER, /* 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) { @@ -1099,8 +1226,7 @@ class MED_MESH_DRIVER }; */ -class MED_MESH_RDONLY_DRIVER -// : public virtual MED_MESH_DRIVER +class MED_MESH_RDONLY_DRIVER : public virtual MED_MESH_DRIVER { public : @@ -1116,20 +1242,36 @@ class MED_MESH_RDONLY_DRIVER 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 : @@ -1140,22 +1282,44 @@ class MED_MESH_WRONLY_DRIVER ~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 & 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 : @@ -1166,13 +1330,313 @@ class MED_MESH_RDWR_DRIVER : public MED_MESH_RDONLY_DRIVER, public MED_MESH_WRON ~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; + } } }; diff --git a/src/MEDMEM_SWIG/my_typemap.i b/src/MEDMEM_SWIG/my_typemap.i index c183ed863..b1938597a 100644 --- a/src/MEDMEM_SWIG/my_typemap.i +++ b/src/MEDMEM_SWIG/my_typemap.i @@ -5,17 +5,17 @@ %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; } } @@ -30,17 +30,17 @@ %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; } } @@ -56,17 +56,17 @@ %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; } } @@ -83,7 +83,7 @@ int i; list::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())); } diff --git a/src/MedMem/Family_i.cxx b/src/MedMem/Family_i.cxx index 90449209c..3715207e1 100644 --- a/src/MedMem/Family_i.cxx +++ b/src/MedMem/Family_i.cxx @@ -1,3 +1,4 @@ +using namespace std; //============================================================================= // File : Family_i.cxx // Project : SALOME diff --git a/src/MedMem/FieldDouble_i.cxx b/src/MedMem/FieldDouble_i.cxx index 535094feb..bdbea873e 100644 --- a/src/MedMem/FieldDouble_i.cxx +++ b/src/MedMem/FieldDouble_i.cxx @@ -1,3 +1,4 @@ +using namespace std; //============================================================================= // File : Fielddouble_i.hxx // Project : SALOME diff --git a/src/MedMem/FieldInt_i.cxx b/src/MedMem/FieldInt_i.cxx index 691250453..ddb75d3e1 100644 --- a/src/MedMem/FieldInt_i.cxx +++ b/src/MedMem/FieldInt_i.cxx @@ -1,3 +1,4 @@ +using namespace std; //============================================================================= // File : Fieldint_i.hxx // Project : SALOME diff --git a/src/MedMem/Field_i.cxx b/src/MedMem/Field_i.cxx index a4c941c85..93e640872 100644 --- a/src/MedMem/Field_i.cxx +++ b/src/MedMem/Field_i.cxx @@ -1,3 +1,4 @@ +using namespace std; //============================================================================= // File : Field_i.cxx // Created : mer fév 20 15:47:57 CET 2002 diff --git a/src/MedMem/Group_i.cxx b/src/MedMem/Group_i.cxx index d9e89d87e..bd531e87c 100644 --- a/src/MedMem/Group_i.cxx +++ b/src/MedMem/Group_i.cxx @@ -1,3 +1,4 @@ +using namespace std; //============================================================================= // File : Group_i.cxx // Project : SALOME diff --git a/src/MedMem/Med_i.cxx b/src/MedMem/Med_i.cxx index 1ed42bc64..c1cfc9c8d 100644 --- a/src/MedMem/Med_i.cxx +++ b/src/MedMem/Med_i.cxx @@ -1,3 +1,4 @@ +using namespace std; //============================================================================= // File : Med_i.cxx // Project : SALOME @@ -201,6 +202,36 @@ void MED_i::initWithFieldType(SALOMEDS::Study_ptr myStudy,driverTypes driverType // SUPPORT : _med->updateSupport() ; + + // we add all group and family in study : + // we add all families + vector familyVector ; + vector::iterator familyVectorIt ; + // we add all groups + vector groupVector ; + vector::iterator groupVectorIt ; + + MED_FR::MESH_ENTITIES::const_iterator currentEntity; + for (int i=0; igetMesh(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 mySupports = _med->getSupports(meshesNames[i]) ; map::const_iterator itSupport ; diff --git a/src/MedMem/Mesh_i.cxx b/src/MedMem/Mesh_i.cxx index c77bfc3f4..ca28b495c 100644 --- a/src/MedMem/Mesh_i.cxx +++ b/src/MedMem/Mesh_i.cxx @@ -1,3 +1,4 @@ +using namespace std; //============================================================================= // File : Mesh_i.cxx // Project : SALOME @@ -439,7 +440,8 @@ MESSAGE("MED_NODAL"); 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); diff --git a/src/MedMem/Support_i.cxx b/src/MedMem/Support_i.cxx index e13784592..f59bb1cf9 100644 --- a/src/MedMem/Support_i.cxx +++ b/src/MedMem/Support_i.cxx @@ -1,3 +1,4 @@ +using namespace std; //============================================================================= // File : Support_i.cxx // Project : SALOME diff --git a/src/MedMem/convert.cxx b/src/MedMem/convert.cxx index bd89292d9..adc9f269f 100644 --- a/src/MedMem/convert.cxx +++ b/src/MedMem/convert.cxx @@ -1,3 +1,4 @@ +using namespace std; //============================================================================= // File : convert.cxx // Created : mer fév 20 15:47:57 CET 2002