From 04cb8b387518962a75b12ada776de90eb747f685 Mon Sep 17 00:00:00 2001 From: ageay Date: Thu, 19 Apr 2012 07:32:46 +0000 Subject: [PATCH] Standardization of API --- src/MEDLoader/MEDFileField.cxx | 9 +++++---- src/MEDLoader/MEDFileField.hxx | 4 ++-- src/MEDLoader/SauvWriter.cxx | 2 +- src/MEDLoader/Swig/MEDLoader.i | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 6f0a3f9db..9c2f025e8 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -1841,12 +1841,13 @@ int MEDFieldFieldGlobs::getLocalizationId(const char *loc) const throw(INTERP_KE return std::distance(_locs.begin(),it); } -const DataArrayInt *MEDFieldFieldGlobs::getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception) +const DataArrayInt *MEDFieldFieldGlobs::getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception) { - std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),ParaMEDMEMImpl::PflFinder(pflName)); + std::string pflNameCpp(pflName); + std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),ParaMEDMEMImpl::PflFinder(pflNameCpp)); if(it==_pfls.end()) { - std::ostringstream oss; oss << "MEDFieldFieldGlobs::getProfile: no such profile name : \"" << pflName << "\" Possible profiles are : "; + std::ostringstream oss; oss << "MEDFieldFieldGlobs::getProfile: no such profile name : \"" << pflNameCpp << "\" Possible profiles are : "; for(it=_pfls.begin();it!=_pfls.end();it++) oss << "\"" << (*it)->getName() << "\", "; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -2010,7 +2011,7 @@ const MEDFileFieldLoc& MEDFieldFieldGlobsReal::getLocalizationFromId(int locId) return _globals->getLocalizationFromId(locId); } -const DataArrayInt *MEDFieldFieldGlobsReal::getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception) +const DataArrayInt *MEDFieldFieldGlobsReal::getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception) { return _globals->getProfile(pflName); } diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index 36f0f30d8..0222687ec 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -268,7 +268,7 @@ namespace ParaMEDMEM std::string getFileName2() const { return _file_name; } const MEDFileFieldLoc& getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception); const MEDFileFieldLoc& getLocalization(const char *pflName) const throw(INTERP_KERNEL::Exception); - const DataArrayInt *getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception); + const DataArrayInt *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception); // void appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception); void appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w) throw(INTERP_KERNEL::Exception); @@ -310,7 +310,7 @@ namespace ParaMEDMEM std::string getFileName2() const; const MEDFileFieldLoc& getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception); const MEDFileFieldLoc& getLocalization(const char *pflName) const throw(INTERP_KERNEL::Exception); - const DataArrayInt *getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception); + const DataArrayInt *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception); // void appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception); void appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w) throw(INTERP_KERNEL::Exception); diff --git a/src/MEDLoader/SauvWriter.cxx b/src/MEDLoader/SauvWriter.cxx index b645140e1..60dc24928 100644 --- a/src/MEDLoader/SauvWriter.cxx +++ b/src/MEDLoader/SauvWriter.cxx @@ -469,7 +469,7 @@ void SauvWriter::fillProfileSubMeshes() if ( !pfl2sm->second ) { SubMesh* sm = pfl2sm->second = addSubMesh( "", dimRelExt ); // no names for profiles - const DataArrayInt * pfl = isOnAll ? 0 : fields[i]->getProfile( pfls[iType][iPfl] ); + const DataArrayInt * pfl = isOnAll ? 0 : fields[i]->getProfile( pfls[iType][iPfl].c_str() ); makeProfileIDs( sm, types[iType], pfl ); } } diff --git a/src/MEDLoader/Swig/MEDLoader.i b/src/MEDLoader/Swig/MEDLoader.i index e8fc4a344..37377053c 100644 --- a/src/MEDLoader/Swig/MEDLoader.i +++ b/src/MEDLoader/Swig/MEDLoader.i @@ -644,7 +644,7 @@ namespace ParaMEDMEM virtual std::vector getLocsReallyUsed() const = 0; %extend { - PyObject *getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception) + PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception) { const DataArrayInt *ret=self->getProfile(pflName); if(ret) -- 2.39.2