X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FSauvMedConvertor.hxx;h=94db491416266ec0d1820625fef2d15074e6df60;hb=0b187729ac99d3e9e9bb9d2be8cb8600a783be6c;hp=f35f48bb4e0f5cd2f713fe0f01c7107ce94e1b48;hpb=5a8157e5b775f7ba2d3ce25162dd0b3320b8546f;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/SauvMedConvertor.hxx b/src/MEDLoader/SauvMedConvertor.hxx index f35f48bb4..94db49141 100644 --- a/src/MEDLoader/SauvMedConvertor.hxx +++ b/src/MEDLoader/SauvMedConvertor.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -35,7 +35,7 @@ #include #include -namespace ParaMEDMEM +namespace MEDCoupling { class DataArrayDouble; class DataArrayInt; @@ -94,7 +94,6 @@ namespace SauvUtilities std::string _name; std::vector _cells; std::vector< Group* > _groups; // des sous-groupes composant le Group - //bool _isShared; // true if any Cell was added to the mesh from other Group bool _isProfile; // is a field support or not std::vector _refNames; /* names of groups referring this one; _refNames is resized according to nb of references @@ -103,7 +102,7 @@ namespace SauvUtilities reference is converted into a copy of the medGroup (issue 0021311) */ - ParaMEDMEM::DataArrayInt* _medGroup; // result of conversion + MEDCoupling::DataArrayInt* _medGroup; // result of conversion std::vector< unsigned > _relocTable; // for _cells[i] gives its index in _medGroup bool empty() const { return _cells.empty() && _groups.empty(); } @@ -126,11 +125,11 @@ namespace SauvUtilities void setData( int nb_comp, Group* supp ) { _support = supp; _comp_names.resize(nb_comp); _nb_gauss.resize(nb_comp,1); } - int nbComponents() const { return _comp_names.size(); } + int nbComponents() const { return _comp_names.size(); } std::string & compName( int i_comp ) { return _comp_names[ i_comp ]; } - bool isValidNbGauss() const { return *std::max_element( _nb_gauss.begin(), _nb_gauss.end() ) == + bool isSameNbGauss() const { return *std::max_element( _nb_gauss.begin(), _nb_gauss.end() ) == *std::min_element( _nb_gauss.begin(), _nb_gauss.end() ); } - int nbGauss() const { return _nb_gauss[0] ? _nb_gauss[0] : 1; } + int nbGauss() const { return _nb_gauss[0] ? _nb_gauss[0] : 1; } bool hasGauss() const { return nbGauss() > 1; } }; // ---------------------------------------------------------------------------- @@ -145,7 +144,7 @@ namespace SauvUtilities is the same and supports of subcomponents do not overlap */ std::vector< std::vector< double > > _comp_values; - ParaMEDMEM::MEDFileFieldMultiTS* _curMedField; + MEDCoupling::MEDFileFieldMultiTS* _curMedField; DoubleField( int nb_sub, int total_nb_comp ) : _sub(nb_sub), _group(NULL), _curMedField(NULL) { _comp_values.reserve( total_nb_comp ); } @@ -155,14 +154,15 @@ namespace SauvUtilities bool hasSameComponentsBySupport() const; bool isMultiTimeStamps() const; - bool isMedCompatible() const; - ParaMEDMEM::TypeOfField getMedType( const int iSub=0 ) const; - ParaMEDMEM::TypeOfTimeDiscretization getMedTimeDisc() const; + bool isMedCompatible(bool& sameNbGauss) const; + MEDCoupling::TypeOfField getMedType( const int iSub=0 ) const; + MEDCoupling::TypeOfTimeDiscretization getMedTimeDisc() const; int getNbTuples( const int iSub=0 ) const; int getNbValuesPerElement( const int iSub=0 ) const; int getNbGauss( const int iSub=0 ) const; const Group* getSupport( const int iSub=0 ) const; int setValues( double * valPtr, const int iSub, const int elemShift=0 ) const; + void splitSubWithDiffNbGauss(); //virtual void dump(std::ostream&) const; //virtual ~DoubleField() {} @@ -254,24 +254,25 @@ namespace SauvUtilities Node* getNode( TID nID ) { return _points.getNode( nID ); } int getNbCellsOfType( TCellType type ) const { return _cellsByType[type].size(); } const Cell* insert(TCellType type, const Cell& ma) { return &( *_cellsByType[type].insert( ma ).first ); } - ParaMEDMEM::MEDFileData* convertInMEDFileDS(); + Group* addNewGroup(std::vector* groupsToFix=0); + MEDCoupling::MEDFileData* convertInMEDFileDS(); private: - ParaMEDMEM::MEDFileUMesh* makeMEDFileMesh(); - ParaMEDMEM::DataArrayDouble * getCoords(); - void setConnectivity( ParaMEDMEM::MEDFileUMesh* mesh, ParaMEDMEM::DataArrayDouble* coords ); - void setGroups( ParaMEDMEM::MEDFileUMesh* mesh ); - ParaMEDMEM::MEDFileFields * makeMEDFileFields(ParaMEDMEM::MEDFileUMesh* mesh); + MEDCoupling::MEDFileUMesh* makeMEDFileMesh(); + MEDCoupling::DataArrayDouble * getCoords(); + void setConnectivity( MEDCoupling::MEDFileUMesh* mesh, MEDCoupling::DataArrayDouble* coords ); + void setGroups( MEDCoupling::MEDFileUMesh* mesh ); + MEDCoupling::MEDFileFields * makeMEDFileFields(MEDCoupling::MEDFileUMesh* mesh); void setFields( SauvUtilities::DoubleField* fld, - ParaMEDMEM::MEDFileFields* medFields, - ParaMEDMEM::MEDFileUMesh* mesh, + MEDCoupling::MEDFileFields* medFields, + MEDCoupling::MEDFileUMesh* mesh, const TID castemID, std::set< std::string >& usedNames); void setTS( SauvUtilities::DoubleField* fld, - ParaMEDMEM::DataArrayDouble* values, - ParaMEDMEM::MEDFileFields* medFields, - ParaMEDMEM::MEDFileUMesh* mesh, + MEDCoupling::DataArrayDouble* values, + MEDCoupling::MEDFileFields* medFields, + MEDCoupling::MEDFileUMesh* mesh, const int iSub=0); void checkDataAvailability() const; void setGroupLongNames();