From c3620bf7f7a8e91d325b473fc55cf9052ac770ec Mon Sep 17 00:00:00 2001 From: ageay Date: Tue, 23 Jul 2013 13:37:27 +0000 Subject: [PATCH] All getName method return std::string now --- .../MEDCouplingFieldDoubleServant.cxx | 2 +- .../MEDCouplingMeshServant.cxx | 2 +- src/MEDCoupling_Swig/MEDCouplingCommon.i | 17 ++++- src/MEDLoader/MEDFileData.cxx | 2 +- src/MEDLoader/MEDFileField.cxx | 8 +- src/MEDLoader/MEDFileField.hxx | 2 +- src/MEDLoader/MEDFileFieldOverView.cxx | 71 +++++++++++++++++- src/MEDLoader/MEDFileFieldOverView.hxx | 19 ++++- src/MEDLoader/MEDFileMesh.cxx | 8 +- src/MEDLoader/MEDFileMesh.hxx | 6 +- src/MEDLoader/MEDFileMeshLL.cxx | 8 +- src/MEDLoader/MEDFileParameter.hxx | 8 +- src/MEDLoader/MEDLoader.cxx | 2 +- src/MEDLoader/SauvMedConvertor.cxx | 2 +- src/MEDLoader/SauvWriter.cxx | 14 ++-- src/MEDLoader/Swig/MEDLoaderCommon.i | 16 ++-- src/MEDLoader/Test/MEDLoaderTest.cxx | 74 +++++++++---------- src/MEDLoader/Test/SauvLoaderTest.cxx | 2 +- src/MEDOP/cmp/MEDDataManager_i.cxx | 6 +- src/ParaMEDLoader/ParaMEDLoader.cxx | 2 +- 20 files changed, 181 insertions(+), 90 deletions(-) diff --git a/src/MEDCouplingCorba/MEDCouplingFieldDoubleServant.cxx b/src/MEDCouplingCorba/MEDCouplingFieldDoubleServant.cxx index 170ef0725..9e9c755d1 100644 --- a/src/MEDCouplingCorba/MEDCouplingFieldDoubleServant.cxx +++ b/src/MEDCouplingCorba/MEDCouplingFieldDoubleServant.cxx @@ -29,7 +29,7 @@ MEDCouplingFieldDoubleServant::MEDCouplingFieldDoubleServant(const MEDCouplingFi char *MEDCouplingFieldDoubleServant::getName() { - return CORBA::string_dup(getPointer()->getName()); + return CORBA::string_dup(getPointer()->getName().c_str()); } SALOME_TYPES::ListOfString *MEDCouplingFieldDoubleServant::getInfoOnComponents() diff --git a/src/MEDCouplingCorba/MEDCouplingMeshServant.cxx b/src/MEDCouplingCorba/MEDCouplingMeshServant.cxx index c7913d40a..f2fc2f832 100644 --- a/src/MEDCouplingCorba/MEDCouplingMeshServant.cxx +++ b/src/MEDCouplingCorba/MEDCouplingMeshServant.cxx @@ -31,7 +31,7 @@ MEDCouplingMeshServant::MEDCouplingMeshServant(const MEDCouplingMesh *cppPointer char *MEDCouplingMeshServant::getName() { - return CORBA::string_dup(getPointer()->getName()); + return CORBA::string_dup(getPointer()->getName().c_str()); } void MEDCouplingMeshServant::getTinyInfo(SALOME_TYPES::ListOfDouble_out da, SALOME_TYPES::ListOfLong_out la, SALOME_TYPES::ListOfString_out sa) diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 8cf917b1b..111271078 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -459,6 +459,7 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh; %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart; %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom; +%newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity; %newobject ParaMEDMEM::MEDCouplingCMesh::New; %newobject ParaMEDMEM::MEDCouplingCMesh::clone; %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt; @@ -659,9 +660,9 @@ namespace ParaMEDMEM { public: void setName(const char *name); - const char *getName() const; + std::string getName() const; void setDescription(const char *descr); - const char *getDescription() const; + std::string getDescription() const; void setTime(double val, int iteration, int order); void setTimeUnit(const char *unit); const char *getTimeUnit() const; @@ -2991,6 +2992,14 @@ namespace ParaMEDMEM return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp); } + static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception) + { + int szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr); + return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr); + } + static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception) { int szArr,sw,iTypppArr; @@ -3231,9 +3240,9 @@ namespace ParaMEDMEM virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception); void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception); void setName(const char *name) throw(INTERP_KERNEL::Exception); - const char *getDescription() const throw(INTERP_KERNEL::Exception); + std::string getDescription() const throw(INTERP_KERNEL::Exception); void setDescription(const char *desc) throw(INTERP_KERNEL::Exception); - const char *getName() const throw(INTERP_KERNEL::Exception); + std::string getName() const throw(INTERP_KERNEL::Exception); TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception); NatureOfField getNature() const throw(INTERP_KERNEL::Exception); virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception); diff --git a/src/MEDLoader/MEDFileData.cxx b/src/MEDLoader/MEDFileData.cxx index 8dc033c54..321aefa88 100644 --- a/src/MEDLoader/MEDFileData.cxx +++ b/src/MEDLoader/MEDFileData.cxx @@ -208,7 +208,7 @@ bool MEDFileData::unPolyzeMeshes() throw(INTERP_KERNEL::Exception) MEDFileFields *fs=_fields; if(fs) for(std::size_t i=0;irenumberEntitiesLyingOnMesh(meshesImpacted[i]->getName(),oldCodeOfMeshImpacted[i],newCodeOfMeshImpacted[i],renumParamsOfMeshImpacted[i]); + fs->renumberEntitiesLyingOnMesh(meshesImpacted[i]->getName().c_str(),oldCodeOfMeshImpacted[i],newCodeOfMeshImpacted[i],renumParamsOfMeshImpacted[i]); } return !meshesImpacted.empty(); } diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 8ee6fde59..c11642437 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -2239,7 +2239,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, cons return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc); } MEDCouplingAutoRefCountObjectPtr m2=mesh->buildPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); - m2->setName(mesh->getName()); + m2->setName(mesh->getName().c_str()); MEDCouplingAutoRefCountObjectPtr ret=finishField(type,glob,dads,locs,m2,isPfl,arrOut,nasc); isPfl=true; return ret.retn(); @@ -2291,7 +2291,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField { MEDCouplingAutoRefCountObjectPtr da3=da->transformWithIndArrR(arr2->begin(),arr2->end()); arrOut->renumberInPlace(da3->getConstPointer()); - mesh2->setName(mesh->getName()); + mesh2->setName(mesh->getName().c_str()); ret->setMesh(mesh2); return ret.retn(); } @@ -4521,7 +4521,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(Typ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception) { static const char msg1[]="MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : request for a renumbered field following mesh numbering whereas it is a profile field !"; - int meshId=getMeshIdFromMeshName(mesh->getName()); + int meshId=getMeshIdFromMeshName(mesh->getName().c_str()); bool isPfl=false; MEDCouplingAutoRefCountObjectPtr ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl,arrOut,nasc); switch(renumPol) @@ -4599,7 +4599,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception) { MEDCouplingAutoRefCountObjectPtr m=mesh->getGenMeshAtLevel(meshDimRelToMax); - int meshId=getMeshIdFromMeshName(mesh->getName()); + int meshId=getMeshIdFromMeshName(mesh->getName().c_str()); MEDCouplingAutoRefCountObjectPtr ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc); ret->setName(nasc.getName().c_str()); return ret.retn(); diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index a4b312eb4..2f6e1ae38 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -50,7 +50,7 @@ namespace ParaMEDMEM { public: void MEDLOADER_EXPORT simpleRepr(std::ostream& oss) const; - const MEDLOADER_EXPORT std::string& getName() const { return _name; } + std::string MEDLOADER_EXPORT getName() const { return _name; } void MEDLOADER_EXPORT setName(const char *name); static MEDFileFieldLoc *New(med_idt fid, const char *locName); static MEDFileFieldLoc *New(med_idt fid, int id); diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index ceb1cf05c..7d43b18a7 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -642,6 +642,8 @@ MEDMeshMultiLev *MEDFileField1TSStruct::buildFromScratchDataSetSupport(const MED std::vector levs(1,0); return MEDMeshMultiLev::New(mst->getTheMesh(),levs); } + else + return MEDMeshMultiLev::NewOnlyOnNode(mst->getTheMesh(),_already_checked[pos1][0].getPfl(globs)); } } @@ -850,6 +852,14 @@ MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector levs(1,0); + MEDCouplingAutoRefCountObjectPtr ret(MEDMeshMultiLev::New(m,levs)); + ret->selectPartOfNodes(pflOnNode); + return ret.retn(); +} + void MEDMeshMultiLev::setNodeReduction(const DataArrayInt *nr) { if(nr) @@ -924,6 +934,22 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vectorisAllocated()) + return ; + /*std::vector ngs(getNodeGridStructure()); + MEDCouplingAutoRefCountObjectPtr conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size())); + MEDCouplingAutoRefCountObjectPtr m(MEDCoupling1SGTUMesh::New("",GMEDCouplingStructuredMesh::etGeoTypeGivenMeshDimension(ngs.size()))); + m->setNodalConnectivity(conn); + DataArrayInt *cellIds=0; + m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds); + MEDCouplingAutoRefCountObjectPtr cellIdsSafe(cellIds); + MEDCouplingAutoRefCountObjectPtr m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end())); + int tmp=-1; + _node_reduction=m2->getNodeIdsInUse(tmp);*/ +} + MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector& levs) throw(INTERP_KERNEL::Exception) { return new MEDCMeshMultiLev(m,levs); @@ -951,7 +977,7 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector } } -MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(gts,pfls,nbEntities) +MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDStructuredMeshMultiLev(gts,pfls,nbEntities) { if(!m) throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : null input pointer !"); @@ -970,6 +996,16 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector MEDCMeshMultiLev::getNodeGridStructure() const throw(INTERP_KERNEL::Exception) +{ + std::vector ret(_coords.size()); + for(std::size_t i=0;i<_coords.size();i++) + ret[i]=_coords[i]->getNumberOfTuples(); + return ret; +} + +//= + MEDCurveLinearMeshMultiLev *MEDCurveLinearMeshMultiLev::New(const MEDFileCurveLinearMesh *m, const std::vector& levs) throw(INTERP_KERNEL::Exception) { return new MEDCurveLinearMeshMultiLev(m,levs); @@ -994,7 +1030,7 @@ MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearM _structure=m->getMesh()->getNodeGridStructure(); } -MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(gts,pfls,nbEntities) +MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDStructuredMeshMultiLev(gts,pfls,nbEntities) { if(!m) throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : null input pointer !"); @@ -1010,3 +1046,34 @@ MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearM _coords=coords; _structure=m->getMesh()->getNodeGridStructure(); } + +std::vector MEDCurveLinearMeshMultiLev::getNodeGridStructure() const throw(INTERP_KERNEL::Exception) +{ + return _structure; +} + +//= + +MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev() +{ +} + +MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(gts,pfls,nbEntities) +{ +} + +void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) throw(INTERP_KERNEL::Exception) +{ + if(!pflNodes || !pflNodes->isAllocated()) + return ; + std::vector ngs(getNodeGridStructure()); + MEDCouplingAutoRefCountObjectPtr conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size())); + MEDCouplingAutoRefCountObjectPtr m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(ngs.size()))); + m->setNodalConnectivity(conn); + DataArrayInt *cellIds=0; + m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds); + MEDCouplingAutoRefCountObjectPtr cellIdsSafe(cellIds); + MEDCouplingAutoRefCountObjectPtr m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end())); + int tmp=-1; + _node_reduction=m2->getNodeIdsInUse(tmp); +} diff --git a/src/MEDLoader/MEDFileFieldOverView.hxx b/src/MEDLoader/MEDFileFieldOverView.hxx index 994076a20..6dca9aa9d 100644 --- a/src/MEDLoader/MEDFileFieldOverView.hxx +++ b/src/MEDLoader/MEDFileFieldOverView.hxx @@ -70,7 +70,9 @@ namespace ParaMEDMEM public: static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) throw(INTERP_KERNEL::Exception); static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& levs) throw(INTERP_KERNEL::Exception); + static MEDMeshMultiLev *NewOnlyOnNode(const MEDFileMesh *m, const DataArrayInt *pflOnNode) throw(INTERP_KERNEL::Exception); void setNodeReduction(const DataArrayInt *nr); + virtual void selectPartOfNodes(const DataArrayInt *pflNodes) throw(INTERP_KERNEL::Exception) = 0; protected: MEDMeshMultiLev(); MEDMeshMultiLev(const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); @@ -86,6 +88,7 @@ namespace ParaMEDMEM public: static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector& levs) throw(INTERP_KERNEL::Exception); static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) throw(INTERP_KERNEL::Exception); + void selectPartOfNodes(const DataArrayInt *pflNodes) throw(INTERP_KERNEL::Exception); private: MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& levs); MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); @@ -93,11 +96,22 @@ namespace ParaMEDMEM std::vector< MEDCouplingAutoRefCountObjectPtr > _parts; }; - class MEDCMeshMultiLev : public MEDMeshMultiLev + class MEDStructuredMeshMultiLev : public MEDMeshMultiLev + { + public: + void selectPartOfNodes(const DataArrayInt *pflNodes) throw(INTERP_KERNEL::Exception); + virtual std::vector getNodeGridStructure() const throw(INTERP_KERNEL::Exception) = 0; + protected: + MEDStructuredMeshMultiLev(); + MEDStructuredMeshMultiLev(const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + }; + + class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev { public: static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector& levs) throw(INTERP_KERNEL::Exception); static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) throw(INTERP_KERNEL::Exception); + std::vector getNodeGridStructure() const throw(INTERP_KERNEL::Exception); private: MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& levs); MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); @@ -105,11 +119,12 @@ namespace ParaMEDMEM std::vector< MEDCouplingAutoRefCountObjectPtr > _coords; }; - class MEDCurveLinearMeshMultiLev : public MEDMeshMultiLev + class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev { public: static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector& levs) throw(INTERP_KERNEL::Exception); static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls , const std::vector& nbEntities) throw(INTERP_KERNEL::Exception); + std::vector getNodeGridStructure() const throw(INTERP_KERNEL::Exception); private: MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& levs); MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 569c46e9c..615abd7aa 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -2855,7 +2855,7 @@ MEDCouplingUMesh *MEDFileUMesh::getMeshAtLevel(int meshDimRelToMaxExt, bool renu MEDCouplingAutoRefCountObjectPtr cc=_coords->deepCpy(); umesh->setCoords(cc); MEDFileUMeshSplitL1::ClearNonDiscrAttributes(umesh); - umesh->setName(getName()); + umesh->setName(getName().c_str()); return umesh; } } @@ -3125,7 +3125,7 @@ void MEDFileUMesh::duplicateNodesOnM1Group(const char *grpNameM1, DataArrayInt * MEDCouplingAutoRefCountObjectPtr szOfCellGrpOfSameType(tmp00); MEDCouplingAutoRefCountObjectPtr idInMsOfCellGrpOfSameType(tmp11); // - newm1->setName(getName()); + newm1->setName(getName().c_str()); const DataArrayInt *fam=getFamilyFieldAtLevel(-1); if(!fam) throw INTERP_KERNEL::Exception("MEDFileUMesh::duplicateNodesOnM1Group : internal problem !"); @@ -3526,7 +3526,7 @@ void MEDFileUMesh::setMeshes(const std::vector& ms, bo for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++) { int mdim=(*it)->getMeshDimension(); - setName((*it)->getName()); + setName((*it)->getName().c_str()); setMeshAtLevel(mdim-zeDim,const_cast(*it),renum); } setName(name.c_str()); @@ -5050,7 +5050,7 @@ std::size_t MEDFileMeshMultiTS::getHeapMemorySize() const return ret; } -const char *MEDFileMeshMultiTS::getName() const throw(INTERP_KERNEL::Exception) +std::string MEDFileMeshMultiTS::getName() const throw(INTERP_KERNEL::Exception) { if(_mesh_one_ts.empty()) throw INTERP_KERNEL::Exception("MEDFileMeshMultiTS::getName : no time steps set !"); diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index b0b77289a..595d432df 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -47,12 +47,12 @@ namespace ParaMEDMEM virtual void clearNonDiscrAttributes() const; void setName(const char *name) { _name=name; } bool changeNames(const std::vector< std::pair >& modifTab) throw(INTERP_KERNEL::Exception); - const char *getName() const { return _name.c_str(); } + std::string getName() const { return _name; } const char *getUnivName() const { return _univ_name.c_str(); } bool getUnivNameWrStatus() const { return _univ_wr_status; } void setUnivNameWrStatus(bool newStatus) { _univ_wr_status=newStatus; } void setDescription(const char *name) { _desc_name=name; } - const char *getDescription() const { return _desc_name.c_str(); } + std::string getDescription() const { return _desc_name; } void setOrder(int order) { _order=order; } int getOrder() const { return _order; } void setIteration(int it) { _iteration=it; } @@ -395,7 +395,7 @@ namespace ParaMEDMEM static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception); MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception); std::size_t getHeapMemorySize() const; - const char *getName() const throw(INTERP_KERNEL::Exception); + std::string getName() const throw(INTERP_KERNEL::Exception); void setName(const char *newMeshName) throw(INTERP_KERNEL::Exception); bool changeNames(const std::vector< std::pair >& modifTab) throw(INTERP_KERNEL::Exception); MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception); diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index c5983997e..d023393e7 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -1144,8 +1144,8 @@ void MEDFileUMeshAggregateCompute::synchronizeTinyInfo(const MEDFileMesh& master const MEDCoupling1GTUMesh *tmp(*it); if(tmp) { - (const_cast(tmp))->setName(master.getName()); - (const_cast(tmp))->setDescription(master.getDescription()); + (const_cast(tmp))->setName(master.getName().c_str()); + (const_cast(tmp))->setDescription(master.getDescription().c_str()); (const_cast(tmp))->setTime(master.getTimeValue(),master.getIteration(),master.getOrder()); (const_cast(tmp))->setTimeUnit(master.getTimeUnit()); } @@ -1153,8 +1153,8 @@ void MEDFileUMeshAggregateCompute::synchronizeTinyInfo(const MEDFileMesh& master const MEDCouplingUMesh *m(_m); if(m) { - (const_cast(m))->setName(master.getName()); - (const_cast(m))->setDescription(master.getDescription()); + (const_cast(m))->setName(master.getName().c_str()); + (const_cast(m))->setDescription(master.getDescription().c_str()); (const_cast(m))->setTime(master.getTimeValue(),master.getIteration(),master.getOrder()); (const_cast(m))->setTimeUnit(master.getTimeUnit()); } diff --git a/src/MEDLoader/MEDFileParameter.hxx b/src/MEDLoader/MEDFileParameter.hxx index 43b147322..cb4c6fad1 100644 --- a/src/MEDLoader/MEDFileParameter.hxx +++ b/src/MEDLoader/MEDFileParameter.hxx @@ -80,9 +80,9 @@ namespace ParaMEDMEM { public: void setDescription(const char *name) { _desc_name=name; } - const char *getDescription() const { return _desc_name.c_str(); } + std::string getDescription() const { return _desc_name; } void setTimeUnit(const char *unit) { _dt_unit=unit; } - const char *getTimeUnit() const { return _dt_unit.c_str(); } + std::string getTimeUnit() const { return _dt_unit; } std::size_t getHeapMemSizeOfStrings() const; bool isEqualStrings(const MEDFileParameterTinyInfo& other, std::string& what) const; protected: @@ -106,7 +106,7 @@ namespace ParaMEDMEM virtual std::string simpleRepr() const; std::size_t getHeapMemorySize() const; void setName(const char *name) throw(INTERP_KERNEL::Exception) { _name=name; } - const char *getName() const throw(INTERP_KERNEL::Exception) { return _name.c_str(); } + std::string getName() const throw(INTERP_KERNEL::Exception) { return _name; } void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); private: MEDFileParameterDouble1TS(); @@ -121,7 +121,7 @@ namespace ParaMEDMEM static MEDFileParameterMultiTS *New(); static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception); static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception); - const char *getName() const { return _name.c_str(); } + std::string getName() const { return _name; } void setName(const char *name) { _name=name; } std::size_t getHeapMemorySize() const; MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception); diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index dfcc4a802..525a94e07 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -1368,7 +1368,7 @@ void MEDLoader::WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFi MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(fileName,f,false); else { - MEDCouplingAutoRefCountObjectPtr mm=MEDFileMesh::New(fileName,f->getMesh()->getName()); + MEDCouplingAutoRefCountObjectPtr mm=MEDFileMesh::New(fileName,f->getMesh()->getName().c_str()); const MEDFileMesh *mmPtr(mm); const MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) diff --git a/src/MEDLoader/SauvMedConvertor.cxx b/src/MEDLoader/SauvMedConvertor.cxx index c4b17862c..1b811c497 100644 --- a/src/MEDLoader/SauvMedConvertor.cxx +++ b/src/MEDLoader/SauvMedConvertor.cxx @@ -1160,7 +1160,7 @@ ParaMEDMEM::MEDFileUMesh* IntermediateMED::makeMEDFileMesh() coords->decrRef(); - if ( !mesh->getName() || strlen( mesh->getName() ) == 0 ) + if ( !mesh->getName().c_str() || strlen( mesh->getName().c_str() ) == 0 ) mesh->setName( "MESH" ); return mesh; diff --git a/src/MEDLoader/SauvWriter.cxx b/src/MEDLoader/SauvWriter.cxx index 13f44b92f..4a2105620 100644 --- a/src/MEDLoader/SauvWriter.cxx +++ b/src/MEDLoader/SauvWriter.cxx @@ -464,7 +464,7 @@ void SauvWriter::fillProfileSubMeshes() vector< vector > typesF; vector< vector > pfls, locs; fields[i]->getFieldSplitedByType( iters[0].first, iters[0].second, - _fileMesh->getName(), types, typesF, pfls, locs); + _fileMesh->getName().c_str(), types, typesF, pfls, locs); int dimRelExt; for ( size_t iType = 0; iType < types.size(); ++iType ) { @@ -512,7 +512,7 @@ int SauvWriter::evaluateNbProfileSubMeshes() const vector< vector > typesF; vector< vector > pfls, locs; _cellFields[i]->getFieldSplitedByType( iters[0].first, iters[0].second, - _fileMesh->getName(), types, typesF, pfls, locs); + _fileMesh->getName().c_str(), types, typesF, pfls, locs); nb += 2 * types.size(); // x 2 - a type can be on nodes and on cells at the same time } @@ -1062,7 +1062,7 @@ void SauvWriter::writeNodalFields(map& fldNamePrefixMap) vector< vector > typesF; vector< vector > pfls, locs; vector< vector< std::pair > > valsVec; - valsVec=_nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName(), + valsVec=_nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(), types, typesF, pfls, locs); // believe that there can be only one type in a nodal field, // so do not use a loop on types @@ -1111,7 +1111,7 @@ void SauvWriter::writeNodalFields(map& fldNamePrefixMap) vector< vector > typesF; vector< vector > pfls, locs; vector< vector< std::pair > > valsVec; - valsVec = _nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName(), + valsVec = _nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(), types, typesF, pfls, locs); // believe that there can be only one type in a nodal field, // so do not perform a loop on types @@ -1172,7 +1172,7 @@ void SauvWriter::writeElemFields(map& fldNamePrefixMap) vector< vector > typesF; vector< vector > pfls, locs; vector< vector< std::pair > > valsVec; - valsVec = _cellFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName(), + valsVec = _cellFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(), types, typesF, pfls, locs); for ( size_t i = 0; i < valsVec.size(); ++i ) nbSub += valsVec[i].size(); @@ -1199,7 +1199,7 @@ void SauvWriter::writeElemFields(map& fldNamePrefixMap) vector types; vector< vector > typesF; vector< vector > pfls, locs; - _cellFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName(), + _cellFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(), types, typesF, pfls, locs); for ( size_t iType = 0; iType < pfls.size(); ++iType ) for ( size_t iP = 0; iP < pfls[iType].size(); ++iP ) @@ -1265,7 +1265,7 @@ void SauvWriter::writeElemTimeStamp(int iF, int iter, int order) vector< vector > typesF; vector< vector > pfls, locs; vector< vector< std::pair > > valsVec; - valsVec = _cellFields[iF]->getFieldSplitedByType( iter, order, _fileMesh->getName(), + valsVec = _cellFields[iF]->getFieldSplitedByType( iter, order, _fileMesh->getName().c_str(), types, typesF, pfls, locs); for ( size_t iType = 0; iType < pfls.size(); ++iType ) for ( size_t iP = 0; iP < pfls[iType].size(); ++iP ) diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index d6a0a2083..c0b36d9bc 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -438,12 +438,12 @@ namespace ParaMEDMEM virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception); virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception); void setName(const char *name); - const char *getName(); + std::string getName(); const char *getUnivName() const; bool getUnivNameWrStatus() const; void setUnivNameWrStatus(bool newStatus); void setDescription(const char *name); - const char *getDescription() const; + std::string getDescription() const; void setOrder(int order); int getOrder() const; void setIteration(int it); @@ -865,7 +865,7 @@ namespace ParaMEDMEM static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception); static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception); MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception); - const char *getName() const throw(INTERP_KERNEL::Exception); + std::string getName() const throw(INTERP_KERNEL::Exception); void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception); %extend @@ -1004,7 +1004,7 @@ namespace ParaMEDMEM class MEDFileFieldLoc : public RefCountObject { public: - const std::string& getName() const; + std::string getName() const; int getDimension() const; int getNumberOfGaussPoints() const; int getNumberOfPointsInCells() const; @@ -2338,9 +2338,9 @@ namespace ParaMEDMEM { public: void setDescription(const char *name); - const char *getDescription() const; + std::string getDescription() const; void setTimeUnit(const char *unit); - const char *getTimeUnit() const; + std::string getTimeUnit() const; }; class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo @@ -2353,7 +2353,7 @@ namespace ParaMEDMEM virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception); virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception); void setName(const char *name) throw(INTERP_KERNEL::Exception); - const char *getName() const throw(INTERP_KERNEL::Exception); + std::string getName() const throw(INTERP_KERNEL::Exception); void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); %extend { @@ -2402,7 +2402,7 @@ namespace ParaMEDMEM static MEDFileParameterMultiTS *New(); static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception); static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception); - const char *getName() const; + std::string getName() const; void setName(const char *name); MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception); void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); diff --git a/src/MEDLoader/Test/MEDLoaderTest.cxx b/src/MEDLoader/Test/MEDLoaderTest.cxx index bd8970b7b..738b576c0 100644 --- a/src/MEDLoader/Test/MEDLoaderTest.cxx +++ b/src/MEDLoader/Test/MEDLoaderTest.cxx @@ -34,7 +34,7 @@ void MEDLoaderTest::testMesh1DRW() MEDCouplingUMesh *mesh=build1DMesh_1(); mesh->checkCoherency(); MEDLoader::WriteUMesh("file1.med",mesh,true); - MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file1.med",mesh->getName(),0); + MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file1.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); mesh->decrRef(); @@ -45,7 +45,7 @@ void MEDLoaderTest::testMesh2DCurveRW() MEDCouplingUMesh *mesh=build2DCurveMesh_1(); mesh->checkCoherency(); MEDLoader::WriteUMesh("file2.med",mesh,true); - MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file2.med",mesh->getName(),0); + MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file2.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); mesh->decrRef(); @@ -56,7 +56,7 @@ void MEDLoaderTest::testMesh2DRW() MEDCouplingUMesh *mesh=build2DMesh_1(); mesh->checkCoherency(); MEDLoader::WriteUMesh("file3.med",mesh,true); - MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file3.med",mesh->getName(),0); + MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file3.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); mesh->decrRef(); @@ -67,7 +67,7 @@ void MEDLoaderTest::testMesh3DSurfRW() MEDCouplingUMesh *mesh=build3DSurfMesh_1(); mesh->checkCoherency(); MEDLoader::WriteUMesh("file4.med",mesh,true); - MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file4.med",mesh->getName(),0); + MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file4.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); mesh->decrRef(); @@ -78,7 +78,7 @@ void MEDLoaderTest::testMesh3DRW() MEDCouplingUMesh *mesh=build3DMesh_1(); mesh->checkCoherency(); MEDLoader::WriteUMesh("file5.med",mesh,true); - MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file5.med",mesh->getName(),0); + MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file5.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); mesh->decrRef(); @@ -91,17 +91,17 @@ void MEDLoaderTest::testFieldRW1() { MEDCouplingFieldDouble *f1=buildVecFieldOnCells_1(); MEDLoader::WriteField("file6.med",f1,true); - MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell("file6.med",f1->getMesh()->getName(),0,f1->getName(),0,1); + MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell("file6.med",f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); f1->decrRef(); f2->decrRef(); // f1=buildVecFieldOnNodes_1(); MEDLoader::WriteField("file7.med",f1,true); - f2=MEDLoader::ReadFieldNode("file7.med",f1->getMesh()->getName(),0,f1->getName(),2,3); + f2=MEDLoader::ReadFieldNode("file7.med",f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,3); CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); // testing kind message on error of field type. - CPPUNIT_ASSERT_THROW(MEDLoader::ReadFieldCell("file7.med",f1->getMesh()->getName(),0,f1->getName(),2,3),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(MEDLoader::ReadFieldCell("file7.med",f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,3),INTERP_KERNEL::Exception); // f1->decrRef(); f2->decrRef(); @@ -125,22 +125,22 @@ void MEDLoaderTest::testFieldRW2() tmp[0]=VAL2; MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); //retrieving time steps... - MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName(),0,f1->getName(),8,9); + MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),8,9); f1->setTime(10.,8,9); tmp[0]=VAL1; CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); f2->decrRef(); - f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName(),0,f1->getName(),0,1); + f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); MEDCouplingFieldDouble *f3=buildVecFieldOnCells_1(); CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); f2->decrRef(); - f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName(),0,f1->getName(),18,19); + f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),18,19); f1->setTime(10.14,18,19); tmp[0]=VAL2; CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); //test of throw on invalid (dt,it) - CPPUNIT_ASSERT_THROW(MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName(),0,f1->getName(),28,19),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),28,19),INTERP_KERNEL::Exception); f2->decrRef(); f1->decrRef(); //ON NODES @@ -154,17 +154,17 @@ void MEDLoaderTest::testFieldRW2() f1->setTime(210.,208,209); tmp[3]=VAL2; MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName2,f1); - f2=MEDLoader::ReadFieldNode(fileName2,f1->getMesh()->getName(),0,f1->getName(),108,109); + f2=MEDLoader::ReadFieldNode(fileName2,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),108,109); f1->setTime(110.,108,109); tmp[3]=VAL1; CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); f2->decrRef(); - f2=MEDLoader::ReadFieldNode(fileName2,f1->getMesh()->getName(),0,f1->getName(),2,3); + f2=MEDLoader::ReadFieldNode(fileName2,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,3); f3=buildVecFieldOnNodes_1(); CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); f2->decrRef(); - f2=MEDLoader::ReadFieldNode(fileName2,f1->getMesh()->getName(),0,f1->getName(),208,209); + f2=MEDLoader::ReadFieldNode(fileName2,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),208,209); f1->setTime(210.,208,209); tmp[3]=VAL2; CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); @@ -353,7 +353,7 @@ void MEDLoaderTest::testFieldProfilRW1() MEDLoader::WriteUMesh(fileName,mesh1,true); const int part1[5]={1,2,4,13,15}; MEDCouplingUMesh *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true); - mesh2->setName(mesh1->getName());//<- important for the test + mesh2->setName(mesh1->getName().c_str());//<- important for the test // int nbOfCells=mesh2->getNumberOfCells(); CPPUNIT_ASSERT_EQUAL(5,nbOfCells); @@ -372,8 +372,8 @@ void MEDLoaderTest::testFieldProfilRW1() // MEDLoader::WriteField(fileName,f1,false);//<- false important for the test // - MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName(),0,f1->getName(),2,7); - std::vector types=MEDLoader::GetTypesOfField(fileName,f1->getMesh()->getName(),f1->getName()); + MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7); + std::vector types=MEDLoader::GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)types.size()); CPPUNIT_ASSERT(types[0]==ON_CELLS); f2->checkCoherency(); @@ -410,10 +410,10 @@ void MEDLoaderTest::testFieldNodeProfilRW1() f1->checkCoherency(); const int arr2[2]={1,4};//node ids are 2,4,5,3,6,7 MEDCouplingFieldDouble *f2=f1->buildSubPart(arr2,arr2+2); - (const_cast(f2->getMesh()))->setName(f1->getMesh()->getName()); + (const_cast(f2->getMesh()))->setName(f1->getMesh()->getName().c_str()); MEDLoader::WriteField(fileName,f2,false);//<- false important for the test // - MEDCouplingFieldDouble *f3=MEDLoader::ReadFieldNode(fileName,f2->getMesh()->getName(),0,f2->getName(),2,7); + MEDCouplingFieldDouble *f3=MEDLoader::ReadFieldNode(fileName,f2->getMesh()->getName().c_str(),0,f2->getName().c_str(),2,7); f3->checkCoherency(); CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); @@ -422,7 +422,7 @@ void MEDLoaderTest::testFieldNodeProfilRW1() f2->renumberNodes(arr3); MEDLoader::WriteUMesh(fileName2,m,true); MEDLoader::WriteField(fileName2,f2,false);//<- false important for the test - f3=MEDLoader::ReadFieldNode(fileName2,f2->getMesh()->getName(),0,f2->getName(),2,7); + f3=MEDLoader::ReadFieldNode(fileName2,f2->getMesh()->getName().c_str(),0,f2->getName().c_str(),2,7); f3->checkCoherency(); CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); @@ -459,7 +459,7 @@ void MEDLoaderTest::testFieldNodeProfilRW2() f1->renumberNodes(renumArr); f1->checkCoherency(); MEDLoader::WriteField(fileName,f1,false);//<- false important for the test - MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldNode(fileName,f1->getMesh()->getName(),0,f1->getName(),2,7); + MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7); CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12)); // f2->decrRef(); @@ -472,7 +472,7 @@ void MEDLoaderTest::testFieldGaussRW1() const char fileName[]="file13.med"; MEDCouplingFieldDouble *f1=buildVecFieldOnGauss_1(); MEDLoader::WriteField(fileName,f1,true); - MEDCouplingFieldDouble *f2=MEDLoader::ReadField(ON_GAUSS_PT,fileName,f1->getMesh()->getName(),0,f1->getName(),1,5); + MEDCouplingFieldDouble *f2=MEDLoader::ReadField(ON_GAUSS_PT,fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),1,5); CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); f2->decrRef(); f1->decrRef(); @@ -483,7 +483,7 @@ void MEDLoaderTest::testFieldGaussNERW1() const char fileName[]="file14.med"; MEDCouplingFieldDouble *f1=buildVecFieldOnGaussNE_1(); MEDLoader::WriteField(fileName,f1,true); - MEDCouplingFieldDouble *f2=MEDLoader::ReadField(ON_GAUSS_NE,fileName,f1->getMesh()->getName(),0,f1->getName(),1,5); + MEDCouplingFieldDouble *f2=MEDLoader::ReadField(ON_GAUSS_NE,fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),1,5); CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); f2->decrRef(); f1->decrRef(); @@ -528,7 +528,7 @@ void MEDLoaderTest::testMesh3DSurfShuffleRW() mesh->renumberCells(renumber1,false); mesh->checkCoherency(); MEDLoader::WriteUMesh(fileName,mesh,true); - MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile(fileName,mesh->getName(),0); + MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile(fileName,mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); mesh->decrRef(); @@ -554,7 +554,7 @@ void MEDLoaderTest::testFieldShuffleRW1() const int renumber1[6]={2,1,5,0,3,4}; f1->renumberCells(renumber1,false); MEDLoader::WriteField(fileName,f1,true); - MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(fileName,mesh->getName(),0,f1->getName(),2,7); + MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(fileName,mesh->getName().c_str(),0,f1->getName().c_str(),2,7); CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12)); f2->decrRef(); // @@ -599,7 +599,7 @@ void MEDLoaderTest::testMultiFieldShuffleRW1() its.push_back(std::pair(1,2)); its.push_back(std::pair(3,4)); its.push_back(std::pair(5,6)); - std::vector fs=MEDLoader::ReadFieldsOnSameMesh(ON_CELLS,fileName,f_1->getMesh()->getName(),0,f_1->getName(),its); + std::vector fs=MEDLoader::ReadFieldsOnSameMesh(ON_CELLS,fileName,f_1->getMesh()->getName().c_str(),0,f_1->getName().c_str(),its); CPPUNIT_ASSERT_EQUAL(3,(int)fs.size()); const MEDCouplingMesh *mm=fs[0]->getMesh(); CPPUNIT_ASSERT(fs[0]->isEqual(f_1,1e-12,1e-12)); @@ -633,11 +633,11 @@ void MEDLoaderTest::testWriteUMeshesRW1() meshes.push_back(m2d); meshes.push_back(m3d); MEDLoader::WriteUMeshes(fileName,meshes,true); - MEDCouplingUMesh *m3d_bis=MEDLoader::ReadUMeshFromFile(fileName,m2d->getName(),0); + MEDCouplingUMesh *m3d_bis=MEDLoader::ReadUMeshFromFile(fileName,m2d->getName().c_str(),0); CPPUNIT_ASSERT(!m3d_bis->isEqual(m3d,1e-12)); - m3d_bis->setName(m3d->getName()); + m3d_bis->setName(m3d->getName().c_str()); CPPUNIT_ASSERT(m3d_bis->isEqual(m3d,1e-12)); - MEDCouplingUMesh *m2d_bis=MEDLoader::ReadUMeshFromFile(fileName,m2d->getName(),-1);//-1 for faces + MEDCouplingUMesh *m2d_bis=MEDLoader::ReadUMeshFromFile(fileName,m2d->getName().c_str(),-1);//-1 for faces CPPUNIT_ASSERT(m2d_bis->isEqual(m2d,1e-12)); // Creation of a field on faces. MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); @@ -655,7 +655,7 @@ void MEDLoaderTest::testWriteUMeshesRW1() f1->setTime(3.14,2,7); f1->checkCoherency(); MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); - MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName(),-1,f1->getName(),2,7); + MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),-1,f1->getName().c_str(),2,7); CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12)); f1->decrRef(); f2->decrRef(); @@ -704,26 +704,26 @@ void MEDLoaderTest::testMixCellAndNodesFieldRW1() f2->checkCoherency(); // MEDLoader::WriteField(fileName,f1,true); - std::vector ts=MEDLoader::GetTypesOfField(fileName,f1->getMesh()->getName(),f1->getName()); + std::vector ts=MEDLoader::GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)ts.size()); CPPUNIT_ASSERT_EQUAL(ON_CELLS,ts[0]); - std::vector fs=MEDLoader::GetAllFieldNamesOnMesh(fileName,f1->getMesh()->getName()); + std::vector fs=MEDLoader::GetAllFieldNamesOnMesh(fileName,f1->getMesh()->getName().c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)fs.size()); CPPUNIT_ASSERT(fs[0]=="FieldMix"); MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f2); - fs=MEDLoader::GetAllFieldNamesOnMesh(fileName,f1->getMesh()->getName()); + fs=MEDLoader::GetAllFieldNamesOnMesh(fileName,f1->getMesh()->getName().c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)fs.size()); CPPUNIT_ASSERT(fs[0]=="FieldMix"); // - ts=MEDLoader::GetTypesOfField(fileName,f1->getMesh()->getName(),f1->getName()); + ts=MEDLoader::GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str()); CPPUNIT_ASSERT_EQUAL(2,(int)ts.size()); CPPUNIT_ASSERT_EQUAL(ON_NODES,ts[0]); CPPUNIT_ASSERT_EQUAL(ON_CELLS,ts[1]); // - MEDCouplingFieldDouble *f3=MEDLoader::ReadFieldNode(fileName,f1->getMesh()->getName(),0,f1->getName(),2,7); + MEDCouplingFieldDouble *f3=MEDLoader::ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7); CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); - f3=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName(),0,f1->getName(),2,7); + f3=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7); CPPUNIT_ASSERT(f3->isEqual(f1,1e-12,1e-12)); f3->decrRef(); // diff --git a/src/MEDLoader/Test/SauvLoaderTest.cxx b/src/MEDLoader/Test/SauvLoaderTest.cxx index 113633c73..62410d9b5 100644 --- a/src/MEDLoader/Test/SauvLoaderTest.cxx +++ b/src/MEDLoader/Test/SauvLoaderTest.cxx @@ -306,7 +306,7 @@ void SauvLoaderTest::testMed2Sauv() } // "Field on 2 faces" MEDCouplingAutoRefCountObjectPtr fieldOnFaces = - dynamic_cast(d2->getFields()->getFieldWithName(f1->getName())); + dynamic_cast(d2->getFields()->getFieldWithName(f1->getName().c_str())); io1 = fieldOnFaces->getIterations(); MEDCouplingAutoRefCountObjectPtr fof = fieldOnFaces->getFieldOnMeshAtLevel(f1->getTypeOfField(),io1[0].first,io1[0].second,um1); diff --git a/src/MEDOP/cmp/MEDDataManager_i.cxx b/src/MEDOP/cmp/MEDDataManager_i.cxx index b64b90a37..88e32191a 100644 --- a/src/MEDOP/cmp/MEDDataManager_i.cxx +++ b/src/MEDOP/cmp/MEDDataManager_i.cxx @@ -583,7 +583,7 @@ MEDCouplingFieldDouble * MEDDataManager_i::getFieldDouble(const MEDOP::FieldHand long sourceid = _meshHandlerMap[meshid]->sourceid; const char * filepath = source_to_file((_datasourceHandlerMap[sourceid])->uri); - const char * meshName = myMesh->getName(); + const char * meshName = myMesh->getName().c_str(); LOG("getFieldDouble: field "<fieldname<<" loaded from file "<type; int meshDimRelToMax = 0; @@ -612,8 +612,8 @@ MEDCouplingFieldDouble * MEDDataManager_i::getFieldDouble(const MEDOP::FieldHand MEDOP::FieldHandler * MEDDataManager_i::addField(MEDCouplingFieldDouble * fieldDouble, long meshHandlerId) { - const char * fieldName = fieldDouble->getName(); - const char * meshName = fieldDouble->getMesh()->getName(); + const char * fieldName = fieldDouble->getName().c_str(); + const char * meshName = fieldDouble->getMesh()->getName().c_str(); TypeOfField type = fieldDouble->getTypeOfField(); int iteration, order; diff --git a/src/ParaMEDLoader/ParaMEDLoader.cxx b/src/ParaMEDLoader/ParaMEDLoader.cxx index da973787c..50519734f 100644 --- a/src/ParaMEDLoader/ParaMEDLoader.cxx +++ b/src/ParaMEDLoader/ParaMEDLoader.cxx @@ -46,7 +46,7 @@ void ParaMEDLoader::WriteParaMesh(const char *fileName, ParaMEDMEM::ParaMESH *me fileNames[i]=sstr.str(); } if(myRank==0) - WriteMasterFile(fileName,fileNames,mesh->getCellMesh()->getName()); + WriteMasterFile(fileName,fileNames,mesh->getCellMesh()->getName().c_str()); MEDLoader::WriteUMesh(fileNames[myRank].c_str(),dynamic_cast(mesh->getCellMesh()),true); } -- 2.39.2