From 108d739460de39c96211da105da0777deee716cb Mon Sep 17 00:00:00 2001 From: ageay Date: Wed, 22 Jan 2014 14:04:02 +0000 Subject: [PATCH] API modification : input string have type : const std::string& instead of const char * --- .../ExprEval/InterpKernelExprParser.cxx | 2 +- .../ExprEval/InterpKernelExprParser.hxx | 2 +- src/INTERP_KERNEL/Interpolation.hxx | 6 +- src/INTERP_KERNEL/Interpolation.txx | 7 +- src/INTERP_KERNEL/Interpolation2D1D.hxx | 2 +- src/INTERP_KERNEL/Interpolation2D1D.txx | 2 +- src/INTERP_KERNEL/Interpolation3D.hxx | 2 +- src/INTERP_KERNEL/Interpolation3D.txx | 3 +- src/INTERP_KERNEL/Interpolation3D2D.hxx | 2 +- src/INTERP_KERNEL/Interpolation3D2D.txx | 2 +- src/INTERP_KERNEL/InterpolationCurve.hxx | 2 +- src/INTERP_KERNEL/InterpolationCurve.txx | 17 +- src/INTERP_KERNEL/InterpolationOptions.cxx | 9 +- src/INTERP_KERNEL/InterpolationOptions.hxx | 2 +- src/INTERP_KERNEL/InterpolationPlanar.hxx | 2 +- src/INTERP_KERNEL/InterpolationPlanar.txx | 3 +- src/MEDCoupling/MEDCoupling1GTUMesh.cxx | 58 +-- src/MEDCoupling/MEDCoupling1GTUMesh.hxx | 12 +- src/MEDCoupling/MEDCouplingCMesh.cxx | 16 +- src/MEDCoupling/MEDCouplingCMesh.hxx | 2 +- .../MEDCouplingCurveLinearMesh.cxx | 10 +- .../MEDCouplingCurveLinearMesh.hxx | 2 +- src/MEDCoupling/MEDCouplingExtrudedMesh.cxx | 10 +- src/MEDCoupling/MEDCouplingField.cxx | 4 +- src/MEDCoupling/MEDCouplingField.hxx | 4 +- .../MEDCouplingFieldDiscretization.cxx | 17 +- .../MEDCouplingFieldDiscretization.hxx | 6 +- src/MEDCoupling/MEDCouplingFieldDouble.cxx | 58 +-- src/MEDCoupling/MEDCouplingFieldDouble.hxx | 26 +- src/MEDCoupling/MEDCouplingMemArray.cxx | 80 ++-- src/MEDCoupling/MEDCouplingMemArray.hxx | 52 +-- src/MEDCoupling/MEDCouplingMemArrayChar.cxx | 12 +- src/MEDCoupling/MEDCouplingMesh.cxx | 18 +- src/MEDCoupling/MEDCouplingMesh.hxx | 18 +- src/MEDCoupling/MEDCouplingPointSet.cxx | 18 +- src/MEDCoupling/MEDCouplingRemapper.cxx | 50 +-- src/MEDCoupling/MEDCouplingRemapper.hxx | 2 +- src/MEDCoupling/MEDCouplingStructuredMesh.cxx | 2 +- .../MEDCouplingTimeDiscretization.cxx | 20 +- .../MEDCouplingTimeDiscretization.hxx | 22 +- src/MEDCoupling/MEDCouplingUMesh.cxx | 24 +- src/MEDCoupling/MEDCouplingUMesh.hxx | 2 +- src/MEDCoupling_Swig/MEDCouplingCommon.i | 58 +-- .../MEDCouplingFieldDiscretization.i | 2 +- src/MEDCoupling_Swig/MEDCouplingMemArray.i | 32 +- src/MEDCoupling_Swig/MEDCouplingRemapper.i | 2 +- src/MEDLoader/MEDFileData.cxx | 12 +- src/MEDLoader/MEDFileData.hxx | 8 +- src/MEDLoader/MEDFileField.cxx | 360 ++++++++-------- src/MEDLoader/MEDFileField.hxx | 272 ++++++------ src/MEDLoader/MEDFileFieldOverView.cxx | 4 +- src/MEDLoader/MEDFileFieldOverView.hxx | 2 +- src/MEDLoader/MEDFileMesh.cxx | 281 ++++++------- src/MEDLoader/MEDFileMesh.hxx | 134 +++--- src/MEDLoader/MEDFileMeshElt.cxx | 14 +- src/MEDLoader/MEDFileMeshElt.hxx | 2 +- src/MEDLoader/MEDFileMeshLL.cxx | 96 ++--- src/MEDLoader/MEDFileMeshLL.hxx | 26 +- src/MEDLoader/MEDFileParameter.cxx | 54 +-- src/MEDLoader/MEDFileParameter.hxx | 42 +- src/MEDLoader/MEDFileUtilities.cxx | 6 +- src/MEDLoader/MEDFileUtilities.hxx | 4 +- src/MEDLoader/MEDLoader.cxx | 176 ++++---- src/MEDLoader/MEDLoader.hxx | 92 ++--- src/MEDLoader/MEDLoaderBase.cxx | 8 +- src/MEDLoader/MEDLoaderBase.hxx | 4 +- src/MEDLoader/SauvReader.cxx | 8 +- src/MEDLoader/SauvReader.hxx | 2 +- src/MEDLoader/SauvWriter.cxx | 4 +- src/MEDLoader/SauvWriter.hxx | 2 +- src/MEDLoader/Swig/MEDLoaderCommon.i | 388 +++++++++--------- src/MEDOP/cmp/MEDDataManager_i.cxx | 32 +- src/MEDOP/cmp/MEDDataManager_i.hxx | 4 +- .../MEDPARTITIONER_MeshCollection.cxx | 8 +- .../MEDPARTITIONER_MeshCollectionDriver.cxx | 24 +- src/MEDPartitioner/MEDPARTITIONER_Utils.cxx | 8 +- src/ParaMEDMEM/InterpolationMatrix.cxx | 26 +- src/ParaMEDMEM/NonCoincidentDEC.cxx | 6 +- src/ParaMEDMEM/OverlapInterpolationMatrix.cxx | 30 +- src/RENUMBER/renumbering.cxx | 10 +- 80 files changed, 1429 insertions(+), 1424 deletions(-) diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx index 42630e3ab..5a9437a57 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx @@ -156,7 +156,7 @@ LeafExprVar::~LeafExprVar() { } -ExprParser::ExprParser(const char *expr, ExprParser *father):_father(father),_is_parsed(false),_leaf(0),_is_parsing_ok(false),_expr(expr) +ExprParser::ExprParser(const std::string& expr, ExprParser *father):_father(father),_is_parsed(false),_leaf(0),_is_parsing_ok(false),_expr(expr) { _expr=deleteWhiteSpaces(_expr); } diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx index 85c4ac35b..a5730415b 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx @@ -82,7 +82,7 @@ namespace INTERP_KERNEL class ExprParser { public: - INTERPKERNEL_EXPORT ExprParser(const char *expr, ExprParser *father=0); + INTERPKERNEL_EXPORT ExprParser(const std::string& expr, ExprParser *father=0); INTERPKERNEL_EXPORT ExprParser(const char *expr, int lgth, ExprParser *father=0); INTERPKERNEL_EXPORT ~ExprParser(); INTERPKERNEL_EXPORT void parse(); diff --git a/src/INTERP_KERNEL/Interpolation.hxx b/src/INTERP_KERNEL/Interpolation.hxx index a9402871f..77022c356 100644 --- a/src/INTERP_KERNEL/Interpolation.hxx +++ b/src/INTERP_KERNEL/Interpolation.hxx @@ -40,14 +40,14 @@ namespace INTERP_KERNEL int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result) { return asLeaf().interpolateMeshes(meshS,meshT,result); } template - int fromIntegralUniform(const MyMeshType& meshT, MatrixType& result, const char *method) { return fromToIntegralUniform(false,meshT,result,method); } + int fromIntegralUniform(const MyMeshType& meshT, MatrixType& result, const std::string& method) { return fromToIntegralUniform(false,meshT,result,method); } template - int toIntegralUniform(const MyMeshType& meshS, MatrixType& result, const char *method) { return fromToIntegralUniform(true,meshS,result,method); } + int toIntegralUniform(const MyMeshType& meshS, MatrixType& result, const std::string& method) { return fromToIntegralUniform(true,meshS,result,method); } template static double CalculateCharacteristicSizeOfMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, const int printLevel); protected: template - int fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const char *method); + int fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const std::string& method); protected: TrueMainInterpolator& asLeaf() { return static_cast(*this); } }; diff --git a/src/INTERP_KERNEL/Interpolation.txx b/src/INTERP_KERNEL/Interpolation.txx index e9d435d38..ee8587760 100644 --- a/src/INTERP_KERNEL/Interpolation.txx +++ b/src/INTERP_KERNEL/Interpolation.txx @@ -29,12 +29,11 @@ namespace INTERP_KERNEL { template template - int Interpolation::fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const char *method) + int Interpolation::fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const std::string& method) { typedef typename MyMeshType::MyConnType ConnType; - std::string methodCPP(method); int ret=-1; - if(methodCPP=="P0") + if(method=="P0") { IntegralUniformIntersectorP0 intersector(mesh,InterpolationOptions::getMeasureAbsStatus()); intersector.setFromTo(fromTo); @@ -42,7 +41,7 @@ namespace INTERP_KERNEL intersector.intersectCells(0,tmp,result); ret=intersector.getNumberOfColsOfResMatrix(); } - else if(methodCPP=="P1") + else if(method=="P1") { IntegralUniformIntersectorP1 intersector(mesh,InterpolationOptions::getMeasureAbsStatus()); intersector.setFromTo(fromTo); diff --git a/src/INTERP_KERNEL/Interpolation2D1D.hxx b/src/INTERP_KERNEL/Interpolation2D1D.hxx index 686d7d6fa..5121674cd 100644 --- a/src/INTERP_KERNEL/Interpolation2D1D.hxx +++ b/src/INTERP_KERNEL/Interpolation2D1D.hxx @@ -48,7 +48,7 @@ namespace INTERP_KERNEL // Main function to interpolate triangular and quadratic meshes template - int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const char *method); + int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method); DuplicateFacesType retrieveDuplicateFaces() const { return _duplicate_faces; diff --git a/src/INTERP_KERNEL/Interpolation2D1D.txx b/src/INTERP_KERNEL/Interpolation2D1D.txx index 365e697f6..7f4283eac 100644 --- a/src/INTERP_KERNEL/Interpolation2D1D.txx +++ b/src/INTERP_KERNEL/Interpolation2D1D.txx @@ -46,7 +46,7 @@ namespace INTERP_KERNEL * */ template - int Interpolation2D1D::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const char *method) + int Interpolation2D1D::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method) { static const int SPACEDIM=MyMeshType::MY_SPACEDIM; typedef typename MyMeshType::MyConnType ConnType; diff --git a/src/INTERP_KERNEL/Interpolation3D.hxx b/src/INTERP_KERNEL/Interpolation3D.hxx index ddebd1827..d3732c56d 100644 --- a/src/INTERP_KERNEL/Interpolation3D.hxx +++ b/src/INTERP_KERNEL/Interpolation3D.hxx @@ -34,7 +34,7 @@ namespace INTERP_KERNEL Interpolation3D(); Interpolation3D(const InterpolationOptions& io); template - int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const char *method); + int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method); private: SplittingPolicy _splitting_policy; }; diff --git a/src/INTERP_KERNEL/Interpolation3D.txx b/src/INTERP_KERNEL/Interpolation3D.txx index 851cb7902..67327f861 100644 --- a/src/INTERP_KERNEL/Interpolation3D.txx +++ b/src/INTERP_KERNEL/Interpolation3D.txx @@ -17,6 +17,7 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // Author : Anthony Geay (CEA/DEN) + #ifndef __INTERPOLATION3D_TXX__ #define __INTERPOLATION3D_TXX__ @@ -73,7 +74,7 @@ namespace INTERP_KERNEL * */ template - int Interpolation3D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const char *method) + int Interpolation3D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method) { typedef typename MyMeshType::MyConnType ConnType; // create MeshElement objects corresponding to each element of the two meshes diff --git a/src/INTERP_KERNEL/Interpolation3D2D.hxx b/src/INTERP_KERNEL/Interpolation3D2D.hxx index 75bebaee8..8ece823b0 100644 --- a/src/INTERP_KERNEL/Interpolation3D2D.hxx +++ b/src/INTERP_KERNEL/Interpolation3D2D.hxx @@ -50,7 +50,7 @@ namespace INTERP_KERNEL int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MyMatrixType& matrix, - const char *method); + const std::string& method); INTERPKERNEL_EXPORT DuplicateFacesType retrieveDuplicateFaces() const { return _duplicate_faces; } private: SplittingPolicy _splitting_policy; diff --git a/src/INTERP_KERNEL/Interpolation3D2D.txx b/src/INTERP_KERNEL/Interpolation3D2D.txx index b84b992ad..77878cf19 100644 --- a/src/INTERP_KERNEL/Interpolation3D2D.txx +++ b/src/INTERP_KERNEL/Interpolation3D2D.txx @@ -63,7 +63,7 @@ namespace INTERP_KERNEL int Interpolation3D2D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MyMatrixType& matrix, - const char *method) + const std::string& method) { typedef typename MyMeshType::MyConnType ConnType; // create MeshElement objects corresponding to each element of the two meshes diff --git a/src/INTERP_KERNEL/InterpolationCurve.hxx b/src/INTERP_KERNEL/InterpolationCurve.hxx index 36aaa086b..a952bd8f5 100644 --- a/src/INTERP_KERNEL/InterpolationCurve.hxx +++ b/src/INTERP_KERNEL/InterpolationCurve.hxx @@ -36,7 +36,7 @@ namespace INTERP_KERNEL // Main function to interpolate template int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, - MatrixType& result, const char *method); + MatrixType& result, const std::string& method); }; } diff --git a/src/INTERP_KERNEL/InterpolationCurve.txx b/src/INTERP_KERNEL/InterpolationCurve.txx index cd9e00355..111515ffb 100644 --- a/src/INTERP_KERNEL/InterpolationCurve.txx +++ b/src/INTERP_KERNEL/InterpolationCurve.txx @@ -72,10 +72,10 @@ namespace INTERP_KERNEL */ template template - int InterpolationCurve::interpolateMeshes (const MyMeshType& myMeshS, - const MyMeshType& myMeshT, - MatrixType& result, - const char * method) + int InterpolationCurve::interpolateMeshes (const MyMeshType& myMeshS, + const MyMeshType& myMeshT, + MatrixType& result, + const std::string& method) { static const int SPACEDIM=MyMeshType::MY_SPACEDIM; typedef typename MyMeshType::MyConnType ConnType; @@ -88,8 +88,7 @@ namespace INTERP_KERNEL long nbMailleT = myMeshT.getNumberOfElements(); CurveIntersector* intersector=0; - std::string meth(method); - if(meth=="P0P0") + if(method=="P0P0") { intersector = new CurveIntersectorP0P0 (myMeshT, myMeshS, @@ -98,7 +97,7 @@ namespace INTERP_KERNEL InterpolationOptions::getMedianPlane(), InterpolationOptions::getPrintLevel()); } - else if(meth=="P0P1") + else if(method=="P0P1") { intersector = new CurveIntersectorP0P1 (myMeshT, myMeshS, @@ -107,7 +106,7 @@ namespace INTERP_KERNEL InterpolationOptions::getMedianPlane(), InterpolationOptions::getPrintLevel()); } - else if(meth=="P1P0") + else if(method=="P1P0") { intersector = new CurveIntersectorP1P0 (myMeshT, myMeshS, @@ -116,7 +115,7 @@ namespace INTERP_KERNEL InterpolationOptions::getMedianPlane(), InterpolationOptions::getPrintLevel()); } - else if(meth=="P1P1") + else if(method=="P1P1") { intersector = new CurveIntersectorP1P1 (myMeshT, myMeshS, diff --git a/src/INTERP_KERNEL/InterpolationOptions.cxx b/src/INTERP_KERNEL/InterpolationOptions.cxx index 43d2e4222..ebd37d1a1 100644 --- a/src/INTERP_KERNEL/InterpolationOptions.cxx +++ b/src/INTERP_KERNEL/InterpolationOptions.cxx @@ -286,19 +286,18 @@ std::string INTERP_KERNEL::InterpolationOptions::printOptions() const return oss.str(); } -void INTERP_KERNEL::InterpolationOptions::CheckAndSplitInterpolationMethod(const char *method, std::string& srcMeth, std::string& trgMeth) +void INTERP_KERNEL::InterpolationOptions::CheckAndSplitInterpolationMethod(const std::string& method, std::string& srcMeth, std::string& trgMeth) { const int NB_OF_METH_MANAGED=4; const char *METH_MANAGED[NB_OF_METH_MANAGED]={"P0P0","P0P1","P1P0","P1P1"}; - std::string methodC(method); bool found=false; for(int i=0;i - int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const char *method); + int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method); public: bool doRotate() const { return asLeafInterpPlanar().doRotate(); } double medianPlane() const { return asLeafInterpPlanar().medianPlane(); } diff --git a/src/INTERP_KERNEL/InterpolationPlanar.txx b/src/INTERP_KERNEL/InterpolationPlanar.txx index 13a6817c3..73b2e9d31 100644 --- a/src/INTERP_KERNEL/InterpolationPlanar.txx +++ b/src/INTERP_KERNEL/InterpolationPlanar.txx @@ -17,6 +17,7 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // Author : Anthony Geay (CEA/DEN) + #ifndef __INTERPOLATIONPLANAR_TXX__ #define __INTERPOLATIONPLANAR_TXX__ @@ -111,7 +112,7 @@ namespace INTERP_KERNEL */ template template - int InterpolationPlanar::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const char *method) + int InterpolationPlanar::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method) { static const int SPACEDIM=MyMeshType::MY_SPACEDIM; typedef typename MyMeshType::MyConnType ConnType; diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index ca92e2fa0..9328df367 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -32,7 +32,7 @@ MEDCoupling1GTUMesh::MEDCoupling1GTUMesh() { } -MEDCoupling1GTUMesh::MEDCoupling1GTUMesh(const char *name, const INTERP_KERNEL::CellModel& cm):_cm(&cm) +MEDCoupling1GTUMesh::MEDCoupling1GTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm):_cm(&cm) { setName(name); } @@ -41,7 +41,7 @@ MEDCoupling1GTUMesh::MEDCoupling1GTUMesh(const MEDCoupling1GTUMesh& other, bool { } -MEDCoupling1GTUMesh *MEDCoupling1GTUMesh::New(const char *name, INTERP_KERNEL::NormalizedCellType type) +MEDCoupling1GTUMesh *MEDCoupling1GTUMesh::New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) { if(type==INTERP_KERNEL::NORM_ERROR) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::New : NORM_ERROR is not a valid type to be used as base geometric type for a mesh !"); @@ -404,7 +404,7 @@ MEDCouplingUMesh *MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(const std::v throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : the first instance in input parts is null !"); const DataArrayDouble *coords(firstPart->getCoords()); int meshDim(firstPart->getMeshDimension()); - MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingUMesh::New(firstPart->getName().c_str(),meshDim)); ret->setDescription(firstPart->getDescription().c_str()); + MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingUMesh::New(firstPart->getName(),meshDim)); ret->setDescription(firstPart->getDescription()); ret->setCoords(coords); int nbOfCells(0),connSize(0); for(std::vector< const MEDCoupling1GTUMesh *>::const_iterator it=parts.begin();it!=parts.end();it++) @@ -467,7 +467,7 @@ MEDCoupling1SGTUMesh::MEDCoupling1SGTUMesh(const MEDCoupling1SGTUMesh& other, bo } } -MEDCoupling1SGTUMesh::MEDCoupling1SGTUMesh(const char *name, const INTERP_KERNEL::CellModel& cm):MEDCoupling1GTUMesh(name,cm) +MEDCoupling1SGTUMesh::MEDCoupling1SGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm):MEDCoupling1GTUMesh(name,cm) { } @@ -480,7 +480,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::New() return new MEDCoupling1SGTUMesh; } -MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::New(const char *name, INTERP_KERNEL::NormalizedCellType type) +MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) { if(type==INTERP_KERNEL::NORM_ERROR) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::New : NORM_ERROR is not a valid type to be used as base geometric type for a mesh !"); @@ -501,8 +501,8 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::New(const MEDCouplingUMesh *m) if(gts.size()!=1) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::New : input mesh must have exactly one geometric type !"); int geoType((int)*gts.begin()); - MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1SGTUMesh::New(m->getName().c_str(),*gts.begin())); - ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription().c_str()); + MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1SGTUMesh::New(m->getName(),*gts.begin())); + ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription()); int nbCells(m->getNumberOfCells()); int nbOfNodesPerCell(ret->getNumberOfNodesPerCell()); MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()); conn->alloc(nbCells*nbOfNodesPerCell,1); @@ -949,7 +949,7 @@ MEDCouplingMesh *MEDCoupling1SGTUMesh::mergeMyselfWith(const MEDCouplingMesh *ot MEDCouplingUMesh *MEDCoupling1SGTUMesh::buildUnstructured() const { - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(getName().c_str(),getMeshDimension()); + MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(getName(),getMeshDimension()); ret->setCoords(getCoords()); const int *nodalConn=_conn->begin(); int nbCells=getNumberOfCells(); @@ -1168,7 +1168,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vector ret(new MEDCoupling1SGTUMesh(getName().c_str(),*_cm)); + MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); ret->setCoords(_coords); std::size_t nbOfElemsRet=std::distance(begin,end); const int *inConn=_conn->getConstPointer(); @@ -1194,7 +1194,7 @@ MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords2(int star { int ncell=getNumberOfCells(); int nbOfElemsRet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords2 : "); - MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1SGTUMesh(getName().c_str(),*_cm)); + MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); ret->setCoords(_coords); const int *inConn=_conn->getConstPointer(); int sz=getNumberOfNodesPerCell(); @@ -1237,7 +1237,7 @@ void MEDCoupling1SGTUMesh::computeNodeIdsAlg(std::vector& nodeIdsInUse) co MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(int spaceDim) const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1SGTUMesh(getName().c_str(),*_cm)); + MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); MEDCouplingAutoRefCountObjectPtr tmp1; const DataArrayInt *nodalConn(_conn); if(!nodalConn) @@ -1442,9 +1442,9 @@ void MEDCoupling1SGTUMesh::unserialization(const std::vector& tinyInfoD, { INTERP_KERNEL::NormalizedCellType gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]); _cm=&INTERP_KERNEL::CellModel::GetCellModel(gt); - setName(littleStrings[0].c_str()); - setDescription(littleStrings[1].c_str()); - setTimeUnit(littleStrings[2].c_str()); + setName(littleStrings[0]); + setDescription(littleStrings[1]); + setTimeUnit(littleStrings[2]); setTime(tinyInfoD[0],tinyInfo[1],tinyInfo[2]); int sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]); // @@ -1648,7 +1648,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4() const throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4 : this method can be applied only on HEXA8 mesh !"); int nbHexa8(getNumberOfCells()); const int *inConnPtr(getNodalConnectivity()->begin()); - MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1SGTUMesh::New(getName().c_str(),INTERP_KERNEL::NORM_QUAD4)); + MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_QUAD4)); MEDCouplingAutoRefCountObjectPtr c(DataArrayInt::New()); c->alloc(nbHexa8*6*4,1); int *cPtr(c->getPointer()); for(int i=0;i v(4); v[0]=getCoords(); v[1]=facesBaryArr; v[2]=edgesBaryArr; v[3]=baryArr; MEDCouplingAutoRefCountObjectPtr zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; facesBaryArr=0; std::string name("DualOf_"); name+=getName(); - MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1DGTUMesh::New(name.c_str(),INTERP_KERNEL::NORM_POLYHED)); ret->setCoords(zeArr); + MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYHED)); ret->setCoords(zeArr); MEDCouplingAutoRefCountObjectPtr cArr(DataArrayInt::New()),ciArr(DataArrayInt::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1); for(int i=0;i v(3); v[0]=getCoords(); v[1]=edgesBaryArr; v[2]=baryArr; MEDCouplingAutoRefCountObjectPtr zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; std::string name("DualOf_"); name+=getName(); - MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1DGTUMesh::New(name.c_str(),INTERP_KERNEL::NORM_POLYGON)); ret->setCoords(zeArr); + MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYGON)); ret->setCoords(zeArr); MEDCouplingAutoRefCountObjectPtr cArr(DataArrayInt::New()),ciArr(DataArrayInt::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1); for(int i=0;i ret=MEDCouplingUMesh::New(getName().c_str(),getMeshDimension()); + MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(getName(),getMeshDimension()); ret->setCoords(getCoords()); const int *nodalConn=_conn->begin(),*nodalConnI=_conn_indx->begin(); int nbCells=getNumberOfCells();//checkCoherency @@ -2710,7 +2710,7 @@ MEDCouplingPointSet *MEDCoupling1DGTUMesh::mergeMyselfWithOnSameCoords(const MED MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const { checkCoherency(); - MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1DGTUMesh(getName().c_str(),*_cm)); + MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); ret->setCoords(_coords); DataArrayInt *c=0,*ci=0; MEDCouplingUMesh::ExtractFromIndexedArrays(begin,end,_conn,_conn_indx,c,ci); @@ -2722,7 +2722,7 @@ MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords(const int MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords2(int start, int end, int step) const { checkCoherency(); - MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1DGTUMesh(getName().c_str(),*_cm)); + MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); ret->setCoords(_coords); DataArrayInt *c=0,*ci=0; MEDCouplingUMesh::ExtractFromIndexedArrays2(start,end,step,_conn,_conn_indx,c,ci); @@ -2900,9 +2900,9 @@ void MEDCoupling1DGTUMesh::unserialization(const std::vector& tinyInfoD, { INTERP_KERNEL::NormalizedCellType gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]); _cm=&INTERP_KERNEL::CellModel::GetCellModel(gt); - setName(littleStrings[0].c_str()); - setDescription(littleStrings[1].c_str()); - setTimeUnit(littleStrings[2].c_str()); + setName(littleStrings[0]); + setDescription(littleStrings[1]); + setTimeUnit(littleStrings[2]); setTime(tinyInfoD[0],tinyInfo[1],tinyInfo[2]); int sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]),sz4(tinyInfo[7]),sz5(tinyInfo[8]); // @@ -3139,7 +3139,7 @@ DataArrayInt *MEDCoupling1DGTUMesh::getNodalConnectivityIndex() const */ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::copyWithNodalConnectivityPacked(bool& isShallowCpyOfNodalConnn) const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1DGTUMesh(getName().c_str(),*_cm)); + MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); DataArrayInt *nc=0,*nci=0; isShallowCpyOfNodalConnn=retrievePackedNodalConnectivity(nc,nci); MEDCouplingAutoRefCountObjectPtr ncs(nc),ncis(nci); @@ -3322,7 +3322,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshesLL(std::vector ret(new MEDCoupling1DGTUMesh(getName().c_str(),*_cm)); + MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); MEDCouplingAutoRefCountObjectPtr tmp1,tmp2; const DataArrayInt *nodalConn(_conn),*nodalConnI(_conn_indx); if(!nodalConn) @@ -3481,8 +3481,8 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::New(const MEDCouplingUMesh *m) if(gts.size()!=1) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::New : input mesh must have exactly one geometric type !"); int geoType((int)*gts.begin()); - MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1DGTUMesh::New(m->getName().c_str(),*gts.begin())); - ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription().c_str()); + MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1DGTUMesh::New(m->getName(),*gts.begin())); + ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription()); int nbCells(m->getNumberOfCells()); MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()),connI(DataArrayInt::New()); conn->alloc(m->getMeshLength()-nbCells,1); connI->alloc(nbCells+1,1); diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.hxx b/src/MEDCoupling/MEDCoupling1GTUMesh.hxx index 805ba002d..32414fb04 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.hxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.hxx @@ -35,7 +35,7 @@ namespace ParaMEDMEM class MEDCoupling1GTUMesh : public MEDCouplingPointSet { public: - MEDCOUPLING_EXPORT static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type); + MEDCOUPLING_EXPORT static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type); MEDCOUPLING_EXPORT static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m); MEDCOUPLING_EXPORT const INTERP_KERNEL::CellModel& getCellModel() const; MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getCellModelEnum() const; @@ -73,7 +73,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT virtual DataArrayInt *getNodalConnectivity() const = 0; MEDCOUPLING_EXPORT virtual void checkCoherencyOfConnectivity() const = 0; protected: - MEDCoupling1GTUMesh(const char *name, const INTERP_KERNEL::CellModel& cm); + MEDCoupling1GTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm); MEDCoupling1GTUMesh(const MEDCoupling1GTUMesh& other, bool recDeepCpy); MEDCoupling1GTUMesh(); protected: @@ -85,7 +85,7 @@ namespace ParaMEDMEM class MEDCoupling1SGTUMesh : public MEDCoupling1GTUMesh { public: - MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type); + MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type); MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m); //! useless constructor only for CORBA -> not swigged MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *New(); @@ -153,7 +153,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); private: - MEDCoupling1SGTUMesh(const char *name, const INTERP_KERNEL::CellModel& cm); + MEDCoupling1SGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm); MEDCoupling1SGTUMesh(const MEDCoupling1SGTUMesh& other, bool recDeepCpy); MEDCoupling1SGTUMesh(); private: @@ -174,7 +174,7 @@ namespace ParaMEDMEM class MEDCoupling1DGTUMesh : public MEDCoupling1GTUMesh { public: - MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type); + MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type); MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m); //! useless constructor only for CORBA -> not swigged MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *New(); @@ -244,7 +244,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); private: - MEDCoupling1DGTUMesh(const char *name, const INTERP_KERNEL::CellModel& cm); + MEDCoupling1DGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm); MEDCoupling1DGTUMesh(const MEDCoupling1DGTUMesh& other, bool recDeepCpy); MEDCoupling1DGTUMesh(); private: diff --git a/src/MEDCoupling/MEDCouplingCMesh.cxx b/src/MEDCoupling/MEDCouplingCMesh.cxx index 9588dca64..b928c5d87 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCMesh.cxx @@ -79,7 +79,7 @@ MEDCouplingCMesh *MEDCouplingCMesh::New() return new MEDCouplingCMesh; } -MEDCouplingCMesh *MEDCouplingCMesh::New(const char *meshName) +MEDCouplingCMesh *MEDCouplingCMesh::New(const std::string& meshName) { MEDCouplingCMesh *ret=new MEDCouplingCMesh; ret->setName(meshName); @@ -617,7 +617,7 @@ MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureField(bool isAbs) const name+=getName(); int nbelem=getNumberOfCells(); MEDCouplingFieldDouble *field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); - field->setName(name.c_str()); + field->setName(name); DataArrayDouble* array=DataArrayDouble::New(); array->alloc(nbelem,1); double *area_vol=array->getPointer(); @@ -758,7 +758,7 @@ DataArrayDouble *MEDCouplingCMesh::getCoordinatesAndOwner() const for(int j=0;jgetConstPointer(); - ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0).c_str()); + ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0)); } int tmp2[3]; for(int i=0;igetNbOfElems()-1; - ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0).c_str()); + ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0)); const double *srcPtr=tabs[j]->getConstPointer(); tabsPtr[j].insert(tabsPtr[j].end(),srcPtr,srcPtr+sz); std::transform(tabsPtr[j].begin(),tabsPtr[j].end(),srcPtr+1,tabsPtr[j].begin(),std::plus()); @@ -878,9 +878,9 @@ void MEDCouplingCMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const void MEDCouplingCMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) { - setName(littleStrings[0].c_str()); - setDescription(littleStrings[1].c_str()); - setTimeUnit(littleStrings[2].c_str()); + setName(littleStrings[0]); + setDescription(littleStrings[1]); + setTimeUnit(littleStrings[2]); DataArrayDouble **thisArr[3]={&_x_array,&_y_array,&_z_array}; const double *data=a2->getConstPointer(); for(int i=0;i<3;i++) @@ -889,7 +889,7 @@ void MEDCouplingCMesh::unserialization(const std::vector& tinyInfoD, con { (*(thisArr[i]))=DataArrayDouble::New(); (*(thisArr[i]))->alloc(tinyInfo[i],1); - (*(thisArr[i]))->setInfoOnComponent(0,littleStrings[i+3].c_str()); + (*(thisArr[i]))->setInfoOnComponent(0,littleStrings[i+3]); std::copy(data,data+tinyInfo[i],(*(thisArr[i]))->getPointer()); data+=tinyInfo[i]; } diff --git a/src/MEDCoupling/MEDCouplingCMesh.hxx b/src/MEDCoupling/MEDCouplingCMesh.hxx index 5a6cc2576..0a503fe97 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCMesh.hxx @@ -33,7 +33,7 @@ namespace ParaMEDMEM { public: MEDCOUPLING_EXPORT static MEDCouplingCMesh *New(); - MEDCOUPLING_EXPORT static MEDCouplingCMesh *New(const char *meshName); + MEDCOUPLING_EXPORT static MEDCouplingCMesh *New(const std::string& meshName); MEDCOUPLING_EXPORT MEDCouplingMesh *deepCpy() const; MEDCOUPLING_EXPORT MEDCouplingCMesh *clone(bool recDeepCpy) const; MEDCOUPLING_EXPORT void updateTime() const; diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx index 6dc3063da..e8e1aa467 100644 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx @@ -57,7 +57,7 @@ MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::New() return new MEDCouplingCurveLinearMesh; } -MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::New(const char *meshName) +MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::New(const std::string& meshName) { MEDCouplingCurveLinearMesh *ret=new MEDCouplingCurveLinearMesh; ret->setName(meshName); @@ -391,7 +391,7 @@ MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::getMeasureField(bool isAbs) int meshDim=getMeshDimension(); std::string name="MeasureOfMesh_"; name+=getName(); MEDCouplingAutoRefCountObjectPtr field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); - field->setName(name.c_str()); field->setMesh(const_cast(this)); field->synchronizeTimeWithMesh(); + field->setName(name); field->setMesh(const_cast(this)); field->synchronizeTimeWithMesh(); switch(meshDim) { case 3: @@ -878,9 +878,9 @@ void MEDCouplingCurveLinearMesh::serialize(DataArrayInt *&a1, DataArrayDouble *& void MEDCouplingCurveLinearMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) { - setName(littleStrings[0].c_str()); - setDescription(littleStrings[1].c_str()); - setTimeUnit(littleStrings[2].c_str()); + setName(littleStrings[0]); + setDescription(littleStrings[1]); + setTimeUnit(littleStrings[2]); setTime(tinyInfoD[0],tinyInfo[0],tinyInfo[1]); int sz=tinyInfo[2]; _structure.resize(sz); diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx index 46a09bfdf..faba1c7b4 100644 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx @@ -34,7 +34,7 @@ namespace ParaMEDMEM { public: MEDCOUPLING_EXPORT static MEDCouplingCurveLinearMesh *New(); - MEDCOUPLING_EXPORT static MEDCouplingCurveLinearMesh *New(const char *meshName); + MEDCOUPLING_EXPORT static MEDCouplingCurveLinearMesh *New(const std::string& meshName); MEDCOUPLING_EXPORT MEDCouplingMesh *deepCpy() const; MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const; MEDCOUPLING_EXPORT void updateTime() const; diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx index 862532670..8ebcf8a71 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx @@ -101,7 +101,7 @@ try:_mesh2D(const_cast(mesh2D)),_mesh1D(MEDCouplingUMesh::Ne if(_mesh2D!=0) _mesh2D->incrRef(); computeExtrusion(mesh3D); - setName(mesh3D->getName().c_str()); + setName(mesh3D->getName()); } catch(INTERP_KERNEL::Exception& e) { @@ -448,7 +448,7 @@ MEDCouplingUMesh *MEDCouplingExtrudedMesh::build3DUnstructuredMesh() const MEDCouplingUMesh *ret=_mesh2D->buildExtrudedMesh(_mesh1D,0); const int *renum=_mesh3D_ids->getConstPointer(); ret->renumberCells(renum,false); - ret->setName(getName().c_str()); + ret->setName(getName()); return ret; } @@ -480,7 +480,7 @@ MEDCouplingFieldDouble *MEDCouplingExtrudedMesh::getMeasureField(bool) const retPtr[renum[i*nbOf2DCells+j]]=ret2DPtr[j]*ret1DPtr[i]; ret->setArray(da); da->decrRef(); - ret->setName(name.c_str()); + ret->setName(name); ret2D->decrRef(); ret1D->decrRef(); return ret; @@ -903,8 +903,8 @@ void MEDCouplingExtrudedMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) void MEDCouplingExtrudedMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) { - setName(littleStrings[littleStrings.size()-2].c_str()); - setDescription(littleStrings.back().c_str()); + setName(littleStrings[littleStrings.size()-2]); + setDescription(littleStrings.back()); std::size_t sz=tinyInfo.size(); int sz1=tinyInfo[sz-2]; _cell_2D_id=tinyInfo[sz-3]; diff --git a/src/MEDCoupling/MEDCouplingField.cxx b/src/MEDCoupling/MEDCouplingField.cxx index 3f50f4c57..55b6e0b98 100644 --- a/src/MEDCoupling/MEDCouplingField.cxx +++ b/src/MEDCoupling/MEDCouplingField.cxx @@ -590,8 +590,8 @@ void MEDCouplingField::copyTinyStringsFrom(const MEDCouplingField *other) { if(other) { - setName(other->_name.c_str()); - setDescription(other->_desc.c_str()); + setName(other->_name); + setDescription(other->_desc); } } diff --git a/src/MEDCoupling/MEDCouplingField.hxx b/src/MEDCoupling/MEDCouplingField.hxx index 8b2117c26..d857aceb9 100644 --- a/src/MEDCoupling/MEDCouplingField.hxx +++ b/src/MEDCoupling/MEDCouplingField.hxx @@ -53,9 +53,9 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT virtual void copyTinyStringsFrom(const MEDCouplingField *other); MEDCOUPLING_EXPORT void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh); MEDCOUPLING_EXPORT const ParaMEDMEM::MEDCouplingMesh *getMesh() const { return _mesh; } - MEDCOUPLING_EXPORT void setName(const char *name) { _name=name; } + MEDCOUPLING_EXPORT void setName(const std::string& name) { _name=name; } MEDCOUPLING_EXPORT std::string getDescription() const { return _desc; } - MEDCOUPLING_EXPORT void setDescription(const char *desc) { _desc=desc; } + MEDCOUPLING_EXPORT void setDescription(const std::string& desc) { _desc=desc; } MEDCOUPLING_EXPORT std::string getName() const { return _name; } MEDCOUPLING_EXPORT TypeOfField getTypeOfField() const; MEDCOUPLING_EXPORT NatureOfField getNature() const; diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx index 159ce3f8f..4790b4cb9 100644 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx @@ -135,18 +135,17 @@ MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::New(TypeOfField } } -TypeOfField MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(const char *repr) +TypeOfField MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(const std::string& repr) { - std::string reprCpp(repr); - if(reprCpp==MEDCouplingFieldDiscretizationP0::REPR) + if(repr==MEDCouplingFieldDiscretizationP0::REPR) return MEDCouplingFieldDiscretizationP0::TYPE; - if(reprCpp==MEDCouplingFieldDiscretizationP1::REPR) + if(repr==MEDCouplingFieldDiscretizationP1::REPR) return MEDCouplingFieldDiscretizationP1::TYPE; - if(reprCpp==MEDCouplingFieldDiscretizationGauss::REPR) + if(repr==MEDCouplingFieldDiscretizationGauss::REPR) return MEDCouplingFieldDiscretizationGauss::TYPE; - if(reprCpp==MEDCouplingFieldDiscretizationGaussNE::REPR) + if(repr==MEDCouplingFieldDiscretizationGaussNE::REPR) return MEDCouplingFieldDiscretizationGaussNE::TYPE; - if(reprCpp==MEDCouplingFieldDiscretizationKriging::REPR) + if(repr==MEDCouplingFieldDiscretizationKriging::REPR) return MEDCouplingFieldDiscretizationKriging::TYPE; throw INTERP_KERNEL::Exception("Representation does not match with any field discretization !"); } @@ -396,7 +395,7 @@ void MEDCouplingFieldDiscretization::getCellIdsHavingGaussLocalization(int locId throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); } -void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, const int *old2NewPtr, int newNbOfEntity, DataArrayDouble *arr, const char *msg) +void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, const int *old2NewPtr, int newNbOfEntity, DataArrayDouble *arr, const std::string& msg) { if(!arr) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr : input array is NULL !"); @@ -434,7 +433,7 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons } } -void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const char *msg) +void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const std::string& msg) { int nbOfComp=arr->getNumberOfComponents(); MEDCouplingAutoRefCountObjectPtr arrCpy=arr->deepCpy(); diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx index 374369da2..599747830 100644 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx @@ -49,7 +49,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildren() const; - MEDCOUPLING_EXPORT static TypeOfField GetTypeOfFieldFromStringRepr(const char *repr); + MEDCOUPLING_EXPORT static TypeOfField GetTypeOfFieldFromStringRepr(const std::string& repr); MEDCOUPLING_EXPORT virtual TypeOfField getEnum() const = 0; MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingFieldDiscretization *other, double eps) const; MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const = 0; @@ -107,8 +107,8 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT virtual ~MEDCouplingFieldDiscretization(); protected: MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization(); - MEDCOUPLING_EXPORT static void RenumberEntitiesFromO2NArr(double epsOnVals, const int *old2NewPtr, int newNbOfEntity, DataArrayDouble *arr, const char *msg); - MEDCOUPLING_EXPORT static void RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const char *msg); + MEDCOUPLING_EXPORT static void RenumberEntitiesFromO2NArr(double epsOnVals, const int *old2NewPtr, int newNbOfEntity, DataArrayDouble *arr, const std::string& msg); + MEDCOUPLING_EXPORT static void RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const std::string& msg); protected: double _precision; static const double DFLT_PRECISION; diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index 4b3fad76b..ee9fca8be 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -85,7 +85,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::New(const MEDCouplingFieldTempla * Sets a time \a unit of \a this field. For more info, see \ref MEDCouplingFirstSteps3. * \param [in] unit \a unit (string) in which time is measured. */ -void MEDCouplingFieldDouble::setTimeUnit(const char *unit) +void MEDCouplingFieldDouble::setTimeUnit(const std::string& unit) { _time_discr->setTimeUnit(unit); } @@ -94,7 +94,7 @@ void MEDCouplingFieldDouble::setTimeUnit(const char *unit) * Returns a time unit of \a this field. * \return a string describing units in which time is measured. */ -const char *MEDCouplingFieldDouble::getTimeUnit() const +std::string MEDCouplingFieldDouble::getTimeUnit() const { return _time_discr->getTimeUnit(); } @@ -212,8 +212,8 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfT disc=_type->clone(); MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),tdo,disc.retn()); ret->setMesh(getMesh()); - ret->setName(getName().c_str()); - ret->setDescription(getDescription().c_str()); + ret->setName(getName()); + ret->setDescription(getDescription()); return ret.retn(); } @@ -452,7 +452,7 @@ std::string MEDCouplingFieldDouble::advancedRepr() const return ret.str(); } -void MEDCouplingFieldDouble::writeVTK(const char *fileName, bool isBinary) const +void MEDCouplingFieldDouble::writeVTK(const std::string& fileName, bool isBinary) const { std::vector fs(1,this); MEDCouplingFieldDouble::WriteVTK(fileName,fs,isBinary); @@ -1515,7 +1515,7 @@ void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, FunctionToEvaluate f * \ref cpp_mcfielddouble_fillFromAnalytic "Here is a C++ example".
* \ref py_mcfielddouble_fillFromAnalytic "Here is a Python example". */ -void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const char *func) +void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const std::string& func) { if(!_mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic : no mesh defined !"); @@ -1530,7 +1530,7 @@ void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const char *func) * The function is applied to coordinates of value location points. For example, if * \a this field is on cells, the function is applied to cell barycenters.
* This method differs from - * \ref ParaMEDMEM::MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const char *func) "fillFromAnalytic()" + * \ref ParaMEDMEM::MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const std::string& func) "fillFromAnalytic()" * by the way how variable * names, used in the function, are associated with components of coordinates of field * location points; here, a variable name corresponding to a component is retrieved from @@ -1562,7 +1562,7 @@ void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const char *func) * \ref cpp_mcfielddouble_fillFromAnalytic2 "Here is a C++ example".
* \ref py_mcfielddouble_fillFromAnalytic2 "Here is a Python example". */ -void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const char *func) +void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const std::string& func) { if(!_mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic2 : no mesh defined !"); @@ -1577,7 +1577,7 @@ void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const char *func) * The function is applied to coordinates of value location points. For example, if * \a this field is on cells, the function is applied to cell barycenters.
* This method differs from - * \ref ParaMEDMEM::MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const char *func) "fillFromAnalytic()" + * \ref ParaMEDMEM::MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const std::string& func) "fillFromAnalytic()" * by the way how variable * names, used in the function, are associated with components of coordinates of field * location points; here, a component index of a variable is defined by a @@ -1609,7 +1609,7 @@ void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const char *func) * \ref cpp_mcfielddouble_fillFromAnalytic3 "Here is a C++ example".
* \ref py_mcfielddouble_fillFromAnalytic3 "Here is a Python example". */ -void MEDCouplingFieldDouble::fillFromAnalytic3(int nbOfComp, const std::vector& varsOrder, const char *func) +void MEDCouplingFieldDouble::fillFromAnalytic3(int nbOfComp, const std::vector& varsOrder, const std::string& func) { if(!_mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic2 : no mesh defined !"); @@ -1686,7 +1686,7 @@ void MEDCouplingFieldDouble::applyFunc(int nbOfComp, double val) * \ref cpp_mcfielddouble_applyFunc "Here is a C++ example".
* \ref py_mcfielddouble_applyFunc "Here is a Python example". */ -void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func) +void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const std::string& func) { _time_discr->applyFunc(nbOfComp,func); } @@ -1698,7 +1698,7 @@ void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func) * For more info on supported expressions that can be used in the function, see \ref * MEDCouplingArrayApplyFuncExpr.
* This method differs from - * \ref ParaMEDMEM::MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func) "applyFunc()" + * \ref ParaMEDMEM::MEDCouplingFieldDouble::applyFunc(int nbOfComp, const std::string& func) "applyFunc()" * by the way how variable * names, used in the function, are associated with components of field values; * here, a variable name corresponding to a component is retrieved from @@ -1724,7 +1724,7 @@ void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func) * \ref cpp_mcfielddouble_applyFunc2 "Here is a C++ example".
* \ref py_mcfielddouble_applyFunc2 "Here is a Python example". */ -void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const char *func) +void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const std::string& func) { _time_discr->applyFunc2(nbOfComp,func); } @@ -1733,7 +1733,7 @@ void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const char *func) * Modifies values of \a this field by applying a function to each tuple of all * data arrays. * This method differs from - * \ref ParaMEDMEM::MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func) "applyFunc()" + * \ref ParaMEDMEM::MEDCouplingFieldDouble::applyFunc(int nbOfComp, const std::string& func) "applyFunc()" * by the way how variable * names, used in the function, are associated with components of field values; * here, a component index of a variable is defined by a @@ -1761,7 +1761,7 @@ void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const char *func) * \ref cpp_mcfielddouble_applyFunc3 "Here is a C++ example".
* \ref py_mcfielddouble_applyFunc3 "Here is a Python example". */ -void MEDCouplingFieldDouble::applyFunc3(int nbOfComp, const std::vector& varsOrder, const char *func) +void MEDCouplingFieldDouble::applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func) { _time_discr->applyFunc3(nbOfComp,varsOrder,func); } @@ -1791,7 +1791,7 @@ void MEDCouplingFieldDouble::applyFunc3(int nbOfComp, const std::vector * \ref py_mcfielddouble_applyFunc_same_nb_comp "Here is a Python example". */ -void MEDCouplingFieldDouble::applyFunc(const char *func) +void MEDCouplingFieldDouble::applyFunc(const std::string& func) { _time_discr->applyFunc(func); } @@ -1801,7 +1801,7 @@ void MEDCouplingFieldDouble::applyFunc(const char *func) * The field will contain exactly the same number of components after the call. * Use is not warranted for the moment ! */ -void MEDCouplingFieldDouble::applyFuncFast32(const char *func) +void MEDCouplingFieldDouble::applyFuncFast32(const std::string& func) { _time_discr->applyFuncFast32(func); } @@ -1811,7 +1811,7 @@ void MEDCouplingFieldDouble::applyFuncFast32(const char *func) * The field will contain exactly the same number of components after the call. * Use is not warranted for the moment ! */ -void MEDCouplingFieldDouble::applyFuncFast64(const char *func) +void MEDCouplingFieldDouble::applyFuncFast64(const std::string& func) { _time_discr->applyFuncFast64(func); } @@ -1919,7 +1919,7 @@ void MEDCouplingFieldDouble::synchronizeTimeWithMesh() double val=_mesh->getTime(it,ordr); std::string timeUnit(_mesh->getTimeUnit()); setTime(val,it,ordr); - setTimeUnit(timeUnit.c_str()); + setTimeUnit(timeUnit); } /*! @@ -2068,7 +2068,7 @@ void MEDCouplingFieldDouble::finishUnserialization(const std::vector& tinyI int nbOfElemS=(int)tinyInfoS.size(); _name=tinyInfoS[nbOfElemS-3]; _desc=tinyInfoS[nbOfElemS-2]; - setTimeUnit(tinyInfoS[nbOfElemS-1].c_str()); + setTimeUnit(tinyInfoS[nbOfElemS-1]); } /*! @@ -2600,7 +2600,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::maxPerTuple() const MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); std::ostringstream oss; oss << "Max_" << getName(); - ret->setName(oss.str().c_str()); + ret->setName(oss.str()); ret->setMesh(getMesh()); return ret.retn(); } @@ -2639,7 +2639,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std MEDCouplingTimeDiscretization *td=_time_discr->keepSelectedComponents(compoIds); td->copyTinyAttrFrom(*_time_discr); MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); - ret->setName(getName().c_str()); + ret->setName(getName()); ret->setMesh(getMesh()); return ret.retn(); } @@ -2700,8 +2700,8 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const MEDCouplingFie MEDCouplingTimeDiscretization *td=f1->_time_discr->aggregate(f2->_time_discr); td->copyTinyAttrFrom(*f1->_time_discr); MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone()); - ret->setName(f1->getName().c_str()); - ret->setDescription(f1->getDescription().c_str()); + ret->setName(f1->getName()); + ret->setDescription(f1->getDescription()); if(m1) { MEDCouplingAutoRefCountObjectPtr m=m1->mergeMyselfWith(m2); @@ -2752,8 +2752,8 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const std::vectoraggregate(tds); td->copyTinyAttrFrom(*(a[0]->_time_discr)); MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(a[0]->getNature(),td,a[0]->_type->clone()); - ret->setName(a[0]->getName().c_str()); - ret->setDescription(a[0]->getDescription().c_str()); + ret->setName(a[0]->getName()); + ret->setDescription(a[0]->getDescription()); if(ms2[0]) { MEDCouplingAutoRefCountObjectPtr m=MEDCouplingUMesh::MergeUMeshes(ms2); @@ -3181,7 +3181,7 @@ const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator^=(const MEDCoupli * \ref cpp_mcfielddouble_WriteVTK "Here is a C++ example".
* \ref py_mcfielddouble_WriteVTK "Here is a Python example". */ -void MEDCouplingFieldDouble::WriteVTK(const char *fileName, const std::vector& fs, bool isBinary) +void MEDCouplingFieldDouble::WriteVTK(const std::string& fileName, const std::vector& fs, bool isBinary) { if(fs.empty()) return; @@ -3211,9 +3211,9 @@ void MEDCouplingFieldDouble::WriteVTK(const char *fileName, const std::vectorgetTypeOfField(); if(typ==ON_CELLS) - cur->getArray()->writeVTK(coss,8,cur->getName().c_str(),byteArr); + cur->getArray()->writeVTK(coss,8,cur->getName(),byteArr); else if(typ==ON_NODES) - cur->getArray()->writeVTK(noss,8,cur->getName().c_str(),byteArr); + cur->getArray()->writeVTK(noss,8,cur->getName(),byteArr); else throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::WriteVTK : only node and cell fields supported for the moment !"); } diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.hxx b/src/MEDCoupling/MEDCouplingFieldDouble.hxx index 8b2c5e22f..d4a088bc5 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.hxx @@ -35,15 +35,15 @@ namespace ParaMEDMEM public: MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); - MEDCOUPLING_EXPORT void setTimeUnit(const char *unit); - MEDCOUPLING_EXPORT const char *getTimeUnit() const; + MEDCOUPLING_EXPORT void setTimeUnit(const std::string& unit); + MEDCOUPLING_EXPORT std::string getTimeUnit() const; MEDCOUPLING_EXPORT void synchronizeTimeWithSupport(); MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingField *other); MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingFieldDouble *other); MEDCOUPLING_EXPORT void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other); MEDCOUPLING_EXPORT std::string simpleRepr() const; MEDCOUPLING_EXPORT std::string advancedRepr() const; - MEDCOUPLING_EXPORT void writeVTK(const char *fileName, bool isBinary=true) const; + MEDCOUPLING_EXPORT void writeVTK(const std::string& fileName, bool isBinary=true) const; MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec, std::string& reason) const; MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const; MEDCOUPLING_EXPORT bool areCompatibleForMerge(const MEDCouplingField *other) const; @@ -117,17 +117,17 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void applyLin(double a, double b, int compoId); MEDCOUPLING_EXPORT MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void fillFromAnalytic(int nbOfComp, FunctionToEvaluate func); - MEDCOUPLING_EXPORT void fillFromAnalytic(int nbOfComp, const char *func); - MEDCOUPLING_EXPORT void fillFromAnalytic2(int nbOfComp, const char *func); - MEDCOUPLING_EXPORT void fillFromAnalytic3(int nbOfComp, const std::vector& varsOrder, const char *func); + MEDCOUPLING_EXPORT void fillFromAnalytic(int nbOfComp, const std::string& func); + MEDCOUPLING_EXPORT void fillFromAnalytic2(int nbOfComp, const std::string& func); + MEDCOUPLING_EXPORT void fillFromAnalytic3(int nbOfComp, const std::vector& varsOrder, const std::string& func); MEDCOUPLING_EXPORT void applyFunc(int nbOfComp, FunctionToEvaluate func); MEDCOUPLING_EXPORT void applyFunc(int nbOfComp, double val); - MEDCOUPLING_EXPORT void applyFunc(int nbOfComp, const char *func); - MEDCOUPLING_EXPORT void applyFunc2(int nbOfComp, const char *func); - MEDCOUPLING_EXPORT void applyFunc3(int nbOfComp, const std::vector& varsOrder, const char *func); - MEDCOUPLING_EXPORT void applyFunc(const char *func); - MEDCOUPLING_EXPORT void applyFuncFast32(const char *func); - MEDCOUPLING_EXPORT void applyFuncFast64(const char *func); + MEDCOUPLING_EXPORT void applyFunc(int nbOfComp, const std::string& func); + MEDCOUPLING_EXPORT void applyFunc2(int nbOfComp, const std::string& func); + MEDCOUPLING_EXPORT void applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func); + MEDCOUPLING_EXPORT void applyFunc(const std::string& func); + MEDCOUPLING_EXPORT void applyFuncFast32(const std::string& func); + MEDCOUPLING_EXPORT void applyFuncFast64(const std::string& func); MEDCOUPLING_EXPORT int getNumberOfComponents() const; MEDCOUPLING_EXPORT int getNumberOfTuples() const; MEDCOUPLING_EXPORT int getNumberOfValues() const; @@ -190,7 +190,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT MEDCouplingFieldDouble *operator^(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT const MEDCouplingFieldDouble &operator^=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *PowFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2); - MEDCOUPLING_EXPORT static void WriteVTK(const char *fileName, const std::vector& fs, bool isBinary=true); + MEDCOUPLING_EXPORT static void WriteVTK(const std::string& fileName, const std::vector& fs, bool isBinary=true); public: MEDCOUPLING_EXPORT const MEDCouplingTimeDiscretization *getTimeDiscretizationUnderGround() const { return _time_discr; } MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *getTimeDiscretizationUnderGround() { return _time_discr; } diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index ff071afa6..0d5d059a0 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -130,7 +130,7 @@ std::vector DataArray::getDirectChildren() const * See \ref MEDCouplingArrayBasicsName "DataArrays infos" for more information. * \param [in] name - new array name */ -void DataArray::setName(const char *name) +void DataArray::setName(const std::string& name) { _name=name; } @@ -164,7 +164,7 @@ void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vect throw INTERP_KERNEL::Exception(oss.str().c_str()); } for(std::size_t i=0;i& compoIds, const DataArray& other) @@ -180,7 +180,7 @@ void DataArray::copyPartOfStringInfoFrom2(const std::vector& compoIds, cons throw INTERP_KERNEL::Exception(oss.str().c_str()); } for(std::size_t i=0;i& arrs) * \param [in] info - the string containing the information. * \throw If \a i is not a valid component index. */ -void DataArray::setInfoOnComponent(int i, const char *info) +void DataArray::setInfoOnComponent(int i, const std::string& info) { if(i<(int)_info_on_compo.size() && i>=0) _info_on_compo[i]=info; @@ -516,7 +516,7 @@ void DataArray::setInfoAndChangeNbOfCompo(const std::vector& info) _info_on_compo=info; } -void DataArray::checkNbOfTuples(int nbOfTuples, const char *msg) const +void DataArray::checkNbOfTuples(int nbOfTuples, const std::string& msg) const { if(getNumberOfTuples()!=nbOfTuples) { @@ -525,7 +525,7 @@ void DataArray::checkNbOfTuples(int nbOfTuples, const char *msg) const } } -void DataArray::checkNbOfComps(int nbOfCompo, const char *msg) const +void DataArray::checkNbOfComps(int nbOfCompo, const std::string& msg) const { if(getNumberOfComponents()!=nbOfCompo) { @@ -534,7 +534,7 @@ void DataArray::checkNbOfComps(int nbOfCompo, const char *msg) const } } -void DataArray::checkNbOfElems(std::size_t nbOfElems, const char *msg) const +void DataArray::checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const { if(getNbOfElems()!=nbOfElems) { @@ -543,7 +543,7 @@ void DataArray::checkNbOfElems(std::size_t nbOfElems, const char *msg) const } } -void DataArray::checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const +void DataArray::checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const { if(getNumberOfTuples()!=other.getNumberOfTuples()) { @@ -557,7 +557,7 @@ void DataArray::checkNbOfTuplesAndComp(const DataArray& other, const char *msg) } } -void DataArray::checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const +void DataArray::checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const { checkNbOfTuples(nbOfTuples,msg); checkNbOfComps(nbOfCompo,msg); @@ -566,7 +566,7 @@ void DataArray::checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char /*! * Simply this method checks that \b value is in [0,\b ref). */ -void DataArray::CheckValueInRange(int ref, int value, const char *msg) +void DataArray::CheckValueInRange(int ref, int value, const std::string& msg) { if(value<0 || value>=ref) { @@ -579,7 +579,7 @@ void DataArray::CheckValueInRange(int ref, int value, const char *msg) * This method checks that [\b start, \b end) is compliant with ref length \b value. * typicaly start in [0,\b value) and end in [0,\b value). If value==start and start==end, it is supported. */ -void DataArray::CheckValueInRangeEx(int value, int start, int end, const char *msg) +void DataArray::CheckValueInRangeEx(int value, int start, int end, const std::string& msg) { if(start<0 || start>=value) { @@ -596,7 +596,7 @@ void DataArray::CheckValueInRangeEx(int value, int start, int end, const char *m } } -void DataArray::CheckClosingParInRange(int ref, int value, const char *msg) +void DataArray::CheckClosingParInRange(int ref, int value, const std::string& msg) { if(value<0 || value>ref) { @@ -644,7 +644,7 @@ void DataArray::GetSlice(int start, int stop, int step, int sliceId, int nbOfSli stopSlice=stop; } -int DataArray::GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) +int DataArray::GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) { if(endsetName(getName().c_str()); + ret->setName(getName()); for(int i=0;isetInfoOnComponent(i,getInfoOnComponent(i).c_str()); - ret->setName(getName().c_str()); + ret->setInfoOnComponent(i,getInfoOnComponent(i)); + ret->setName(getName()); return ret.retn(); } @@ -3536,7 +3536,7 @@ DataArrayDouble *DataArrayDouble::fromCylToCart() const w[1]=wIn[0]*sin(wIn[1]); w[2]=wIn[2]; } - ret->setInfoOnComponent(2,getInfoOnComponent(2).c_str()); + ret->setInfoOnComponent(2,getInfoOnComponent(2)); return ret; } @@ -4276,7 +4276,7 @@ DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, FunctionToEvaluate fun * \throw If \a this is not allocated. * \throw If computing \a func fails. */ -DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, const char *func) const +DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, const std::string& func) const { checkAllocated(); INTERP_KERNEL::ExprParser expr(func); @@ -4330,7 +4330,7 @@ DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, const char *func) cons * \throw If \a this is not allocated. * \throw If computing \a func fails. */ -DataArrayDouble *DataArrayDouble::applyFunc(const char *func) const +DataArrayDouble *DataArrayDouble::applyFunc(const std::string& func) const { checkAllocated(); INTERP_KERNEL::ExprParser expr(func); @@ -4376,7 +4376,7 @@ DataArrayDouble *DataArrayDouble::applyFunc(const char *func) const * \throw If \a func contains vars that are not in \a this->getInfoOnComponent(). * \throw If computing \a func fails. */ -DataArrayDouble *DataArrayDouble::applyFunc2(int nbOfComp, const char *func) const +DataArrayDouble *DataArrayDouble::applyFunc2(int nbOfComp, const std::string& func) const { checkAllocated(); INTERP_KERNEL::ExprParser expr(func); @@ -4432,7 +4432,7 @@ DataArrayDouble *DataArrayDouble::applyFunc2(int nbOfComp, const char *func) con * \throw If \a func contains vars not in \a varsOrder. * \throw If computing \a func fails. */ -DataArrayDouble *DataArrayDouble::applyFunc3(int nbOfComp, const std::vector& varsOrder, const char *func) const +DataArrayDouble *DataArrayDouble::applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func) const { checkAllocated(); INTERP_KERNEL::ExprParser expr(func); @@ -4472,7 +4472,7 @@ DataArrayDouble *DataArrayDouble::applyFunc3(int nbOfComp, const std::vectorsetInfoOnComponent(k,a[i]->getInfoOnComponent(j).c_str()); + ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j)); return ret; } @@ -4749,8 +4749,8 @@ DataArrayDouble *DataArrayDouble::Dot(const DataArrayDouble *a1, const DataArray sum+=a1Ptr[i*nbOfComp+j]*a2Ptr[i*nbOfComp+j]; retPtr[i]=sum; } - ret->setInfoOnComponent(0,a1->getInfoOnComponent(0).c_str()); - ret->setName(a1->getName().c_str()); + ret->setInfoOnComponent(0,a1->getInfoOnComponent(0)); + ret->setName(a1->getName()); return ret; } @@ -5605,12 +5605,12 @@ bool DataArrayDouble::resizeForUnserialization(const std::vector& tinyInfoI */ void DataArrayDouble::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS) { - setName(tinyInfoS[0].c_str()); + setName(tinyInfoS[0]); if(isAllocated()) { int nbOfCompo=getNumberOfComponents(); for(int i=0;isetName(getName().c_str()); + ret->setName(getName()); for(int i=0;isetInfoOnComponent(i,getInfoOnComponent(i).c_str()); - ret->setName(getName().c_str()); + ret->setInfoOnComponent(i,getInfoOnComponent(i)); + ret->setName(getName()); return ret.retn(); } @@ -9407,7 +9407,7 @@ DataArrayInt *DataArrayInt::Meld(const std::vector& arr) int k=0; for(int i=0;i<(int)a.size();i++) for(int j=0;jsetInfoOnComponent(k,a[i]->getInfoOnComponent(j).c_str()); + ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j)); return ret; } @@ -11192,12 +11192,12 @@ bool DataArrayInt::resizeForUnserialization(const std::vector& tinyInfoI) */ void DataArrayInt::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS) { - setName(tinyInfoS[0].c_str()); + setName(tinyInfoS[0]); if(isAllocated()) { int nbOfCompo=tinyInfoI[1]; for(int i=0;i getDirectChildren() const; - MEDCOUPLING_EXPORT void setName(const char *name); + MEDCOUPLING_EXPORT void setName(const std::string& name); MEDCOUPLING_EXPORT void copyStringInfoFrom(const DataArray& other); MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds); MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom2(const std::vector& compoIds, const DataArray& other); MEDCOUPLING_EXPORT bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const; MEDCOUPLING_EXPORT bool areInfoEquals(const DataArray& other) const; - MEDCOUPLING_EXPORT std::string cppRepr(const char *varName) const; + MEDCOUPLING_EXPORT std::string cppRepr(const std::string& varName) const; MEDCOUPLING_EXPORT std::string getName() const { return _name; } MEDCOUPLING_EXPORT const std::vector &getInfoOnComponents() const { return _info_on_compo; } MEDCOUPLING_EXPORT std::vector &getInfoOnComponents() { return _info_on_compo; } @@ -134,7 +134,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT std::string getInfoOnComponent(int i) const; MEDCOUPLING_EXPORT std::string getVarOnComponent(int i) const; MEDCOUPLING_EXPORT std::string getUnitOnComponent(int i) const; - MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const char *info); + MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const std::string& info); MEDCOUPLING_EXPORT int getNumberOfComponents() const { return (int)_info_on_compo.size(); } MEDCOUPLING_EXPORT void setPartOfValuesBase3(const DataArray *aBase, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); MEDCOUPLING_EXPORT virtual DataArray *deepCpy() const = 0; @@ -156,14 +156,14 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const = 0; MEDCOUPLING_EXPORT virtual DataArray *selectByTupleId2(int bg, int end2, int step) const = 0; MEDCOUPLING_EXPORT virtual void rearrange(int newNbOfCompo) = 0; - MEDCOUPLING_EXPORT void checkNbOfTuples(int nbOfTuples, const char *msg) const; - MEDCOUPLING_EXPORT void checkNbOfComps(int nbOfCompo, const char *msg) const; - MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const; - MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const; - MEDCOUPLING_EXPORT void checkNbOfElems(std::size_t nbOfElems, const char *msg) const; + MEDCOUPLING_EXPORT void checkNbOfTuples(int nbOfTuples, const std::string& msg) const; + MEDCOUPLING_EXPORT void checkNbOfComps(int nbOfCompo, const std::string& msg) const; + MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const; + MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const; + MEDCOUPLING_EXPORT void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const; MEDCOUPLING_EXPORT static void GetSlice(int start, int stop, int step, int sliceId, int nbOfSlices, int& startSlice, int& stopSlice); - MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg); - MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg); + MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg); + MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg); MEDCOUPLING_EXPORT static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step); MEDCOUPLING_EXPORT static std::string GetVarNameFromInfo(const std::string& info); MEDCOUPLING_EXPORT static std::string GetUnitFromInfo(const std::string& info); @@ -172,16 +172,16 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT virtual void reprZipStream(std::ostream& stream) const = 0; MEDCOUPLING_EXPORT virtual void reprWithoutNameStream(std::ostream& stream) const; MEDCOUPLING_EXPORT virtual void reprZipWithoutNameStream(std::ostream& stream) const = 0; - MEDCOUPLING_EXPORT virtual void reprCppStream(const char *varName, std::ostream& stream) const = 0; + MEDCOUPLING_EXPORT virtual void reprCppStream(const std::string& varName, std::ostream& stream) const = 0; MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0; MEDCOUPLING_EXPORT virtual void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const = 0; protected: DataArray() { } ~DataArray() { } protected: - static void CheckValueInRange(int ref, int value, const char *msg); - static void CheckValueInRangeEx(int value, int start, int end, const char *msg); - static void CheckClosingParInRange(int ref, int value, const char *msg); + static void CheckValueInRange(int ref, int value, const std::string& msg); + static void CheckValueInRangeEx(int value, int start, int end, const std::string& msg); + static void CheckClosingParInRange(int ref, int value, const std::string& msg); protected: std::string _name; std::vector _info_on_compo; @@ -227,12 +227,12 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT bool isMonotonic(bool increasing, double eps) const; MEDCOUPLING_EXPORT std::string repr() const; MEDCOUPLING_EXPORT std::string reprZip() const; - MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const char *nameInFile, DataArrayByte *byteArr) const; + MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const std::string& nameInFile, DataArrayByte *byteArr) const; MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const; - MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const; + MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; MEDCOUPLING_EXPORT bool isEqual(const DataArrayDouble& other, double prec) const; @@ -340,12 +340,12 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void applyRPow(double val); MEDCOUPLING_EXPORT DataArrayDouble *negate() const; MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const; - MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, const char *func) const; - MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(const char *func) const; - MEDCOUPLING_EXPORT DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const; - MEDCOUPLING_EXPORT DataArrayDouble *applyFunc3(int nbOfComp, const std::vector& varsOrder, const char *func) const; - MEDCOUPLING_EXPORT void applyFuncFast32(const char *func); - MEDCOUPLING_EXPORT void applyFuncFast64(const char *func); + MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, const std::string& func) const; + MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(const std::string& func) const; + MEDCOUPLING_EXPORT DataArrayDouble *applyFunc2(int nbOfComp, const std::string& func) const; + MEDCOUPLING_EXPORT DataArrayDouble *applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func) const; + MEDCOUPLING_EXPORT void applyFuncFast32(const std::string& func); + MEDCOUPLING_EXPORT void applyFuncFast64(const std::string& func); MEDCOUPLING_EXPORT DataArrayInt *getIdsInRange(double vmin, double vmax) const; MEDCOUPLING_EXPORT DataArrayInt *getIdsNotInRange(double vmin, double vmax) const; MEDCOUPLING_EXPORT static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2); @@ -464,12 +464,12 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void iota(int init=0); MEDCOUPLING_EXPORT std::string repr() const; MEDCOUPLING_EXPORT std::string reprZip() const; - MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const char *type, const char *nameInFile, DataArrayByte *byteArr) const; + MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const; MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const; - MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const; + MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; MEDCOUPLING_EXPORT void transformWithIndArr(const int *indArrBg, const int *indArrEnd); @@ -776,7 +776,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const; - MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const; + MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const; @@ -833,7 +833,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const; - MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const; + MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const; diff --git a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx index 25aab4219..bd7cc6973 100644 --- a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx +++ b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx @@ -714,10 +714,10 @@ DataArrayChar *DataArrayChar::changeNbOfComponents(int newNbOfComp, char dftValu for(;jsetName(getName().c_str()); + ret->setName(getName()); for(int i=0;isetInfoOnComponent(i,getInfoOnComponent(i).c_str()); - ret->setName(getName().c_str()); + ret->setInfoOnComponent(i,getInfoOnComponent(i)); + ret->setName(getName()); return ret.retn(); } @@ -1937,7 +1937,7 @@ DataArrayChar *DataArrayChar::Meld(const std::vector& arr int k=0; for(int i=0;i<(int)a.size();i++) for(int j=0;jsetInfoOnComponent(k,a[i]->getInfoOnComponent(j).c_str()); + ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j)); return ret; } @@ -2070,7 +2070,7 @@ void DataArrayByte::reprZipWithoutNameStream(std::ostream& stream) const _mem.reprZip(getNumberOfComponents(),stream); } -void DataArrayByte::reprCppStream(const char *varName, std::ostream& stream) const +void DataArrayByte::reprCppStream(const std::string& varName, std::ostream& stream) const { int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents(); const char *data=getConstPointer(); @@ -2402,7 +2402,7 @@ void DataArrayAsciiChar::reprZipWithoutNameStream(std::ostream& stream) const reprWithoutNameStream(stream); } -void DataArrayAsciiChar::reprCppStream(const char *varName, std::ostream& stream) const +void DataArrayAsciiChar::reprCppStream(const std::string& varName, std::ostream& stream) const { int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents(); const char *data=getConstPointer(); diff --git a/src/MEDCoupling/MEDCouplingMesh.cxx b/src/MEDCoupling/MEDCouplingMesh.cxx index 4aae2aa58..181288b4b 100644 --- a/src/MEDCoupling/MEDCouplingMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMesh.cxx @@ -374,7 +374,7 @@ void MEDCouplingMesh::copyTinyInfoFrom(const MEDCouplingMesh *other) * \ref cpp_mcmesh_fillFromAnalytic "Here is a C++ example".
* \ref py_mcmesh_fillFromAnalytic "Here is a Python example". */ -MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const +MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const { MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(t,ONE_TIME); ret->setMesh(this); @@ -389,7 +389,7 @@ MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbO * function to coordinates of field location points (defined by the given field type). * For example, if \a t == ParaMEDMEM::ON_CELLS, the function is applied to cell * barycenters. This method differs from - * \ref MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const "fillFromAnalytic()" + * \ref MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const "fillFromAnalytic()" * by the way how variable * names, used in the function, are associated with components of coordinates of field * location points; here, a variable name corresponding to a component is retrieved from @@ -424,7 +424,7 @@ MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbO * \ref cpp_mcmesh_fillFromAnalytic2 "Here is a C++ example".
* \ref py_mcmesh_fillFromAnalytic2 "Here is a Python example". */ -MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const +MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const { MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(t,ONE_TIME); ret->setMesh(this); @@ -475,7 +475,7 @@ MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic2(TypeOfField t, int nb * \ref cpp_mcmesh_fillFromAnalytic3 "Here is a C++ example".
* \ref py_mcmesh_fillFromAnalytic3 "Here is a Python example". */ -MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector& varsOrder, const char *func) const +MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector& varsOrder, const std::string& func) const { MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(t,ONE_TIME); ret->setMesh(this); @@ -682,7 +682,7 @@ void MEDCouplingMesh::getCellsContainingPoints(const double *pos, int nbOfPoints * \param [in] fileName - the name of the file to write in. * \throw If \a fileName is not a writable file. */ -void MEDCouplingMesh::writeVTK(const char *fileName, bool isBinary) const +void MEDCouplingMesh::writeVTK(const std::string& fileName, bool isBinary) const { std::string cda,pda; MEDCouplingAutoRefCountObjectPtr byteArr; @@ -691,18 +691,18 @@ void MEDCouplingMesh::writeVTK(const char *fileName, bool isBinary) const writeVTKAdvanced(fileName,cda,pda,byteArr); } -void MEDCouplingMesh::writeVTKAdvanced(const char *fileName, const std::string& cda, const std::string& pda, DataArrayByte *byteData) const +void MEDCouplingMesh::writeVTKAdvanced(const std::string& fileName, const std::string& cda, const std::string& pda, DataArrayByte *byteData) const { - std::ofstream ofs(fileName); + std::ofstream ofs(fileName.c_str()); ofs << "\n"; writeVTKLL(ofs,cda,pda,byteData); if(byteData) { ofs << "\n_1234"; ofs << std::flush; ofs.close(); - std::ofstream ofs2(fileName,std::ios_base::binary | std::ios_base::app); + std::ofstream ofs2(fileName.c_str(),std::ios_base::binary | std::ios_base::app); ofs2.write(byteData->begin(),byteData->getNbOfElems()); ofs2 << std::flush; ofs2.close(); - std::ofstream ofs3(fileName,std::ios_base::app); ofs3 << "\n\n\n"; ofs3.close(); + std::ofstream ofs3(fileName.c_str(),std::ios_base::app); ofs3 << "\n\n\n"; ofs3.close(); } else { diff --git a/src/MEDCoupling/MEDCouplingMesh.hxx b/src/MEDCoupling/MEDCouplingMesh.hxx index 57de33976..5c9e33553 100644 --- a/src/MEDCoupling/MEDCouplingMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMesh.hxx @@ -55,14 +55,14 @@ namespace ParaMEDMEM { public: MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT void setName(const char *name) { _name=name; } + MEDCOUPLING_EXPORT void setName(const std::string& name) { _name=name; } MEDCOUPLING_EXPORT std::string getName() const { return _name; } - MEDCOUPLING_EXPORT void setDescription(const char *descr) { _description=descr; } + MEDCOUPLING_EXPORT void setDescription(const std::string& descr) { _description=descr; } MEDCOUPLING_EXPORT std::string getDescription() const { return _description; } MEDCOUPLING_EXPORT double getTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _time; } MEDCOUPLING_EXPORT void setTime(double val, int iteration, int order) { _time=val; _iteration=iteration; _order=order; } - MEDCOUPLING_EXPORT void setTimeUnit(const char *unit) { _time_unit=unit; } - MEDCOUPLING_EXPORT const char *getTimeUnit() const { return _time_unit.c_str(); } + MEDCOUPLING_EXPORT void setTimeUnit(const std::string& unit) { _time_unit=unit; } + MEDCOUPLING_EXPORT std::string getTimeUnit() const { return _time_unit; } MEDCOUPLING_EXPORT virtual MEDCouplingMesh *deepCpy() const = 0; MEDCOUPLING_EXPORT virtual MEDCouplingMeshType getType() const = 0; MEDCOUPLING_EXPORT bool isStructured() const; @@ -113,9 +113,9 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT virtual void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const; MEDCOUPLING_EXPORT virtual void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MEDCouplingAutoRefCountObjectPtr& elts, MEDCouplingAutoRefCountObjectPtr& eltsIndex) const; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, FunctionToEvaluate func) const; - MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const; - MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const; - MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector& varsOrder, const char *func) const; + MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const; + MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const; + MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector& varsOrder, const std::string& func) const; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *buildOrthogonalField() const = 0; MEDCOUPLING_EXPORT virtual void rotate(const double *center, const double *vector, double angle) = 0; MEDCOUPLING_EXPORT virtual void translate(const double *vector) = 0; @@ -144,9 +144,9 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT virtual void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const = 0; MEDCOUPLING_EXPORT virtual void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) = 0; - MEDCOUPLING_EXPORT void writeVTK(const char *fileName, bool isBinary=true) const; + MEDCOUPLING_EXPORT void writeVTK(const std::string& fileName, bool isBinary=true) const; /// @cond INTERNAL - MEDCOUPLING_EXPORT void writeVTKAdvanced(const char *fileName, const std::string& cda, const std::string& pda, DataArrayByte *byteData) const; + MEDCOUPLING_EXPORT void writeVTKAdvanced(const std::string& fileName, const std::string& cda, const std::string& pda, DataArrayByte *byteData) const; /// @endcond MEDCOUPLING_EXPORT virtual void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const = 0; MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0; diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index f8f15be3e..5e9033058 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -910,19 +910,19 @@ void MEDCouplingPointSet::unserialization(const std::vector& tinyInfoD, if(tinyInfo[2]>=0 && tinyInfo[1]>=1) { setCoords(a2); - setName(littleStrings[0].c_str()); - setDescription(littleStrings[1].c_str()); - a2->setName(littleStrings[2].c_str()); - setTimeUnit(littleStrings[3].c_str()); + setName(littleStrings[0]); + setDescription(littleStrings[1]); + a2->setName(littleStrings[2]); + setTimeUnit(littleStrings[3]); for(int i=0;isetInfoOnComponent(i,littleStrings[i+4].c_str()); + getCoords()->setInfoOnComponent(i,littleStrings[i+4]); setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]); } else { - setName(littleStrings[0].c_str()); - setDescription(littleStrings[1].c_str()); - setTimeUnit(littleStrings[2].c_str()); + setName(littleStrings[0]); + setDescription(littleStrings[1]); + setTimeUnit(littleStrings[2]); setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]); } } @@ -1537,7 +1537,7 @@ DataArrayInt *MEDCouplingPointSet::getCellIdsLyingOnNodes(const int *begin, cons { DataArrayInt *cellIdsKept=0; fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept); - cellIdsKept->setName(getName().c_str()); + cellIdsKept->setName(getName()); return cellIdsKept; } diff --git a/src/MEDCoupling/MEDCouplingRemapper.cxx b/src/MEDCoupling/MEDCouplingRemapper.cxx index dd837acda..1c5e17a91 100644 --- a/src/MEDCoupling/MEDCouplingRemapper.cxx +++ b/src/MEDCoupling/MEDCouplingRemapper.cxx @@ -49,15 +49,15 @@ MEDCouplingRemapper::~MEDCouplingRemapper() releaseData(false); } -int MEDCouplingRemapper::prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method) +int MEDCouplingRemapper::prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method) { if(!srcMesh || !targetMesh) throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepare : presence of NULL input pointer !"); std::string srcMethod,targetMethod; INTERP_KERNEL::Interpolation::CheckAndSplitInterpolationMethod(method,srcMethod,targetMethod); - MEDCouplingAutoRefCountObjectPtr src=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(srcMethod.c_str())); + MEDCouplingAutoRefCountObjectPtr src=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(srcMethod)); src->setMesh(srcMesh); - MEDCouplingAutoRefCountObjectPtr target=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(targetMethod.c_str())); + MEDCouplingAutoRefCountObjectPtr target=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(targetMethod)); target->setMesh(targetMesh); return prepareEx(src,target); } @@ -322,35 +322,35 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<1,1> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<1,1> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation1D interpolation(*this); - nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str()); + nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method); } else if(srcMeshDim==1 && trgMeshDim==1 && srcSpaceDim==2) { MEDCouplingNormalizedUnstructuredMesh<2,1> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<2,1> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2DCurve interpolation(*this); - nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str()); + nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method); } else if(srcMeshDim==2 && trgMeshDim==2 && srcSpaceDim==2) { MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2D interpolation(*this); - nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str()); + nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method); } else if(srcMeshDim==3 && trgMeshDim==3 && srcSpaceDim==3) { MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation3D interpolation(*this); - nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str()); + nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method); } else if(srcMeshDim==2 && trgMeshDim==2 && srcSpaceDim==3) { MEDCouplingNormalizedUnstructuredMesh<3,2> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<3,2> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation3DSurf interpolation(*this); - nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str()); + nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method); } else if(srcMeshDim==3 && trgMeshDim==1 && srcSpaceDim==3) { @@ -359,7 +359,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation3D interpolation(*this); - nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str()); + nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method); } else if(srcMeshDim==1 && trgMeshDim==3 && srcSpaceDim==3) { @@ -369,7 +369,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation3D interpolation(*this); std::vector > matrixTmp; - nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method.c_str()); + nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method); ReverseMatrix(matrixTmp,nbCols,_matrix); nbCols=matrixTmp.size(); } @@ -380,7 +380,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2D interpolation(*this); - nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str()); + nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method); } else { @@ -388,7 +388,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2D1D interpolation(*this); std::vector > matrixTmp; - nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method.c_str()); + nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method); ReverseMatrix(matrixTmp,nbCols,_matrix); nbCols=matrixTmp.size(); INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces(); @@ -412,7 +412,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2D interpolation(*this); std::vector > matrixTmp; - nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method.c_str()); + nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method); ReverseMatrix(matrixTmp,nbCols,_matrix); nbCols=matrixTmp.size(); } @@ -421,7 +421,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2D1D interpolation(*this); - nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str()); + nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method); INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces(); if(!duplicateFaces.empty()) { @@ -440,7 +440,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation3D2D interpolation(*this); - nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str()); + nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method); INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces(); if(!duplicateFaces.empty()) { @@ -459,7 +459,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation3D2D interpolation(*this); std::vector > matrixTmp; - nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method.c_str()); + nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method); ReverseMatrix(matrixTmp,nbCols,_matrix); nbCols=matrixTmp.size(); INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces(); @@ -480,19 +480,19 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() { MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh); INTERP_KERNEL::Interpolation2D interpolation(*this); - nbCols=interpolation.toIntegralUniform(source_mesh_wrapper,_matrix,srcMeth.c_str()); + nbCols=interpolation.toIntegralUniform(source_mesh_wrapper,_matrix,srcMeth); } else if(srcMeshDim==3 && srcSpaceDim==3) { MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh); INTERP_KERNEL::Interpolation3D interpolation(*this); - nbCols=interpolation.toIntegralUniform(source_mesh_wrapper,_matrix,srcMeth.c_str()); + nbCols=interpolation.toIntegralUniform(source_mesh_wrapper,_matrix,srcMeth); } else if(srcMeshDim==2 && srcSpaceDim==3) { MEDCouplingNormalizedUnstructuredMesh<3,2> source_mesh_wrapper(src_mesh); INTERP_KERNEL::Interpolation3DSurf interpolation(*this); - nbCols=interpolation.toIntegralUniform(source_mesh_wrapper,_matrix,srcMeth.c_str()); + nbCols=interpolation.toIntegralUniform(source_mesh_wrapper,_matrix,srcMeth); } else throw INTERP_KERNEL::Exception("No interpolation available for the given mesh and space dimension of source mesh to -1D targetMesh"); @@ -503,19 +503,19 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() { MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2D interpolation(*this); - nbCols=interpolation.fromIntegralUniform(source_mesh_wrapper,_matrix,trgMeth.c_str()); + nbCols=interpolation.fromIntegralUniform(source_mesh_wrapper,_matrix,trgMeth); } else if(trgMeshDim==3 && trgSpaceDim==3) { MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation3D interpolation(*this); - nbCols=interpolation.fromIntegralUniform(source_mesh_wrapper,_matrix,trgMeth.c_str()); + nbCols=interpolation.fromIntegralUniform(source_mesh_wrapper,_matrix,trgMeth); } else if(trgMeshDim==2 && trgSpaceDim==3) { MEDCouplingNormalizedUnstructuredMesh<3,2> source_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation3DSurf interpolation(*this); - nbCols=interpolation.fromIntegralUniform(source_mesh_wrapper,_matrix,trgMeth.c_str()); + nbCols=interpolation.fromIntegralUniform(source_mesh_wrapper,_matrix,trgMeth); } else throw INTERP_KERNEL::Exception("No interpolation available for the given mesh and space dimension of source mesh from -1D sourceMesh"); @@ -542,7 +542,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyEE() MEDCouplingNormalizedUnstructuredMesh<3,2> target_mesh_wrapper(target_mesh->getMesh2D()); INTERP_KERNEL::Interpolation3DSurf interpolation2D(*this); std::vector > matrix2D; - int nbCols2D=interpolation2D.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,matrix2D,methC.c_str()); + int nbCols2D=interpolation2D.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,matrix2D,methC); MEDCouplingUMesh *s1D,*t1D; double v[3]; MEDCouplingExtrudedMesh::Project1DMeshes(src_mesh->getMesh1D(),target_mesh->getMesh1D(),getPrecision(),s1D,t1D,v); @@ -550,7 +550,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyEE() MEDCouplingNormalizedUnstructuredMesh<1,1> t1DWrapper(t1D); std::vector > matrix1D; INTERP_KERNEL::Interpolation1D interpolation1D(*this); - int nbCols1D=interpolation1D.interpolateMeshes(s1DWrapper,t1DWrapper,matrix1D,methC.c_str()); + int nbCols1D=interpolation1D.interpolateMeshes(s1DWrapper,t1DWrapper,matrix1D,methC); s1D->decrRef(); t1D->decrRef(); buildFinalInterpolationMatrixByConvolution(matrix1D,matrix2D,src_mesh->getMesh3DIds()->getConstPointer(),nbCols2D,nbCols1D, @@ -810,7 +810,7 @@ bool MEDCouplingRemapper::isInterpKernelOnlyOrNotOnly() const try { std::string tmp1,tmp2; - INTERP_KERNEL::Interpolation::CheckAndSplitInterpolationMethod(method.c_str(),tmp1,tmp2); + INTERP_KERNEL::Interpolation::CheckAndSplitInterpolationMethod(method,tmp1,tmp2); return true; } catch(INTERP_KERNEL::Exception& /*e*/) diff --git a/src/MEDCoupling/MEDCouplingRemapper.hxx b/src/MEDCoupling/MEDCouplingRemapper.hxx index 36cb62369..2904d5d9a 100644 --- a/src/MEDCoupling/MEDCouplingRemapper.hxx +++ b/src/MEDCoupling/MEDCouplingRemapper.hxx @@ -54,7 +54,7 @@ namespace ParaMEDMEM public: MEDCOUPLINGREMAPPER_EXPORT MEDCouplingRemapper(); MEDCOUPLINGREMAPPER_EXPORT ~MEDCouplingRemapper(); - MEDCOUPLINGREMAPPER_EXPORT int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method); + MEDCOUPLINGREMAPPER_EXPORT int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method); MEDCOUPLINGREMAPPER_EXPORT int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target); MEDCOUPLINGREMAPPER_EXPORT void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue); MEDCOUPLINGREMAPPER_EXPORT void partialTransfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField); diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx index 71b581d3c..20982788a 100644 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -285,7 +285,7 @@ MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTUnstructured() const int ns[3]; getNodeGridStructure(ns); MEDCouplingAutoRefCountObjectPtr conn(Build1GTNodalConnectivity(ns,ns+meshDim)); - MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1SGTUMesh::New(getName().c_str(),GetGeoTypeGivenMeshDimension(meshDim))); + MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim))); ret->setNodalConnectivity(conn); ret->setCoords(coords); return ret.retn(); } diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx index f0900c107..3ed4634bb 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx @@ -264,7 +264,7 @@ void MEDCouplingTimeDiscretization::finishUnserialization(const std::vector _time_tolerance=tinyInfoD[0]; int nbOfCompo=_array->getNumberOfComponents(); for(int i=0;isetInfoOnComponent(i,tinyInfoS[i].c_str()); + _array->setInfoOnComponent(i,tinyInfoS[i]); } void MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(std::vector& tinyInfo) const @@ -715,7 +715,7 @@ void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, FunctionToEvaluate f setArrays(arrays3,0); } -void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const char *func) +void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const std::string& func) { std::vector arrays; getArrays(arrays); @@ -733,7 +733,7 @@ void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const char *func) setArrays(arrays3,0); } -void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const char *func) +void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const std::string& func) { std::vector arrays; getArrays(arrays); @@ -751,7 +751,7 @@ void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const char *func) setArrays(arrays3,0); } -void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector& varsOrder, const char *func) +void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func) { std::vector arrays; getArrays(arrays); @@ -769,7 +769,7 @@ void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector arrays; getArrays(arrays); @@ -787,7 +787,7 @@ void MEDCouplingTimeDiscretization::applyFunc(const char *func) setArrays(arrays3,0); } -void MEDCouplingTimeDiscretization::applyFuncFast32(const char *func) +void MEDCouplingTimeDiscretization::applyFuncFast32(const std::string& func) { std::vector arrays; getArrays(arrays); @@ -798,7 +798,7 @@ void MEDCouplingTimeDiscretization::applyFuncFast32(const char *func) } } -void MEDCouplingTimeDiscretization::applyFuncFast64(const char *func) +void MEDCouplingTimeDiscretization::applyFuncFast64(const std::string& func) { std::vector arrays; getArrays(arrays); @@ -822,7 +822,7 @@ void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, setArrays(arrays3,0); } -void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const char *func) +void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const std::string& func) { std::vector arrays; getArrays(arrays); @@ -835,7 +835,7 @@ void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, setArrays(arrays3,0); } -void MEDCouplingTimeDiscretization::fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const char *func) +void MEDCouplingTimeDiscretization::fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const std::string& func) { std::vector arrays; getArrays(arrays); @@ -848,7 +848,7 @@ void MEDCouplingTimeDiscretization::fillFromAnalytic2(const DataArrayDouble *loc setArrays(arrays3,0); } -void MEDCouplingTimeDiscretization::fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector& varsOrder, const char *func) +void MEDCouplingTimeDiscretization::fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector& varsOrder, const std::string& func) { std::vector arrays; getArrays(arrays); diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx index 263539b0f..ca9e5da63 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx @@ -44,8 +44,8 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT virtual std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT virtual std::vector getDirectChildren() const; MEDCOUPLING_EXPORT static MEDCouplingTimeDiscretization *New(TypeOfTimeDiscretization type); - MEDCOUPLING_EXPORT void setTimeUnit(const char *unit) { _time_unit=unit; } - MEDCOUPLING_EXPORT const char *getTimeUnit() const { return _time_unit.c_str(); } + MEDCOUPLING_EXPORT void setTimeUnit(const std::string& unit) { _time_unit=unit; } + MEDCOUPLING_EXPORT std::string getTimeUnit() const { return _time_unit; } MEDCOUPLING_EXPORT virtual void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other); MEDCOUPLING_EXPORT virtual void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other); MEDCOUPLING_EXPORT virtual void checkCoherency() const; @@ -139,16 +139,16 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT virtual void setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value); MEDCOUPLING_EXPORT virtual void applyLin(double a, double b, int compoId); MEDCOUPLING_EXPORT virtual void applyFunc(int nbOfComp, FunctionToEvaluate func); - MEDCOUPLING_EXPORT virtual void applyFunc(int nbOfComp, const char *func); - MEDCOUPLING_EXPORT virtual void applyFunc2(int nbOfComp, const char *func); - MEDCOUPLING_EXPORT virtual void applyFunc3(int nbOfComp, const std::vector& varsOrder, const char *func); - MEDCOUPLING_EXPORT virtual void applyFunc(const char *func); - MEDCOUPLING_EXPORT virtual void applyFuncFast32(const char *func); - MEDCOUPLING_EXPORT virtual void applyFuncFast64(const char *func); + MEDCOUPLING_EXPORT virtual void applyFunc(int nbOfComp, const std::string& func); + MEDCOUPLING_EXPORT virtual void applyFunc2(int nbOfComp, const std::string& func); + MEDCOUPLING_EXPORT virtual void applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func); + MEDCOUPLING_EXPORT virtual void applyFunc(const std::string& func); + MEDCOUPLING_EXPORT virtual void applyFuncFast32(const std::string& func); + MEDCOUPLING_EXPORT virtual void applyFuncFast64(const std::string& func); MEDCOUPLING_EXPORT virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func); - MEDCOUPLING_EXPORT virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const char *func); - MEDCOUPLING_EXPORT virtual void fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const char *func); - MEDCOUPLING_EXPORT virtual void fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector& varsOrder, const char *func); + MEDCOUPLING_EXPORT virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const std::string& func); + MEDCOUPLING_EXPORT virtual void fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const std::string& func); + MEDCOUPLING_EXPORT virtual void fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector& varsOrder, const std::string& func); // MEDCOUPLING_EXPORT virtual ~MEDCouplingTimeDiscretization(); protected: diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 10f88afc0..29d78628e 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -58,7 +58,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::New() return new MEDCouplingUMesh; } -MEDCouplingUMesh *MEDCouplingUMesh::New(const char *meshName, int meshDim) +MEDCouplingUMesh *MEDCouplingUMesh::New(const std::string& meshName, int meshDim) { MEDCouplingUMesh *ret=new MEDCouplingUMesh; ret->setName(meshName); @@ -879,7 +879,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivityGen(DataArrayInt const int *conn=_nodal_connec->getConstPointer(); const int *connIndex=_nodal_connec_index->getConstPointer(); std::string name="Mesh constituent of "; name+=getName(); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(name.c_str(),getMeshDimension()-SonsGenerator::DELTA); + MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(name,getMeshDimension()-SonsGenerator::DELTA); ret->setCoords(getCoords()); ret->allocateCells(2*nbOfCells); descIndx->alloc(nbOfCells+1,1); @@ -1849,7 +1849,7 @@ bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int com } MEDCouplingAutoRefCountObjectPtr o2n=mesh->zipConnectivityTraducer(compType,nbOfCells); arr=o2n->substr(nbOfCells); - arr->setName(other->getName().c_str()); + arr->setName(other->getName()); int tmp; if(other->getNumberOfCells()==0) return true; @@ -1893,7 +1893,7 @@ bool MEDCouplingUMesh::areCellsIncludedIn2(const MEDCouplingUMesh *other, DataAr } } } - arr2->setName(other->getName().c_str()); + arr2->setName(other->getName()); if(arr2->presenceOfValue(0)) return false; arr=arr2.retn(); @@ -2863,7 +2863,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSetInstanceFromThis(int spaceDim) const int mdim=getMeshDimension(); if(mdim<0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSetInstanceFromThis : invalid mesh dimension ! Should be >= 0 !"); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(getName().c_str(),mdim); + MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(getName(),mdim); MEDCouplingAutoRefCountObjectPtr tmp1,tmp2; bool needToCpyCT=true; if(!_nodal_connec) @@ -3251,7 +3251,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureField(bool isAbs) const name+=getName(); int nbelem=getNumberOfCells(); MEDCouplingAutoRefCountObjectPtr field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); - field->setName(name.c_str()); + field->setName(name); MEDCouplingAutoRefCountObjectPtr array=DataArrayDouble::New(); array->alloc(nbelem,1); double *area_vol=array->getPointer(); @@ -3306,7 +3306,7 @@ DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const int *be name+=getName(); int nbelem=(int)std::distance(begin,end); MEDCouplingAutoRefCountObjectPtr array=DataArrayDouble::New(); - array->setName(name.c_str()); + array->setName(name); array->alloc(nbelem,1); double *area_vol=array->getPointer(); if(getMeshDimension()!=-1) @@ -6913,7 +6913,7 @@ MEDCoupling1GTUMesh *MEDCouplingUMesh::convertIntoSingleGeoTypeMesh() const if(_types.size()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertIntoSingleGeoTypeMesh : current mesh does not contain exactly one geometric type !"); INTERP_KERNEL::NormalizedCellType typ=*_types.begin(); - MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling1GTUMesh::New(getName().c_str(),typ); + MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling1GTUMesh::New(getName(),typ); ret->setCoords(getCoords()); MEDCoupling1SGTUMesh *retC=dynamic_cast((MEDCoupling1GTUMesh*)ret); if(retC) @@ -7389,7 +7389,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::Build0DMeshFromCoords(DataArrayDouble *da) if(!da) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Build0DMeshFromCoords : instance of DataArrayDouble must be not null !"); da->checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(da->getName().c_str(),0); + MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(da->getName(),0); ret->setCoords(da); int nbOfTuples=da->getNumberOfTuples(); MEDCouplingAutoRefCountObjectPtr c=DataArrayInt::New(); @@ -7662,7 +7662,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::FuseUMeshesOnSameCoords(const std::vectoralloc(curNbOfCells,1); std::copy(o2nPtr+offset,o2nPtr+offset+curNbOfCells,tmp->getPointer()); offset+=curNbOfCells; - tmp->setName(meshes[i]->getName().c_str()); + tmp->setName(meshes[i]->getName()); corr[i]=tmp; } return ret.retn(); @@ -9479,7 +9479,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSpreadZonesWithPoly() const std::vector partition=partitionBySpreadZone(); std::vector< MEDCouplingAutoRefCountObjectPtr > partitionAuto; partitionAuto.reserve(partition.size()); std::copy(partition.begin(),partition.end(),std::back_insert_iterator > >(partitionAuto)); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(getName().c_str(),mdim); + MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(getName(),mdim); ret->setCoords(getCoords()); ret->allocateCells((int)partition.size()); // @@ -9589,7 +9589,7 @@ MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayInt *& if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tetrahedrize : only available for mesh with meshdim == 3 and spacedim == 3 !"); int nbOfCells(getNumberOfCells()),nbNodes(getNumberOfNodes()); - MEDCouplingAutoRefCountObjectPtr ret0(MEDCoupling1SGTUMesh::New(getName().c_str(),INTERP_KERNEL::NORM_TETRA4)); + MEDCouplingAutoRefCountObjectPtr ret0(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_TETRA4)); MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(nbOfCells,1); int *retPt(ret->getPointer()); MEDCouplingAutoRefCountObjectPtr newConn(DataArrayInt::New()); newConn->alloc(0,1); diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index 56eb0193a..eaacda684 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -40,7 +40,7 @@ namespace ParaMEDMEM { public: MEDCOUPLING_EXPORT static MEDCouplingUMesh *New(); - MEDCOUPLING_EXPORT static MEDCouplingUMesh *New(const char *meshName, int meshDim); + MEDCOUPLING_EXPORT static MEDCouplingUMesh *New(const std::string& meshName, int meshDim); MEDCOUPLING_EXPORT MEDCouplingMesh *deepCpy() const; MEDCOUPLING_EXPORT MEDCouplingUMesh *clone(bool recDeepCpy) const; MEDCOUPLING_EXPORT MEDCouplingPointSet *deepCpyConnectivityOnly() const; diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index adf980fe1..3970978a0 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -398,13 +398,13 @@ namespace ParaMEDMEM class MEDCouplingMesh : public RefCountObject, public TimeLabel { public: - void setName(const char *name); + void setName(const std::string& name); std::string getName() const; - void setDescription(const char *descr); + void setDescription(const std::string& descr); std::string getDescription() const; void setTime(double val, int iteration, int order); - void setTimeUnit(const char *unit); - const char *getTimeUnit() const; + void setTimeUnit(const std::string& unit); + std::string getTimeUnit() const; virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception); bool isStructured() const throw(INTERP_KERNEL::Exception); virtual MEDCouplingMesh *deepCpy() const; @@ -432,13 +432,13 @@ namespace ParaMEDMEM virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception); virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception); virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception); - void writeVTK(const char *fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception); + void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception); // tools virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception); virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception); - virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception); - virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception); - virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception); virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception); virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception); virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception); @@ -2542,7 +2542,7 @@ namespace ParaMEDMEM class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet { public: - static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception); + static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception); static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception); INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception); int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception); @@ -2579,7 +2579,7 @@ namespace ParaMEDMEM class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh { public: - static MEDCoupling1SGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception); + static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception); static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception); void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception); int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception); @@ -2590,7 +2590,7 @@ namespace ParaMEDMEM DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception); %extend { - MEDCoupling1SGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception) + MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception) { return MEDCoupling1SGTUMesh::New(name,type); } @@ -2635,14 +2635,14 @@ namespace ParaMEDMEM class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh { public: - static MEDCoupling1DGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception); + static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception); static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception); void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception); MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception); bool isPacked() const throw(INTERP_KERNEL::Exception); %extend { - MEDCoupling1DGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception) + MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception) { return MEDCoupling1DGTUMesh::New(name,type); } @@ -2827,7 +2827,7 @@ namespace ParaMEDMEM { public: static MEDCouplingCMesh *New(); - static MEDCouplingCMesh *New(const char *meshName); + static MEDCouplingCMesh *New(const std::string& meshName); MEDCouplingCMesh *clone(bool recDeepCpy) const; void setCoords(const DataArrayDouble *coordsX, const DataArrayDouble *coordsY=0, @@ -2838,7 +2838,7 @@ namespace ParaMEDMEM { return MEDCouplingCMesh::New(); } - MEDCouplingCMesh(const char *meshName) + MEDCouplingCMesh(const std::string& meshName) { return MEDCouplingCMesh::New(meshName); } @@ -2870,7 +2870,7 @@ namespace ParaMEDMEM { public: static MEDCouplingCurveLinearMesh *New(); - static MEDCouplingCurveLinearMesh *New(const char *meshName); + static MEDCouplingCurveLinearMesh *New(const std::string& meshName); MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const; void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception); %extend { @@ -2878,7 +2878,7 @@ namespace ParaMEDMEM { return MEDCouplingCurveLinearMesh::New(); } - MEDCouplingCurveLinearMesh(const char *meshName) + MEDCouplingCurveLinearMesh(const std::string& meshName) { return MEDCouplingCurveLinearMesh::New(meshName); } @@ -3109,14 +3109,14 @@ namespace ParaMEDMEM public: static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); - void setTimeUnit(const char *unit); - const char *getTimeUnit() const; + void setTimeUnit(const std::string& unit); + std::string getTimeUnit() const; void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception); void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception); void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception); std::string simpleRepr() const throw(INTERP_KERNEL::Exception); std::string advancedRepr() const throw(INTERP_KERNEL::Exception); - void writeVTK(const char *fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception); + void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *clone(bool recDeepCpy) const; MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const; MEDCouplingFieldDouble *deepCpy() const; @@ -3163,16 +3163,16 @@ namespace ParaMEDMEM void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception); void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception); - void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception); - void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception); - void fillFromAnalytic3(int nbOfComp, const std::vector& varsOrder, const char *func) throw(INTERP_KERNEL::Exception); - void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception); - void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception); - void applyFunc3(int nbOfComp, const std::vector& varsOrder, const char *func) throw(INTERP_KERNEL::Exception); + void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); + void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); + void fillFromAnalytic3(int nbOfComp, const std::vector& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception); + void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); + void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); + void applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception); void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception); - void applyFunc(const char *func) throw(INTERP_KERNEL::Exception); - void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception); - void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception); + void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception); + void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception); + void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception); double accumulate(int compId) const throw(INTERP_KERNEL::Exception); double getMaxValue() const throw(INTERP_KERNEL::Exception); double getMinValue() const throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i b/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i index 6c6858cc4..8b8e37894 100644 --- a/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i +++ b/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i @@ -37,7 +37,7 @@ namespace ParaMEDMEM static MEDCouplingFieldDiscretization *New(TypeOfField type) throw(INTERP_KERNEL::Exception); double getPrecision() const throw(INTERP_KERNEL::Exception); void setPrecision(double val) throw(INTERP_KERNEL::Exception); - static TypeOfField GetTypeOfFieldFromStringRepr(const char *repr) throw(INTERP_KERNEL::Exception); + static TypeOfField GetTypeOfFieldFromStringRepr(const std::string& repr) throw(INTERP_KERNEL::Exception); virtual TypeOfField getEnum() const throw(INTERP_KERNEL::Exception); virtual bool isEqual(const MEDCouplingFieldDiscretization *other, double eps) const throw(INTERP_KERNEL::Exception); virtual bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling_Swig/MEDCouplingMemArray.i b/src/MEDCoupling_Swig/MEDCouplingMemArray.i index d664d0894..100f477be 100644 --- a/src/MEDCoupling_Swig/MEDCouplingMemArray.i +++ b/src/MEDCoupling_Swig/MEDCouplingMemArray.i @@ -203,13 +203,13 @@ namespace ParaMEDMEM class DataArray : public RefCountObject, public TimeLabel { public: - void setName(const char *name); + void setName(const std::string& name); void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception); void copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds) throw(INTERP_KERNEL::Exception); void copyPartOfStringInfoFrom2(const std::vector& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception); bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception); bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception); - std::string cppRepr(const char *varName) const throw(INTERP_KERNEL::Exception); + std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception); std::string getName() const; void setInfoOnComponents(const std::vector& info) throw(INTERP_KERNEL::Exception); void setInfoAndChangeNbOfCompo(const std::vector& info) throw(INTERP_KERNEL::Exception); @@ -218,7 +218,7 @@ namespace ParaMEDMEM std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception); std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception); std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception); - void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception); + void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception); int getNumberOfComponents() const; virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception); virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception); @@ -231,13 +231,13 @@ namespace ParaMEDMEM virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception); virtual DataArray *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception); virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception); - void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception); - void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception); - void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception); - void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception); - void checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception); - static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception); - static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception); + void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception); + void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception); + void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception); + void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception); + void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception); + static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception); + static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception); static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception); static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception); static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception); @@ -574,12 +574,12 @@ namespace ParaMEDMEM void applyRPow(double val) throw(INTERP_KERNEL::Exception); DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception); DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception); - DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception); - DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception); - DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception); - DataArrayDouble *applyFunc3(int nbOfComp, const std::vector& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception); - void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception); - void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception); + DataArrayDouble *applyFunc(int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception); + DataArrayDouble *applyFunc(const std::string& func) const throw(INTERP_KERNEL::Exception); + DataArrayDouble *applyFunc2(int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception); + DataArrayDouble *applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception); + void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception); + void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception); DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception); DataArrayInt *getIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception); static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling_Swig/MEDCouplingRemapper.i b/src/MEDCoupling_Swig/MEDCouplingRemapper.i index 557d63bcf..91b0add29 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRemapper.i +++ b/src/MEDCoupling_Swig/MEDCouplingRemapper.i @@ -57,7 +57,7 @@ namespace ParaMEDMEM public: MEDCouplingRemapper(); ~MEDCouplingRemapper(); - int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method) throw(INTERP_KERNEL::Exception); + int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method) throw(INTERP_KERNEL::Exception); int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target) throw(INTERP_KERNEL::Exception); void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception); void partialTransfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField) throw(INTERP_KERNEL::Exception); diff --git a/src/MEDLoader/MEDFileData.cxx b/src/MEDLoader/MEDFileData.cxx index ba72ae464..537bee6e7 100644 --- a/src/MEDLoader/MEDFileData.cxx +++ b/src/MEDLoader/MEDFileData.cxx @@ -22,7 +22,7 @@ using namespace ParaMEDMEM; -MEDFileData *MEDFileData::New(const char *fileName) +MEDFileData *MEDFileData::New(const std::string& fileName) { return new MEDFileData(fileName); } @@ -169,7 +169,7 @@ bool MEDFileData::changeMeshNames(const std::vector< std::pair > v(1); @@ -214,7 +214,7 @@ bool MEDFileData::unPolyzeMeshes() MEDFileFields *fs=_fields; if(fs) for(std::size_t i=0;irenumberEntitiesLyingOnMesh(meshesImpacted[i]->getName().c_str(),oldCodeOfMeshImpacted[i],newCodeOfMeshImpacted[i],renumParamsOfMeshImpacted[i]); + fs->renumberEntitiesLyingOnMesh(meshesImpacted[i]->getName(),oldCodeOfMeshImpacted[i],newCodeOfMeshImpacted[i],renumParamsOfMeshImpacted[i]); } return !meshesImpacted.empty(); } @@ -223,7 +223,7 @@ MEDFileData::MEDFileData() { } -MEDFileData::MEDFileData(const char *fileName) +MEDFileData::MEDFileData(const std::string& fileName) try { _fields=MEDFileFields::New(fileName); @@ -235,10 +235,10 @@ catch(INTERP_KERNEL::Exception& e) throw e; } -void MEDFileData::write(const char *fileName, int mode) const +void MEDFileData::write(const std::string& fileName, int mode) const { med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); const MEDFileMeshes *ms=_meshes; if(ms) ms->write(fid); diff --git a/src/MEDLoader/MEDFileData.hxx b/src/MEDLoader/MEDFileData.hxx index b9683f8a5..cbe25dd82 100644 --- a/src/MEDLoader/MEDFileData.hxx +++ b/src/MEDLoader/MEDFileData.hxx @@ -34,7 +34,7 @@ namespace ParaMEDMEM class MEDFileData : public RefCountObject, public MEDFileWritable { public: - MEDLOADER_EXPORT static MEDFileData *New(const char *fileName); + MEDLOADER_EXPORT static MEDFileData *New(const std::string& fileName); MEDLOADER_EXPORT static MEDFileData *New(); MEDLOADER_EXPORT MEDFileData *deepCpy() const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; @@ -51,13 +51,13 @@ namespace ParaMEDMEM MEDLOADER_EXPORT std::string simpleRepr() const; // MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair >& modifTab); - MEDLOADER_EXPORT bool changeMeshName(const char *oldMeshName, const char *newMeshName); + MEDLOADER_EXPORT bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName); MEDLOADER_EXPORT bool unPolyzeMeshes(); // - MEDLOADER_EXPORT void write(const char *fileName, int mode) const; + MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; private: MEDFileData(); - MEDFileData(const char *fileName); + MEDFileData(const std::string& fileName); private: MEDCouplingAutoRefCountObjectPtr _fields; MEDCouplingAutoRefCountObjectPtr _meshes; diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index b68147e4b..2421cbc37 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -43,7 +43,7 @@ using namespace ParaMEDMEM; const char MEDFileField1TSWithoutSDA::TYPE_STR[]="FLOAT64"; const char MEDFileIntField1TSWithoutSDA::TYPE_STR[]="INT32"; -MEDFileFieldLoc *MEDFileFieldLoc::New(med_idt fid, const char *locName) +MEDFileFieldLoc *MEDFileFieldLoc::New(med_idt fid, const std::string& locName) { return new MEDFileFieldLoc(fid,locName); } @@ -53,26 +53,26 @@ MEDFileFieldLoc *MEDFileFieldLoc::New(med_idt fid, int id) return new MEDFileFieldLoc(fid,id); } -MEDFileFieldLoc *MEDFileFieldLoc::New(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w) +MEDFileFieldLoc *MEDFileFieldLoc::New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w) { return new MEDFileFieldLoc(locName,geoType,refCoo,gsCoo,w); } -MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, const char *locName):_name(locName) +MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, const std::string& locName):_name(locName) { med_geometry_type geotype; med_geometry_type sectiongeotype; int nsectionmeshcell; INTERP_KERNEL::AutoPtr geointerpname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); INTERP_KERNEL::AutoPtr sectionmeshname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); - MEDlocalizationInfoByName(fid,locName,&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype); + MEDlocalizationInfoByName(fid,locName.c_str(),&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype); _geo_type=(INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+34,geotype))); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type); _nb_node_per_cell=cm.getNumberOfNodes(); _ref_coo.resize(_dim*_nb_node_per_cell); _gs_coo.resize(_dim*_nb_gauss_pt); _w.resize(_nb_gauss_pt); - MEDlocalizationRd(fid,locName,MED_FULL_INTERLACE,&_ref_coo[0],&_gs_coo[0],&_w[0]); + MEDlocalizationRd(fid,locName.c_str(),MED_FULL_INTERLACE,&_ref_coo[0],&_gs_coo[0],&_w[0]); } MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id) @@ -94,7 +94,7 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id) MEDlocalizationRd(fid,locName,MED_FULL_INTERLACE,&_ref_coo[0],&_gs_coo[0],&_w[0]); } -MEDFileFieldLoc::MEDFileFieldLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, +MEDFileFieldLoc::MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w):_name(locName),_geo_type(geoType),_ref_coo(refCoo),_gs_coo(gsCoo), _w(w) { @@ -132,7 +132,7 @@ void MEDFileFieldLoc::simpleRepr(std::ostream& oss) const oss << "GaussPtsCoords="; std::copy(_gs_coo.begin(),_gs_coo.end(),std::ostream_iterator(oss," ")); oss << std::endl; } -void MEDFileFieldLoc::setName(const char *name) +void MEDFileFieldLoc::setName(const std::string& name) { _name=name; } @@ -631,7 +631,7 @@ std::string MEDFileFieldPerMeshPerTypePerDisc::getProfile() const return _profile; } -void MEDFileFieldPerMeshPerTypePerDisc::setProfile(const char *newPflName) +void MEDFileFieldPerMeshPerTypePerDisc::setProfile(const std::string& newPflName) { _profile=newPflName; } @@ -641,7 +641,7 @@ std::string MEDFileFieldPerMeshPerTypePerDisc::getLocalization() const return _localization; } -void MEDFileFieldPerMeshPerTypePerDisc::setLocalization(const char *newLocName) +void MEDFileFieldPerMeshPerTypePerDisc::setLocalization(const std::string& newLocName) { _localization=newLocName; } @@ -1887,7 +1887,7 @@ bool MEDFileFieldPerMesh::changeMeshNames(const std::vector< std::pair& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, +bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob) { if(_mesh_name!=meshName) @@ -2395,15 +2395,15 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, copyTinyInfoFrom(mesh); } -void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int id, const char *pflName) +void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int id, const std::string& pflName) { if(id>=(int)_pfls.size()) _pfls.resize(id+1); _pfls[id]=DataArrayInt::New(); - int lgth=MEDprofileSizeByName(fid,pflName); + int lgth=MEDprofileSizeByName(fid,pflName.c_str()); _pfls[id]->setName(pflName); _pfls[id]->alloc(lgth,1); - MEDprofileRd(fid,pflName,_pfls[id]->getPointer()); + MEDprofileRd(fid,pflName.c_str(),_pfls[id]->getPointer()); _pfls[id]->applyLin(1,-1,0);//Converting into C format } @@ -2519,7 +2519,7 @@ void MEDFileFieldGlobs::loadAllGlobals(med_idt fid) } } -MEDFileFieldGlobs *MEDFileFieldGlobs::New(const char *fname) +MEDFileFieldGlobs *MEDFileFieldGlobs::New(const std::string& fname) { return new MEDFileFieldGlobs(fname); } @@ -2626,7 +2626,7 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::deepCpyPart(const std::vector return ret.retn(); } -MEDFileFieldGlobs::MEDFileFieldGlobs(const char *fname):_file_name(fname) +MEDFileFieldGlobs::MEDFileFieldGlobs(const std::string& fname):_file_name(fname) { } @@ -2664,7 +2664,7 @@ void MEDFileFieldGlobs::simpleRepr(std::ostream& oss) const } } -void MEDFileFieldGlobs::setFileName(const char *fileName) +void MEDFileFieldGlobs::setFileName(const std::string& fileName) { _file_name=fileName; } @@ -2716,7 +2716,7 @@ int MEDFileFieldGlobs::getNbOfGaussPtPerCell(int locId) const return _locs[locId]->getNbOfGaussPtPerCell(); } -const MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const char *locName) const +const MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const std::string& locName) const { return getLocalizationFromId(getLocalizationId(locName)); } @@ -2733,10 +2733,10 @@ namespace ParaMEDMEMImpl class LocFinder { public: - LocFinder(const char *loc):_loc(loc) { } + LocFinder(const std::string& loc):_loc(loc) { } bool operator() (const MEDCouplingAutoRefCountObjectPtr& loc) { return loc->isName(_loc); } private: - const char *_loc; + const std::string &_loc; }; class PflFinder @@ -2749,7 +2749,7 @@ namespace ParaMEDMEMImpl }; } -int MEDFileFieldGlobs::getLocalizationId(const char *loc) const +int MEDFileFieldGlobs::getLocalizationId(const std::string& loc) const { std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=std::find_if(_locs.begin(),_locs.end(),ParaMEDMEMImpl::LocFinder(loc)); if(it==_locs.end()) @@ -2765,7 +2765,7 @@ int MEDFileFieldGlobs::getLocalizationId(const char *loc) const /*! * The returned value is never null. */ -const DataArrayInt *MEDFileFieldGlobs::getProfile(const char *pflName) const +const DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) const { std::string pflNameCpp(pflName); std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),ParaMEDMEMImpl::PflFinder(pflNameCpp)); @@ -2793,7 +2793,7 @@ MEDFileFieldLoc& MEDFileFieldGlobs::getLocalizationFromId(int locId) return *_locs[locId]; } -MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const char *locName) +MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const std::string& locName) { return getLocalizationFromId(getLocalizationId(locName)); } @@ -2801,7 +2801,7 @@ MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const char *locName) /*! * The returned value is never null. */ -DataArrayInt *MEDFileFieldGlobs::getProfile(const char *pflName) +DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) { std::string pflNameCpp(pflName); std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),ParaMEDMEMImpl::PflFinder(pflNameCpp)); @@ -2864,14 +2864,14 @@ std::vector MEDFileFieldGlobs::getLocs() const return ret; } -bool MEDFileFieldGlobs::existsPfl(const char *pflName) const +bool MEDFileFieldGlobs::existsPfl(const std::string& pflName) const { std::vector v=getPfls(); std::string s(pflName); return std::find(v.begin(),v.end(),s)!=v.end(); } -bool MEDFileFieldGlobs::existsLoc(const char *locName) const +bool MEDFileFieldGlobs::existsLoc(const std::string& locName) const { std::vector v=getLocs(); std::string s(locName); @@ -2941,7 +2941,7 @@ void MEDFileFieldGlobs::appendProfile(DataArrayInt *pfl) _pfls.push_back(pfl); } -void MEDFileFieldGlobs::appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w) +void MEDFileFieldGlobs::appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w) { std::string name(locName); if(name.empty()) @@ -2971,7 +2971,7 @@ std::string MEDFileFieldGlobs::createNewNameOfLoc() const return CreateNewNameNotIn("NewLoc_",names); } -std::string MEDFileFieldGlobs::CreateNewNameNotIn(const char *prefix, const std::vector& namesToAvoid) +std::string MEDFileFieldGlobs::CreateNewNameNotIn(const std::string& prefix, const std::vector& namesToAvoid) { for(std::size_t sz=0;sz<100000;sz++) { @@ -2987,7 +2987,7 @@ std::string MEDFileFieldGlobs::CreateNewNameNotIn(const char *prefix, const std: * Creates a MEDFileFieldGlobsReal on a given file name. Nothing is read here. * \param [in] fname - the file name. */ -MEDFileFieldGlobsReal::MEDFileFieldGlobsReal(const char *fname):_globals(MEDFileFieldGlobs::New(fname)) +MEDFileFieldGlobsReal::MEDFileFieldGlobsReal(const std::string& fname):_globals(MEDFileFieldGlobs::New(fname)) { } @@ -3113,7 +3113,7 @@ void MEDFileFieldGlobsReal::checkGlobsLocsPartCoherency() const contentNotNull()->checkGlobsLocsPartCoherency(getLocsReallyUsed()); } -void MEDFileFieldGlobsReal::loadProfileInFile(med_idt fid, int id, const char *pflName) +void MEDFileFieldGlobsReal::loadProfileInFile(med_idt fid, int id, const std::string& pflName) { contentNotNull()->loadProfileInFile(fid,id,pflName); } @@ -3163,7 +3163,7 @@ std::vector MEDFileFieldGlobsReal::getLocs() const * \param [in] pflName - the profile name of interest. * \return bool - \c true if the profile named \a pflName exists. */ -bool MEDFileFieldGlobsReal::existsPfl(const char *pflName) const +bool MEDFileFieldGlobsReal::existsPfl(const std::string& pflName) const { return contentNotNull()->existsPfl(pflName); } @@ -3173,7 +3173,7 @@ bool MEDFileFieldGlobsReal::existsPfl(const char *pflName) const * \param [in] locName - the localization name of interest. * \return bool - \c true if the localization named \a locName exists. */ -bool MEDFileFieldGlobsReal::existsLoc(const char *locName) const +bool MEDFileFieldGlobsReal::existsLoc(const std::string& locName) const { return contentNotNull()->existsLoc(locName); } @@ -3192,7 +3192,7 @@ std::string MEDFileFieldGlobsReal::createNewNameOfLoc() const * Sets the name of a MED file. * \param [inout] fileName - the file name. */ -void MEDFileFieldGlobsReal::setFileName(const char *fileName) +void MEDFileFieldGlobsReal::setFileName(const std::string& fileName) { contentNotNull()->setFileName(fileName); } @@ -3285,7 +3285,7 @@ void MEDFileFieldGlobsReal::changeLocsNames(const std::vector< std::pair, std::string > > mapOfModif(1); std::pair, std::string > p(std::vector(1,std::string(oldName)),std::string(newName)); @@ -3299,7 +3299,7 @@ void MEDFileFieldGlobsReal::changePflName(const char *oldName, const char *newNa * \param [in] newName - a new name of the localization. * \sa changeLocsNames(). */ -void MEDFileFieldGlobsReal::changeLocName(const char *oldName, const char *newName) +void MEDFileFieldGlobsReal::changeLocName(const std::string& oldName, const std::string& newName) { std::vector< std::pair, std::string > > mapOfModif(1); std::pair, std::string > p(std::vector(1,std::string(oldName)),std::string(newName)); @@ -3384,16 +3384,16 @@ int MEDFileFieldGlobsReal::getNbOfGaussPtPerCell(int locId) const * \return int - the id of the localization. * \throw If there is no a localization named \a loc. */ -int MEDFileFieldGlobsReal::getLocalizationId(const char *loc) const +int MEDFileFieldGlobsReal::getLocalizationId(const std::string& loc) const { return contentNotNull()->getLocalizationId(loc); } /*! * Returns the name of the MED file. - * \return const char * - the MED file name. + * \return const std::string& - the MED file name. */ -const char *MEDFileFieldGlobsReal::getFileName() const +std::string MEDFileFieldGlobsReal::getFileName() const { return contentNotNull()->getFileName(); } @@ -3409,7 +3409,7 @@ std::string MEDFileFieldGlobsReal::getFileName2() const * \return const MEDFileFieldLoc& - the localization object having the name \a locName. * \throw If there is no a localization named \a locName. */ -const MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const char *locName) const +const MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const std::string& locName) const { return contentNotNull()->getLocalization(locName); } @@ -3431,7 +3431,7 @@ const MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalizationFromId(int locId) c * \return const DataArrayInt * - the profile array having the name \a pflName. * \throw If there is no a profile named \a pflName. */ -const DataArrayInt *MEDFileFieldGlobsReal::getProfile(const char *pflName) const +const DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) const { return contentNotNull()->getProfile(pflName); } @@ -3466,7 +3466,7 @@ MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalizationFromId(int locId) * having the name \a locName. * \throw If there is no a localization named \a locName. */ -MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const char *locName) +MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const std::string& locName) { return contentNotNull()->getLocalization(locName); } @@ -3477,7 +3477,7 @@ MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const char *locName) * \return DataArrayInt * - a non-const pointer to the profile array having the name \a pflName. * \throw If there is no a profile named \a pflName. */ -DataArrayInt *MEDFileFieldGlobsReal::getProfile(const char *pflName) +DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) { return contentNotNull()->getProfile(pflName); } @@ -3536,7 +3536,7 @@ void MEDFileFieldGlobsReal::appendProfile(DataArrayInt *pfl) * \throw If a localization with the name \a locName already exists but is * different form the new one. */ -void MEDFileFieldGlobsReal::appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w) +void MEDFileFieldGlobsReal::appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w) { contentNotNull()->appendLoc(locName,geoType,refCoo,gsCoo,w); } @@ -3563,7 +3563,7 @@ MEDFileFieldNameScope::MEDFileFieldNameScope() { } -MEDFileFieldNameScope::MEDFileFieldNameScope(const char *fieldName):_name(fieldName) +MEDFileFieldNameScope::MEDFileFieldNameScope(const std::string& fieldName):_name(fieldName) { } @@ -3580,7 +3580,7 @@ std::string MEDFileFieldNameScope::getName() const * Sets name of \a this field * \param [in] name - the new field name. */ -void MEDFileFieldNameScope::setName(const char *fieldName) +void MEDFileFieldNameScope::setName(const std::string& fieldName) { _name=fieldName; } @@ -3590,7 +3590,7 @@ std::string MEDFileFieldNameScope::getDtUnit() const return _dt_unit; } -void MEDFileFieldNameScope::setDtUnit(const char *dtUnit) +void MEDFileFieldNameScope::setDtUnit(const std::string& dtUnit) { _dt_unit=dtUnit; } @@ -3691,7 +3691,7 @@ std::vector< MEDCouplingAutoRefCountObjectPtr return ret; } -MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order):MEDFileFieldNameScope(fieldName),_iteration(iteration),_order(order),_csit(csit),_nb_of_tuples_to_be_allocated(-2) +MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order):MEDFileFieldNameScope(fieldName),_iteration(iteration),_order(order),_csit(csit),_nb_of_tuples_to_be_allocated(-2) { } @@ -3724,7 +3724,7 @@ std::string MEDFileAnyTypeField1TSWithoutSDA::getMeshName() const return _field_per_mesh[0]->getMeshName(); } -void MEDFileAnyTypeField1TSWithoutSDA::setMeshName(const char *newMeshName) +void MEDFileAnyTypeField1TSWithoutSDA::setMeshName(const std::string& newMeshName) { std::string oldName(getMeshName()); std::vector< std::pair > v(1); @@ -3932,10 +3932,10 @@ void MEDFileAnyTypeField1TSWithoutSDA::changeLocsRefsNamesGen2(const std::vector * Length of this and of nested sequences is the same as that of \a typesF. * \throw If no field is lying on \a mname. */ -std::vector< std::vector< std::pair > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const char *mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const +std::vector< std::vector< std::pair > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { int meshId=0; - if(mname) + if(!mname.empty()) meshId=getMeshIdFromMeshName(mname); else if(_field_per_mesh.empty()) @@ -3984,7 +3984,7 @@ std::vector< std::vector< std::pair > > MEDFileAnyTypeField1TSWithoutSD * \return int - the maximal absolute dimension of elements \a this fields lies on. * \throw If no field is lying on \a mname. */ -int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const char *mname, std::vector& levs) const +int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const std::string& mname, std::vector& levs) const { levs.clear(); int meshId=getMeshIdFromMeshName(mname); @@ -4016,7 +4016,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const char *mname, std:: * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of * \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0. */ -MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) +MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) { int mid=getMeshIdFromMeshName(mName); return _field_per_mesh[mid]->getLeafGivenTypeAndLocId(typ,locId); @@ -4028,7 +4028,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGive * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of * \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0. */ -const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const +const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const { int mid=getMeshIdFromMeshName(mName); return _field_per_mesh[mid]->getLeafGivenTypeAndLocId(typ,locId); @@ -4037,11 +4037,11 @@ const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLe /*! * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh. */ -int MEDFileAnyTypeField1TSWithoutSDA::getMeshIdFromMeshName(const char *mName) const +int MEDFileAnyTypeField1TSWithoutSDA::getMeshIdFromMeshName(const std::string& mName) const { if(_field_per_mesh.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getMeshIdFromMeshName : No field set !"); - if(mName==0) + if(mName.empty()) return 0; std::string mName2(mName); int ret=0; @@ -4078,7 +4078,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary(const MEDCouplingMe return sz; } -bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const char *meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, +bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob) { bool ret=false; @@ -4474,10 +4474,10 @@ std::vector& MEDFileAnyTypeField1TSWithoutSDA::getInfo() * \throw If no field of \a this is lying on the mesh \a mName. * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. */ -MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const +MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const { MEDCouplingAutoRefCountObjectPtr mm; - if(mName==0) + if(mName.empty()) mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder()); else mm=MEDFileMesh::New(glob->getFileName(),mName,getMeshIteration(),getMeshOrder()); @@ -4534,10 +4534,10 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( * \throw If there are no mesh entities in the mesh. * \throw If no field values of the given \a type are available. */ -MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(TypeOfField type, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const +MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const { - MEDCouplingAutoRefCountObjectPtr mm; - if(mName==0) + MEDCouplingAutoRefCountObjectPtr mm; + if(mName.empty()) mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder()); else mm=MEDFileMesh::New(glob->getFileName(),mName,getMeshIteration(),getMeshOrder()); @@ -4571,7 +4571,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 { 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().c_str()); + int meshId=getMeshIdFromMeshName(mesh->getName()); bool isPfl=false; MEDCouplingAutoRefCountObjectPtr ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl,arrOut,nasc); switch(renumPol) @@ -4712,7 +4712,7 @@ std::vector MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh * return code; } -MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const char *fieldName, int csit, int iteration, int order, const std::vector& infos) +MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos) { return new MEDFileField1TSWithoutSDA(fieldName,csit,iteration,order,infos); } @@ -4751,10 +4751,10 @@ MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const char *fieldName, * Length of this and of nested sequences is the same as that of \a typesF. * \throw If no field is lying on \a mname. */ -std::vector< std::vector > MEDFileField1TSWithoutSDA::getFieldSplitedByType2(const char *mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const +std::vector< std::vector > MEDFileField1TSWithoutSDA::getFieldSplitedByType2(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { int meshId=0; - if(mname) + if(!mname.empty()) meshId=getMeshIdFromMeshName(mname); else if(_field_per_mesh.empty()) @@ -4870,7 +4870,7 @@ DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< st return getUndergroundDataArrayDoubleExt(entries); } -MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order, +MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos):MEDFileAnyTypeField1TSWithoutSDA(fieldName,csit,iteration,order) { DataArrayDouble *arr=getOrCreateAndGetArrayDouble(); @@ -4949,7 +4949,7 @@ const DataArray *MEDFileField1TSWithoutSDA::getOrCreateAndGetArray() const //= MEDFileIntField1TSWithoutSDA -MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::New(const char *fieldName, int csit, int iteration, int order, +MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::New(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos) { return new MEDFileIntField1TSWithoutSDA(fieldName,csit,iteration,order,infos); @@ -4959,7 +4959,7 @@ MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA():MEDFileAnyTypeField { } -MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order, +MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos):MEDFileAnyTypeField1TSWithoutSDA(fieldName,csit,iteration,order) { DataArrayInt *arr=getOrCreateAndGetArrayInt(); @@ -5132,7 +5132,7 @@ MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS() //= MEDFileAnyTypeField1TS -MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName, bool loadAll) +MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const std::string& fileName, bool loadAll) { med_field_type typcha; // @@ -5173,11 +5173,11 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i return ret.retn(); } -MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName, bool loadAll) +MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const std::string& fileName, bool loadAll) try:MEDFileFieldGlobsReal(fileName) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); _content=BuildContentFrom(fid,fileName,loadAll); loadGlobals(fid); } @@ -5186,7 +5186,7 @@ catch(INTERP_KERNEL::Exception& e) throw e; } -MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, bool loadAll) +MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, bool loadAll) { med_field_type typcha; std::vector infos; @@ -5223,7 +5223,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i // med_int numdt,numit; med_float dt; - MEDfieldComputingStepInfo(fid,fieldName,1,&numdt,&numit,&dt); + MEDfieldComputingStepInfo(fid,fieldName.c_str(),1,&numdt,&numit,&dt); ret->setTime(numdt,numit,dt); ret->_csit=1; if(loadAll) @@ -5233,11 +5233,11 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i return ret.retn(); } -MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName, bool loadAll) +MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll) try:MEDFileFieldGlobsReal(fileName) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); _content=BuildContentFrom(fid,fileName,fieldName,loadAll); loadGlobals(fid); } @@ -5246,7 +5246,7 @@ catch(INTERP_KERNEL::Exception& e) throw e; } -MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, const char *fileName) +MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, const std::string& fileName) { if(!c) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !"); @@ -5267,37 +5267,37 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::BuildNewInstanceFromContent(MEDF throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::BuildNewInstanceFromContent : internal error ! a content of type different from FLOAT64 and INT32 has been built but not intercepted !"); } -MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName, bool loadAll) +MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, bool loadAll) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); MEDCouplingAutoRefCountObjectPtr c=BuildContentFrom(fid,fileName,loadAll); MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); return ret.retn(); } -MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName, const char *fieldName, bool loadAll) +MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); MEDCouplingAutoRefCountObjectPtr c=BuildContentFrom(fid,fileName,fieldName,loadAll); MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); return ret.retn(); } -MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll) +MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); MEDCouplingAutoRefCountObjectPtr c=BuildContentFrom(fid,fileName,fieldName,iteration,order,loadAll); MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); return ret.retn(); } -MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, int iteration, int order, bool loadAll) +MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll) { med_field_type typcha; std::vector infos; @@ -5332,7 +5332,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i { med_int numdt,numit; med_float dt; - MEDfieldComputingStepInfo(fid,fieldName,i+1,&numdt,&numit,&dt); + MEDfieldComputingStepInfo(fid,fieldName.c_str(),i+1,&numdt,&numit,&dt); if(numdt==iteration && numit==order) { found=true; @@ -5355,12 +5355,12 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i return ret.retn(); } -MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll) +MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll) try:MEDFileFieldGlobsReal(fileName) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); - _content=BuildContentFrom(fid,fileName,fieldName,iteration,order,loadAll); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); + _content=BuildContentFrom(fid,fileName.c_str(),fieldName.c_str(),iteration,order,loadAll); loadGlobals(fid); } catch(INTERP_KERNEL::Exception& e) @@ -5388,7 +5388,7 @@ MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const MEDFileAnyTypeField1TSWitho } } -int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, const char *fileName, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector& infos, std::string& dtunitOut) +int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, const std::string& fileName, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector& infos, std::string& dtunitOut) { if(checkFieldId) { @@ -5422,7 +5422,7 @@ int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, const char *fileName, int * \param [out] * \return in case of success the number of time steps available for the field with name \a fieldName. */ -int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const char *fileName, const char *fieldName, int& posCFormat, med_field_type& typcha, std::vector& infos, std::string& dtunitOut) +int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const std::string& fileName, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector& infos, std::string& dtunitOut) { int nbFields=MEDnField(fid); bool found=false; @@ -5465,7 +5465,7 @@ int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const char *fileName, const * \param [in] forceRenameOnGlob specifies the behaviour in case of profile \b newPflName already exists. If true, the renaming is done without check. It can lead to major bug. * If false, an exception will be thrown to force user to change previously the name of the profile with name \b newPflName */ -void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob) +void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob) { MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId); std::string oldPflName=disc->getProfile(); @@ -5503,7 +5503,7 @@ void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const char *mName, INTERP_KERN * \param [in] forceRenameOnGlob specifies the behaviour in case of profile \b newLocName already exists. If true, the renaming is done without check. It can lead to major bug. * If false, an exception will be thrown to force user to change previously the name of the profile with name \b newLocName */ -void MEDFileAnyTypeField1TS::setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob) +void MEDFileAnyTypeField1TS::setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob) { MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId); std::string oldLocName=disc->getLocalization(); @@ -5549,10 +5549,10 @@ const MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::contentNotNullBa * \throw If no field data is set. * \throw If \a mode == 1 and the same data is present in an existing file. */ -void MEDFileAnyTypeField1TS::write(const char *fileName, int mode) const +void MEDFileAnyTypeField1TS::write(const std::string& fileName, int mode) const { med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); writeLL(fid); } @@ -5566,7 +5566,7 @@ void MEDFileAnyTypeField1TS::write(const char *fileName, int mode) const */ void MEDFileAnyTypeField1TS::loadArrays() { - MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY); contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase()); } @@ -5579,7 +5579,7 @@ void MEDFileAnyTypeField1TS::loadArrays() */ void MEDFileAnyTypeField1TS::loadArraysIfNecessary() { - MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY); contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase()); } @@ -5716,7 +5716,7 @@ std::string MEDFileAnyTypeField1TS::getName() const return contentNotNullBase()->getName(); } -void MEDFileAnyTypeField1TS::setName(const char *name) +void MEDFileAnyTypeField1TS::setName(const std::string& name) { contentNotNullBase()->setName(name); } @@ -5731,7 +5731,7 @@ std::string MEDFileAnyTypeField1TS::getDtUnit() const return contentNotNullBase()->getDtUnit(); } -void MEDFileAnyTypeField1TS::setDtUnit(const char *dtUnit) +void MEDFileAnyTypeField1TS::setDtUnit(const std::string& dtUnit) { contentNotNullBase()->setDtUnit(dtUnit); } @@ -5741,7 +5741,7 @@ std::string MEDFileAnyTypeField1TS::getMeshName() const return contentNotNullBase()->getMeshName(); } -void MEDFileAnyTypeField1TS::setMeshName(const char *newMeshName) +void MEDFileAnyTypeField1TS::setMeshName(const std::string& newMeshName) { contentNotNullBase()->setMeshName(newMeshName); } @@ -5800,17 +5800,17 @@ std::vector& MEDFileAnyTypeField1TS::getInfo() return contentNotNullBase()->getInfo(); } -MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TS::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) +MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TS::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) { return contentNotNullBase()->getLeafGivenMeshAndTypeAndLocId(mName,typ,locId); } -const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TS::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const +const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TS::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const { return contentNotNullBase()->getLeafGivenMeshAndTypeAndLocId(mName,typ,locId); } -int MEDFileAnyTypeField1TS::getNonEmptyLevels(const char *mname, std::vector& levs) const +int MEDFileAnyTypeField1TS::getNonEmptyLevels(const std::string& mname, std::vector& levs) const { return contentNotNullBase()->getNonEmptyLevels(mname,levs); } @@ -5820,7 +5820,7 @@ std::vector MEDFileAnyTypeField1TS::getTypesOfFieldAvailable() cons return contentNotNullBase()->getTypesOfFieldAvailable(); } -std::vector< std::vector > > MEDFileAnyTypeField1TS::getFieldSplitedByType(const char *mname, std::vector& types, std::vector< std::vector >& typesF, +std::vector< std::vector > > MEDFileAnyTypeField1TS::getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const throw(INTERP_KERNEL::Exception) { return contentNotNullBase()->getFieldSplitedByType(mname,types,typesF,pfls,locs); @@ -5891,7 +5891,7 @@ int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field * is to delete this field using decrRef() as it is no more needed. * \throw If reading the file fails. */ -MEDFileField1TS *MEDFileField1TS::New(const char *fileName, bool loadAll) +MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, bool loadAll) { MEDCouplingAutoRefCountObjectPtr ret=new MEDFileField1TS(fileName,loadAll); ret->contentNotNull(); @@ -5908,7 +5908,7 @@ MEDFileField1TS *MEDFileField1TS::New(const char *fileName, bool loadAll) * \throw If reading the file fails. * \throw If there is no field named \a fieldName in the file. */ -MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldName, bool loadAll) +MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { MEDCouplingAutoRefCountObjectPtr ret=new MEDFileField1TS(fileName,fieldName,loadAll); ret->contentNotNull(); @@ -5928,7 +5928,7 @@ MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldNam * \throw If there is no field named \a fieldName in the file. * \throw If the required time step is missing from the file. */ -MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll) +MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll) { MEDCouplingAutoRefCountObjectPtr ret=new MEDFileField1TS(fileName,fieldName,iteration,order,loadAll); ret->contentNotNull(); @@ -6040,21 +6040,21 @@ DataArrayDouble *MEDFileField1TS::ReturnSafelyDataArrayDouble(MEDCouplingAutoRef return arrOutC; } -MEDFileField1TS::MEDFileField1TS(const char *fileName, bool loadAll) +MEDFileField1TS::MEDFileField1TS(const std::string& fileName, bool loadAll) try:MEDFileAnyTypeField1TS(fileName,loadAll) { } catch(INTERP_KERNEL::Exception& e) { throw e; } -MEDFileField1TS::MEDFileField1TS(const char *fileName, const char *fieldName, bool loadAll) +MEDFileField1TS::MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll) try:MEDFileAnyTypeField1TS(fileName,fieldName,loadAll) { } catch(INTERP_KERNEL::Exception& e) { throw e; } -MEDFileField1TS::MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll) +MEDFileField1TS::MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll) try:MEDFileAnyTypeField1TS(fileName,fieldName,iteration,order,loadAll) { } @@ -6107,7 +6107,7 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevel(TypeOfField type, int m if(getFileName2().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !"); MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this,arrOut,*contentNotNull()); + MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNull()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -6139,7 +6139,7 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtTopLevel(TypeOfField type, in if(getFileName2().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtTopLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtTopLevel method instead !"); MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtTopLevel(type,0,renumPol,this,arrOut,*contentNotNull()); + MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNull()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -6227,7 +6227,7 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. * \sa getFieldAtLevel() */ -MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol) const +MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol) const { if(getFileName2().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !"); @@ -6321,7 +6321,7 @@ DataArrayDouble *MEDFileField1TS::getUndergroundDataArrayExt(std::vector< std::p return contentNotNull()->getUndergroundDataArrayDoubleExt(entries); } -std::vector< std::vector > MEDFileField1TS::getFieldSplitedByType2(const char *mname, std::vector& types, std::vector< std::vector >& typesF, +std::vector< std::vector > MEDFileField1TS::getFieldSplitedByType2(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const throw(INTERP_KERNEL::Exception) { return contentNotNull()->getFieldSplitedByType2(mname,types,typesF,pfls,locs); @@ -6336,21 +6336,21 @@ MEDFileIntField1TS *MEDFileIntField1TS::New() return ret.retn(); } -MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName, bool loadAll) +MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, bool loadAll) { MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntField1TS(fileName,loadAll); ret->contentNotNull(); return ret.retn(); } -MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName, const char *fieldName, bool loadAll) +MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntField1TS(fileName,fieldName,loadAll); ret->contentNotNull(); return ret.retn(); } -MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll) +MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll) { MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntField1TS(fileName,fieldName,iteration,order,loadAll); ret->contentNotNull(); @@ -6369,21 +6369,21 @@ MEDFileIntField1TS::MEDFileIntField1TS() _content=new MEDFileIntField1TSWithoutSDA; } -MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName, bool loadAll) +MEDFileIntField1TS::MEDFileIntField1TS(const std::string& fileName, bool loadAll) try:MEDFileAnyTypeField1TS(fileName,loadAll) { } catch(INTERP_KERNEL::Exception& e) { throw e; } -MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName, const char *fieldName, bool loadAll) +MEDFileIntField1TS::MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll) try:MEDFileAnyTypeField1TS(fileName,fieldName,loadAll) { } catch(INTERP_KERNEL::Exception& e) { throw e; } -MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll) +MEDFileIntField1TS::MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll) try:MEDFileAnyTypeField1TS(fileName,fieldName,iteration,order,loadAll) { } @@ -6499,7 +6499,7 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevel(TypeOfField type, in if(getFileName2().empty()) throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !"); MEDCouplingAutoRefCountObjectPtr arrOut2; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this,arrOut2,*contentNotNull()); + MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut2,*contentNotNull()); DataArrayInt *arrOutC=dynamic_cast((DataArray *)arrOut2); if(!arrOutC) throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevelOld : mismatch between dataArrays type and MEDFileIntField1TS ! Expected int32 !"); @@ -6546,7 +6546,7 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtTopLevel(TypeOfField type, if(getFileName2().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtTopLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtTopLevel method instead !"); MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtTopLevel(type,0,renumPol,this,arr,*contentNotNull()); + MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNull()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -6637,7 +6637,7 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField ty * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. * \sa getFieldAtLevel() */ -MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const +MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const { if(getFileName2().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !"); @@ -6691,7 +6691,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA() { } -MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(const char *fieldName):MEDFileFieldNameScope(fieldName) +MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(const std::string& fieldName):MEDFileFieldNameScope(fieldName) { } @@ -6707,7 +6707,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_i loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,typcha,loadAll); } -MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll) +MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll) try:MEDFileFieldNameScope(fieldName),_infos(infos) { setDtUnit(dtunit.c_str()); @@ -6886,7 +6886,7 @@ std::string MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshName() const return _time_steps[0]->getMeshName(); } -void MEDFileAnyTypeFieldMultiTSWithoutSDA::setMeshName(const char *newMeshName) +void MEDFileAnyTypeFieldMultiTSWithoutSDA::setMeshName(const std::string& newMeshName) { std::string oldName(getMeshName()); std::vector< std::pair > v(1); @@ -6922,7 +6922,7 @@ DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArrayExt(int return getTimeStepEntry(iteration,order).getUndergroundDataArrayExt(entries); } -bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const char *meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, +bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob) { bool ret=false; @@ -7243,7 +7243,7 @@ std::vector< std::pair > MEDFileAnyTypeFieldMultiTSWithoutSDA::getItera * To retrieve the highest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+0);//absDim-meshDim+relativeLev * To retrieve the lowest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+(-1));//absDim-meshDim+relativeLev */ -int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNonEmptyLevels(int iteration, int order, const char *mname, std::vector& levs) const +int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector& levs) const { return getTimeStepEntry(iteration,order).getNonEmptyLevels(mname,levs); } @@ -7362,7 +7362,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMultiTSWithoutSDA::ge /*! * entry point for users that want to iterate into MEDFile DataStructure without any overhead. */ -std::vector< std::vector< std::pair > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(int iteration, int order, const char *mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const +std::vector< std::vector< std::pair > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs); } @@ -7565,7 +7565,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MEDCouplingAutoRe //= MEDFileFieldMultiTSWithoutSDA -MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll) +MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll) { return new MEDFileFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll); } @@ -7574,7 +7574,7 @@ MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA() { } -MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(const char *fieldName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName) +MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName) { } @@ -7588,7 +7588,7 @@ try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId,loadAll) catch(INTERP_KERNEL::Exception& e) { throw e; } -MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll) +MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll) try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll) { } @@ -7628,7 +7628,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::createNew() * entry point for users that want to iterate into MEDFile DataStructure with a reduced overhead because output arrays are extracted (created) specially * for the call of this method. That's why the DataArrayDouble instance in returned vector of vector should be dealed by the caller. */ -std::vector< std::vector > MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2(int iteration, int order, const char *mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const +std::vector< std::vector > MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=getTimeStepEntry(iteration,order); const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); @@ -7663,11 +7663,11 @@ MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS() { } -MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const char *fileName, bool loadAll) +MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const std::string& fileName, bool loadAll) try:MEDFileFieldGlobsReal(fileName) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); _content=BuildContentFrom(fid,fileName,loadAll); loadGlobals(fid); } @@ -7676,7 +7676,7 @@ catch(INTERP_KERNEL::Exception& e) throw e; } -MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, bool loadAll) +MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, bool loadAll) { med_field_type typcha; std::vector infos; @@ -7706,7 +7706,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr return ret.retn(); } -MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const char *fileName, bool loadAll) +MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const std::string& fileName, bool loadAll) { med_field_type typcha; // @@ -7736,7 +7736,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr return ret.retn(); } -MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, const char *fileName) +MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, const std::string& fileName) { if(!c) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !"); @@ -7757,11 +7757,11 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromCont throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : internal error ! a content of type different from FLOAT64 and INT32 has been built but not intercepted !"); } -MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll) +MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll) try:MEDFileFieldGlobsReal(fileName) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); _content=BuildContentFrom(fid,fileName,fieldName,loadAll); loadGlobals(fid); } @@ -7772,7 +7772,7 @@ catch(INTERP_KERNEL::Exception& e) //= MEDFileIntFieldMultiTSWithoutSDA -MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll) +MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll) { return new MEDFileIntFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll); } @@ -7781,11 +7781,11 @@ MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA() { } -MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(const char *fieldName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName) +MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName) { } -MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll) +MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll) try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll) { } @@ -7861,10 +7861,10 @@ MEDFileFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::convertToDouble * is to delete this field using decrRef() as it is no more needed. * \throw If reading the file fails. */ -MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const char *fileName, bool loadAll) +MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, bool loadAll) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); MEDCouplingAutoRefCountObjectPtr c=BuildContentFrom(fid,fileName,loadAll); MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); @@ -7881,10 +7881,10 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const char *fileName * \throw If reading the file fails. * \throw If there is no field named \a fieldName in the file. */ -MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const char *fileName, const char *fieldName, bool loadAll) +MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); MEDCouplingAutoRefCountObjectPtr c=BuildContentFrom(fid,fileName,fieldName,loadAll); MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); @@ -8035,7 +8035,7 @@ int MEDFileAnyTypeFieldMultiTS::getPosGivenTime(double time, double eps) const return contentNotNullBase()->getPosGivenTime(time,eps); } -int MEDFileAnyTypeFieldMultiTS::getNonEmptyLevels(int iteration, int order, const char *mname, std::vector& levs) const +int MEDFileAnyTypeFieldMultiTS::getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector& levs) const { return contentNotNullBase()->getNonEmptyLevels(iteration,order,mname,levs); } @@ -8045,7 +8045,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMultiTS::getTypesOfFi return contentNotNullBase()->getTypesOfFieldAvailable(); } -std::vector< std::vector< std::pair > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(int iteration, int order, const char *mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const +std::vector< std::vector< std::pair > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { return contentNotNullBase()->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs); } @@ -8055,7 +8055,7 @@ std::string MEDFileAnyTypeFieldMultiTS::getName() const return contentNotNullBase()->getName(); } -void MEDFileAnyTypeFieldMultiTS::setName(const char *name) +void MEDFileAnyTypeFieldMultiTS::setName(const std::string& name) { contentNotNullBase()->setName(name); } @@ -8065,7 +8065,7 @@ std::string MEDFileAnyTypeFieldMultiTS::getDtUnit() const return contentNotNullBase()->getDtUnit(); } -void MEDFileAnyTypeFieldMultiTS::setDtUnit(const char *dtUnit) +void MEDFileAnyTypeFieldMultiTS::setDtUnit(const std::string& dtUnit) { contentNotNullBase()->setDtUnit(dtUnit); } @@ -8085,7 +8085,7 @@ std::string MEDFileAnyTypeFieldMultiTS::getMeshName() const return contentNotNullBase()->getMeshName(); } -void MEDFileAnyTypeFieldMultiTS::setMeshName(const char *newMeshName) +void MEDFileAnyTypeFieldMultiTS::setMeshName(const std::string& newMeshName) { contentNotNullBase()->setMeshName(newMeshName); } @@ -8128,10 +8128,10 @@ void MEDFileAnyTypeFieldMultiTS::writeLL(med_idt fid) const * \throw If no field data is set. * \throw If \a mode == 1 and the same data is present in an existing file. */ -void MEDFileAnyTypeFieldMultiTS::write(const char *fileName, int mode) const +void MEDFileAnyTypeFieldMultiTS::write(const std::string& fileName, int mode) const { med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); writeLL(fid); } @@ -8144,7 +8144,7 @@ void MEDFileAnyTypeFieldMultiTS::write(const char *fileName, int mode) const */ void MEDFileAnyTypeFieldMultiTS::loadArrays() { - MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY); contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase()); } @@ -8157,7 +8157,7 @@ void MEDFileAnyTypeFieldMultiTS::loadArrays() */ void MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary() { - MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY); contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase()); } @@ -8511,7 +8511,7 @@ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New() * is to delete this field using decrRef() as it is no more needed. * \throw If reading the file fails. */ -MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName, bool loadAll) +MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const std::string& fileName, bool loadAll) { MEDCouplingAutoRefCountObjectPtr ret=new MEDFileFieldMultiTS(fileName,loadAll); ret->contentNotNull();//to check that content type matches with \a this type. @@ -8528,7 +8528,7 @@ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName, bool loadAll * \throw If reading the file fails. * \throw If there is no field named \a fieldName in the file. */ -MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName, const char *fieldName, bool loadAll) +MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { MEDCouplingAutoRefCountObjectPtr ret=new MEDFileFieldMultiTS(fileName,fieldName,loadAll); ret->contentNotNull();//to check that content type matches with \a this type. @@ -8650,7 +8650,7 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevel(TypeOfField type, i if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtLevel : mismatch of type of field expecting FLOAT64 !"); MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this,arrOut,*contentNotNullBase()); + MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNullBase()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -8682,7 +8682,7 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtTopLevel(TypeOfField type if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtTopLevel : mismatch of type of field !"); MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtTopLevel(type,0,renumPol,this,arrOut,*contentNotNullBase()); + MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNullBase()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -8758,7 +8758,7 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField t * This method is called 'old' because the user should give the mesh name he wants to use for it's field. * This method is useful for MED2 file format when field on different mesh was autorized. */ -MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol) const +MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevelOld(TypeOfField type, const std::string& mname, int iteration, int order, int meshDimRelToMax, int renumPol) const { const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=contentNotNullBase()->getTimeStepEntry(iteration,order); const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); @@ -8876,14 +8876,14 @@ MEDFileFieldMultiTS::MEDFileFieldMultiTS() _content=new MEDFileFieldMultiTSWithoutSDA; } -MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName, bool loadAll) +MEDFileFieldMultiTS::MEDFileFieldMultiTS(const std::string& fileName, bool loadAll) try:MEDFileAnyTypeFieldMultiTS(fileName,loadAll) { } catch(INTERP_KERNEL::Exception& e) { throw e; } -MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll) +MEDFileFieldMultiTS::MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll) try:MEDFileAnyTypeFieldMultiTS(fileName,fieldName,loadAll) { } @@ -8894,7 +8894,7 @@ MEDFileFieldMultiTS::MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& ot { } -std::vector< std::vector > MEDFileFieldMultiTS::getFieldSplitedByType2(int iteration, int order, const char *mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const +std::vector< std::vector > MEDFileFieldMultiTS::getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { return contentNotNull()->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs); } @@ -8958,7 +8958,7 @@ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New() * is to delete this field using decrRef() as it is no more needed. * \throw If reading the file fails. */ -MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const char *fileName, bool loadAll) +MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const std::string& fileName, bool loadAll) { MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntFieldMultiTS(fileName,loadAll); ret->contentNotNull();//to check that content type matches with \a this type. @@ -8975,7 +8975,7 @@ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const char *fileName, bool l * \throw If reading the file fails. * \throw If there is no field named \a fieldName in the file. */ -MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const char *fileName, const char *fieldName, bool loadAll) +MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll); ret->contentNotNull();//to check that content type matches with \a this type. @@ -9072,7 +9072,7 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevel(TypeOfField type if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldAtLevel : mismatch of type of field expecting INT32 !"); MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this,arr,*contentNotNullBase()); + MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arr,*contentNotNullBase()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -9105,7 +9105,7 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtTopLevel(TypeOfField t if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldAtTopLevel : mismatch of type of field ! INT32 expected !"); MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtTopLevel(type,0,renumPol,this,arr,*contentNotNullBase()); + MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNullBase()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -9183,7 +9183,7 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfFiel * This method is called 'old' because the user should give the mesh name he wants to use for it's field. * This method is useful for MED2 file format when field on different mesh was autorized. */ -MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const +MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const { const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=contentNotNullBase()->getTimeStepEntry(iteration,order); const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); @@ -9326,14 +9326,14 @@ MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWitho { } -MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const char *fileName, bool loadAll) +MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll) try:MEDFileAnyTypeFieldMultiTS(fileName,loadAll) { } catch(INTERP_KERNEL::Exception& e) { throw e; } -MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll) +MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll) try:MEDFileAnyTypeFieldMultiTS(fileName,fieldName,loadAll) { } @@ -9352,7 +9352,7 @@ MEDFileFields *MEDFileFields::New() return new MEDFileFields; } -MEDFileFields *MEDFileFields::New(const char *fileName, bool loadAll) +MEDFileFields *MEDFileFields::New(const std::string& fileName, bool loadAll) { return new MEDFileFields(fileName,loadAll); } @@ -9516,11 +9516,11 @@ MEDFileFields::MEDFileFields() { } -MEDFileFields::MEDFileFields(const char *fileName, bool loadAll) +MEDFileFields::MEDFileFields(const std::string& fileName, bool loadAll) try:MEDFileFieldGlobsReal(fileName) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); int nbFields=MEDnField(fid); _fields.resize(nbFields); med_field_type typcha; @@ -9571,10 +9571,10 @@ void MEDFileFields::writeLL(med_idt fid) const } } -void MEDFileFields::write(const char *fileName, int mode) const +void MEDFileFields::write(const std::string& fileName, int mode) const { med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod); + MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),medmod)); writeLL(fid); } @@ -9587,7 +9587,7 @@ void MEDFileFields::write(const char *fileName, int mode) const */ void MEDFileFields::loadArrays() { - MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY); for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_fields.begin();it!=_fields.end();it++) { MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); @@ -9605,7 +9605,7 @@ void MEDFileFields::loadArrays() */ void MEDFileFields::loadArraysIfNecessary() { - MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY); for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_fields.begin();it!=_fields.end();it++) { MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); @@ -9622,7 +9622,7 @@ void MEDFileFields::loadArraysIfNecessary() */ void MEDFileFields::unloadArrays() { - MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY); for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_fields.begin();it!=_fields.end();it++) { MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); @@ -9797,7 +9797,7 @@ bool MEDFileFields::changeMeshNames(const std::vector< std::pair& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N) +bool MEDFileFields::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N) { bool ret=false; for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_fields.begin();it!=_fields.end();it++) @@ -9861,7 +9861,7 @@ MEDFileFields *MEDFileFields::buildSubPart(const int *startIds, const int *endId return ret.retn(); } -MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldWithName(const char *fieldName) const +MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldWithName(const std::string& fieldName) const { return getFieldAtPos(getPosFromFieldName(fieldName)); } @@ -9875,7 +9875,7 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldWithName(const char *fieldNam * \param [in] meshName - the name of the mesh on w * \return a new object that the caller should deal with. */ -MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const char *meshName) const +MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const { MEDCouplingAutoRefCountObjectPtr ret=MEDFileFields::New(); for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) @@ -9946,7 +9946,7 @@ MEDFileFieldsIterator *MEDFileFields::iterator() return new MEDFileFieldsIterator(this); } -int MEDFileFields::getPosFromFieldName(const char *fieldName) const +int MEDFileFields::getPosFromFieldName(const std::string& fieldName) const { std::string tmp(fieldName); std::vector poss; diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index 3da4614aa..2d54b1a02 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -52,17 +52,17 @@ namespace ParaMEDMEM public: MEDLOADER_EXPORT void simpleRepr(std::ostream& oss) const; MEDLOADER_EXPORT std::string getName() const { return _name; } - MEDLOADER_EXPORT void setName(const char *name); - static MEDFileFieldLoc *New(med_idt fid, const char *locName); + MEDLOADER_EXPORT void setName(const std::string& name); + static MEDFileFieldLoc *New(med_idt fid, const std::string& locName); static MEDFileFieldLoc *New(med_idt fid, int id); - static MEDFileFieldLoc *New(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); + static MEDFileFieldLoc *New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildren() const; MEDFileFieldLoc *deepCpy() const; MEDLOADER_EXPORT int getNbOfGaussPtPerCell() const { return _nb_gauss_pt; } MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT std::string repr() const; - MEDLOADER_EXPORT bool isName(const char *name) const { return _name==name; } + MEDLOADER_EXPORT bool isName(const std::string& name) const { return _name==name; } MEDLOADER_EXPORT int getDimension() const { return _dim; } MEDLOADER_EXPORT int getNumberOfGaussPoints() const { return _nb_gauss_pt; } MEDLOADER_EXPORT int getNumberOfPointsInCells() const { return _nb_node_per_cell; } @@ -72,9 +72,9 @@ namespace ParaMEDMEM MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getGeoType() const { return _geo_type; } MEDLOADER_EXPORT bool isEqual(const MEDFileFieldLoc& other, double eps) const; private: - MEDFileFieldLoc(med_idt fid, const char *locName); + MEDFileFieldLoc(med_idt fid, const std::string& locName); MEDFileFieldLoc(med_idt fid, int id); - MEDFileFieldLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); + MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); private: int _dim; int _nb_gauss_pt; @@ -129,9 +129,9 @@ namespace ParaMEDMEM const DataArray *getOrCreateAndGetArray() const; const std::vector& getInfo() const; std::string getProfile() const; - void setProfile(const char *newPflName); + void setProfile(const std::string& newPflName); std::string getLocalization() const; - void setLocalization(const char *newLocName); + void setLocalization(const std::string& newLocName); int getLocId() const { return _loc_id; } void setLocId(int newId) const { _loc_id=newId; } void setFather(MEDFileFieldPerMeshPerType *newFather) { _father=newFather; } @@ -262,7 +262,7 @@ namespace ParaMEDMEM std::vector getPflsReallyUsedMulti() const; std::vector getLocsReallyUsedMulti() const; bool changeMeshNames(const std::vector< std::pair >& modifTab); - bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); + bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); void keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its); void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); @@ -304,7 +304,7 @@ namespace ParaMEDMEM class MEDFileFieldGlobs : public RefCountObject { public: - static MEDFileFieldGlobs *New(const char *fname); + static MEDFileFieldGlobs *New(const std::string& fname); static MEDFileFieldGlobs *New(); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildren() const; @@ -315,43 +315,43 @@ namespace ParaMEDMEM void appendGlobs(const MEDFileFieldGlobs& other, double eps); void checkGlobsPflsPartCoherency(const std::vector& pflsUsed) const; void checkGlobsLocsPartCoherency(const std::vector& locsUsed) const; - void loadProfileInFile(med_idt fid, int id, const char *pflName); + void loadProfileInFile(med_idt fid, int id, const std::string& pflName); void loadProfileInFile(med_idt fid, int id); void loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& real); void loadAllGlobals(med_idt fid); void writeGlobals(med_idt fid, const MEDFileWritable& opt) const; std::vector getPfls() const; std::vector getLocs() const; - bool existsPfl(const char *pflName) const; - bool existsLoc(const char *locName) const; + bool existsPfl(const std::string& pflName) const; + bool existsLoc(const std::string& locName) const; std::string createNewNameOfPfl() const; std::string createNewNameOfLoc() const; std::vector< std::vector > whichAreEqualProfiles() const; std::vector< std::vector > whichAreEqualLocs(double eps) const; - void setFileName(const char *fileName); + void setFileName(const std::string& fileName); void changePflsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif); void changeLocsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif); int getNbOfGaussPtPerCell(int locId) const; - int getLocalizationId(const char *loc) const; - const char *getFileName() const { return _file_name.c_str(); } + int getLocalizationId(const std::string& loc) const; + std::string getFileName() const { return _file_name; } std::string getFileName2() const { return _file_name; } const MEDFileFieldLoc& getLocalizationFromId(int locId) const; - const MEDFileFieldLoc& getLocalization(const char *locName) const; + const MEDFileFieldLoc& getLocalization(const std::string& locName) const; const DataArrayInt *getProfileFromId(int pflId) const; - const DataArrayInt *getProfile(const char *pflName) const; + const DataArrayInt *getProfile(const std::string& pflName) const; MEDFileFieldLoc& getLocalizationFromId(int locId); - MEDFileFieldLoc& getLocalization(const char *locName); - DataArrayInt *getProfile(const char *pflName); + MEDFileFieldLoc& getLocalization(const std::string& locName); + DataArrayInt *getProfile(const std::string& pflName); DataArrayInt *getProfileFromId(int pflId); void killProfileIds(const std::vector& pflIds); void killLocalizationIds(const std::vector& locIds); // void appendProfile(DataArrayInt *pfl); - void appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); + void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); // - static std::string CreateNewNameNotIn(const char *prefix, const std::vector& namesToAvoid); + static std::string CreateNewNameNotIn(const std::string& prefix, const std::vector& namesToAvoid); protected: - MEDFileFieldGlobs(const char *fname); + MEDFileFieldGlobs(const std::string& fname); MEDFileFieldGlobs(); ~MEDFileFieldGlobs(); protected: @@ -365,7 +365,7 @@ namespace ParaMEDMEM class MEDFileFieldGlobsReal { public: - MEDLOADER_EXPORT MEDFileFieldGlobsReal(const char *fname); + MEDLOADER_EXPORT MEDFileFieldGlobsReal(const std::string& fname); MEDLOADER_EXPORT MEDFileFieldGlobsReal(); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildren() const; @@ -387,45 +387,45 @@ namespace ParaMEDMEM MEDLOADER_EXPORT virtual void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) = 0; MEDLOADER_EXPORT virtual ~MEDFileFieldGlobsReal(); // - MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id, const char *pflName); + MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id, const std::string& pflName); MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id); MEDLOADER_EXPORT void loadGlobals(med_idt fid); MEDLOADER_EXPORT void loadAllGlobals(med_idt fid); MEDLOADER_EXPORT void writeGlobals(med_idt fid, const MEDFileWritable& opt) const; MEDLOADER_EXPORT std::vector getPfls() const; MEDLOADER_EXPORT std::vector getLocs() const; - MEDLOADER_EXPORT bool existsPfl(const char *pflName) const; - MEDLOADER_EXPORT bool existsLoc(const char *locName) const; + MEDLOADER_EXPORT bool existsPfl(const std::string& pflName) const; + MEDLOADER_EXPORT bool existsLoc(const std::string& locName) const; MEDLOADER_EXPORT std::string createNewNameOfPfl() const; MEDLOADER_EXPORT std::string createNewNameOfLoc() const; MEDLOADER_EXPORT std::vector< std::vector > whichAreEqualProfiles() const; MEDLOADER_EXPORT std::vector< std::vector > whichAreEqualLocs(double eps) const; - MEDLOADER_EXPORT void setFileName(const char *fileName); + MEDLOADER_EXPORT void setFileName(const std::string& fileName); MEDLOADER_EXPORT void changePflsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif); MEDLOADER_EXPORT void changeLocsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif); MEDLOADER_EXPORT void changePflsNames(const std::vector< std::pair, std::string > >& mapOfModif); MEDLOADER_EXPORT void changeLocsNames(const std::vector< std::pair, std::string > >& mapOfModif); - MEDLOADER_EXPORT void changePflName(const char *oldName, const char *newName); - MEDLOADER_EXPORT void changeLocName(const char *oldName, const char *newName); + MEDLOADER_EXPORT void changePflName(const std::string& oldName, const std::string& newName); + MEDLOADER_EXPORT void changeLocName(const std::string& oldName, const std::string& newName); MEDLOADER_EXPORT std::vector< std::pair, std::string > > zipPflsNames(); MEDLOADER_EXPORT std::vector< std::pair, std::string > > zipLocsNames(double eps); MEDLOADER_EXPORT int getNbOfGaussPtPerCell(int locId) const; - MEDLOADER_EXPORT int getLocalizationId(const char *loc) const; - MEDLOADER_EXPORT const char *getFileName() const; + MEDLOADER_EXPORT int getLocalizationId(const std::string& loc) const; + MEDLOADER_EXPORT std::string getFileName() const; MEDLOADER_EXPORT std::string getFileName2() const; MEDLOADER_EXPORT const MEDFileFieldLoc& getLocalizationFromId(int locId) const; - MEDLOADER_EXPORT const MEDFileFieldLoc& getLocalization(const char *locName) const; + MEDLOADER_EXPORT const MEDFileFieldLoc& getLocalization(const std::string& locName) const; MEDLOADER_EXPORT MEDFileFieldLoc& getLocalizationFromId(int locId); - MEDLOADER_EXPORT MEDFileFieldLoc& getLocalization(const char *locName); - MEDLOADER_EXPORT const DataArrayInt *getProfile(const char *pflName) const; + MEDLOADER_EXPORT MEDFileFieldLoc& getLocalization(const std::string& locName); + MEDLOADER_EXPORT const DataArrayInt *getProfile(const std::string& pflName) const; MEDLOADER_EXPORT const DataArrayInt *getProfileFromId(int pflId) const; - MEDLOADER_EXPORT DataArrayInt *getProfile(const char *pflName); + MEDLOADER_EXPORT DataArrayInt *getProfile(const std::string& pflName); MEDLOADER_EXPORT DataArrayInt *getProfileFromId(int pflId); MEDLOADER_EXPORT void killProfileIds(const std::vector& pflIds); MEDLOADER_EXPORT void killLocalizationIds(const std::vector& locIds); // MEDLOADER_EXPORT void appendProfile(DataArrayInt *pfl); - MEDLOADER_EXPORT void appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); + MEDLOADER_EXPORT void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); protected: MEDFileFieldGlobs *contentNotNull(); const MEDFileFieldGlobs *contentNotNull() const; @@ -437,11 +437,11 @@ namespace ParaMEDMEM { public: MEDLOADER_EXPORT MEDFileFieldNameScope(); - MEDLOADER_EXPORT MEDFileFieldNameScope(const char *fieldName); + MEDLOADER_EXPORT MEDFileFieldNameScope(const std::string& fieldName); MEDLOADER_EXPORT std::string getName() const; - MEDLOADER_EXPORT void setName(const char *fieldName); + MEDLOADER_EXPORT void setName(const std::string& fieldName); MEDLOADER_EXPORT std::string getDtUnit() const; - MEDLOADER_EXPORT void setDtUnit(const char *dtUnit); + MEDLOADER_EXPORT void setDtUnit(const std::string& dtUnit); MEDLOADER_EXPORT void copyNameScope(const MEDFileFieldNameScope& other); protected: std::string _name; @@ -455,14 +455,14 @@ namespace ParaMEDMEM { public: MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA(); - MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order); + MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order); MEDLOADER_EXPORT int getIteration() const { return _iteration; } MEDLOADER_EXPORT int getOrder() const { return _order; } MEDLOADER_EXPORT double getTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _dt; } MEDLOADER_EXPORT void setTime(int iteration, int order, double val) { _dt=val; _iteration=iteration; _order=order; } MEDLOADER_EXPORT int getDimension() const; MEDLOADER_EXPORT std::string getMeshName() const; - MEDLOADER_EXPORT void setMeshName(const char *newMeshName); + MEDLOADER_EXPORT void setMeshName(const std::string& newMeshName); MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair >& modifTab); MEDLOADER_EXPORT int getMeshIteration() const; MEDLOADER_EXPORT int getMeshOrder() const; @@ -479,11 +479,11 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void changePflsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif); MEDLOADER_EXPORT void changeLocsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif); // - MEDLOADER_EXPORT int getNonEmptyLevels(const char *mname, std::vector& levs) const; - MEDLOADER_EXPORT std::vector< std::vector > > getFieldSplitedByType(const char *mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; + MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector& levs) const; + MEDLOADER_EXPORT std::vector< std::vector > > getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; // - MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId); - MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const; + MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId); + MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const; MEDLOADER_EXPORT void deepCpyLeavesFrom(const MEDFileAnyTypeField1TSWithoutSDA& other); public: MEDLOADER_EXPORT int getNumberOfComponents() const; @@ -507,13 +507,13 @@ namespace ParaMEDMEM MEDLOADER_EXPORT virtual DataArray *getOrCreateAndGetArray() = 0; MEDLOADER_EXPORT virtual const DataArray *getOrCreateAndGetArray() const = 0; public: - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr &arrOut, const MEDFileFieldNameScope& nasc) const; + MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr &arrOut, const MEDFileFieldNameScope& nasc) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MEDCouplingAutoRefCountObjectPtr &arrOut, const MEDFileFieldNameScope& nasc) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr &arrOut, const MEDFileFieldNameScope& nasc) const; + MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr &arrOut, const MEDFileFieldNameScope& nasc) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MEDCouplingAutoRefCountObjectPtr &arrOut, const MEDFileFieldNameScope& nasc) const; DataArray *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const; public: - MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); + MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); MEDLOADER_EXPORT std::vector< MEDCouplingAutoRefCountObjectPtr > splitDiscretizations() const; MEDLOADER_EXPORT int keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair >& its); public: @@ -526,7 +526,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void unloadArrays(); MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& opts, const MEDFileFieldNameScope& nasc) const; protected: - int getMeshIdFromMeshName(const char *mName) const; + int getMeshIdFromMeshName(const std::string& mName) const; int addNewEntryIfNecessary(const MEDCouplingMesh *mesh); void updateData(int newLgth, const std::vector< std::pair >& oldStartStops); protected: @@ -557,13 +557,13 @@ namespace ParaMEDMEM MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayDouble() const; MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayDoubleExt(std::vector< std::pair,std::pair > >& entries) const; - MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(const char *mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; + MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT static void CheckMeshDimRel(int meshDimRelToMax); MEDLOADER_EXPORT static std::vector CheckSBTMesh(const MEDCouplingMesh *mesh); - MEDLOADER_EXPORT static MEDFileField1TSWithoutSDA *New(const char *fieldName, int csit, int iteration, int order, const std::vector& infos); + MEDLOADER_EXPORT static MEDFileField1TSWithoutSDA *New(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos); public: MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(); - MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order, const std::vector& infos); + MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos); MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *deepCpy() const; MEDLOADER_EXPORT void setArray(DataArray *arr); @@ -586,7 +586,7 @@ namespace ParaMEDMEM { public: MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA(); - MEDLOADER_EXPORT static MEDFileIntField1TSWithoutSDA *New(const char *fieldName, int csit, int iteration, int order, const std::vector& infos); + MEDLOADER_EXPORT static MEDFileIntField1TSWithoutSDA *New(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos); MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *deepCpy() const; MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT const char *getTypeStr() const; @@ -602,7 +602,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *convertToDouble() const; protected: - MEDFileIntField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order, const std::vector& infos); + MEDFileIntField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos); protected: MEDCouplingAutoRefCountObjectPtr< DataArrayInt > _arr; public: @@ -616,33 +616,33 @@ namespace ParaMEDMEM { protected: MEDLOADER_EXPORT MEDFileAnyTypeField1TS(); - MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const char *fileName, bool loadAll); - MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName, bool loadAll); - MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll); + MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const std::string& fileName, bool loadAll); + MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll); + MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll); MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const MEDFileAnyTypeField1TSWithoutSDA& other, bool shallowCopyOfContent); - MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, const char *fileName); - MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, bool loadAll); - MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, bool loadAll); - MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, int iteration, int order, bool loadAll); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, const std::string& fileName); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, bool loadAll); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, bool loadAll); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll); MEDLOADER_EXPORT void writeLL(med_idt fid) const; // direct forwarding to MEDFileAnyTypeField1TSWithoutSDA instance _content public: - MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const char *fileName, bool loadAll=true); - MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true); - MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true); MEDLOADER_EXPORT int getDimension() const; MEDLOADER_EXPORT int getIteration() const; MEDLOADER_EXPORT int getOrder() const; MEDLOADER_EXPORT double getTime(int& iteration, int& order) const; MEDLOADER_EXPORT void setTime(int iteration, int order, double val); MEDLOADER_EXPORT std::string getName() const; - MEDLOADER_EXPORT void setName(const char *name); + MEDLOADER_EXPORT void setName(const std::string& name); MEDLOADER_EXPORT std::string simpleRepr() const; MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const; MEDLOADER_EXPORT std::string getDtUnit() const; - MEDLOADER_EXPORT void setDtUnit(const char *dtUnit); + MEDLOADER_EXPORT void setDtUnit(const std::string& dtUnit); MEDLOADER_EXPORT std::string getMeshName() const; - MEDLOADER_EXPORT void setMeshName(const char *newMeshName); + MEDLOADER_EXPORT void setMeshName(const std::string& newMeshName); MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair >& modifTab); MEDLOADER_EXPORT int getMeshIteration() const; MEDLOADER_EXPORT int getMeshOrder() const; @@ -655,13 +655,13 @@ namespace ParaMEDMEM MEDLOADER_EXPORT const std::vector& getInfo() const; MEDLOADER_EXPORT std::vector& getInfo(); MEDLOADER_EXPORT std::vector getTypesOfFieldAvailable() const; - MEDLOADER_EXPORT std::vector< std::vector > > getFieldSplitedByType(const char *mname, std::vector& types, std::vector< std::vector >& typesF, + MEDLOADER_EXPORT std::vector< std::vector > > getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const throw(INTERP_KERNEL::Exception); - MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId); - MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const; - MEDLOADER_EXPORT int getNonEmptyLevels(const char *mname, std::vector& levs) const; + MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId); + MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const; + MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector& levs) const; public: - MEDLOADER_EXPORT void write(const char *fileName, int mode) const; + MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void loadArrays(); MEDLOADER_EXPORT void loadArraysIfNecessary(); MEDLOADER_EXPORT void unloadArrays(); @@ -672,9 +672,9 @@ namespace ParaMEDMEM MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *shallowCpy() const = 0; public: //! underground method see MEDFileField1TSWithoutSDA::setProfileNameOnLeaf - MEDLOADER_EXPORT void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false); + MEDLOADER_EXPORT void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false); //! underground method see MEDFileField1TSWithoutSDA::setLocNameOnLeaf - MEDLOADER_EXPORT void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false); + MEDLOADER_EXPORT void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildren() const; MEDLOADER_EXPORT std::vector getPflsReallyUsed() const; @@ -684,8 +684,8 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); public: - MEDLOADER_EXPORT static int LocateField2(med_idt fid, const char *fileName, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector& infos, std::string& dtunitOut); - MEDLOADER_EXPORT static int LocateField(med_idt fid, const char *fileName, const char *fieldName, int& posCFormat, med_field_type& typcha, std::vector& infos, std::string& dtunitOut); + MEDLOADER_EXPORT static int LocateField2(med_idt fid, const std::string& fileName, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector& infos, std::string& dtunitOut); + MEDLOADER_EXPORT static int LocateField(med_idt fid, const std::string& fileName, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector& infos, std::string& dtunitOut); public: MEDLOADER_EXPORT virtual med_field_type getMEDFileFieldType() const = 0; MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *contentNotNullBase(); @@ -702,9 +702,9 @@ namespace ParaMEDMEM class MEDFileField1TS : public MEDFileAnyTypeField1TS { public: - MEDLOADER_EXPORT static MEDFileField1TS *New(const char *fileName, bool loadAll=true); - MEDLOADER_EXPORT static MEDFileField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true); - MEDLOADER_EXPORT static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true); MEDLOADER_EXPORT static MEDFileField1TS *New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent); MEDLOADER_EXPORT static MEDFileField1TS *New(); MEDLOADER_EXPORT MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const; @@ -713,7 +713,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; MEDLOADER_EXPORT DataArrayDouble *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const; // MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field); @@ -724,7 +724,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArray() const; MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; - MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(const char *mname, std::vector& types, std::vector< std::vector >& typesF, + MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const throw(INTERP_KERNEL::Exception); public: MEDLOADER_EXPORT static void SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MEDCouplingAutoRefCountObjectPtr& arr); @@ -734,9 +734,9 @@ namespace ParaMEDMEM const MEDFileField1TSWithoutSDA *contentNotNull() const; MEDFileField1TSWithoutSDA *contentNotNull(); private: - MEDFileField1TS(const char *fileName, bool loadAll); - MEDFileField1TS(const char *fileName, const char *fieldName, bool loadAll); - MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll); + MEDFileField1TS(const std::string& fileName, bool loadAll); + MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll); + MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll); MEDFileField1TS(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent); MEDFileField1TS(); }; @@ -745,9 +745,9 @@ namespace ParaMEDMEM { public: MEDLOADER_EXPORT static MEDFileIntField1TS *New(); - MEDLOADER_EXPORT static MEDFileIntField1TS *New(const char *fileName, bool loadAll=true); - MEDLOADER_EXPORT static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true); - MEDLOADER_EXPORT static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true); MEDLOADER_EXPORT static MEDFileIntField1TS *New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent); MEDLOADER_EXPORT MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const; MEDLOADER_EXPORT MEDFileAnyTypeField1TS *shallowCpy() const; @@ -756,7 +756,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, DataArrayInt* &arrOut, int renumPol=0) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const; MEDLOADER_EXPORT DataArrayInt *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const; // MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals); @@ -770,9 +770,9 @@ namespace ParaMEDMEM MEDFileIntField1TSWithoutSDA *contentNotNull(); private: MEDFileIntField1TS(); - MEDFileIntField1TS(const char *fileName, bool loadAll); - MEDFileIntField1TS(const char *fileName, const char *fieldName, bool loadAll); - MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll); + MEDFileIntField1TS(const std::string& fileName, bool loadAll); + MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll); + MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll); MEDFileIntField1TS(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent); }; @@ -780,9 +780,9 @@ namespace ParaMEDMEM { protected: MEDFileAnyTypeFieldMultiTSWithoutSDA(); - MEDFileAnyTypeFieldMultiTSWithoutSDA(const char *fieldName); + MEDFileAnyTypeFieldMultiTSWithoutSDA(const std::string& fieldName); MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll); - MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll); + MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll); public: MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildren() const; @@ -800,7 +800,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT const MEDFileAnyTypeField1TSWithoutSDA& getTimeStepEntry(int iteration, int order) const; MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA& getTimeStepEntry(int iteration, int order); MEDLOADER_EXPORT std::string getMeshName() const; - MEDLOADER_EXPORT void setMeshName(const char *newMeshName); + MEDLOADER_EXPORT void setMeshName(const std::string& newMeshName); MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair >& modifTab); MEDLOADER_EXPORT int getNumberOfTS() const; MEDLOADER_EXPORT void eraseEmptyTS(); @@ -817,14 +817,14 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void pushBackTimeStep(MEDCouplingAutoRefCountObjectPtr& tse); MEDLOADER_EXPORT void synchronizeNameScope(); MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const; - MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const char *mname, std::vector& levs) const; + MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector& levs) const; MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob); MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob); - MEDLOADER_EXPORT std::vector< std::vector< std::pair > > getFieldSplitedByType(int iteration, int order, const char *mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; + MEDLOADER_EXPORT std::vector< std::vector< std::pair > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT std::vector< std::vector > getTypesOfFieldAvailable() const; MEDLOADER_EXPORT DataArray *getUndergroundDataArray(int iteration, int order) const; MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const; - MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); + MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); MEDLOADER_EXPORT void loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll); MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& opts) const; MEDLOADER_EXPORT void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc); @@ -856,16 +856,16 @@ namespace ParaMEDMEM class MEDFileFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA { public: - MEDLOADER_EXPORT static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll); + MEDLOADER_EXPORT static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll); MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll); MEDLOADER_EXPORT const char *getTypeStr() const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const; - MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(int iteration, int order, const char *mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; + MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA *convertToInt() const; protected: - MEDFileFieldMultiTSWithoutSDA(const char *fieldName); - MEDFileFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll); + MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName); + MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll); med_field_type getMEDFileFieldType() const { return MED_FLOAT64; } MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const; void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const; @@ -876,15 +876,15 @@ namespace ParaMEDMEM class MEDFileIntFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA { public: - MEDLOADER_EXPORT static MEDFileIntFieldMultiTSWithoutSDA *New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll); + MEDLOADER_EXPORT static MEDFileIntFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll); MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll); MEDLOADER_EXPORT const char *getTypeStr() const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const; MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA *convertToDouble() const; protected: - MEDFileIntFieldMultiTSWithoutSDA(const char *fieldName); - MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll); + MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName); + MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll); med_field_type getMEDFileFieldType() const { return MED_INT32; } MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const; void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const; @@ -901,19 +901,19 @@ namespace ParaMEDMEM { protected: MEDFileAnyTypeFieldMultiTS(); - MEDFileAnyTypeFieldMultiTS(const char *fileName, bool loadAll); - MEDFileAnyTypeFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll); + MEDFileAnyTypeFieldMultiTS(const std::string& fileName, bool loadAll); + MEDFileAnyTypeFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll); MEDFileAnyTypeFieldMultiTS(const MEDFileAnyTypeFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); - static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, const char *fileName); - static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, bool loadAll); - static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, bool loadAll); + static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, const std::string& fileName); + static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, bool loadAll); + static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, bool loadAll); public: - MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, bool loadAll=true); - MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); MEDLOADER_EXPORT void loadArrays(); MEDLOADER_EXPORT void loadArraysIfNecessary(); MEDLOADER_EXPORT void unloadArrays(); - MEDLOADER_EXPORT void write(const char *fileName, int mode) const; + MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildren() const; @@ -931,11 +931,11 @@ namespace ParaMEDMEM MEDLOADER_EXPORT static int CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiTS *f0, MEDFileAnyTypeFieldMultiTS *f1, const MEDFileMesh *mesh, TypeOfField& tof0, TypeOfField& tof1); public:// direct forwarding to MEDFileField1TSWithoutSDA instance _content MEDLOADER_EXPORT std::string getName() const; - MEDLOADER_EXPORT void setName(const char *name); + MEDLOADER_EXPORT void setName(const std::string& name); MEDLOADER_EXPORT std::string getDtUnit() const; - MEDLOADER_EXPORT void setDtUnit(const char *dtUnit); + MEDLOADER_EXPORT void setDtUnit(const std::string& dtUnit); MEDLOADER_EXPORT std::string getMeshName() const; - MEDLOADER_EXPORT void setMeshName(const char *newMeshName); + MEDLOADER_EXPORT void setMeshName(const std::string& newMeshName); MEDLOADER_EXPORT std::string simpleRepr() const; MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const; MEDLOADER_EXPORT int getNumberOfTS() const; @@ -956,9 +956,9 @@ namespace ParaMEDMEM MEDLOADER_EXPORT const std::vector& getInfo() const; MEDLOADER_EXPORT void setInfo(const std::vector& info); MEDLOADER_EXPORT int getNumberOfComponents() const; - MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const char *mname, std::vector& levs) const; + MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector& levs) const; MEDLOADER_EXPORT std::vector< std::vector > getTypesOfFieldAvailable() const; - MEDLOADER_EXPORT std::vector< std::vector< std::pair > > getFieldSplitedByType(int iteration, int order, const char *mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; + MEDLOADER_EXPORT std::vector< std::vector< std::pair > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT MEDCouplingAutoRefCountObjectPtr getContent(); public: MEDLOADER_EXPORT std::vector getPflsReallyUsed() const; @@ -985,8 +985,8 @@ namespace ParaMEDMEM { public: MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(); - MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const char *fileName, bool loadAll=true); - MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const; MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const; @@ -1000,12 +1000,12 @@ namespace ParaMEDMEM MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const; MEDLOADER_EXPORT DataArrayDouble *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const; // MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field); MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); - MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(int iteration, int order, const char *mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; + MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArray(int iteration, int order) const; MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const; private: @@ -1014,8 +1014,8 @@ namespace ParaMEDMEM private: MEDFileFieldMultiTS(); MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); - MEDFileFieldMultiTS(const char *fileName, bool loadAll); - MEDFileFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll); + MEDFileFieldMultiTS(const std::string& fileName, bool loadAll); + MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll); }; /*! @@ -1025,8 +1025,8 @@ namespace ParaMEDMEM { public: MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(); - MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const char *fileName, bool loadAll=true); - MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const; MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const; @@ -1037,7 +1037,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, DataArrayInt* &arrOut, int renumPol=0) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const; MEDLOADER_EXPORT DataArrayInt *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const; // MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals); @@ -1050,8 +1050,8 @@ namespace ParaMEDMEM private: MEDFileIntFieldMultiTS(); MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); - MEDFileIntFieldMultiTS(const char *fileName, bool loadAll); - MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll); + MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll); + MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll); }; class MEDFileAnyTypeFieldMultiTSIterator @@ -1075,12 +1075,12 @@ namespace ParaMEDMEM { public: MEDLOADER_EXPORT static MEDFileFields *New(); - MEDLOADER_EXPORT static MEDFileFields *New(const char *fileName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileFields *New(const std::string& fileName, bool loadAll=true); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildren() const; MEDLOADER_EXPORT MEDFileFields *deepCpy() const; MEDLOADER_EXPORT MEDFileFields *shallowCpy() const; - MEDLOADER_EXPORT void write(const char *fileName, int mode) const; + MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT void loadArrays(); MEDLOADER_EXPORT void loadArraysIfNecessary(); @@ -1096,11 +1096,11 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void pushField(MEDFileAnyTypeFieldMultiTS *field); MEDLOADER_EXPORT void pushFields(const std::vector& fields); MEDLOADER_EXPORT void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field); - MEDLOADER_EXPORT int getPosFromFieldName(const char *fieldName) const; + MEDLOADER_EXPORT int getPosFromFieldName(const std::string& fieldName) const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const; - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const; + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const; MEDLOADER_EXPORT MEDFileFields *buildSubPart(const int *startIds, const int *endIds) const; - MEDLOADER_EXPORT MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const; + MEDLOADER_EXPORT MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const; MEDLOADER_EXPORT MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const; MEDLOADER_EXPORT MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const; MEDLOADER_EXPORT MEDFileFieldsIterator *iterator(); @@ -1108,7 +1108,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void destroyFieldsAtPos(const int *startIds, const int *endIds); MEDLOADER_EXPORT void destroyFieldsAtPos2(int bg, int end, int step); MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair >& modifTab); - MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N); + MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N); public: MEDLOADER_EXPORT std::vector getPflsReallyUsed() const; MEDLOADER_EXPORT std::vector getLocsReallyUsed() const; @@ -1118,7 +1118,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); private: MEDFileFields(); - MEDFileFields(const char *fileName, bool loadAll); + MEDFileFields(const std::string& fileName, bool loadAll); private: std::vector< MEDCouplingAutoRefCountObjectPtr > _fields; }; diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index 2a6f8fcee..3b89bbac3 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -1486,7 +1486,7 @@ void MEDFileField1TSStructItem2::checkInRange(int nbOfEntity, int nip, const MED } } -bool MEDFileField1TSStructItem2::isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const char *pflName) const +bool MEDFileField1TSStructItem2::isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const { if(startExp!=_start_end.first) return false; @@ -1828,7 +1828,7 @@ MEDFileField1TSStructItem MEDFileField1TSStructItem::BuildItemFrom(const MEDFile std::vector< std::vector > pfls,locs; std::vector< std::vector > typesF; std::vector geoTypes; - std::vector< std::vector > > strtEnds=ref->getFieldSplitedByType(0,geoTypes,typesF,pfls,locs); + std::vector< std::vector > > strtEnds=ref->getFieldSplitedByType(std::string(),geoTypes,typesF,pfls,locs); std::size_t nbOfGeoTypes(geoTypes.size()); if(nbOfGeoTypes==0) throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : not null by empty ref !"); diff --git a/src/MEDLoader/MEDFileFieldOverView.hxx b/src/MEDLoader/MEDFileFieldOverView.hxx index 6e5014ebf..d1c6b1cc6 100644 --- a/src/MEDLoader/MEDFileFieldOverView.hxx +++ b/src/MEDLoader/MEDFileFieldOverView.hxx @@ -208,7 +208,7 @@ namespace ParaMEDMEM int getNbOfIntegrationPts(const MEDFileFieldGlobsReal *globs) const; //! warning this method also set _nb_of_entity attribute ! void checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs); - bool isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const char *pflName) const; + bool isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const; bool operator==(const MEDFileField1TSStructItem2& other) const throw(INTERP_KERNEL::Exception); bool isCellSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const; bool isNodeSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const; diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 165d0a991..db630e845 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -69,7 +69,7 @@ std::vector MEDFileMesh::getDirectChildren() const * \throw If there is no meshes in the file. * \throw If the mesh in the file is of a not supported type. */ -MEDFileMesh *MEDFileMesh::New(const char *fileName, MEDFileMeshReadSelector *mrs) +MEDFileMesh *MEDFileMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs) { std::vector ms=MEDLoader::GetMeshNames(fileName); if(ms.empty()) @@ -79,28 +79,28 @@ MEDFileMesh *MEDFileMesh::New(const char *fileName, MEDFileMeshReadSelector *mrs } MEDFileUtilities::CheckFileForRead(fileName); ParaMEDMEM::MEDCouplingMeshType meshType; - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); int dt,it; std::string dummy2; - MEDFileMeshL2::GetMeshIdFromName(fid,ms.front().c_str(),meshType,dt,it,dummy2); + MEDFileMeshL2::GetMeshIdFromName(fid,ms.front(),meshType,dt,it,dummy2); switch(meshType) { case UNSTRUCTURED: { MEDCouplingAutoRefCountObjectPtr ret=MEDFileUMesh::New(); - ret->loadUMeshFromFile(fid,ms.front().c_str(),dt,it,mrs); + ret->loadUMeshFromFile(fid,ms.front(),dt,it,mrs); return (MEDFileUMesh *)ret.retn(); } case CARTESIAN: { MEDCouplingAutoRefCountObjectPtr ret=MEDFileCMesh::New(); - ret->loadCMeshFromFile(fid,ms.front().c_str(),dt,it,mrs); + ret->loadCMeshFromFile(fid,ms.front(),dt,it,mrs); return (MEDFileCMesh *)ret.retn(); } case CURVE_LINEAR: { MEDCouplingAutoRefCountObjectPtr ret=MEDFileCurveLinearMesh::New(); - ret->loadCLMeshFromFile(fid,ms.front().c_str(),dt,it,mrs); + ret->loadCLMeshFromFile(fid,ms.front(),dt,it,mrs); return (MEDFileCurveLinearMesh *)ret.retn(); } default: @@ -125,11 +125,11 @@ MEDFileMesh *MEDFileMesh::New(const char *fileName, MEDFileMeshReadSelector *mrs * \throw If there is no mesh with given attributes in the file. * \throw If the mesh in the file is of a not supported type. */ -MEDFileMesh *MEDFileMesh::New(const char *fileName, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +MEDFileMesh *MEDFileMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { MEDFileUtilities::CheckFileForRead(fileName); ParaMEDMEM::MEDCouplingMeshType meshType; - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); int dummy0,dummy1; std::string dummy2; MEDFileMeshL2::GetMeshIdFromName(fid,mName,meshType,dummy0,dummy1,dummy2); @@ -187,12 +187,12 @@ void MEDFileMesh::write(med_idt fid) const * \throw If the mesh name is not set. * \throw If \a mode == 1 and the same data is present in an existing file. */ -void MEDFileMesh::write(const char *fileName, int mode) const +void MEDFileMesh::write(const std::string& fileName, int mode) const { med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); std::ostringstream oss; oss << "MEDFileMesh : error on attempt to write in file : \"" << fileName << "\""; - MEDFileUtilities::CheckMEDCode(fid,fid,oss.str().c_str()); + MEDFileUtilities::CheckMEDCode(fid,fid,oss.str()); write(fid); } @@ -319,7 +319,7 @@ void MEDFileMesh::clearFamGrpMaps() * \return std::vector - a sequence of names of the families. * \throw If the name of a nonexistent group is specified. */ -std::vector MEDFileMesh::getFamiliesOnGroup(const char *name) const +std::vector MEDFileMesh::getFamiliesOnGroup(const std::string& name) const { std::string oname(name); std::map >::const_iterator it=_groups.find(oname); @@ -364,7 +364,7 @@ std::vector MEDFileMesh::getFamiliesOnGroups(const std::vector - sequence of ids of the families. * \throw If the name of a nonexistent group is specified. */ -std::vector MEDFileMesh::getFamiliesIdsOnGroup(const char *name) const +std::vector MEDFileMesh::getFamiliesIdsOnGroup(const std::string& name) const { std::string oname(name); std::map >::const_iterator it=_groups.find(oname); @@ -385,7 +385,7 @@ std::vector MEDFileMesh::getFamiliesIdsOnGroup(const char *name) const * \param [in] name - the name of the group of interest. * \param [in] fams - a sequence of names of families constituting the group. */ -void MEDFileMesh::setFamiliesOnGroup(const char *name, const std::vector& fams) +void MEDFileMesh::setFamiliesOnGroup(const std::string& name, const std::vector& fams) { std::string oname(name); _groups[oname]=fams; @@ -405,7 +405,7 @@ void MEDFileMesh::setFamiliesOnGroup(const char *name, const std::vector& famIds) +void MEDFileMesh::setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds) { std::string oname(name); std::vector fams(famIds.size()); @@ -423,7 +423,7 @@ void MEDFileMesh::setFamiliesIdsOnGroup(const char *name, const std::vector * \param [in] name - the name of the family of interest. * \return std::vector - a sequence of names of groups including the family. */ -std::vector MEDFileMesh::getGroupsOnFamily(const char *name) const +std::vector MEDFileMesh::getGroupsOnFamily(const std::string& name) const { std::vector ret; for(std::map >::const_iterator it1=_groups.begin();it1!=_groups.end();it1++) @@ -444,7 +444,7 @@ std::vector MEDFileMesh::getGroupsOnFamily(const char *name) const * \param [in] grps - a sequence of group names to add the family in. * \throw If a family named \a famName not yet exists. */ -void MEDFileMesh::setGroupsOnFamily(const char *famName, const std::vector& grps) +void MEDFileMesh::setGroupsOnFamily(const std::string& famName, const std::vector& grps) { std::string fName(famName); const std::map::const_iterator it=_families.find(fName); @@ -504,7 +504,7 @@ void MEDFileMesh::assignFamilyNameWithGroupName() std::map newFams; for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { - std::vector grps=getGroupsOnFamily((*it).first.c_str()); + std::vector grps=getGroupsOnFamily((*it).first); if(grps.size()==1 && groups[grps[0]].size()==1) { if(newFams.find(grps[0])!=newFams.end()) @@ -557,7 +557,7 @@ std::vector MEDFileMesh::removeEmptyGroups() * \param [in] name - the name of the group to remove. * \throw If no group with such a \a name exists. */ -void MEDFileMesh::removeGroup(const char *name) +void MEDFileMesh::removeGroup(const std::string& name) { std::string oname(name); std::map >::iterator it=_groups.find(oname); @@ -576,7 +576,7 @@ void MEDFileMesh::removeGroup(const char *name) * \param [in] name - the name of the family to remove. * \throw If no family with such a \a name exists. */ -void MEDFileMesh::removeFamily(const char *name) +void MEDFileMesh::removeFamily(const std::string& name) { std::string oname(name); std::map::iterator it=_families.find(oname); @@ -638,7 +638,7 @@ std::vector MEDFileMesh::removeOrphanFamilies() else { ret.push_back((*it).first); - std::vector grpsOnEraseFam=getGroupsOnFamily((*it).first.c_str()); + std::vector grpsOnEraseFam=getGroupsOnFamily((*it).first); for(std::vector::const_iterator it2=grpsOnEraseFam.begin();it2!=grpsOnEraseFam.end();it2++) { std::map >::iterator it3=grps.find(*it2);//it3!=grps.empty() thanks to copy @@ -660,7 +660,7 @@ std::vector MEDFileMesh::removeOrphanFamilies() * \throw If no group named \a oldName exists in \a this mesh. * \throw If a group named \a newName already exists. */ -void MEDFileMesh::changeGroupName(const char *oldName, const char *newName) +void MEDFileMesh::changeGroupName(const std::string& oldName, const std::string& newName) { std::string oname(oldName); std::map >::iterator it=_groups.find(oname); @@ -710,7 +710,7 @@ void MEDFileMesh::changeFamilyId(int oldId, int newId) * \throw If no family named \a oldName exists in \a this mesh. * \throw If a family named \a newName already exists. */ -void MEDFileMesh::changeFamilyName(const char *oldName, const char *newName) +void MEDFileMesh::changeFamilyName(const std::string& oldName, const std::string& newName) { std::string oname(oldName); std::map::iterator it=_families.find(oname); @@ -827,7 +827,7 @@ bool MEDFileMesh::areGrpsEqual(const MEDFileMesh *other, std::string& what) cons * \param [in] groupName - the group name. * \return bool - \c true the group \a groupName exists in \a this mesh. */ -bool MEDFileMesh::existsGroup(const char *groupName) const +bool MEDFileMesh::existsGroup(const std::string& groupName) const { std::string grpName(groupName); return _groups.find(grpName)!=_groups.end(); @@ -851,7 +851,7 @@ bool MEDFileMesh::existsFamily(int famId) const * \param [in] familyName - the family name. * \return bool - \c true the family \a familyName exists in \a this mesh. */ -bool MEDFileMesh::existsFamily(const char *familyName) const +bool MEDFileMesh::existsFamily(const std::string& familyName) const { std::string fname(familyName); return _families.find(fname)!=_families.end(); @@ -862,13 +862,13 @@ bool MEDFileMesh::existsFamily(const char *familyName) const * \param [in] familyName - the family name. * \param [in] id - a new id of the family. */ -void MEDFileMesh::setFamilyId(const char *familyName, int id) +void MEDFileMesh::setFamilyId(const std::string& familyName, int id) { std::string fname(familyName); _families[fname]=id; } -void MEDFileMesh::setFamilyIdUnique(const char *familyName, int id) +void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, int id) { std::string fname(familyName); for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) @@ -889,7 +889,7 @@ void MEDFileMesh::setFamilyIdUnique(const char *familyName, int id) * \param [in] famId - an id of the family. * \throw If a family with the same name or id already exists in \a this mesh. */ -void MEDFileMesh::addFamily(const char *familyName, int famId) +void MEDFileMesh::addFamily(const std::string& familyName, int famId) { std::string fname(familyName); std::map::const_iterator it=_families.find(fname); @@ -928,7 +928,7 @@ void MEDFileMesh::addFamily(const char *familyName, int famId) * \throw If no mesh entities of dimension \a meshDimRelToMaxExt exist in \a this mesh. * \throw If no family field of dimension \a meshDimRelToMaxExt is present in \a this mesh. */ -void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) +void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName) { std::string grpName(groupName); std::vector levs=getNonEmptyLevelsExt(); @@ -996,7 +996,7 @@ bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector& famIds, const std std::string famName=getFamilyNameGivenId(*it2); std::ostringstream oss; oss << "Family_" << maxFamId; std::string zeName=CreateNameNotIn(oss.str(),allFams); - addFamilyOnAllGroupsHaving(famName.c_str(),zeName.c_str()); + addFamilyOnAllGroupsHaving(famName,zeName); _families[zeName]=maxFamId; (const_cast(fieldFamIds))->changeValue(*it2,maxFamId); maxFamId++; @@ -1014,7 +1014,7 @@ bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector& famIds, const std * \throw If \a grpName or \a famName is an empty string. * \throw If no family named \a famName is present in \a this mesh. */ -void MEDFileMesh::addFamilyOnGrp(const char *grpName, const char *famName) +void MEDFileMesh::addFamilyOnGrp(const std::string& grpName, const std::string& famName) { std::string grpn(grpName); std::string famn(famName); @@ -1046,7 +1046,7 @@ void MEDFileMesh::addFamilyOnGrp(const char *grpName, const char *famName) * This method is quite underground because it can lead to unconsistency because family 'otherFamName' is \b not added into _families. * This method is used by MEDFileMesh::keepFamIdsOnlyOnLevs method. */ -void MEDFileMesh::addFamilyOnAllGroupsHaving(const char *famName, const char *otherFamName) +void MEDFileMesh::addFamilyOnAllGroupsHaving(const std::string& famName, const std::string& otherFamName) { std::string famNameCpp(famName); std::string otherCpp(otherFamName); @@ -1060,12 +1060,12 @@ void MEDFileMesh::addFamilyOnAllGroupsHaving(const char *famName, const char *ot } } -void MEDFileMesh::changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector& newFamiliesNames) +void MEDFileMesh::changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector& newFamiliesNames) { ChangeAllGroupsContainingFamily(_groups,familyNameToChange,newFamiliesNames); } -void MEDFileMesh::ChangeAllGroupsContainingFamily(std::map >& groups, const char *familyNameToChange, const std::vector& newFamiliesNames) +void MEDFileMesh::ChangeAllGroupsContainingFamily(std::map >& groups, const std::string& familyNameToChange, const std::vector& newFamiliesNames) { std::string fam(familyNameToChange); for(std::map >::iterator it=groups.begin();it!=groups.end();it++) @@ -1149,7 +1149,7 @@ void MEDFileMesh::setGroupInfo(const std::map::const_iterator it=_families.find(oname); @@ -1355,12 +1355,12 @@ bool MEDFileMesh::ensureDifferentFamIdsPerLevel() if(allIds->presenceOfValue(*it3)) { std::string famName=getFamilyNameGivenId(*it3); - std::vector grps=getGroupsOnFamily(famName.c_str()); + std::vector grps=getGroupsOnFamily(famName); ren[*it3]=maxId; bool dummy; std::string newFam=findOrCreateAndGiveFamilyWithId(maxId,dummy); for(std::vector::const_iterator it4=grps.begin();it4!=grps.end();it4++) - addFamilyOnGrp((*it4).c_str(),newFam.c_str()); + addFamilyOnGrp((*it4),newFam); } } MEDCouplingAutoRefCountObjectPtr ids=fam->getIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size()); @@ -1581,7 +1581,7 @@ std::string MEDFileMesh::simpleRepr() const * \throw If the name of a nonexistent group is specified. * \throw If the family field is missing for \a meshDimRelToMaxExt. */ -DataArrayInt *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum) const +DataArrayInt *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum) const { std::vector tmp(1); tmp[0]=grp; @@ -1621,7 +1621,7 @@ DataArrayInt *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vecto * is to delete this array using decrRef() as it is no more needed. * \throw If the family field is missing for \a meshDimRelToMaxExt. */ -DataArrayInt *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum) const +DataArrayInt *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum) const { std::vector tmp(1); tmp[0]=fam; @@ -1641,7 +1641,7 @@ DataArrayInt *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const char *fam, * \throw If the name of a nonexistent group is specified. * \throw If the family field is missing for nodes. */ -DataArrayInt *MEDFileMesh::getNodeGroupArr(const char *grp, bool renum) const +DataArrayInt *MEDFileMesh::getNodeGroupArr(const std::string& grp, bool renum) const { std::vector tmp(1); tmp[0]=grp; @@ -1677,7 +1677,7 @@ DataArrayInt *MEDFileMesh::getNodeGroupsArr(const std::vector& grps * \throw If the name of a nonexistent group is specified. * \throw If the family field is missing for nodes. */ -DataArrayInt *MEDFileMesh::getNodeFamilyArr(const char *fam, bool renum) const +DataArrayInt *MEDFileMesh::getNodeFamilyArr(const std::string& fam, bool renum) const { std::vector tmp(1); tmp[0]=fam; @@ -1743,7 +1743,7 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vectorsetName(grps[ii]->getName().c_str()); + grps2[ii]->setName(grps[ii]->getName()); } std::vector grps3(grps2.begin(),grps2.end()); fam=DataArrayInt::MakePartition(grps3,sz,fidsOfGroups); @@ -1900,7 +1900,7 @@ void MEDFileMesh::getFamilyRepr(std::ostream& oss) const { oss << "- Family with name \"" << (*it).first << "\" with number " << (*it).second << std::endl; oss << " - Groups lying on this family : "; - std::vector grps=getGroupsOnFamily((*it).first.c_str()); + std::vector grps=getGroupsOnFamily((*it).first); std::copy(grps.begin(),grps.end(),std::ostream_iterator(oss," ")); oss << std::endl << std::endl; } @@ -1920,10 +1920,10 @@ void MEDFileMesh::getFamilyRepr(std::ostream& oss) const * \throw If there is no mesh with given attributes in the file. * \throw If the mesh in the file is not an unstructured one. */ -MEDFileUMesh *MEDFileUMesh::New(const char *fileName, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +MEDFileUMesh *MEDFileUMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); return new MEDFileUMesh(fid,mName,dt,it,mrs); } @@ -1937,7 +1937,7 @@ MEDFileUMesh *MEDFileUMesh::New(const char *fileName, const char *mName, int dt, * \throw If there is no meshes in the file. * \throw If the mesh in the file is not an unstructured one. */ -MEDFileUMesh *MEDFileUMesh::New(const char *fileName, MEDFileMeshReadSelector *mrs) +MEDFileUMesh *MEDFileUMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs) { std::vector ms=MEDLoader::GetMeshNames(fileName); if(ms.empty()) @@ -1946,12 +1946,12 @@ MEDFileUMesh *MEDFileUMesh::New(const char *fileName, MEDFileMeshReadSelector *m throw INTERP_KERNEL::Exception(oss.str().c_str()); } MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); int dt,it; ParaMEDMEM::MEDCouplingMeshType meshType; std::string dummy2; - MEDFileMeshL2::GetMeshIdFromName(fid,ms.front().c_str(),meshType,dt,it,dummy2); - return new MEDFileUMesh(fid,ms.front().c_str(),dt,it,mrs); + MEDFileMeshL2::GetMeshIdFromName(fid,ms.front(),meshType,dt,it,dummy2); + return new MEDFileUMesh(fid,ms.front(),dt,it,mrs); } /*! @@ -2161,7 +2161,7 @@ MEDFileUMesh::MEDFileUMesh() { } -MEDFileUMesh::MEDFileUMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +MEDFileUMesh::MEDFileUMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) try { loadUMeshFromFile(fid,mName,dt,it,mrs); @@ -2171,7 +2171,7 @@ catch(INTERP_KERNEL::Exception& e) throw e; } -void MEDFileUMesh::loadUMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +void MEDFileUMesh::loadUMeshFromFile(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { MEDFileUMeshL2 loaderl2; ParaMEDMEM::MEDCouplingMeshType meshType; @@ -2237,11 +2237,12 @@ void MEDFileUMesh::writeLL(med_idt fid) const } MEDmeshCr(fid,maa,spaceDim,mdim,MED_UNSTRUCTURED_MESH,desc,"",MED_SORT_DTIT,MED_CARTESIAN,comp,unit); MEDmeshUniversalNameWr(fid,maa); - MEDFileUMeshL2::WriteCoords(fid,maa,_iteration,_order,_time,_coords,_fam_coords,_num_coords,_name_coords); + std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE)); + MEDFileUMeshL2::WriteCoords(fid,meshName,_iteration,_order,_time,_coords,_fam_coords,_num_coords,_name_coords); for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++) if((const MEDFileUMeshSplitL1 *)(*it)!=0) - (*it)->write(fid,maa,mdim); - MEDFileUMeshL2::WriteFamiliesAndGrps(fid,maa,_families,_groups,_too_long_str); + (*it)->write(fid,meshName,mdim); + MEDFileUMeshL2::WriteFamiliesAndGrps(fid,meshName,_families,_groups,_too_long_str); } /*! @@ -2333,7 +2334,7 @@ std::vector MEDFileUMesh::getNameArrNonEmptyLevelsExt() const * \param [in] grp - the name of the group of interest. * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileUMesh::getGrpNonEmptyLevels(const char *grp) const +std::vector MEDFileUMesh::getGrpNonEmptyLevels(const std::string& grp) const { std::vector fams=getFamiliesOnGroup(grp); return getFamsNonEmptyLevels(fams); @@ -2344,7 +2345,7 @@ std::vector MEDFileUMesh::getGrpNonEmptyLevels(const char *grp) const * \param [in] grp - the name of the group of interest. * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileUMesh::getGrpNonEmptyLevelsExt(const char *grp) const +std::vector MEDFileUMesh::getGrpNonEmptyLevelsExt(const std::string& grp) const { std::vector fams=getFamiliesOnGroup(grp); return getFamsNonEmptyLevelsExt(fams); @@ -2356,7 +2357,7 @@ std::vector MEDFileUMesh::getGrpNonEmptyLevelsExt(const char *grp) const * \param [in] fam - the name of the family of interest. * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileUMesh::getFamNonEmptyLevels(const char *fam) const +std::vector MEDFileUMesh::getFamNonEmptyLevels(const std::string& fam) const { std::vector fams(1,std::string(fam)); return getFamsNonEmptyLevels(fams); @@ -2367,7 +2368,7 @@ std::vector MEDFileUMesh::getFamNonEmptyLevels(const char *fam) const * \param [in] fam - the name of the family of interest. * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileUMesh::getFamNonEmptyLevelsExt(const char *fam) const +std::vector MEDFileUMesh::getFamNonEmptyLevelsExt(const std::string& fam) const { std::vector fams(1,std::string(fam)); return getFamsNonEmptyLevelsExt(fams); @@ -2448,7 +2449,7 @@ std::vector MEDFileUMesh::getGroupsOnSpecifiedLev(int meshDimRelToM std::vector allGrps=getGroupsNames(); for(std::vector::const_iterator it=allGrps.begin();it!=allGrps.end();it++) { - std::vector levs=getGrpNonEmptyLevelsExt((*it).c_str()); + std::vector levs=getGrpNonEmptyLevelsExt((*it)); if(std::find(levs.begin(),levs.end(),meshDimRelToMaxExt)!=levs.end()) ret.push_back(*it); } @@ -2685,7 +2686,7 @@ void MEDFileUMesh::whichAreNodesFetched(const MEDFileField1TSStructItem& st, con m->computeNodeIdsAlg(nodesFetched); else { - const DataArrayInt *arr(globs->getProfile(st[i].getPflName().c_str())); + const DataArrayInt *arr(globs->getProfile(st[i].getPflName())); MEDCouplingAutoRefCountObjectPtr m2(dynamic_cast(m->buildPartOfMySelf(arr->begin(),arr->end(),true))); m2->computeNodeIdsAlg(nodesFetched); } @@ -2740,7 +2741,7 @@ DataArrayDouble *MEDFileUMesh::getCoords() const * \throw If the name of a nonexistent group is specified. * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. */ -MEDCouplingUMesh *MEDFileUMesh::getGroup(int meshDimRelToMaxExt, const char *grp, bool renum) const +MEDCouplingUMesh *MEDFileUMesh::getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum) const { synchronizeTinyInfoOnLeaves(); std::vector tmp(1); @@ -2768,7 +2769,7 @@ MEDCouplingUMesh *MEDFileUMesh::getGroups(int meshDimRelToMaxExt, const std::vec std::vector fams2=getFamiliesOnGroups(grps); MEDCouplingAutoRefCountObjectPtr zeRet=getFamilies(meshDimRelToMaxExt,fams2,renum); if(grps.size()==1 && ((MEDCouplingUMesh *)zeRet)) - zeRet->setName(grps[0].c_str()); + zeRet->setName(grps[0]); return zeRet.retn(); } @@ -2786,7 +2787,7 @@ MEDCouplingUMesh *MEDFileUMesh::getGroups(int meshDimRelToMaxExt, const std::vec * \throw If a name of a nonexistent family is present in \a grps. * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. */ -MEDCouplingUMesh *MEDFileUMesh::getFamily(int meshDimRelToMaxExt, const char *fam, bool renum) const +MEDCouplingUMesh *MEDFileUMesh::getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum) const { synchronizeTinyInfoOnLeaves(); std::vector tmp(1); @@ -2827,7 +2828,7 @@ MEDCouplingUMesh *MEDFileUMesh::getFamilies(int meshDimRelToMaxExt, const std::v else zeRet=l1->getFamilyPart(0,0,renum); if(fams.size()==1 && ((MEDCouplingUMesh *)zeRet)) - zeRet->setName(fams[0].c_str()); + zeRet->setName(fams[0]); return zeRet.retn(); } @@ -2895,7 +2896,7 @@ MEDCouplingUMesh *MEDFileUMesh::getMeshAtLevel(int meshDimRelToMaxExt, bool renu MEDCouplingAutoRefCountObjectPtr cc=_coords->deepCpy(); umesh->setCoords(cc); MEDFileUMeshSplitL1::ClearNonDiscrAttributes(umesh); - umesh->setName(getName().c_str()); + umesh->setName(getName()); return umesh; } } @@ -3185,7 +3186,7 @@ void MEDFileUMesh::optimizeFamilies() _groups.erase(*it); } -void MEDFileUMesh::duplicateNodesOnM1Group(const char *grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified) +void MEDFileUMesh::duplicateNodesOnM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified) { std::vector levs=getNonEmptyLevels(); if(std::find(levs.begin(),levs.end(),0)==levs.end() || std::find(levs.begin(),levs.end(),-1)==levs.end()) @@ -3229,7 +3230,7 @@ void MEDFileUMesh::duplicateNodesOnM1Group(const char *grpNameM1, DataArrayInt * MEDCouplingAutoRefCountObjectPtr szOfCellGrpOfSameType(tmp00); MEDCouplingAutoRefCountObjectPtr idInMsOfCellGrpOfSameType(tmp11); // - newm1->setName(getName().c_str()); + newm1->setName(getName()); const DataArrayInt *fam=getFamilyFieldAtLevel(-1); if(!fam) throw INTERP_KERNEL::Exception("MEDFileUMesh::duplicateNodesOnM1Group : internal problem !"); @@ -3258,8 +3259,8 @@ void MEDFileUMesh::duplicateNodesOnM1Group(const char *grpNameM1, DataArrayInt * setMeshAtLevel(-1,newm1); setFamilyFieldArr(-1,newFam); std::string grpName2(grpNameM1); grpName2+="_dup"; - addFamily(grpName2.c_str(),idd); - addFamilyOnGrp(grpName2.c_str(),grpName2.c_str()); + addFamily(grpName2,idd); + addFamilyOnGrp(grpName2,grpName2); // fam=_fam_coords; if(fam) @@ -3499,7 +3500,7 @@ void MEDFileUMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids if(existsFamily(*famId)) { std::string locFamName2=getFamilyNameGivenId(*famId); std::vector v(2); v[0]=locFamName2; v[1]=locFamName; - ChangeAllGroupsContainingFamily(groups,getFamilyNameGivenId(*famId).c_str(),v); + ChangeAllGroupsContainingFamily(groups,getFamilyNameGivenId(*famId),v); } maxVal++; } // modifying all other groups on *famId to lie on maxVal and lie the grp on maxVal @@ -3512,7 +3513,7 @@ void MEDFileUMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids if(existsFamily(*famId)) { std::string n1(FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal:-maxVal,created)); std::vector v(2); v[0]=n1; v[1]=n2; - ChangeAllGroupsContainingFamily(groups,getFamilyNameGivenId(*famId).c_str(),v); + ChangeAllGroupsContainingFamily(groups,getFamilyNameGivenId(*famId),v); } maxVal+=2; } @@ -3653,10 +3654,10 @@ 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().c_str()); + setName((*it)->getName()); setMeshAtLevel(mdim-zeDim,const_cast(*it),renum); } - setName(name.c_str()); + setName(name); } /*! @@ -4517,7 +4518,7 @@ void MEDFileStructuredMesh::whichAreNodesFetched(const MEDFileField1TSStructItem std::fill(nodesFetched.begin(),nodesFetched.end(),true); return ; } - const DataArrayInt *arr(globs->getProfile(st[0].getPflName().c_str())); + const DataArrayInt *arr(globs->getProfile(st[0].getPflName())); const MEDCouplingStructuredMesh *cmesh=getStructuredMesh();//cmesh not null because getNumberOfNodes called before int sz(nodesFetched.size()); for(const int *work=arr->begin();work!=arr->end();work++) @@ -4555,7 +4556,7 @@ med_geometry_type MEDFileStructuredMesh::GetGeoTypeFromMeshDim(int meshDim) return geoTypeReq; } -void MEDFileStructuredMesh::loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +void MEDFileStructuredMesh::loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { setName(strm->getName()); setDescription(strm->getDescription()); @@ -4566,85 +4567,85 @@ void MEDFileStructuredMesh::loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt setTimeUnit(strm->getTimeUnit()); MEDFileMeshL2::ReadFamiliesAndGrps(fid,mName,_families,_groups,mrs); med_bool chgt=MED_FALSE,trsf=MED_FALSE; - int nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf); + int nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf); if(nbOfElt>0) { if(!mrs || mrs->isNodeFamilyFieldReading()) { _fam_nodes=DataArrayInt::New(); _fam_nodes->alloc(nbOfElt,1); - MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,MED_NODE,MED_NONE,_fam_nodes->getPointer()); + MEDmeshEntityFamilyNumberRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_fam_nodes->getPointer()); } } - nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,MED_NUMBER,MED_NODAL,&chgt,&trsf); + nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_NUMBER,MED_NODAL,&chgt,&trsf); if(nbOfElt>0) { if(!mrs || mrs->isNodeNumFieldReading()) { _num_nodes=DataArrayInt::New(); _num_nodes->alloc(nbOfElt,1); - MEDmeshEntityNumberRd(fid,mName,dt,it,MED_NODE,MED_NONE,_num_nodes->getPointer()); + MEDmeshEntityNumberRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_num_nodes->getPointer()); } } int meshDim=getStructuredMesh()->getMeshDimension(); med_geometry_type geoTypeReq=GetGeoTypeFromMeshDim(meshDim); - nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_CELL,geoTypeReq,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf); + nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf); if(nbOfElt>0) { if(!mrs || mrs->isCellFamilyFieldReading()) { _fam_cells=DataArrayInt::New(); _fam_cells->alloc(nbOfElt,1); - MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,MED_CELL,geoTypeReq,_fam_cells->getPointer()); + MEDmeshEntityFamilyNumberRd(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,_fam_cells->getPointer()); } } - nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_CELL,geoTypeReq,MED_NUMBER,MED_NODAL,&chgt,&trsf); + nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NUMBER,MED_NODAL,&chgt,&trsf); if(nbOfElt>0) { if(!mrs || mrs->isCellNumFieldReading()) { _num_cells=DataArrayInt::New(); _num_cells->alloc(nbOfElt,1); - MEDmeshEntityNumberRd(fid,mName,dt,it,MED_CELL,geoTypeReq,_num_cells->getPointer()); + MEDmeshEntityNumberRd(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,_num_cells->getPointer()); } } - nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_CELL,geoTypeReq,MED_NAME,MED_NODAL,&chgt,&trsf); + nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NAME,MED_NODAL,&chgt,&trsf); if(nbOfElt>0) { if(!mrs || mrs->isCellNameFieldReading()) { _names_cells=DataArrayAsciiChar::New(); _names_cells->alloc(nbOfElt+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end - MEDmeshEntityNameRd(fid,mName,dt,it,MED_CELL,geoTypeReq,_names_cells->getPointer()); + MEDmeshEntityNameRd(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,_names_cells->getPointer()); _names_cells->reAlloc(nbOfElt);//not a bug to avoid the memory corruption due to last \0 at the end } } - nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,MED_NAME,MED_NODAL,&chgt,&trsf); + nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_NAME,MED_NODAL,&chgt,&trsf); if(nbOfElt>0) { if(!mrs || mrs->isNodeNameFieldReading()) { _names_nodes=DataArrayAsciiChar::New(); _names_nodes->alloc(nbOfElt+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end - MEDmeshEntityNameRd(fid,mName,dt,it,MED_NODE,MED_NONE,_names_nodes->getPointer()); + MEDmeshEntityNameRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_names_nodes->getPointer()); _names_nodes->reAlloc(nbOfElt);//not a bug to avoid the memory corruption due to last \0 at the end } } } -void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const char *maa) const +void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const std::string& maa) const { int meshDim=getStructuredMesh()->getMeshDimension(); med_geometry_type geoTypeReq=GetGeoTypeFromMeshDim(meshDim); // if((const DataArrayInt *)_fam_cells) - MEDmeshEntityFamilyNumberWr(fid,maa,_iteration,_order,MED_CELL,geoTypeReq,_fam_cells->getNumberOfTuples(),_fam_cells->getConstPointer()); + MEDmeshEntityFamilyNumberWr(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_fam_cells->getNumberOfTuples(),_fam_cells->getConstPointer()); if((const DataArrayInt *)_fam_nodes) - MEDmeshEntityFamilyNumberWr(fid,maa,_iteration,_order,MED_NODE,MED_NONE,_fam_nodes->getNumberOfTuples(),_fam_nodes->getConstPointer()); + MEDmeshEntityFamilyNumberWr(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_fam_nodes->getNumberOfTuples(),_fam_nodes->getConstPointer()); if((const DataArrayInt *)_num_cells) - MEDmeshEntityNumberWr(fid,maa,_iteration,_order,MED_CELL,geoTypeReq,_num_cells->getNumberOfTuples(),_num_cells->getConstPointer()); + MEDmeshEntityNumberWr(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_num_cells->getNumberOfTuples(),_num_cells->getConstPointer()); if((const DataArrayInt *)_num_nodes) - MEDmeshEntityNumberWr(fid,maa,_iteration,_order,MED_NODE,MED_NONE,_num_nodes->getNumberOfTuples(),_num_nodes->getConstPointer()); + MEDmeshEntityNumberWr(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_num_nodes->getNumberOfTuples(),_num_nodes->getConstPointer()); if((const DataArrayAsciiChar *)_names_cells) { if(_names_cells->getNumberOfComponents()!=MED_SNAME_SIZE) @@ -4653,7 +4654,7 @@ void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const char *maa) cons oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDmeshEntityNameWr(fid,maa,_iteration,_order,MED_CELL,geoTypeReq,_names_cells->getNumberOfTuples(),_names_cells->getConstPointer()); + MEDmeshEntityNameWr(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_names_cells->getNumberOfTuples(),_names_cells->getConstPointer()); } if((const DataArrayAsciiChar *)_names_nodes) { @@ -4663,10 +4664,10 @@ void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const char *maa) cons oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDmeshEntityNameWr(fid,maa,_iteration,_order,MED_NODE,MED_NONE,_names_nodes->getNumberOfTuples(),_names_nodes->getConstPointer()); + MEDmeshEntityNameWr(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_names_nodes->getNumberOfTuples(),_names_nodes->getConstPointer()); } // - MEDFileUMeshL2::WriteFamiliesAndGrps(fid,maa,_families,_groups,_too_long_str); + MEDFileUMeshL2::WriteFamiliesAndGrps(fid,maa.c_str(),_families,_groups,_too_long_str); } /*! @@ -4689,7 +4690,7 @@ MEDFileCMesh *MEDFileCMesh::New() * \throw If there is no meshes in the file. * \throw If the mesh in the file is not a Cartesian one. */ -MEDFileCMesh *MEDFileCMesh::New(const char *fileName, MEDFileMeshReadSelector *mrs) +MEDFileCMesh *MEDFileCMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs) { std::vector ms=MEDLoader::GetMeshNames(fileName); if(ms.empty()) @@ -4698,12 +4699,12 @@ MEDFileCMesh *MEDFileCMesh::New(const char *fileName, MEDFileMeshReadSelector *m throw INTERP_KERNEL::Exception(oss.str().c_str()); } MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); int dt,it; ParaMEDMEM::MEDCouplingMeshType meshType; std::string dummy2; - MEDFileMeshL2::GetMeshIdFromName(fid,ms.front().c_str(),meshType,dt,it,dummy2); - return new MEDFileCMesh(fid,ms.front().c_str(),dt,it,mrs); + MEDFileMeshL2::GetMeshIdFromName(fid,ms.front(),meshType,dt,it,dummy2); + return new MEDFileCMesh(fid,ms.front(),dt,it,mrs); } /*! @@ -4720,10 +4721,10 @@ MEDFileCMesh *MEDFileCMesh::New(const char *fileName, MEDFileMeshReadSelector *m * \throw If there is no mesh with given attributes in the file. * \throw If the mesh in the file is not a Cartesian one. */ -MEDFileCMesh *MEDFileCMesh::New(const char *fileName, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +MEDFileCMesh *MEDFileCMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); return new MEDFileCMesh(fid,mName,dt,it,mrs); } @@ -4853,7 +4854,7 @@ MEDFileCMesh::MEDFileCMesh() { } -MEDFileCMesh::MEDFileCMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +MEDFileCMesh::MEDFileCMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) try { loadCMeshFromFile(fid,mName,dt,it,mrs); @@ -4863,7 +4864,7 @@ catch(INTERP_KERNEL::Exception& e) throw e; } -void MEDFileCMesh::loadCMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +void MEDFileCMesh::loadCMeshFromFile(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { ParaMEDMEM::MEDCouplingMeshType meshType; int dummy0,dummy1; @@ -4940,7 +4941,8 @@ void MEDFileCMesh::writeLL(med_idt fid) const MEDmeshGridIndexCoordinateWr(fid,maa,_iteration,_order,_time,i+1,da->getNumberOfTuples(),da->getConstPointer()); } // - MEDFileStructuredMesh::writeStructuredLL(fid,maa); + std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE)); + MEDFileStructuredMesh::writeStructuredLL(fid,meshName); } void MEDFileCMesh::synchronizeTinyInfoOnLeaves() const @@ -4948,10 +4950,10 @@ void MEDFileCMesh::synchronizeTinyInfoOnLeaves() const const MEDCouplingCMesh *cmesh=_cmesh; if(!cmesh) return; - (const_cast(cmesh))->setName(_name.c_str()); - (const_cast(cmesh))->setDescription(_desc_name.c_str()); + (const_cast(cmesh))->setName(_name); + (const_cast(cmesh))->setDescription(_desc_name); (const_cast(cmesh))->setTime(_time,_iteration,_order); - (const_cast(cmesh))->setTimeUnit(_dt_unit.c_str()); + (const_cast(cmesh))->setTimeUnit(_dt_unit); } MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New() @@ -4959,7 +4961,7 @@ MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New() return new MEDFileCurveLinearMesh; } -MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const char *fileName, MEDFileMeshReadSelector *mrs) +MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs) { std::vector ms=MEDLoader::GetMeshNames(fileName); if(ms.empty()) @@ -4968,18 +4970,18 @@ MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const char *fileName, MEDFil throw INTERP_KERNEL::Exception(oss.str().c_str()); } MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); int dt,it; ParaMEDMEM::MEDCouplingMeshType meshType; std::string dummy2; - MEDFileMeshL2::GetMeshIdFromName(fid,ms.front().c_str(),meshType,dt,it,dummy2); - return new MEDFileCurveLinearMesh(fid,ms.front().c_str(),dt,it,mrs); + MEDFileMeshL2::GetMeshIdFromName(fid,ms.front(),meshType,dt,it,dummy2); + return new MEDFileCurveLinearMesh(fid,ms.front(),dt,it,mrs); } -MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const char *fileName, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); return new MEDFileCurveLinearMesh(fid,mName,dt,it,mrs); } @@ -5075,10 +5077,10 @@ void MEDFileCurveLinearMesh::synchronizeTinyInfoOnLeaves() const const MEDCouplingCurveLinearMesh *clmesh=_clmesh; if(!clmesh) return; - (const_cast(clmesh))->setName(_name.c_str()); - (const_cast(clmesh))->setDescription(_desc_name.c_str()); + (const_cast(clmesh))->setName(_name); + (const_cast(clmesh))->setDescription(_desc_name); (const_cast(clmesh))->setTime(_time,_iteration,_order); - (const_cast(clmesh))->setTimeUnit(_dt_unit.c_str()); + (const_cast(clmesh))->setTimeUnit(_dt_unit); } const MEDCouplingCurveLinearMesh *MEDFileCurveLinearMesh::getMesh() const @@ -5105,7 +5107,7 @@ MEDFileCurveLinearMesh::MEDFileCurveLinearMesh() { } -MEDFileCurveLinearMesh::MEDFileCurveLinearMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +MEDFileCurveLinearMesh::MEDFileCurveLinearMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) try { loadCLMeshFromFile(fid,mName,dt,it,mrs); @@ -5146,10 +5148,11 @@ void MEDFileCurveLinearMesh::writeLL(med_idt fid) const MEDmeshNodeCoordinateWr(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin()); // - MEDFileStructuredMesh::writeStructuredLL(fid,maa); + std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE)); + MEDFileStructuredMesh::writeStructuredLL(fid,meshName); } -void MEDFileCurveLinearMesh::loadCLMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +void MEDFileCurveLinearMesh::loadCLMeshFromFile(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { ParaMEDMEM::MEDCouplingMeshType meshType; int dummy0,dummy1; @@ -5173,12 +5176,12 @@ MEDFileMeshMultiTS *MEDFileMeshMultiTS::New() return new MEDFileMeshMultiTS; } -MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(const char *fileName) +MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(const std::string& fileName) { return new MEDFileMeshMultiTS(fileName); } -MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(const char *fileName, const char *mName) +MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(const std::string& fileName, const std::string& mName) { return new MEDFileMeshMultiTS(fileName,mName); } @@ -5219,7 +5222,7 @@ std::string MEDFileMeshMultiTS::getName() const return _mesh_one_ts[0]->getName(); } -void MEDFileMeshMultiTS::setName(const char *newMeshName) +void MEDFileMeshMultiTS::setName(const std::string& newMeshName) { std::string oldName(getName()); std::vector< std::pair > v(1); @@ -5265,16 +5268,16 @@ void MEDFileMeshMultiTS::write(med_idt fid) const } } -void MEDFileMeshMultiTS::write(const char *fileName, int mode) const +void MEDFileMeshMultiTS::write(const std::string& fileName, int mode) const { med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); std::ostringstream oss; oss << "MEDFileMesh : error on attempt to write in file : \"" << fileName << "\""; - MEDFileUtilities::CheckMEDCode(fid,fid,oss.str().c_str()); + MEDFileUtilities::CheckMEDCode(fid,fid,oss.str()); write(fid); } -void MEDFileMeshMultiTS::loadFromFile(const char *fileName, const char *mName) +void MEDFileMeshMultiTS::loadFromFile(const std::string& fileName, const std::string& mName) {//for the moment to be improved _mesh_one_ts.resize(1); _mesh_one_ts[0]=MEDFileMesh::New(fileName,mName,-1,-1); @@ -5284,7 +5287,7 @@ MEDFileMeshMultiTS::MEDFileMeshMultiTS() { } -MEDFileMeshMultiTS::MEDFileMeshMultiTS(const char *fileName) +MEDFileMeshMultiTS::MEDFileMeshMultiTS(const std::string& fileName) try { std::vector ms=MEDLoader::GetMeshNames(fileName); @@ -5294,19 +5297,19 @@ try throw INTERP_KERNEL::Exception(oss.str().c_str()); } MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); int dt,it; ParaMEDMEM::MEDCouplingMeshType meshType; std::string dummy2; - MEDFileMeshL2::GetMeshIdFromName(fid,ms.front().c_str(),meshType,dt,it,dummy2); - loadFromFile(fileName,ms.front().c_str()); + MEDFileMeshL2::GetMeshIdFromName(fid,ms.front(),meshType,dt,it,dummy2); + loadFromFile(fileName,ms.front()); } catch(INTERP_KERNEL::Exception& e) { throw e; } -MEDFileMeshMultiTS::MEDFileMeshMultiTS(const char *fileName, const char *mName) +MEDFileMeshMultiTS::MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName) try { loadFromFile(fileName,mName); @@ -5321,7 +5324,7 @@ MEDFileMeshes *MEDFileMeshes::New() return new MEDFileMeshes; } -MEDFileMeshes *MEDFileMeshes::New(const char *fileName) +MEDFileMeshes *MEDFileMeshes::New(const std::string& fileName) { return new MEDFileMeshes(fileName); } @@ -5336,12 +5339,12 @@ void MEDFileMeshes::write(med_idt fid) const } } -void MEDFileMeshes::write(const char *fileName, int mode) const +void MEDFileMeshes::write(const std::string& fileName, int mode) const { med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); std::ostringstream oss; oss << "MEDFileMesh : error on attempt to write in file : \"" << fileName << "\""; - MEDFileUtilities::CheckMEDCode(fid,fid,oss.str().c_str()); + MEDFileUtilities::CheckMEDCode(fid,fid,oss.str()); checkCoherency(); write(fid); } @@ -5366,7 +5369,7 @@ MEDFileMesh *MEDFileMeshes::getMeshAtPos(int i) const return _meshes[i]->getOneTimeStep(); } -MEDFileMesh *MEDFileMeshes::getMeshWithName(const char *mname) const +MEDFileMesh *MEDFileMeshes::getMeshWithName(const std::string& mname) const { std::vector ms=getMeshesNames(); std::vector::iterator it=std::find(ms.begin(),ms.end(),mname); @@ -5446,20 +5449,20 @@ void MEDFileMeshes::destroyMeshAtPos(int i) _meshes.erase(_meshes.begin()+i); } -void MEDFileMeshes::loadFromFile(const char *fileName) +void MEDFileMeshes::loadFromFile(const std::string& fileName) { std::vector ms=MEDLoader::GetMeshNames(fileName); int i=0; _meshes.resize(ms.size()); for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++,i++) - _meshes[i]=MEDFileMeshMultiTS::New(fileName,(*it).c_str()); + _meshes[i]=MEDFileMeshMultiTS::New(fileName,(*it)); } MEDFileMeshes::MEDFileMeshes() { } -MEDFileMeshes::MEDFileMeshes(const char *fileName) +MEDFileMeshes::MEDFileMeshes(const std::string& fileName) try { loadFromFile(fileName); diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index f59040f1e..91021245c 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -37,8 +37,8 @@ namespace ParaMEDMEM class MEDFileMesh : public RefCountObject, public MEDFileWritable { public: - MEDLOADER_EXPORT static MEDFileMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0); - MEDLOADER_EXPORT static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildren() const; MEDLOADER_EXPORT virtual MEDFileMesh *createNewEmpty() const = 0; @@ -46,13 +46,13 @@ namespace ParaMEDMEM MEDLOADER_EXPORT virtual MEDFileMesh *shallowCpy() const = 0; MEDLOADER_EXPORT virtual bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; MEDLOADER_EXPORT virtual void clearNonDiscrAttributes() const; - MEDLOADER_EXPORT void setName(const char *name) { _name=name; } + MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; } MEDLOADER_EXPORT bool changeNames(const std::vector< std::pair >& modifTab); MEDLOADER_EXPORT std::string getName() const { return _name; } - MEDLOADER_EXPORT const char *getUnivName() const { return _univ_name.c_str(); } + MEDLOADER_EXPORT std::string getUnivName() const { return _univ_name; } MEDLOADER_EXPORT bool getUnivNameWrStatus() const { return _univ_wr_status; } MEDLOADER_EXPORT void setUnivNameWrStatus(bool newStatus) { _univ_wr_status=newStatus; } - MEDLOADER_EXPORT void setDescription(const char *name) { _desc_name=name; } + MEDLOADER_EXPORT void setDescription(const std::string& name) { _desc_name=name; } MEDLOADER_EXPORT std::string getDescription() const { return _desc_name; } MEDLOADER_EXPORT void setOrder(int order) { _order=order; } MEDLOADER_EXPORT int getOrder() const { return _order; } @@ -62,15 +62,15 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void setTime(int dt, int it, double time) { _time=time; _iteration=dt; _order=it; } MEDLOADER_EXPORT double getTime(int& dt, int& it) { dt=_iteration; it=_order; return _time; } MEDLOADER_EXPORT double getTimeValue() const { return _time; } - MEDLOADER_EXPORT void setTimeUnit(const char *unit) { _dt_unit=unit; } - MEDLOADER_EXPORT const char *getTimeUnit() const { return _dt_unit.c_str(); } + MEDLOADER_EXPORT void setTimeUnit(const std::string& unit) { _dt_unit=unit; } + MEDLOADER_EXPORT std::string getTimeUnit() const { return _dt_unit; } MEDLOADER_EXPORT virtual int getNumberOfNodes() const = 0; MEDLOADER_EXPORT virtual std::vector getNonEmptyLevels() const = 0; MEDLOADER_EXPORT virtual std::vector getNonEmptyLevelsExt() const = 0; MEDLOADER_EXPORT virtual std::vector getFamArrNonEmptyLevelsExt() const = 0; MEDLOADER_EXPORT virtual std::vector getNumArrNonEmptyLevelsExt() const = 0; MEDLOADER_EXPORT virtual std::vector getNameArrNonEmptyLevelsExt() const = 0; - MEDLOADER_EXPORT virtual void write(const char *fileName, int mode) const; + MEDLOADER_EXPORT virtual void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT virtual void write(med_idt fid) const; MEDLOADER_EXPORT virtual int getSizeAtLevel(int meshDimRelToMaxExt) const = 0; MEDLOADER_EXPORT virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const = 0; @@ -79,15 +79,15 @@ namespace ParaMEDMEM // MEDLOADER_EXPORT bool areFamsEqual(const MEDFileMesh *other, std::string& what) const; MEDLOADER_EXPORT bool areGrpsEqual(const MEDFileMesh *other, std::string& what) const; - MEDLOADER_EXPORT bool existsGroup(const char *groupName) const; + MEDLOADER_EXPORT bool existsGroup(const std::string& groupName) const; MEDLOADER_EXPORT bool existsFamily(int famId) const; - MEDLOADER_EXPORT bool existsFamily(const char *familyName) const; - MEDLOADER_EXPORT void setFamilyId(const char *familyName, int id); - MEDLOADER_EXPORT void setFamilyIdUnique(const char *familyName, int id); - MEDLOADER_EXPORT virtual void addFamily(const char *familyName, int id); - MEDLOADER_EXPORT virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName); + MEDLOADER_EXPORT bool existsFamily(const std::string& familyName) const; + MEDLOADER_EXPORT void setFamilyId(const std::string& familyName, int id); + MEDLOADER_EXPORT void setFamilyIdUnique(const std::string& familyName, int id); + MEDLOADER_EXPORT virtual void addFamily(const std::string& familyName, int id); + MEDLOADER_EXPORT virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName); MEDLOADER_EXPORT virtual bool keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& levs); - MEDLOADER_EXPORT void addFamilyOnGrp(const char *grpName, const char *famName); + MEDLOADER_EXPORT void addFamilyOnGrp(const std::string& grpName, const std::string& famName); MEDLOADER_EXPORT std::string findOrCreateAndGiveFamilyWithId(int id, bool& created); MEDLOADER_EXPORT void setFamilyInfo(const std::map& info); MEDLOADER_EXPORT void setGroupInfo(const std::map >&info); @@ -97,26 +97,26 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void clearFamGrpMaps(); MEDLOADER_EXPORT const std::map& getFamilyInfo() const { return _families; } MEDLOADER_EXPORT const std::map >& getGroupInfo() const { return _groups; } - MEDLOADER_EXPORT std::vector getFamiliesOnGroup(const char *name) const; + MEDLOADER_EXPORT std::vector getFamiliesOnGroup(const std::string& name) const; MEDLOADER_EXPORT std::vector getFamiliesOnGroups(const std::vector& grps) const; - MEDLOADER_EXPORT std::vector getFamiliesIdsOnGroup(const char *name) const; - MEDLOADER_EXPORT void setFamiliesOnGroup(const char *name, const std::vector& fams); - MEDLOADER_EXPORT void setFamiliesIdsOnGroup(const char *name, const std::vector& famIds); - MEDLOADER_EXPORT std::vector getGroupsOnFamily(const char *name) const; - MEDLOADER_EXPORT void setGroupsOnFamily(const char *famName, const std::vector& grps); + MEDLOADER_EXPORT std::vector getFamiliesIdsOnGroup(const std::string& name) const; + MEDLOADER_EXPORT void setFamiliesOnGroup(const std::string& name, const std::vector& fams); + MEDLOADER_EXPORT void setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds); + MEDLOADER_EXPORT std::vector getGroupsOnFamily(const std::string& name) const; + MEDLOADER_EXPORT void setGroupsOnFamily(const std::string& famName, const std::vector& grps); MEDLOADER_EXPORT std::vector getGroupsNames() const; MEDLOADER_EXPORT std::vector getFamiliesNames() const; MEDLOADER_EXPORT void assignFamilyNameWithGroupName(); MEDLOADER_EXPORT std::vector removeEmptyGroups(); - MEDLOADER_EXPORT void removeGroup(const char *name); - MEDLOADER_EXPORT void removeFamily(const char *name); + MEDLOADER_EXPORT void removeGroup(const std::string& name); + MEDLOADER_EXPORT void removeFamily(const std::string& name); MEDLOADER_EXPORT std::vector removeOrphanGroups(); MEDLOADER_EXPORT std::vector removeOrphanFamilies(); - MEDLOADER_EXPORT void changeGroupName(const char *oldName, const char *newName); - MEDLOADER_EXPORT void changeFamilyName(const char *oldName, const char *newName); + MEDLOADER_EXPORT void changeGroupName(const std::string& oldName, const std::string& newName); + MEDLOADER_EXPORT void changeFamilyName(const std::string& oldName, const std::string& newName); MEDLOADER_EXPORT void changeFamilyId(int oldId, int newId); - MEDLOADER_EXPORT void changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector& newFamiliesNames); - MEDLOADER_EXPORT int getFamilyId(const char *name) const; + MEDLOADER_EXPORT void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector& newFamiliesNames); + MEDLOADER_EXPORT int getFamilyId(const std::string& name) const; MEDLOADER_EXPORT int getMaxAbsFamilyId() const; MEDLOADER_EXPORT int getMaxFamilyId() const; MEDLOADER_EXPORT int getMinFamilyId() const; @@ -147,19 +147,19 @@ namespace ParaMEDMEM MEDLOADER_EXPORT virtual const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const = 0; MEDLOADER_EXPORT virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const = 0; MEDLOADER_EXPORT virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const; MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupsArr(const std::vector& grps, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const; MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamiliesArr(const std::vector& fams, bool renum=false) const; // tools MEDLOADER_EXPORT virtual bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell) = 0; protected: MEDFileMesh(); //! protected because no way in MED file API to specify this name - void setUnivName(const char *name) { _univ_name=name; } - void addFamilyOnAllGroupsHaving(const char *famName, const char *otherFamName); + void setUnivName(const std::string& name) { _univ_name=name; } + void addFamilyOnAllGroupsHaving(const std::string& famName, const std::string& otherFamName); virtual void writeLL(med_idt fid) const = 0; void dealWithTinyInfo(const MEDCouplingMesh *m); virtual void synchronizeTinyInfoOnLeaves() const = 0; @@ -167,7 +167,7 @@ namespace ParaMEDMEM virtual void appendFamilyEntries(const DataArrayInt *famIds, const std::vector< std::vector >& fidsOfGrps, const std::vector& grpNames); virtual void changeFamilyIdArr(int oldId, int newId) = 0; static void TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector >& famIdsPerGrp); - static void ChangeAllGroupsContainingFamily(std::map >& groups, const char *familyNameToChange, const std::vector& newFamiliesNames); + static void ChangeAllGroupsContainingFamily(std::map >& groups, const std::string& familyNameToChange, const std::vector& newFamiliesNames); static std::string FindOrCreateAndGiveFamilyWithId(std::map& families, int id, bool& created); static std::string CreateNameNotIn(const std::string& nameTry, const std::vector& namesToAvoid); static int PutInThirdComponentOfCodeOffset(std::vector& code, int strt); @@ -192,8 +192,8 @@ namespace ParaMEDMEM { friend class MEDFileMesh; public: - MEDLOADER_EXPORT static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); - MEDLOADER_EXPORT static MEDFileUMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT static MEDFileUMesh *New(); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildren() const; @@ -224,19 +224,19 @@ namespace ParaMEDMEM MEDLOADER_EXPORT std::vector getFamArrNonEmptyLevelsExt() const; MEDLOADER_EXPORT std::vector getNumArrNonEmptyLevelsExt() const; MEDLOADER_EXPORT std::vector getNameArrNonEmptyLevelsExt() const; - MEDLOADER_EXPORT std::vector getGrpNonEmptyLevels(const char *grp) const; - MEDLOADER_EXPORT std::vector getGrpNonEmptyLevelsExt(const char *grp) const; - MEDLOADER_EXPORT std::vector getFamNonEmptyLevels(const char *fam) const; - MEDLOADER_EXPORT std::vector getFamNonEmptyLevelsExt(const char *fam) const; + MEDLOADER_EXPORT std::vector getGrpNonEmptyLevels(const std::string& grp) const; + MEDLOADER_EXPORT std::vector getGrpNonEmptyLevelsExt(const std::string& grp) const; + MEDLOADER_EXPORT std::vector getFamNonEmptyLevels(const std::string& fam) const; + MEDLOADER_EXPORT std::vector getFamNonEmptyLevelsExt(const std::string& fam) const; MEDLOADER_EXPORT std::vector getGrpsNonEmptyLevels(const std::vector& grps) const; MEDLOADER_EXPORT std::vector getGrpsNonEmptyLevelsExt(const std::vector& grps) const; MEDLOADER_EXPORT std::vector getFamsNonEmptyLevels(const std::vector& fams) const; MEDLOADER_EXPORT std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const; MEDLOADER_EXPORT std::vector getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const; MEDLOADER_EXPORT DataArrayDouble *getCoords() const; - MEDLOADER_EXPORT MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const; + MEDLOADER_EXPORT MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; - MEDLOADER_EXPORT MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const; + MEDLOADER_EXPORT MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; MEDLOADER_EXPORT DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const; @@ -268,14 +268,14 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector& ms, bool renum=false); MEDLOADER_EXPORT void optimizeFamilies(); // tools - MEDLOADER_EXPORT void duplicateNodesOnM1Group(const char *grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified); + MEDLOADER_EXPORT void duplicateNodesOnM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified); MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell); MEDLOADER_EXPORT DataArrayInt *zipCoords(); private: void writeLL(med_idt fid) const; MEDFileUMesh(); - MEDFileUMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void loadUMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs); + MEDFileUMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); + void loadUMeshFromFile(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); const MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt) const; MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt); void checkMeshDimCoherency(int meshDim, int meshDimRelToMax) const; @@ -328,8 +328,8 @@ namespace ParaMEDMEM protected: void changeFamilyIdArr(int oldId, int newId); void deepCpyAttributes(); - void loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void writeStructuredLL(med_idt fid, const char *maa) const; + void loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); + void writeStructuredLL(med_idt fid, const std::string& maa) const; virtual const MEDCouplingStructuredMesh *getStructuredMesh() const = 0; static med_geometry_type GetGeoTypeFromMeshDim(int meshDim); private: @@ -348,8 +348,8 @@ namespace ParaMEDMEM friend class MEDFileMesh; public: MEDLOADER_EXPORT static MEDFileCMesh *New(); - MEDLOADER_EXPORT static MEDFileCMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0); - MEDLOADER_EXPORT static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildren() const; MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const; @@ -368,8 +368,8 @@ namespace ParaMEDMEM void writeLL(med_idt fid) const; MEDFileCMesh(); void synchronizeTinyInfoOnLeaves() const; - MEDFileCMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void loadCMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs); + MEDFileCMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); + void loadCMeshFromFile(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); private: MEDCouplingAutoRefCountObjectPtr _cmesh; }; @@ -379,8 +379,8 @@ namespace ParaMEDMEM friend class MEDFileMesh; public: MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(); - MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0); - MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildren() const; MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const; @@ -395,11 +395,11 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void setMesh(MEDCouplingCurveLinearMesh *m); private: MEDFileCurveLinearMesh(); - MEDFileCurveLinearMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs); + MEDFileCurveLinearMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); const MEDCouplingStructuredMesh *getStructuredMesh() const; void synchronizeTinyInfoOnLeaves() const; void writeLL(med_idt fid) const; - void loadCLMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs);//to imp + void loadCLMeshFromFile(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);//to imp private: MEDCouplingAutoRefCountObjectPtr _clmesh; }; @@ -408,23 +408,23 @@ namespace ParaMEDMEM { public: MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(); - MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(const char *fileName); - MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(const char *fileName, const char *mName); + MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(const std::string& fileName); + MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName); MEDLOADER_EXPORT MEDFileMeshMultiTS *deepCpy() const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildren() const; MEDLOADER_EXPORT std::string getName() const; - MEDLOADER_EXPORT void setName(const char *newMeshName); + MEDLOADER_EXPORT void setName(const std::string& newMeshName); MEDLOADER_EXPORT bool changeNames(const std::vector< std::pair >& modifTab); MEDLOADER_EXPORT MEDFileMesh *getOneTimeStep() const; MEDLOADER_EXPORT void write(med_idt fid) const; - MEDLOADER_EXPORT void write(const char *fileName, int mode) const; + MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void setOneTimeStep(MEDFileMesh *mesh1TimeStep); private: - void loadFromFile(const char *fileName, const char *mName); + void loadFromFile(const std::string& fileName, const std::string& mName); MEDFileMeshMultiTS(); - MEDFileMeshMultiTS(const char *fileName); - MEDFileMeshMultiTS(const char *fileName, const char *mName); + MEDFileMeshMultiTS(const std::string& fileName); + MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName); private: std::vector< MEDCouplingAutoRefCountObjectPtr > _mesh_one_ts; }; @@ -435,18 +435,18 @@ namespace ParaMEDMEM { public: MEDLOADER_EXPORT static MEDFileMeshes *New(); - MEDLOADER_EXPORT static MEDFileMeshes *New(const char *fileName); + MEDLOADER_EXPORT static MEDFileMeshes *New(const std::string& fileName); MEDLOADER_EXPORT MEDFileMeshes *deepCpy() const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildren() const; MEDLOADER_EXPORT std::string simpleRepr() const; MEDLOADER_EXPORT void simpleReprWithoutHeader(std::ostream& oss) const; - MEDLOADER_EXPORT void write(const char *fileName, int mode) const; + MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void write(med_idt fid) const; MEDLOADER_EXPORT int getNumberOfMeshes() const; MEDLOADER_EXPORT MEDFileMeshesIterator *iterator(); MEDLOADER_EXPORT MEDFileMesh *getMeshAtPos(int i) const; - MEDLOADER_EXPORT MEDFileMesh *getMeshWithName(const char *mname) const; + MEDLOADER_EXPORT MEDFileMesh *getMeshWithName(const std::string& mname) const; MEDLOADER_EXPORT std::vector getMeshesNames() const; MEDLOADER_EXPORT bool changeNames(const std::vector< std::pair >& modifTab); // @@ -456,9 +456,9 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void destroyMeshAtPos(int i); private: void checkCoherency() const; - void loadFromFile(const char *fileName); + void loadFromFile(const std::string& fileName); MEDFileMeshes(); - MEDFileMeshes(const char *fileName); + MEDFileMeshes(const std::string& fileName); private: std::vector< MEDCouplingAutoRefCountObjectPtr > _meshes; }; diff --git a/src/MEDLoader/MEDFileMeshElt.cxx b/src/MEDLoader/MEDFileMeshElt.cxx index 9a8d48813..fd123cc03 100644 --- a/src/MEDLoader/MEDFileMeshElt.cxx +++ b/src/MEDLoader/MEDFileMeshElt.cxx @@ -212,7 +212,7 @@ void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int loadCommonPart(fid,mName,dt,it,mdim,curNbOfElem,MED_POLYHEDRON,entity,mrs); } -void MEDFileUMeshPerType::Write(med_idt fid, const char *mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names) +void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names) { int nbOfCells=m->getNumberOfCells(); if(nbOfCells<1) @@ -229,7 +229,7 @@ void MEDFileUMeshPerType::Write(med_idt fid, const char *mname, int mdim, const throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #1 !"); MEDCouplingAutoRefCountObjectPtr arr(m0->getNodalConnectivity()->deepCpy()); std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus(),1)); - MEDmeshElementConnectivityWr(fid,mname,dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,nbOfCells,arr->begin()); + MEDmeshElementConnectivityWr(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,nbOfCells,arr->begin()); } else { @@ -241,7 +241,7 @@ void MEDFileUMeshPerType::Write(med_idt fid, const char *mname, int mdim, const MEDCouplingAutoRefCountObjectPtr arr(m0->getNodalConnectivity()->deepCpy()),arrI(m0->getNodalConnectivityIndex()->deepCpy()); std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus(),1)); std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus(),1)); - MEDmeshPolygon2Wr(fid,mname,dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,nbOfCells+1,arrI->begin(),arr->begin()); + MEDmeshPolygon2Wr(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,nbOfCells+1,arrI->begin(),arr->begin()); } else { @@ -271,13 +271,13 @@ void MEDFileUMeshPerType::Write(med_idt fid, const char *mname, int mdim, const } w1[1]=w1[0]+nbOfFaces2; } - MEDmeshPolyhedronWr(fid,mname,dt,it,timm,MED_CELL,MED_NODAL,nbOfCells+1,tab1,nbOfFaces+1,tab2,bigtab); + MEDmeshPolyhedronWr(fid,mname.c_str(),dt,it,timm,MED_CELL,MED_NODAL,nbOfCells+1,tab1,nbOfFaces+1,tab2,bigtab); } } if(fam) - MEDmeshEntityFamilyNumberWr(fid,mname,dt,it,MED_CELL,curMedType,nbOfCells,fam->getConstPointer()); + MEDmeshEntityFamilyNumberWr(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,fam->getConstPointer()); if(num) - MEDmeshEntityNumberWr(fid,mname,dt,it,MED_CELL,curMedType,nbOfCells,num->getConstPointer()); + MEDmeshEntityNumberWr(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,num->getConstPointer()); if(names) { if(names->getNumberOfComponents()!=MED_SNAME_SIZE) @@ -286,6 +286,6 @@ void MEDFileUMeshPerType::Write(med_idt fid, const char *mname, int mdim, const oss << " ! The array has " << names->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDmeshEntityNameWr(fid,mname,dt,it,MED_CELL,curMedType,nbOfCells,names->getConstPointer()); + MEDmeshEntityNameWr(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,names->getConstPointer()); } } diff --git a/src/MEDLoader/MEDFileMeshElt.hxx b/src/MEDLoader/MEDFileMeshElt.hxx index 0868cf757..bf8cf826c 100644 --- a/src/MEDLoader/MEDFileMeshElt.hxx +++ b/src/MEDLoader/MEDFileMeshElt.hxx @@ -46,7 +46,7 @@ namespace ParaMEDMEM const DataArrayInt *getFam() const { return _fam; } const DataArrayInt *getNum() const { return _num; } const DataArrayAsciiChar *getNames() const { return _names; } - static void Write(med_idt fid, const char *mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names); + static void Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names); private: MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, med_entity_type entity, MEDFileMeshReadSelector *mrs); diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 39c409025..6784cb264 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -50,7 +50,7 @@ std::vector MEDFileMeshL2::getDirectChildren() const return std::vector(); } -int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const char *mname, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1) +int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const std::string& mname, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1) { med_mesh_type type_maillage; char maillage_description[MED_COMMENT_SIZE+1]; @@ -94,7 +94,7 @@ int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const char *mname, ParaMEDMEM: case MED_STRUCTURED_MESH: { med_grid_type gt; - MEDmeshGridTypeRd(fid,mname,>); + MEDmeshGridTypeRd(fid,mname.c_str(),>); switch(gt) { case MED_CARTESIAN_GRID: @@ -113,12 +113,12 @@ int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const char *mname, ParaMEDMEM: } med_int numdt,numit; med_float dtt; - MEDmeshComputationStepInfo(fid,mname,1,&numdt,&numit,&dtt); + MEDmeshComputationStepInfo(fid,mname.c_str(),1,&numdt,&numit,&dtt); dt=numdt; it=numit; return ret; } -double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const char *mName, int nstep, int dt, int it) +double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) { bool found=false; med_int numdt,numit; @@ -126,7 +126,7 @@ double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const char *mName, int nste std::vector< std::pair > p(nstep); for(int i=0;i(numdt,numit); found=(numdt==dt) && (numit==numit); } @@ -141,7 +141,7 @@ double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const char *mName, int nste return dtt; } -std::vector MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId, const char *mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim) +std::vector MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId, const std::string& mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim) { med_mesh_type type_maillage; med_int spaceDim; @@ -164,7 +164,7 @@ std::vector MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId, case MED_STRUCTURED_MESH: { med_grid_type gt; - MEDmeshGridTypeRd(fid,mName,>); + MEDmeshGridTypeRd(fid,mName.c_str(),>); switch(gt) { case MED_CARTESIAN_GRID: @@ -191,22 +191,22 @@ std::vector MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId, return infosOnComp; } -void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const char *meshName, std::map& fams, std::map >& grps, MEDFileMeshReadSelector *mrs) +void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName, std::map& fams, std::map >& grps, MEDFileMeshReadSelector *mrs) { if(mrs && !(mrs->isCellFamilyFieldReading() || mrs->isNodeFamilyFieldReading())) return ; char nomfam[MED_NAME_SIZE+1]; med_int numfam; - int nfam=MEDnFamily(fid,meshName); + int nfam=MEDnFamily(fid,meshName.c_str()); for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; INTERP_KERNEL::AutoPtr attdes=new char[MED_COMMENT_SIZE*natt+1]; INTERP_KERNEL::AutoPtr gro=new char[MED_LNAME_SIZE*ngro+1]; - MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro); + MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro); std::string famName=MEDLoaderBase::buildStringFromFortran(nomfam,MED_NAME_SIZE); fams[famName]=numfam; for(int j=0;j& fams, const std::map >& grps, int tooLongStrPol) +void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map& fams, const std::map >& grps, int tooLongStrPol) { for(std::map::const_iterator it=fams.begin();it!=fams.end();it++) { @@ -234,7 +234,7 @@ void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const char *mname, const s MEDLoaderBase::safeStrCpy2((*it2).c_str(),MED_LNAME_SIZE-1,groName+i*MED_LNAME_SIZE,tooLongStrPol); INTERP_KERNEL::AutoPtr famName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); MEDLoaderBase::safeStrCpy((*it).first.c_str(),MED_NAME_SIZE,famName,tooLongStrPol); - int ret=MEDfamilyCr(fid,mname,famName,(*it).second,ngro,groName); + int ret=MEDfamilyCr(fid,mname.c_str(),famName,(*it).second,ngro,groName); ret++; } } @@ -243,13 +243,13 @@ MEDFileUMeshL2::MEDFileUMeshL2() { } -void MEDFileUMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +void MEDFileUMeshL2::loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { - _name.set(mName); + _name.set(mName.c_str()); int nstep; int Mdim; ParaMEDMEM::MEDCouplingMeshType meshType; - std::vector infosOnComp=getAxisInfoOnMesh(fid,mId,mName,meshType,nstep,Mdim); + std::vector infosOnComp=getAxisInfoOnMesh(fid,mId,mName.c_str(),meshType,nstep,Mdim); if(meshType!=UNSTRUCTURED) throw INTERP_KERNEL::Exception("Invalid mesh type ! You are expected an unstructured one whereas in file it is not an unstructured !"); _time=CheckMeshTimeStep(fid,mName,nstep,dt,it); @@ -259,55 +259,55 @@ void MEDFileUMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, in loadCoords(fid,mId,infosOnComp,mName,dt,it); } -void MEDFileUMeshL2::loadConnectivity(med_idt fid, int mdim, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +void MEDFileUMeshL2::loadConnectivity(med_idt fid, int mdim, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { _per_type_mesh.resize(1); _per_type_mesh[0].clear(); for(int j=0;j& infosOnComp, const char *mName, int dt, int it) +void MEDFileUMeshL2::loadCoords(med_idt fid, int mId, const std::vector& infosOnComp, const std::string& mName, int dt, int it) { int spaceDim=infosOnComp.size(); med_bool changement,transformation; - int nCoords=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation); + int nCoords=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation); _coords=DataArrayDouble::New(); _coords->alloc(nCoords,spaceDim); double *coordsPtr=_coords->getPointer(); - MEDmeshNodeCoordinateRd(fid,mName,dt,it,MED_FULL_INTERLACE,coordsPtr); - if(MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) + MEDmeshNodeCoordinateRd(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,coordsPtr); + if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) { _fam_coords=DataArrayInt::New(); _fam_coords->alloc(nCoords,1); - MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,_fam_coords->getPointer()); + MEDmeshEntityFamilyNumberRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_fam_coords->getPointer()); } else _fam_coords=0; - if(MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0) + if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0) { _num_coords=DataArrayInt::New(); _num_coords->alloc(nCoords,1); - MEDmeshEntityNumberRd(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,_num_coords->getPointer()); + MEDmeshEntityNumberRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_num_coords->getPointer()); } else _num_coords=0; - if(MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NAME,MED_NODAL,&changement,&transformation)>0) + if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NAME,MED_NODAL,&changement,&transformation)>0) { _name_coords=DataArrayAsciiChar::New(); _name_coords->alloc(nCoords+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end - MEDmeshEntityNameRd(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,_name_coords->getPointer()); + MEDmeshEntityNameRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_name_coords->getPointer()); _name_coords->reAlloc(nCoords);//not a bug to avoid the memory corruption due to last \0 at the end } else _name_coords=0; for(int i=0;isetInfoOnComponent(i,infosOnComp[i].c_str()); + _coords->setInfoOnComponent(i,infosOnComp[i]); } void MEDFileUMeshL2::sortTypes() @@ -343,15 +343,15 @@ void MEDFileUMeshL2::sortTypes() _per_type_mesh.resize(_per_type_mesh.size()-nbOfUselessLev); } -void MEDFileUMeshL2::WriteCoords(med_idt fid, const char *mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords) +void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords) { if(!coords) return ; - MEDmeshNodeCoordinateWr(fid,mname,dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->getConstPointer()); + MEDmeshNodeCoordinateWr(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->getConstPointer()); if(famCoords) - MEDmeshEntityFamilyNumberWr(fid,mname,dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->getConstPointer()); + MEDmeshEntityFamilyNumberWr(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->getConstPointer()); if(numCoords) - MEDmeshEntityNumberWr(fid,mname,dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->getConstPointer()); + MEDmeshEntityNumberWr(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->getConstPointer()); if(nameCoords) { if(nameCoords->getNumberOfComponents()!=MED_SNAME_SIZE) @@ -360,7 +360,7 @@ void MEDFileUMeshL2::WriteCoords(med_idt fid, const char *mname, int dt, int it, oss << " ! The array has " << nameCoords->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDmeshEntityNameWr(fid,mname,dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->getConstPointer()); + MEDmeshEntityNameWr(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->getConstPointer()); } } @@ -392,13 +392,13 @@ MEDFileCMeshL2::MEDFileCMeshL2() { } -void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, int it) +void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it) { - _name.set(mName); + _name.set(mName.c_str()); int nstep; int Mdim; ParaMEDMEM::MEDCouplingMeshType meshType; - std::vector infosOnComp=getAxisInfoOnMesh(fid,mId,mName,meshType,nstep,Mdim); + std::vector infosOnComp=getAxisInfoOnMesh(fid,mId,mName.c_str(),meshType,nstep,Mdim); if(meshType!=CARTESIAN) throw INTERP_KERNEL::Exception("Invalid mesh type ! You are expected a structured one whereas in file it is not a structured !"); _time=CheckMeshTimeStep(fid,mName,nstep,dt,it); @@ -406,7 +406,7 @@ void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, in _order=it; // med_grid_type gridtype; - MEDmeshGridTypeRd(fid,mName,&gridtype); + MEDmeshGridTypeRd(fid,mName.c_str(),&gridtype); if(gridtype!=MED_CARTESIAN_GRID) throw INTERP_KERNEL::Exception("Invalid structured mesh ! Expected cartesian mesh type !"); _cmesh=MEDCouplingCMesh::New(); @@ -414,11 +414,11 @@ void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, in { med_data_type dataTypeReq=GetDataTypeCorrespondingToSpaceId(i); med_bool chgt=MED_FALSE,trsf=MED_FALSE; - int nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf); + int nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf); MEDCouplingAutoRefCountObjectPtr da=DataArrayDouble::New(); da->alloc(nbOfElt,1); - da->setInfoOnComponent(0,infosOnComp[i].c_str()); - MEDmeshGridIndexCoordinateRd(fid,mName,dt,it,i+1,da->getPointer()); + da->setInfoOnComponent(0,infosOnComp[i]); + MEDmeshGridIndexCoordinateRd(fid,mName.c_str(),dt,it,i+1,da->getPointer()); _cmesh->setCoordsAt(i,da); } } @@ -442,9 +442,9 @@ MEDFileCLMeshL2::MEDFileCLMeshL2() { } -void MEDFileCLMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, int it) +void MEDFileCLMeshL2::loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it) { - _name.set(mName); + _name.set(mName.c_str()); int nstep; int Mdim; ParaMEDMEM::MEDCouplingMeshType meshType; @@ -457,14 +457,14 @@ void MEDFileCLMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, i // _clmesh=MEDCouplingCurveLinearMesh::New(); INTERP_KERNEL::AutoPtr stGrid=new int[Mdim]; - MEDmeshGridStructRd(fid,mName,dt,it,stGrid); + MEDmeshGridStructRd(fid,mName.c_str(),dt,it,stGrid); _clmesh->setNodeGridStructure(stGrid,((int *)stGrid)+Mdim); med_bool chgt=MED_FALSE,trsf=MED_FALSE; - int nbNodes=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf); + int nbNodes=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf); MEDCouplingAutoRefCountObjectPtr da=DataArrayDouble::New(); da->alloc(nbNodes,infosOnComp.size()); da->setInfoOnComponents(infosOnComp); - MEDmeshNodeCoordinateRd(fid,mName,dt,it,MED_FULL_INTERLACE,da->getPointer()); + MEDmeshNodeCoordinateRd(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,da->getPointer()); _clmesh->setCoords(da); } @@ -514,7 +514,7 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other):RefCo { } -MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const char *mName, int id):_m(this) +MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::string& mName, int id):_m(this) { const std::vector< MEDCouplingAutoRefCountObjectPtr >& v=l2.getLev(id); if(v.empty()) @@ -872,7 +872,7 @@ void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector ms(_m_by_types.getParts()); int start=0; diff --git a/src/MEDLoader/MEDFileMeshLL.hxx b/src/MEDLoader/MEDFileMeshLL.hxx index eb1d37adc..5c09e91a4 100644 --- a/src/MEDLoader/MEDFileMeshLL.hxx +++ b/src/MEDLoader/MEDFileMeshLL.hxx @@ -51,11 +51,11 @@ namespace ParaMEDMEM int getIteration() const { return _iteration; } int getOrder() const { return _order; } double getTime() { return _time; } - std::vector getAxisInfoOnMesh(med_idt fid, int mId, const char *mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim); - static int GetMeshIdFromName(med_idt fid, const char *mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1); - static double CheckMeshTimeStep(med_idt fid, const char *mname, int nstep, int dt, int it); - static void ReadFamiliesAndGrps(med_idt fid, const char *mname, std::map& fams, std::map >& grps, MEDFileMeshReadSelector *mrs); - static void WriteFamiliesAndGrps(med_idt fid, const char *mname, const std::map& fams, const std::map >& grps, int tooLongStrPol); + std::vector getAxisInfoOnMesh(med_idt fid, int mId, const std::string& mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim); + static int GetMeshIdFromName(med_idt fid, const std::string& mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1); + static double CheckMeshTimeStep(med_idt fid, const std::string& mname, int nstep, int dt, int it); + static void ReadFamiliesAndGrps(med_idt fid, const std::string& mname, std::map& fams, std::map >& grps, MEDFileMeshReadSelector *mrs); + static void WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map& fams, const std::map >& grps, int tooLongStrPol); protected: MEDFileString _name; MEDFileString _description; @@ -70,9 +70,9 @@ namespace ParaMEDMEM { public: MEDFileUMeshL2(); - void loadAll(med_idt fid, int mId, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void loadConnectivity(med_idt fid, int mdim, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void loadCoords(med_idt fid, int mId, const std::vector& infosOnComp, const char *mName, int dt, int it); + void loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); + void loadConnectivity(med_idt fid, int mdim, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); + void loadCoords(med_idt fid, int mId, const std::vector& infosOnComp, const std::string& mName, int dt, int it); int getNumberOfLevels() const { return _per_type_mesh.size(); } bool emptyLev(int levId) const { return _per_type_mesh[levId].empty(); } const std::vector< MEDCouplingAutoRefCountObjectPtr >& getLev(int levId) const { return _per_type_mesh[levId]; } @@ -83,7 +83,7 @@ namespace ParaMEDMEM MEDCouplingAutoRefCountObjectPtr getCoordsFamily() const { return _fam_coords; } MEDCouplingAutoRefCountObjectPtr getCoordsNum() const { return _num_coords; } MEDCouplingAutoRefCountObjectPtr getCoordsName() const { return _name_coords; } - static void WriteCoords(med_idt fid, const char *mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords); + static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords); private: void sortTypes(); private: @@ -102,7 +102,7 @@ namespace ParaMEDMEM { public: MEDFileCMeshL2(); - void loadAll(med_idt fid, int mId, const char *mName, int dt, int it); + void loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it); MEDCouplingCMesh *getMesh() { return _cmesh; } private: static med_data_type GetDataTypeCorrespondingToSpaceId(int id); @@ -114,7 +114,7 @@ namespace ParaMEDMEM { public: MEDFileCLMeshL2(); - void loadAll(med_idt fid, int mId, const char *mName, int dt, int it); + void loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it); MEDCouplingCurveLinearMesh *getMesh() { return _clmesh; } private: MEDCouplingAutoRefCountObjectPtr _clmesh; @@ -177,7 +177,7 @@ namespace ParaMEDMEM friend class MEDFileUMeshPermCompute; public: MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other); - MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const char *mName, int id); + MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::string& mName, int id); MEDFileUMeshSplitL1(MEDCoupling1GTUMesh *m); MEDFileUMeshSplitL1(MEDCouplingUMesh *m); MEDFileUMeshSplitL1(MEDCouplingUMesh *m, bool newOrOld); @@ -213,7 +213,7 @@ namespace ParaMEDMEM void eraseFamilyField(); void setGroupsFromScratch(const std::vector& ms, std::map& familyIds, std::map >& groups) throw(INTERP_KERNEL::Exception); - void write(med_idt fid, const char *mName, int mdim) const; + void write(med_idt fid, const std::string& mName, int mdim) const; // void setFamilyArr(DataArrayInt *famArr); void setRenumArr(DataArrayInt *renumArr); diff --git a/src/MEDLoader/MEDFileParameter.cxx b/src/MEDLoader/MEDFileParameter.cxx index 0a04d8b04..38559d7ae 100644 --- a/src/MEDLoader/MEDFileParameter.cxx +++ b/src/MEDLoader/MEDFileParameter.cxx @@ -189,17 +189,17 @@ MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New() return new MEDFileParameterDouble1TS; } -MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const char *fileName) +MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const std::string& fileName) { return new MEDFileParameterDouble1TS(fileName); } -MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const char *fileName, const char *paramName) +MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const std::string& fileName, const std::string& paramName) { return new MEDFileParameterDouble1TS(fileName,paramName); } -MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const char *fileName, const char *paramName, int dt, int it) +MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const std::string& fileName, const std::string& paramName, int dt, int it) { return new MEDFileParameterDouble1TS(fileName,paramName,dt,it); } @@ -208,10 +208,10 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS() { } -MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) +MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); int nbPar=MEDnParameter(fid); std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : "; INTERP_KERNEL::AutoPtr pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); @@ -240,10 +240,10 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName, const throw INTERP_KERNEL::Exception(oss.str().c_str()); } -MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName, const char *paramName) +MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); int nbPar=MEDnParameter(fid); std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : "; INTERP_KERNEL::AutoPtr pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); @@ -280,10 +280,10 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName, const throw INTERP_KERNEL::Exception(oss.str().c_str()); } -MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName) +MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); int nbPar=MEDnParameter(fid); if(nbPar<1) { @@ -355,10 +355,10 @@ std::vector MEDFileParameterDouble1TS::getDirectChildre return std::vector(); } -void MEDFileParameterDouble1TS::write(const char *fileName, int mode) const +void MEDFileParameterDouble1TS::write(const std::string& fileName, int mode) const { med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); MEDFileParameterTinyInfo::writeLLHeader(fid,MED_FLOAT64); MEDFileParameterDouble1TSWTI::writeLL(fid,_name,*this); } @@ -368,12 +368,12 @@ MEDFileParameterMultiTS *MEDFileParameterMultiTS::New() return new MEDFileParameterMultiTS; } -MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const char *fileName) +MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const std::string& fileName) { return new MEDFileParameterMultiTS(fileName); } -MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const char *fileName, const char *paramName) +MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const std::string& fileName, const std::string& paramName) { return new MEDFileParameterMultiTS(fileName,paramName); } @@ -393,10 +393,10 @@ MEDFileParameterMultiTS::MEDFileParameterMultiTS(const MEDFileParameterMultiTS& } } -MEDFileParameterMultiTS::MEDFileParameterMultiTS(const char *fileName) +MEDFileParameterMultiTS::MEDFileParameterMultiTS(const std::string& fileName) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); int nbPar=MEDnParameter(fid); if(nbPar<1) { @@ -416,10 +416,10 @@ MEDFileParameterMultiTS::MEDFileParameterMultiTS(const char *fileName) finishLoading(fid,paramType,nbOfSteps); } -MEDFileParameterMultiTS::MEDFileParameterMultiTS(const char *fileName, const char *paramName) +MEDFileParameterMultiTS::MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); int nbPar=MEDnParameter(fid); std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : "; INTERP_KERNEL::AutoPtr pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); @@ -522,10 +522,10 @@ bool MEDFileParameterMultiTS::isEqual(const MEDFileParameterMultiTS *other, doub return true; } -void MEDFileParameterMultiTS::write(const char *fileName, int mode) const +void MEDFileParameterMultiTS::write(const std::string& fileName, int mode) const { med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); writeLL(fid,*this); } @@ -702,15 +702,15 @@ MEDFileParameters *MEDFileParameters::New() return new MEDFileParameters; } -MEDFileParameters *MEDFileParameters::New(const char *fileName) +MEDFileParameters *MEDFileParameters::New(const std::string& fileName) { return new MEDFileParameters(fileName); } -MEDFileParameters::MEDFileParameters(const char *fileName) +MEDFileParameters::MEDFileParameters(const std::string& fileName) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); int nbPar=MEDnParameter(fid); _params.resize(nbPar); INTERP_KERNEL::AutoPtr pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); @@ -722,7 +722,7 @@ MEDFileParameters::MEDFileParameters(const char *fileName) int nbOfSteps; MEDparameterInfo(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps); std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE); - _params[i]=MEDFileParameterMultiTS::New(fileName,paramNameCpp.c_str()); + _params[i]=MEDFileParameterMultiTS::New(fileName,paramNameCpp); } } @@ -784,10 +784,10 @@ MEDFileParameters::MEDFileParameters(const MEDFileParameters& other, bool deepCo } } -void MEDFileParameters::write(const char *fileName, int mode) const +void MEDFileParameters::write(const std::string& fileName, int mode) const { med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); writeLL(fid); } @@ -882,7 +882,7 @@ MEDFileParameterMultiTS *MEDFileParameters::getParamAtPos(int i) const /*! * \return an internal pointer that can be null. Warning the caller is \b not responsible of the returned pointer. */ -MEDFileParameterMultiTS *MEDFileParameters::getParamWithName(const char *paramName) const +MEDFileParameterMultiTS *MEDFileParameters::getParamWithName(const std::string& paramName) const { int pos=getPosFromParamName(paramName); return getParamAtPos(pos); @@ -898,7 +898,7 @@ void MEDFileParameters::destroyParamAtPos(int i) _params[i]=MEDCouplingAutoRefCountObjectPtr(0); } -int MEDFileParameters::getPosFromParamName(const char *paramName) const +int MEDFileParameters::getPosFromParamName(const std::string& paramName) const { std::ostringstream oss; oss << "MEDFileParameters::getPosFromParamName : no such name=" << paramName << " ! Possibilities are :"; int ret=0; diff --git a/src/MEDLoader/MEDFileParameter.hxx b/src/MEDLoader/MEDFileParameter.hxx index 1cd5d3330..1bc97c27f 100644 --- a/src/MEDLoader/MEDFileParameter.hxx +++ b/src/MEDLoader/MEDFileParameter.hxx @@ -80,9 +80,9 @@ namespace ParaMEDMEM class MEDFileParameterTinyInfo : public MEDFileWritable { public: - MEDLOADER_EXPORT void setDescription(const char *name) { _desc_name=name; } + MEDLOADER_EXPORT void setDescription(const std::string& name) { _desc_name=name; } MEDLOADER_EXPORT std::string getDescription() const { return _desc_name; } - MEDLOADER_EXPORT void setTimeUnit(const char *unit) { _dt_unit=unit; } + MEDLOADER_EXPORT void setTimeUnit(const std::string& unit) { _dt_unit=unit; } MEDLOADER_EXPORT std::string getTimeUnit() const { return _dt_unit; } MEDLOADER_EXPORT std::size_t getHeapMemSizeOfStrings() const; MEDLOADER_EXPORT bool isEqualStrings(const MEDFileParameterTinyInfo& other, std::string& what) const; @@ -99,37 +99,37 @@ namespace ParaMEDMEM { public: MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(); - MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const char *fileName); - MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName); - MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it); + MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const std::string& fileName); + MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName); + MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it); MEDLOADER_EXPORT virtual MEDFileParameter1TS *deepCpy() const; MEDLOADER_EXPORT virtual bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const; MEDLOADER_EXPORT virtual std::string simpleRepr() const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildren() const; - MEDLOADER_EXPORT void setName(const char *name) { _name=name; } + MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; } MEDLOADER_EXPORT std::string getName() const { return _name; } - MEDLOADER_EXPORT void write(const char *fileName, int mode) const; + MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; private: MEDFileParameterDouble1TS(); - MEDFileParameterDouble1TS(const char *fileName); - MEDFileParameterDouble1TS(const char *fileName, const char *paramName); - MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it); + MEDFileParameterDouble1TS(const std::string& fileName); + MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName); + MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it); }; class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo { public: MEDLOADER_EXPORT static MEDFileParameterMultiTS *New(); - MEDLOADER_EXPORT static MEDFileParameterMultiTS *New(const char *fileName); - MEDLOADER_EXPORT static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName); + MEDLOADER_EXPORT static MEDFileParameterMultiTS *New(const std::string& fileName); + MEDLOADER_EXPORT static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName); MEDLOADER_EXPORT std::string getName() const { return _name; } - MEDLOADER_EXPORT void setName(const char *name) { _name=name; } + MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; } MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildren() const; MEDLOADER_EXPORT MEDFileParameterMultiTS *deepCpy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileParameterMultiTS *other, double eps, std::string& what) const; - MEDLOADER_EXPORT void write(const char *fileName, int mode) const; + MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& mw) const; MEDLOADER_EXPORT std::string simpleRepr() const; MEDLOADER_EXPORT void appendValue(int dt, int it, double time, double val); @@ -144,8 +144,8 @@ namespace ParaMEDMEM protected: MEDFileParameterMultiTS(); MEDFileParameterMultiTS(const MEDFileParameterMultiTS& other, bool deepCopy); - MEDFileParameterMultiTS(const char *fileName); - MEDFileParameterMultiTS(const char *fileName, const char *paramName); + MEDFileParameterMultiTS(const std::string& fileName); + MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName); void finishLoading(med_idt fid, med_parameter_type typ, int nbOfSteps); protected: std::vector< MEDCouplingAutoRefCountObjectPtr > _param_per_ts; @@ -155,12 +155,12 @@ namespace ParaMEDMEM { public: MEDLOADER_EXPORT static MEDFileParameters *New(); - MEDLOADER_EXPORT static MEDFileParameters *New(const char *fileName); + MEDLOADER_EXPORT static MEDFileParameters *New(const std::string& fileName); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildren() const; MEDLOADER_EXPORT MEDFileParameters *deepCpy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileParameters *other, double eps, std::string& what) const; - MEDLOADER_EXPORT void write(const char *fileName, int mode) const; + MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT std::vector getParamsNames() const; MEDLOADER_EXPORT std::string simpleRepr() const; @@ -169,13 +169,13 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void pushParam(MEDFileParameterMultiTS *param); MEDLOADER_EXPORT void setParamAtPos(int i, MEDFileParameterMultiTS *param); MEDLOADER_EXPORT MEDFileParameterMultiTS *getParamAtPos(int i) const; - MEDLOADER_EXPORT MEDFileParameterMultiTS *getParamWithName(const char *paramName) const; + MEDLOADER_EXPORT MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const; MEDLOADER_EXPORT void destroyParamAtPos(int i); - MEDLOADER_EXPORT int getPosFromParamName(const char *paramName) const; + MEDLOADER_EXPORT int getPosFromParamName(const std::string& paramName) const; MEDLOADER_EXPORT int getNumberOfParams() const; protected: void simpleRepr2(int bkOffset, std::ostream& oss) const; - MEDFileParameters(const char *fileName); + MEDFileParameters(const std::string& fileName); MEDFileParameters(const MEDFileParameters& other, bool deepCopy); MEDFileParameters(); protected: diff --git a/src/MEDLoader/MEDFileUtilities.cxx b/src/MEDLoader/MEDFileUtilities.cxx index e2152003e..3d2cbe48d 100644 --- a/src/MEDLoader/MEDFileUtilities.cxx +++ b/src/MEDLoader/MEDFileUtilities.cxx @@ -56,7 +56,7 @@ const char *MEDFileUtilities::GetReadableMEDFieldType(med_field_type ft) } } -void MEDFileUtilities::CheckMEDCode(int code, med_idt fid, const char *msg) +void MEDFileUtilities::CheckMEDCode(int code, med_idt fid, const std::string& msg) { if(code<0) { @@ -66,7 +66,7 @@ void MEDFileUtilities::CheckMEDCode(int code, med_idt fid, const char *msg) } } -void MEDFileUtilities::CheckFileForRead(const char *fileName) +void MEDFileUtilities::CheckFileForRead(const std::string& fileName) { int status=MEDLoaderBase::getStatusOfFile(fileName); std::ostringstream oss; @@ -89,7 +89,7 @@ void MEDFileUtilities::CheckFileForRead(const char *fileName) throw INTERP_KERNEL::Exception(oss.str().c_str()); } } - AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); if(fid<0) { oss << " has been detected as unreadable by MED file : impossible to read anything !"; diff --git a/src/MEDLoader/MEDFileUtilities.hxx b/src/MEDLoader/MEDFileUtilities.hxx index a17a407ee..426d3f2d1 100644 --- a/src/MEDLoader/MEDFileUtilities.hxx +++ b/src/MEDLoader/MEDFileUtilities.hxx @@ -30,8 +30,8 @@ namespace MEDFileUtilities { med_access_mode TraduceWriteMode(int medloaderwritemode); const char *GetReadableMEDFieldType(med_field_type ft); - void CheckMEDCode(int code, med_idt fid, const char *msg); - void CheckFileForRead(const char *fileName); + void CheckMEDCode(int code, med_idt fid, const std::string& msg); + void CheckFileForRead(const std::string& fileName); class AutoFid { diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index 802903ef2..d4a5ed8e4 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -141,10 +141,10 @@ using namespace ParaMEDMEM; namespace MEDLoaderNS { - int readUMeshDimFromFile(const char *fileName, const char *meshName, std::vector& possibilities); + int readUMeshDimFromFile(const std::string& fileName, const std::string& meshName, std::vector& possibilities); void dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entity_type& whichEntity); - void writeFieldWithoutReadingAndMappingOfMeshInFile(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch); - med_int getIdFromMeshName(med_idt fid, const char *meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception); + void writeFieldWithoutReadingAndMappingOfMeshInFile(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch); + med_int getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception); std::vector getMeshNamesFid(med_idt fid); } @@ -154,14 +154,14 @@ namespace MEDLoaderNS /// @cond INTERNAL /*! - * This method returns a first quick overview of mesh with name 'meshName' into the file 'fileName'. + * This method returns a first quick overview of mesh with name \a meshName into the file \a fileName. * @param possibilities the relativeToMeshDim authorized to returned maxdim. This vector is systematically cleared at the begin of this method. * @return the maximal mesh dimension of specified mesh. If nothing found -1 is returned. */ -int MEDLoaderNS::readUMeshDimFromFile(const char *fileName, const char *meshName, std::vector& possibilities) +int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::string& meshName, std::vector& possibilities) { possibilities.clear(); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); int ret; std::set poss; char nommaa[MED_NAME_SIZE+1]; @@ -214,9 +214,9 @@ int MEDLoaderNS::readUMeshDimFromFile(const char *fileName, const char *meshName return ret; } -med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const char *meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception) +med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception) { - if(meshName==0) + if(meshName.empty()) { std::vector meshes=getMeshNamesFid(fid); if(meshes.empty()) @@ -343,10 +343,10 @@ void MEDLoader::SetTooLongStrPolicy(int val) * - the space dimension * - the number of nodes */ -std::vector< std::vector< std::pair > > MEDLoader::GetUMeshGlobalInfo(const char *fileName, const char *meshName, int &meshDim, int& spaceDim, int& numberOfNodes) +std::vector< std::vector< std::pair > > MEDLoader::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes) { CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); std::set poss; char nommaa[MED_NAME_SIZE+1]; char maillage_description[MED_COMMENT_SIZE+1]; @@ -401,23 +401,23 @@ std::vector< std::vector< std::pair > > M return ret; } -void MEDLoader::CheckFileForRead(const char *fileName) +void MEDLoader::CheckFileForRead(const std::string& fileName) { MEDFileUtilities::CheckFileForRead(fileName); } -std::vector MEDLoader::GetMeshNames(const char *fileName) +std::vector MEDLoader::GetMeshNames(const std::string& fileName) { CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); std::vector ret=MEDLoaderNS::getMeshNamesFid(fid); return ret; } -std::vector< std::pair > MEDLoader::GetComponentsNamesOfField(const char *fileName, const char *fieldName) +std::vector< std::pair > MEDLoader::GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName) { CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); std::vector fields(nbFields); med_field_type typcha; @@ -450,12 +450,12 @@ std::vector< std::pair > MEDLoader::GetComponentsNamesO throw INTERP_KERNEL::Exception(oss.str().c_str()); } -std::vector MEDLoader::GetMeshNamesOnField(const char *fileName, const char *fieldName) +std::vector MEDLoader::GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName) { CheckFileForRead(fileName); std::vector ret; // - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); // med_field_type typcha; @@ -479,23 +479,23 @@ std::vector MEDLoader::GetMeshNamesOnField(const char *fileName, co return ret; } -std::vector MEDLoader::GetMeshFamiliesNames(const char *fileName, const char *meshName) +std::vector MEDLoader::GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName) { CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); - med_int nfam=MEDnFamily(fid,meshName); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); + med_int nfam=MEDnFamily(fid,meshName.c_str()); std::vector ret(nfam); char nomfam[MED_NAME_SIZE+1]; med_int numfam; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; INTERP_KERNEL::AutoPtr attdes=new char[MED_COMMENT_SIZE*natt+1]; INTERP_KERNEL::AutoPtr gro=new char[MED_LNAME_SIZE*ngro+1]; - MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro); + MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro); std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam)); ret[i]=cur; } @@ -503,23 +503,23 @@ std::vector MEDLoader::GetMeshFamiliesNames(const char *fileName, c } -std::vector MEDLoader::GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) +std::vector MEDLoader::GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName) { CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); - med_int nfam=MEDnFamily(fid,meshName); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); + med_int nfam=MEDnFamily(fid,meshName.c_str()); std::vector ret; char nomfam[MED_NAME_SIZE+1]; med_int numfam; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; INTERP_KERNEL::AutoPtr attdes=new char[MED_COMMENT_SIZE*natt+1]; INTERP_KERNEL::AutoPtr gro=new char[MED_LNAME_SIZE*ngro+1]; - MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro); + MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro); std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam)); for(int j=0;j MEDLoader::GetMeshFamiliesNamesOnGroup(const char *file return ret; } -std::vector MEDLoader::GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) +std::vector MEDLoader::GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName) { CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); - med_int nfam=MEDnFamily(fid,meshName); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); + med_int nfam=MEDnFamily(fid,meshName.c_str()); std::vector ret; char nomfam[MED_NAME_SIZE+1]; med_int numfam; bool found=false; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; INTERP_KERNEL::AutoPtr attdes=new char[MED_COMMENT_SIZE*natt+1]; INTERP_KERNEL::AutoPtr gro=new char[MED_LNAME_SIZE*ngro+1]; - MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro); + MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro); std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam)); found=(cur==famName); if(found) @@ -568,23 +568,23 @@ std::vector MEDLoader::GetMeshGroupsNamesOnFamily(const char *fileN } -std::vector MEDLoader::GetMeshGroupsNames(const char *fileName, const char *meshName) +std::vector MEDLoader::GetMeshGroupsNames(const std::string& fileName, const std::string& meshName) { CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); - med_int nfam=MEDnFamily(fid,meshName); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); + med_int nfam=MEDnFamily(fid,meshName.c_str()); std::vector ret; char nomfam[MED_NAME_SIZE+1]; med_int numfam; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; INTERP_KERNEL::AutoPtr attdes=new char[MED_COMMENT_SIZE*natt+1]; INTERP_KERNEL::AutoPtr gro=new char[MED_LNAME_SIZE*ngro+1]; - MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro); + MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro); for(int j=0;j MEDLoader::GetMeshGroupsNames(const char *fileName, con } return ret; } -std::vector MEDLoader::GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) +std::vector MEDLoader::GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName) { CheckFileForRead(fileName); std::vector ret; - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); // med_field_type typcha; @@ -664,11 +664,11 @@ std::vector MEDLoader::GetTypesOfField(const char *file return ret; } -std::vector MEDLoader::GetAllFieldNames(const char *fileName) +std::vector MEDLoader::GetAllFieldNames(const std::string& fileName) { CheckFileForRead(fileName); std::vector ret; - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); med_field_type typcha; for(int i=0;i MEDLoader::GetAllFieldNames(const char *fileName) return ret; } -std::vector MEDLoader::GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) +std::vector MEDLoader::GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) { CheckFileForRead(fileName); std::vector ret; - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); // med_field_type typcha; @@ -718,7 +718,7 @@ std::vector MEDLoader::GetAllFieldNamesOnMesh(const char *fileName, return ret; } -std::vector MEDLoader::GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) +std::vector MEDLoader::GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName) { CheckFileForRead(fileName); switch(type) @@ -732,11 +732,11 @@ std::vector MEDLoader::GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField } } -std::vector MEDLoader::GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) +std::vector MEDLoader::GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) { CheckFileForRead(fileName); std::vector ret; - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); // med_field_type typcha; @@ -782,11 +782,11 @@ std::vector MEDLoader::GetCellFieldNamesOnMesh(const char *fileName return ret; } -std::vector MEDLoader::GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) +std::vector MEDLoader::GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) { CheckFileForRead(fileName); std::vector ret; - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); char pflname[MED_NAME_SIZE+1]=""; char locname[MED_NAME_SIZE+1]=""; @@ -823,11 +823,11 @@ std::vector MEDLoader::GetNodeFieldNamesOnMesh(const char *fileName return ret; } -std::vector< std::pair< std::pair, double> > MEDLoader::GetAllFieldIterations(const char *fileName, const char *fieldName) +std::vector< std::pair< std::pair, double> > MEDLoader::GetAllFieldIterations(const std::string& fileName, const std::string& fieldName) { CheckFileForRead(fileName); std::vector< std::pair< std::pair, double > > ret; - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); // med_field_type typcha; @@ -866,10 +866,10 @@ std::vector< std::pair< std::pair, double> > MEDLoader::GetAllFieldIter throw INTERP_KERNEL::Exception(oss.str().c_str()); } -double MEDLoader::GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) +double MEDLoader::GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order) { CheckFileForRead(fileName); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); // med_field_type typcha; @@ -914,7 +914,7 @@ double MEDLoader::GetTimeAttachedOnFieldIteration(const char *fileName, const ch return ret; } -std::vector< std::pair > MEDLoader::GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) +std::vector< std::pair > MEDLoader::GetFieldIterations(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName) { CheckFileForRead(fileName); switch(type) @@ -928,12 +928,12 @@ std::vector< std::pair > MEDLoader::GetFieldIterations(ParaMEDMEM::Type } } -std::vector< std::pair > MEDLoader::GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) +std::vector< std::pair > MEDLoader::GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) { CheckFileForRead(fileName); std::string meshNameCpp(meshName); std::vector< std::pair > ret; - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); // med_field_type typcha; @@ -1000,12 +1000,12 @@ std::vector< std::pair > MEDLoader::GetCellFieldIterations(const char * return ret; } -std::vector< std::pair > MEDLoader::GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) +std::vector< std::pair > MEDLoader::GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) { CheckFileForRead(fileName); std::string meshNameCpp(meshName); std::vector< std::pair > ret; - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); // med_field_type typcha; @@ -1065,7 +1065,7 @@ std::vector< std::pair > MEDLoader::GetNodeFieldIterations(const char * return ret; } -ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax) +ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax) { CheckFileForRead(fileName); MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); @@ -1089,7 +1089,7 @@ ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const char *fileName, c throw INTERP_KERNEL::Exception(oss.str().c_str()); } -ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const char *fileName, int meshDimRelToMax) +ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax) { CheckFileForRead(fileName); MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName)); @@ -1113,7 +1113,7 @@ ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const char *fileName, i throw INTERP_KERNEL::Exception(oss.str().c_str()); } -ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax) +ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax) { CheckFileForRead(fileName); MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); @@ -1127,7 +1127,7 @@ ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const char *fileName, return mmuPtr->getMeshAtLevel(meshDimRelToMax,true); } -ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const char *fileName, int meshDimRelToMax) +ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax) { CheckFileForRead(fileName); MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName)); @@ -1141,14 +1141,14 @@ ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const char *fileName, return mmuPtr->getMeshAtLevel(meshDimRelToMax,true); } -int MEDLoader::ReadUMeshDimFromFile(const char *fileName, const char *meshName) +int MEDLoader::ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName) { CheckFileForRead(fileName); std::vector poss; return MEDLoaderNS::readUMeshDimFromFile(fileName,meshName,poss); } -ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector& fams) +ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& fams) { CheckFileForRead(fileName); MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); @@ -1162,7 +1162,7 @@ ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFamilies(const char *fileN return mmuPtr->getFamilies(meshDimRelToMax,fams,true); } -ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector& grps) +ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& grps) { CheckFileForRead(fileName); MEDCouplingAutoRefCountObjectPtr mm=MEDFileMesh::New(fileName,meshName); @@ -1176,7 +1176,7 @@ ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromGroups(const char *fileNam return mmuPtr->getGroups(meshDimRelToMax,grps,true); } -ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadField(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) +ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadField(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { CheckFileForRead(fileName); switch(type) @@ -1194,7 +1194,7 @@ ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadField(ParaMEDMEM::TypeOfField } } -std::vector MEDLoader::ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, +std::vector MEDLoader::ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, const std::vector >& its) throw(INTERP_KERNEL::Exception) { if(its.empty()) @@ -1231,31 +1231,31 @@ std::vector MEDLoader::ReadFieldsOnSameMes return ret; } -std::vector MEDLoader::ReadFieldsCellOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, +std::vector MEDLoader::ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, const std::vector >& its) throw(INTERP_KERNEL::Exception) { return ReadFieldsOnSameMesh(ON_CELLS,fileName,meshName,meshDimRelToMax,fieldName,its); } -std::vector MEDLoader::ReadFieldsNodeOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, +std::vector MEDLoader::ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, const std::vector >& its) throw(INTERP_KERNEL::Exception) { return ReadFieldsOnSameMesh(ON_NODES,fileName,meshName,meshDimRelToMax,fieldName,its); } -std::vector MEDLoader::ReadFieldsGaussOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, +std::vector MEDLoader::ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, const std::vector >& its) throw(INTERP_KERNEL::Exception) { return ReadFieldsOnSameMesh(ON_GAUSS_PT,fileName,meshName,meshDimRelToMax,fieldName,its); } -std::vector MEDLoader::ReadFieldsGaussNEOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, +std::vector MEDLoader::ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, const std::vector >& its) throw(INTERP_KERNEL::Exception) { return ReadFieldsOnSameMesh(ON_GAUSS_NE,fileName,meshName,meshDimRelToMax,fieldName,its); } -ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) +ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { MEDCouplingAutoRefCountObjectPtr ff=MEDFileField1TS::New(fileName,fieldName,iteration,order); MEDCouplingAutoRefCountObjectPtr mm=MEDFileMesh::New(fileName,meshName); @@ -1272,7 +1272,7 @@ ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldCell(const char *fileNam return ret.retn(); } -ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) +ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { MEDCouplingAutoRefCountObjectPtr ff=MEDFileField1TS::New(fileName,fieldName,iteration,order); MEDCouplingAutoRefCountObjectPtr mm=MEDFileMesh::New(fileName,meshName); @@ -1314,7 +1314,7 @@ ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldNode(const char *fileNam return ret.retn(); } -ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) +ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { MEDCouplingAutoRefCountObjectPtr ff=MEDFileField1TS::New(fileName,fieldName,iteration,order); MEDCouplingAutoRefCountObjectPtr mm=MEDFileMesh::New(fileName,meshName); @@ -1331,7 +1331,7 @@ ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGauss(const char *fileNa return ret.retn(); } -ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) +ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { MEDCouplingAutoRefCountObjectPtr ff=MEDFileField1TS::New(fileName,fieldName,iteration,order); MEDCouplingAutoRefCountObjectPtr mm=MEDFileMesh::New(fileName,meshName); @@ -1348,7 +1348,7 @@ ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGaussNE(const char *file return ret.retn(); } -void MEDLoader::WriteMesh(const char *fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch) +void MEDLoader::WriteMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch) { if(!mesh) throw INTERP_KERNEL::Exception("MEDLoader::WriteMesh : input mesh is null !"); @@ -1389,7 +1389,7 @@ void MEDLoader::WriteMesh(const char *fileName, const ParaMEDMEM::MEDCouplingMes throw INTERP_KERNEL::Exception("MEDLoader::WriteMesh : only MEDCouplingUMesh, MEDCoupling1GTUMesh, MEDCouplingCMesh, MEDCouplingCurveLinear are dealed in this API for the moment !"); } -void MEDLoader::WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) +void MEDLoader::WriteUMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) { if(!mesh) throw INTERP_KERNEL::Exception("MEDLoader::WriteUMesh : input mesh is null !"); @@ -1401,12 +1401,12 @@ void MEDLoader::WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUM m->write(fileName,mod); } -void MEDLoader::WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) +void MEDLoader::WriteUMeshDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) { MEDLoader::WriteUMesh(fileName,mesh,writeFromScratch); } -void MEDLoader::WriteUMeshesPartition(const char *fileName, const char *meshNameC, const std::vector& meshes, bool writeFromScratch) +void MEDLoader::WriteUMeshesPartition(const std::string& fileName, const std::string& meshNameC, const std::vector& meshes, bool writeFromScratch) { std::string meshName(meshNameC); if(meshName.empty()) @@ -1425,12 +1425,12 @@ void MEDLoader::WriteUMeshesPartition(const char *fileName, const char *meshName m->write(fileName,mod); } -void MEDLoader::WriteUMeshesPartitionDep(const char *fileName, const char *meshNameC, const std::vector& meshes, bool writeFromScratch) +void MEDLoader::WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshNameC, const std::vector& meshes, bool writeFromScratch) { WriteUMeshesPartition(fileName,meshNameC,meshes,writeFromScratch); } -void MEDLoader::WriteUMeshes(const char *fileName, const std::vector& meshes, bool writeFromScratch) +void MEDLoader::WriteUMeshes(const std::string& fileName, const std::vector& meshes, bool writeFromScratch) { int mod=writeFromScratch?2:0; MEDCouplingAutoRefCountObjectPtr m(MEDFileUMesh::New()); @@ -1439,7 +1439,7 @@ void MEDLoader::WriteUMeshes(const char *fileName, const std::vectorwrite(fileName,mod); } -void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) +void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) { MEDCouplingAutoRefCountObjectPtr ff(MEDFileField1TS::New()); MEDLoader::AssignStaticWritePropertiesTo(*ff); @@ -1492,7 +1492,7 @@ void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const char *fil ff->write(fileName,0); } -void MEDLoader::WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) +void MEDLoader::WriteField(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) { if(!f) throw INTERP_KERNEL::Exception("MEDLoader::WriteField : input field is NULL !"); @@ -1579,12 +1579,12 @@ void MEDLoader::WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFi } } -void MEDLoader::WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) +void MEDLoader::WriteFieldDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) { WriteField(fileName,f,writeFromScratch); } -void MEDLoader::WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) +void MEDLoader::WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) { if(!f) throw INTERP_KERNEL::Exception("MEDLoader::WriteFieldUsingAlreadyWrittenMesh : input field is null !"); diff --git a/src/MEDLoader/MEDLoader.hxx b/src/MEDLoader/MEDLoader.hxx index 1f0a7b130..feae9ede5 100644 --- a/src/MEDLoader/MEDLoader.hxx +++ b/src/MEDLoader/MEDLoader.hxx @@ -47,57 +47,57 @@ class MEDLOADER_EXPORT MEDLoader static bool HasXDR(); static std::string MEDFileVersionStr(); static void MEDFileVersion(int& major, int& minor, int& release); - static void CheckFileForRead(const char *fileName); - static std::vector GetMeshNames(const char *fileName); - static std::vector< std::vector< std::pair > > GetUMeshGlobalInfo(const char *fileName, const char *meshName, int &meshDim, int& spaceDim, int& numberOfNodes); - static std::vector< std::pair > GetComponentsNamesOfField(const char *fileName, const char *fieldName); - static std::vector GetMeshNamesOnField(const char *fileName, const char *fieldName); - static std::vector GetMeshGroupsNames(const char *fileName, const char *meshName); - static std::vector GetMeshFamiliesNames(const char *fileName, const char *meshName); - static std::vector GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName); - static std::vector GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName); - static std::vector GetAllFieldNames(const char *fileName); - static std::vector GetAllFieldNamesOnMesh(const char *fileName, const char *meshName); - static std::vector GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName); - static std::vector GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName); - static std::vector GetCellFieldNamesOnMesh(const char *fileName, const char *meshName); - static std::vector GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName); - static std::vector< std::pair > GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName); - static std::vector< std::pair > GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName); - static std::vector< std::pair > GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName); - static std::vector< std::pair< std::pair, double> > GetAllFieldIterations(const char *fileName, const char *fieldName); - static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order); - static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector& fams); - static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector& grps); - static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0); - static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const char *fileName, int meshDimRelToMax=0); - static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0); - static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0); - static int ReadUMeshDimFromFile(const char *fileName, const char *meshName); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order); - static std::vector ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, + static void CheckFileForRead(const std::string& fileName); + static std::vector GetMeshNames(const std::string& fileName); + static std::vector< std::vector< std::pair > > GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes); + static std::vector< std::pair > GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName); + static std::vector GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName); + static std::vector GetMeshGroupsNames(const std::string& fileName, const std::string& meshName); + static std::vector GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName); + static std::vector GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName); + static std::vector GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName); + static std::vector GetAllFieldNames(const std::string& fileName); + static std::vector GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName); + static std::vector GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName); + static std::vector GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName); + static std::vector GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName); + static std::vector GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName); + static std::vector< std::pair > GetFieldIterations(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName); + static std::vector< std::pair > GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName); + static std::vector< std::pair > GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName); + static std::vector< std::pair< std::pair, double> > GetAllFieldIterations(const std::string& fileName, const std::string& fieldName); + static double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order); + static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& fams); + static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& grps); + static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0); + static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0); + static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0); + static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0); + static int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName); + static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + static std::vector ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, const std::vector >& its) throw(INTERP_KERNEL::Exception); - static std::vector ReadFieldsCellOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, + static std::vector ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, const std::vector >& its) throw(INTERP_KERNEL::Exception); - static std::vector ReadFieldsNodeOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, + static std::vector ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, const std::vector >& its) throw(INTERP_KERNEL::Exception); - static std::vector ReadFieldsGaussOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, + static std::vector ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, const std::vector >& its) throw(INTERP_KERNEL::Exception); - static std::vector ReadFieldsGaussNEOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, + static std::vector ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, const std::vector >& its) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order); - static void WriteMesh(const char *fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch); - static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch); - static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch); - static void WriteUMeshesPartition(const char *fileName, const char *meshName, const std::vector& meshes, bool writeFromScratch); - static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, const std::vector& meshes, bool writeFromScratch); - static void WriteUMeshes(const char *fileName, const std::vector& meshes, bool writeFromScratch); - static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch); - static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch); - static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f); + static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + static void WriteMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch); + static void WriteUMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch); + static void WriteUMeshDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch); + static void WriteUMeshesPartition(const std::string& fileName, const std::string& meshName, const std::vector& meshes, bool writeFromScratch); + static void WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshName, const std::vector& meshes, bool writeFromScratch); + static void WriteUMeshes(const std::string& fileName, const std::vector& meshes, bool writeFromScratch); + static void WriteField(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch); + static void WriteFieldDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch); + static void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f); public: static void AssignStaticWritePropertiesTo(ParaMEDMEM::MEDFileWritable& obj); private: diff --git a/src/MEDLoader/MEDLoaderBase.cxx b/src/MEDLoader/MEDLoaderBase.cxx index e35e58563..fe0aa8bf8 100644 --- a/src/MEDLoader/MEDLoaderBase.cxx +++ b/src/MEDLoader/MEDLoaderBase.cxx @@ -28,16 +28,16 @@ const char MEDLoaderBase::WHITE_SPACES[]=" \n"; -int MEDLoaderBase::getStatusOfFile(const char *fileName) +int MEDLoaderBase::getStatusOfFile(const std::string& fileName) { std::ifstream ifs; - ifs.open(fileName); + ifs.open(fileName.c_str()); if((ifs.rdstate() & std::ifstream::failbit)!=0) { ifs.close(); return NOT_EXIST; } - std::ofstream ofs(fileName,std::ios_base::app); + std::ofstream ofs(fileName.c_str(),std::ios_base::app); if((ofs.rdstate() & std::ofstream::failbit)!=0) { return EXIST_RDONLY; @@ -199,7 +199,7 @@ std::string MEDLoaderBase::buildStringFromFortran(const char *expr, int lgth) * This method given the target size to respect 'sizeToRespect' tries to reduce size of 'src' string. * This method uses several soft methods to do its job. But if it fails a simple cut of string will be performed. */ -std::string MEDLoaderBase::zipString(const char *src, int sizeToRespect) +std::string MEDLoaderBase::zipString(const std::string& src, int sizeToRespect) { std::string s(src); strip(s); diff --git a/src/MEDLoader/MEDLoaderBase.hxx b/src/MEDLoader/MEDLoaderBase.hxx index 9ec2093b3..7d60b7e5c 100644 --- a/src/MEDLoader/MEDLoaderBase.hxx +++ b/src/MEDLoader/MEDLoaderBase.hxx @@ -29,7 +29,7 @@ class MEDLOADER_EXPORT MEDLoaderBase { public: - static int getStatusOfFile(const char *fileName); + static int getStatusOfFile(const std::string& fileName); static char *buildEmptyString(int lgth); static void getDirAndBaseName(const std::string& fullName, std::string& dirName, std::string& baseName); static std::string getPathSep(); @@ -41,7 +41,7 @@ public: static void safeStrCpy2(const char *src, int maxLgth, char *dest, int behaviour); static std::string buildStringFromFortran(const char *expr, int lgth); static void zipEqualConsChar(std::string& s, int minConsSmChar); - static std::string zipString(const char *src, int sizeToRespect); + static std::string zipString(const std::string& src, int sizeToRespect); public: static const int EXIST_RW=0; static const int NOT_EXIST=1; diff --git a/src/MEDLoader/SauvReader.cxx b/src/MEDLoader/SauvReader.cxx index 7c76e36cb..848d5e4c2 100644 --- a/src/MEDLoader/SauvReader.cxx +++ b/src/MEDLoader/SauvReader.cxx @@ -44,14 +44,14 @@ using namespace std; */ //================================================================================ -SauvReader* SauvReader::New(const char *fileName) +SauvReader* SauvReader::New(const std::string& fileName) { - if ( !fileName || strlen(fileName) < 1 ) THROW_IK_EXCEPTION("Invalid file name"); + if ( fileName.empty() ) THROW_IK_EXCEPTION("Invalid file name"); ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr< SauvUtilities::FileReader> parser; // try to open as XRD - parser = new XDRReader( fileName ); + parser = new XDRReader( fileName.c_str() ); if ( parser->open() ) { SauvReader* reader = new SauvReader; @@ -60,7 +60,7 @@ SauvReader* SauvReader::New(const char *fileName) } // try to open as ASCII - parser = new ASCIIReader( fileName ); + parser = new ASCIIReader( fileName.c_str() ); if ( parser->open() ) { SauvReader* reader = new SauvReader; diff --git a/src/MEDLoader/SauvReader.hxx b/src/MEDLoader/SauvReader.hxx index cb7b7e6b6..e6d3b53d5 100644 --- a/src/MEDLoader/SauvReader.hxx +++ b/src/MEDLoader/SauvReader.hxx @@ -46,7 +46,7 @@ namespace ParaMEDMEM class SauvReader : public ParaMEDMEM::RefCountObject { public: - MEDLOADER_EXPORT static SauvReader* New(const char *fileName); + MEDLOADER_EXPORT static SauvReader* New(const std::string& fileName); MEDLOADER_EXPORT ParaMEDMEM::MEDFileData * loadInMEDFileDS(); MEDLOADER_EXPORT ~SauvReader(); diff --git a/src/MEDLoader/SauvWriter.cxx b/src/MEDLoader/SauvWriter.cxx index 6478c2bbe..73e59c3d4 100644 --- a/src/MEDLoader/SauvWriter.cxx +++ b/src/MEDLoader/SauvWriter.cxx @@ -621,10 +621,10 @@ void SauvWriter::makeProfileIDs( SubMesh* sm, */ //================================================================================ -void SauvWriter::write(const char* fileName) +void SauvWriter::write(const std::string& fileName) { std::fstream fileStream; - fileStream.open( fileName, ios::out); + fileStream.open( fileName.c_str(), ios::out); if #ifdef WIN32 ( !fileStream || !fileStream.is_open() ) diff --git a/src/MEDLoader/SauvWriter.hxx b/src/MEDLoader/SauvWriter.hxx index bbbdce98d..cbb64d3e6 100644 --- a/src/MEDLoader/SauvWriter.hxx +++ b/src/MEDLoader/SauvWriter.hxx @@ -48,7 +48,7 @@ namespace ParaMEDMEM public: MEDLOADER_EXPORT static SauvWriter *New(); MEDLOADER_EXPORT void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0); - MEDLOADER_EXPORT void write(const char* fileName); + MEDLOADER_EXPORT void write(const std::string& fileName); MEDLOADER_EXPORT void setCpyGrpIfOnASingleFamilyStatus(bool status); MEDLOADER_EXPORT bool getCpyGrpIfOnASingleFamilyStatus() const; private: diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index e3812d071..a5ee0a006 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -226,19 +226,19 @@ public: static void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception); static void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception); static void SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception); - static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception); - static std::vector GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception); - static std::vector GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); - static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); + static void CheckFileForRead(const std::string& fileName) throw(INTERP_KERNEL::Exception); + static std::vector GetMeshNames(const std::string& fileName) throw(INTERP_KERNEL::Exception); + static std::vector GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception); + static std::vector GetMeshGroupsNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); + static std::vector GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); + static std::vector GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName) throw(INTERP_KERNEL::Exception); + static std::vector GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName) throw(INTERP_KERNEL::Exception); + static std::vector GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); + static std::vector GetAllFieldNames(const std::string& fileName) throw(INTERP_KERNEL::Exception); + static std::vector GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); + static std::vector GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); + static std::vector GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); + static double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); static void AssignStaticWritePropertiesTo(ParaMEDMEM::MEDFileWritable& obj) throw(INTERP_KERNEL::Exception); %extend { @@ -253,7 +253,7 @@ public: return ret; } - static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception) + static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) { std::vector< std::pair > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName); PyObject *ret=PyList_New(res.size()); @@ -268,7 +268,7 @@ public: return ret; } - static PyObject *GetAllFieldIterations(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception) + static PyObject *GetAllFieldIterations(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) { std::vector< std::pair< std::pair, double> > res=MEDLoader::GetAllFieldIterations(fileName,fieldName); PyObject *ret=PyList_New(res.size()); @@ -284,7 +284,7 @@ public: return ret; } - static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception) + static PyObject *GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) { std::vector< std::pair > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName); PyObject *ret=PyList_New(res.size()); @@ -298,7 +298,7 @@ public: } return ret; } - static PyObject *GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception) + static PyObject *GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) { std::vector< std::pair > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName); PyObject *ret=PyList_New(res.size()); @@ -312,7 +312,7 @@ public: } return ret; } - static PyObject *GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception) + static PyObject *GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) { std::vector< std::pair > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName); PyObject *ret=PyList_New(res.size()); @@ -326,7 +326,7 @@ public: } return ret; } - static PyObject *GetUMeshGlobalInfo(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception) + static PyObject *GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception) { int meshDim,spaceDim,numberOfNodes; std::vector< std::vector< std::pair > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes); @@ -353,32 +353,32 @@ public: PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes)); return ret; } - static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, - const char *fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception) + static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, + const std::string& fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception) { std::vector > its=convertTimePairIdsFromPy(liIts); std::vector res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its); return convertFieldDoubleVecToPy(res); } - static void WriteUMeshesPartition(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) + static void WriteUMeshesPartition(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) { std::vector v; convertFromPyObjVectorOfObj(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v); MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch); } - static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) + static void WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) { std::vector v; convertFromPyObjVectorOfObj(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v); MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch); } - static void WriteUMeshes(const char *fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) + static void WriteUMeshes(const std::string& fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) { std::vector v; convertFromPyObjVectorOfObj(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v); MEDLoader::WriteUMeshes(fileName,v,writeFromScratch); } - static PyObject *GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception) + static PyObject *GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) { std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName); int size=v.size(); @@ -387,35 +387,35 @@ public: PyList_SetItem(ret,i,PyInt_FromLong((int)v[i])); return ret; } - static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception) + static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception) { std::vector grps; converPyListToVecString(li,grps); return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps); } - static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception) + static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception) { std::vector fams; converPyListToVecString(li,fams); return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams); } } - static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); - static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static void WriteMesh(const char *fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception); + static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); + static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); + static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); + static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); + static int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); + static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); + static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); + static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); + static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); + static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); + static void WriteMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception); + static void WriteUMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception); + static void WriteUMeshDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception); + static void WriteField(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception); + static void WriteFieldDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception); + static void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception); }; namespace ParaMEDMEM @@ -469,18 +469,18 @@ namespace ParaMEDMEM class MEDFileMesh : public RefCountObject, public MEDFileWritable { public: - static MEDFileMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); - static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception); virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception); virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception); virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception); - void setName(const char *name); + void setName(const std::string& name); std::string getName(); - const char *getUnivName() const; + std::string getUnivName() const; bool getUnivNameWrStatus() const; void setUnivNameWrStatus(bool newStatus); - void setDescription(const char *name); + void setDescription(const std::string& name); std::string getDescription() const; void setOrder(int order); int getOrder() const; @@ -489,8 +489,8 @@ namespace ParaMEDMEM void setTimeValue(double time); void setTime(int dt, int it, double time); double getTimeValue() const; - void setTimeUnit(const char *unit); - const char *getTimeUnit() const; + void setTimeUnit(const std::string& unit); + std::string getTimeUnit() const; virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception); virtual std::vector getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception); virtual std::vector getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception); @@ -498,17 +498,17 @@ namespace ParaMEDMEM virtual std::vector getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception); std::vector getNonEmptyLevels() const throw(INTERP_KERNEL::Exception); std::vector getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception); - void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); + void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); // - bool existsGroup(const char *groupName) const throw(INTERP_KERNEL::Exception); + bool existsGroup(const std::string& groupName) const throw(INTERP_KERNEL::Exception); bool existsFamily(int famId) const throw(INTERP_KERNEL::Exception); - bool existsFamily(const char *familyName) const throw(INTERP_KERNEL::Exception); - void setFamilyId(const char *familyName, int id) throw(INTERP_KERNEL::Exception); - void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception); - void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception); - void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception); - virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception); + bool existsFamily(const std::string& familyName) const throw(INTERP_KERNEL::Exception); + void setFamilyId(const std::string& familyName, int id) throw(INTERP_KERNEL::Exception); + void setFamilyIdUnique(const std::string& familyName, int id) throw(INTERP_KERNEL::Exception); + void addFamily(const std::string& familyName, int id) throw(INTERP_KERNEL::Exception); + void addFamilyOnGrp(const std::string& grpName, const std::string& famName) throw(INTERP_KERNEL::Exception); + virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName) throw(INTERP_KERNEL::Exception); virtual bool keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& levs) throw(INTERP_KERNEL::Exception); void copyFamGrpMapsFrom(const MEDFileMesh& other) throw(INTERP_KERNEL::Exception); void clearGrpMap() throw(INTERP_KERNEL::Exception); @@ -516,28 +516,28 @@ namespace ParaMEDMEM void clearFamGrpMaps() throw(INTERP_KERNEL::Exception); const std::map& getFamilyInfo() const throw(INTERP_KERNEL::Exception); const std::map >& getGroupInfo() const throw(INTERP_KERNEL::Exception); - std::vector getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception); + std::vector getFamiliesOnGroup(const std::string& name) const throw(INTERP_KERNEL::Exception); std::vector getFamiliesOnGroups(const std::vector& grps) const throw(INTERP_KERNEL::Exception); - std::vector getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception); - void setFamiliesOnGroup(const char *name, const std::vector& fams) throw(INTERP_KERNEL::Exception); - void setFamiliesIdsOnGroup(const char *name, const std::vector& famIds) throw(INTERP_KERNEL::Exception); - std::vector getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception); - void setGroupsOnFamily(const char *famName, const std::vector& grps) throw(INTERP_KERNEL::Exception); + std::vector getFamiliesIdsOnGroup(const std::string& name) const throw(INTERP_KERNEL::Exception); + void setFamiliesOnGroup(const std::string& name, const std::vector& fams) throw(INTERP_KERNEL::Exception); + void setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds) throw(INTERP_KERNEL::Exception); + std::vector getGroupsOnFamily(const std::string& name) const throw(INTERP_KERNEL::Exception); + void setGroupsOnFamily(const std::string& famName, const std::vector& grps) throw(INTERP_KERNEL::Exception); std::vector getGroupsNames() const throw(INTERP_KERNEL::Exception); std::vector getFamiliesNames() const throw(INTERP_KERNEL::Exception); void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception); std::vector removeEmptyGroups() throw(INTERP_KERNEL::Exception); - void removeGroup(const char *name) throw(INTERP_KERNEL::Exception); - void removeFamily(const char *name) throw(INTERP_KERNEL::Exception); + void removeGroup(const std::string& name) throw(INTERP_KERNEL::Exception); + void removeFamily(const std::string& name) throw(INTERP_KERNEL::Exception); std::vector removeOrphanGroups() throw(INTERP_KERNEL::Exception); std::vector removeOrphanFamilies() throw(INTERP_KERNEL::Exception); - void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception); - void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception); + void changeGroupName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception); + void changeFamilyName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception); void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception); - void changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector& newFamiliesNames) throw(INTERP_KERNEL::Exception); + void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector& newFamiliesNames) throw(INTERP_KERNEL::Exception); void setFamilyInfo(const std::map& info); void setGroupInfo(const std::map >&info); - int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception); + int getFamilyId(const std::string& name) const throw(INTERP_KERNEL::Exception); int getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception); int getMaxFamilyId() const throw(INTERP_KERNEL::Exception); int getMinFamilyId() const throw(INTERP_KERNEL::Exception); @@ -564,11 +564,11 @@ namespace ParaMEDMEM virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception); virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const throw(INTERP_KERNEL::Exception); virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const throw(INTERP_KERNEL::Exception); - virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception); - virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception); - virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception); + virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception); + virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception); + virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception); virtual DataArrayInt *getNodeGroupsArr(const std::vector& grps, bool renum=false) const throw(INTERP_KERNEL::Exception); - virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception); + virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception); virtual DataArrayInt *getNodeFamiliesArr(const std::vector& fams, bool renum=false) const throw(INTERP_KERNEL::Exception); %extend { @@ -697,32 +697,32 @@ namespace ParaMEDMEM class MEDFileUMesh : public MEDFileMesh { public: - static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); - static MEDFileUMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); static MEDFileUMesh *New(); ~MEDFileUMesh(); int getSpaceDimension() const throw(INTERP_KERNEL::Exception); // - std::vector getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception); - std::vector getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception); - std::vector getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception); - std::vector getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception); + std::vector getGrpNonEmptyLevels(const std::string& grp) const throw(INTERP_KERNEL::Exception); + std::vector getGrpNonEmptyLevelsExt(const std::string& grp) const throw(INTERP_KERNEL::Exception); + std::vector getFamNonEmptyLevels(const std::string& fam) const throw(INTERP_KERNEL::Exception); + std::vector getFamNonEmptyLevelsExt(const std::string& fam) const throw(INTERP_KERNEL::Exception); std::vector getGrpsNonEmptyLevels(const std::vector& grps) const throw(INTERP_KERNEL::Exception); std::vector getGrpsNonEmptyLevelsExt(const std::vector& grps) const throw(INTERP_KERNEL::Exception); std::vector getFamsNonEmptyLevels(const std::vector& fams) const throw(INTERP_KERNEL::Exception); std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const throw(INTERP_KERNEL::Exception); std::vector getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); - MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception); - DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception); + MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception); + DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const throw(INTERP_KERNEL::Exception); DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const throw(INTERP_KERNEL::Exception); - MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception); - DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception); + MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception); + DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const throw(INTERP_KERNEL::Exception); DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const throw(INTERP_KERNEL::Exception); - DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception); + DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception); DataArrayInt *getNodeGroupsArr(const std::vector& grps, bool renum=false) const throw(INTERP_KERNEL::Exception); - DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception); + DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception); DataArrayInt *getNodeFamiliesArr(const std::vector& fams, bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception); @@ -745,12 +745,12 @@ namespace ParaMEDMEM DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception); %extend { - MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception) + MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception) { return MEDFileUMesh::New(fileName,mName,dt,it,mrs); } - MEDFileUMesh(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception) + MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception) { return MEDFileUMesh::New(fileName,mrs); } @@ -814,7 +814,7 @@ namespace ParaMEDMEM return ret; } - PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception) + PyObject *duplicateNodesOnM1Group(const std::string& grpNameM1) throw(INTERP_KERNEL::Exception) { DataArrayInt *ret0=0,*ret1=0,*ret2=0; self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2); @@ -857,8 +857,8 @@ namespace ParaMEDMEM { public: static MEDFileCMesh *New(); - static MEDFileCMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); - static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception); int getSpaceDimension() const throw(INTERP_KERNEL::Exception); %extend @@ -868,12 +868,12 @@ namespace ParaMEDMEM return MEDFileCMesh::New(); } - MEDFileCMesh(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception) + MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception) { return MEDFileCMesh::New(fileName,mrs); } - MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception) + MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception) { return MEDFileCMesh::New(fileName,mName,dt,it,mrs); } @@ -892,8 +892,8 @@ namespace ParaMEDMEM { public: static MEDFileCurveLinearMesh *New(); - static MEDFileCurveLinearMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); - static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception); %extend { @@ -902,12 +902,12 @@ namespace ParaMEDMEM return MEDFileCurveLinearMesh::New(); } - MEDFileCurveLinearMesh(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception) + MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception) { return MEDFileCurveLinearMesh::New(fileName,mrs); } - MEDFileCurveLinearMesh(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception) + MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception) { return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs); } @@ -926,11 +926,11 @@ namespace ParaMEDMEM { public: static MEDFileMeshMultiTS *New(); - static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception); - static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception); + static MEDFileMeshMultiTS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception); + static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName) throw(INTERP_KERNEL::Exception); MEDFileMeshMultiTS *deepCpy() 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 write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception); %extend { @@ -939,12 +939,12 @@ namespace ParaMEDMEM return MEDFileMeshMultiTS::New(); } - MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception) + MEDFileMeshMultiTS(const std::string& fileName) throw(INTERP_KERNEL::Exception) { return MEDFileMeshMultiTS::New(fileName); } - MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception) + MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName) throw(INTERP_KERNEL::Exception) { return MEDFileMeshMultiTS::New(fileName,mName); } @@ -985,9 +985,9 @@ namespace ParaMEDMEM { public: static MEDFileMeshes *New(); - static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception); + static MEDFileMeshes *New(const std::string& fileName) throw(INTERP_KERNEL::Exception); MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception); - void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); + void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception); std::vector getMeshesNames() const throw(INTERP_KERNEL::Exception); // @@ -1002,7 +1002,7 @@ namespace ParaMEDMEM return MEDFileMeshes::New(); } - MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception) + MEDFileMeshes(const std::string& fileName) throw(INTERP_KERNEL::Exception) { return MEDFileMeshes::New(fileName); } @@ -1055,7 +1055,7 @@ namespace ParaMEDMEM ret->incrRef(); return ret; } - MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception) + MEDFileMesh *getMeshWithName(const std::string& mname) const throw(INTERP_KERNEL::Exception) { MEDFileMesh *ret=self->getMeshWithName(mname); if(ret) @@ -1099,8 +1099,8 @@ namespace ParaMEDMEM void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception); std::vector getPfls() const throw(INTERP_KERNEL::Exception); std::vector getLocs() const throw(INTERP_KERNEL::Exception); - bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception); - bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception); + bool existsPfl(const std::string& pflName) const throw(INTERP_KERNEL::Exception); + bool existsLoc(const std::string& locName) const throw(INTERP_KERNEL::Exception); std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception); std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception); std::vector< std::vector > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception); @@ -1111,13 +1111,13 @@ namespace ParaMEDMEM virtual std::vector getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception); void killProfileIds(const std::vector& pflIds) throw(INTERP_KERNEL::Exception); void killLocalizationIds(const std::vector& locIds) throw(INTERP_KERNEL::Exception); - void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception); - void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception); + void changePflName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception); + void changeLocName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception); int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception); - int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception); + int getLocalizationId(const std::string& loc) const throw(INTERP_KERNEL::Exception); %extend { - PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception) + PyObject *getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception) { const DataArrayInt *ret=self->getProfile(pflName); if(ret) @@ -1141,7 +1141,7 @@ namespace ParaMEDMEM return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 ); } - PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception) + PyObject *getLocalization(const std::string& locName) const throw(INTERP_KERNEL::Exception) { const MEDFileFieldLoc *loc=&self->getLocalization(locName); if(loc) @@ -1209,10 +1209,10 @@ namespace ParaMEDMEM class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable { public: - static MEDFileAnyTypeField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); - static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); - static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception); - void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); + static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception); + void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); void loadArrays() throw(INTERP_KERNEL::Exception); void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception); void unloadArrays() throw(INTERP_KERNEL::Exception); @@ -1220,9 +1220,9 @@ namespace ParaMEDMEM int getIteration() const throw(INTERP_KERNEL::Exception); int getOrder() const throw(INTERP_KERNEL::Exception); std::string getName() throw(INTERP_KERNEL::Exception); - void setName(const char *name) throw(INTERP_KERNEL::Exception); + void setName(const std::string& name) throw(INTERP_KERNEL::Exception); std::string getMeshName() throw(INTERP_KERNEL::Exception); - void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception); + void setMeshName(const std::string& newMeshName) throw(INTERP_KERNEL::Exception); int getMeshIteration() const throw(INTERP_KERNEL::Exception); int getMeshOrder() const throw(INTERP_KERNEL::Exception); int getNumberOfComponents() const throw(INTERP_KERNEL::Exception); @@ -1233,7 +1233,7 @@ namespace ParaMEDMEM virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception); MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception); std::string getDtUnit() const throw(INTERP_KERNEL::Exception); - void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception); + void setDtUnit(const std::string& dtUnit) throw(INTERP_KERNEL::Exception); %extend { PyObject *getTime() throw(INTERP_KERNEL::Exception) @@ -1256,12 +1256,12 @@ namespace ParaMEDMEM return elt; } - void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception) + void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception) { self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob); } - void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception) + void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception) { self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob); } @@ -1281,7 +1281,7 @@ namespace ParaMEDMEM return ret2; } - PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception) + PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception) { std::vector ret1; int ret0=self->getNonEmptyLevels(mname,ret1); @@ -1291,7 +1291,7 @@ namespace ParaMEDMEM return elt; } - PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception) + PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception) { std::vector types; std::vector< std::vector > typesF; @@ -1351,34 +1351,34 @@ namespace ParaMEDMEM class MEDFileField1TS : public MEDFileAnyTypeField1TS { public: - static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception); - static MEDFileField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); - static MEDFileField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); static MEDFileField1TS *New(); ParaMEDMEM::MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception); - MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception); // void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception); void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception); - void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception); - void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception); + void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception); + void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception); %extend { - MEDFileField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception) + MEDFileField1TS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception) { return MEDFileField1TS::New(fileName,loadAll); } - MEDFileField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception) + MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception) { return MEDFileField1TS::New(fileName,fieldName,loadAll); } - MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception) + MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception) { return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll); } @@ -1411,7 +1411,7 @@ namespace ParaMEDMEM return ret; } - PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception) + PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception) { std::vector types; std::vector< std::vector > typesF; @@ -1486,9 +1486,9 @@ namespace ParaMEDMEM { public: static MEDFileIntField1TS *New(); - static MEDFileIntField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); - static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); - static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception); ParaMEDMEM::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception); // void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception); @@ -1500,17 +1500,17 @@ namespace ParaMEDMEM return MEDFileIntField1TS::New(); } - MEDFileIntField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception) + MEDFileIntField1TS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception) { return MEDFileIntField1TS::New(fileName,loadAll); } - MEDFileIntField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception) + MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception) { return MEDFileIntField1TS::New(fileName,fieldName,loadAll); } - MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception) + MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception) { return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll); } @@ -1560,7 +1560,7 @@ namespace ParaMEDMEM return ret; } - PyObject *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception) + PyObject *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception) { DataArrayInt *ret1=0; MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol); @@ -1612,23 +1612,23 @@ namespace ParaMEDMEM class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable { public: - static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); - static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception); virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception); std::string getName() const throw(INTERP_KERNEL::Exception); - void setName(const char *name) throw(INTERP_KERNEL::Exception); + void setName(const std::string& name) throw(INTERP_KERNEL::Exception); std::string getDtUnit() const throw(INTERP_KERNEL::Exception); - void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception); + void setDtUnit(const std::string& dtUnit) throw(INTERP_KERNEL::Exception); std::string getMeshName() const throw(INTERP_KERNEL::Exception); - void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception); + void setMeshName(const std::string& newMeshName) throw(INTERP_KERNEL::Exception); const std::vector& getInfo() const throw(INTERP_KERNEL::Exception); int getNumberOfComponents() const throw(INTERP_KERNEL::Exception); int getNumberOfTS() const throw(INTERP_KERNEL::Exception); void eraseEmptyTS() throw(INTERP_KERNEL::Exception); int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception); int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception); - void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); + void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); void loadArrays() throw(INTERP_KERNEL::Exception); void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception); void unloadArrays() throw(INTERP_KERNEL::Exception); @@ -1726,7 +1726,7 @@ namespace ParaMEDMEM return ret2; } - PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception) + PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception) { std::vector ret1; int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1); @@ -1736,7 +1736,7 @@ namespace ParaMEDMEM return elt; } - PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception) + PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception) { std::vector types; std::vector< std::vector > typesF; @@ -1971,14 +1971,14 @@ namespace ParaMEDMEM { public: static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception); - static MEDFileFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); - static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); // MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception); - MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception); // void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception); void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception); @@ -1990,12 +1990,12 @@ namespace ParaMEDMEM return MEDFileFieldMultiTS::New(); } - MEDFileFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception) + MEDFileFieldMultiTS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception) { return MEDFileFieldMultiTS::New(fileName,loadAll); } - MEDFileFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception) + MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception) { return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll); } @@ -2015,7 +2015,7 @@ namespace ParaMEDMEM return ret; } - PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception) + PyObject *getFieldSplitedByType2(int iteration, int order, const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception) { std::vector types; std::vector< std::vector > typesF; @@ -2108,8 +2108,8 @@ namespace ParaMEDMEM { public: static MEDFileIntFieldMultiTS *New(); - static MEDFileIntFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); - static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); // void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception); void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception); @@ -2121,12 +2121,12 @@ namespace ParaMEDMEM return MEDFileIntFieldMultiTS::New(); } - MEDFileIntFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception) + MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception) { return MEDFileIntFieldMultiTS::New(fileName,loadAll); } - MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception) + MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception) { return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll); } @@ -2176,7 +2176,7 @@ namespace ParaMEDMEM return ret; } - PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception) + PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception) { DataArrayInt *ret1=0; MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol); @@ -2210,13 +2210,13 @@ namespace ParaMEDMEM { public: static MEDFileFields *New() throw(INTERP_KERNEL::Exception); - static MEDFileFields *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileFields *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception); MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception); void loadArrays() throw(INTERP_KERNEL::Exception); void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception); void unloadArrays() throw(INTERP_KERNEL::Exception); - void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); + void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); int getNumberOfFields() const; std::vector getFieldsNames() const throw(INTERP_KERNEL::Exception); std::vector getMeshesNames() const throw(INTERP_KERNEL::Exception); @@ -2224,10 +2224,10 @@ namespace ParaMEDMEM void resize(int newSize) throw(INTERP_KERNEL::Exception); void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception); void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception); - int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception); + int getPosFromFieldName(const std::string& fieldName) const throw(INTERP_KERNEL::Exception); MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception); - MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception); - MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception); + MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const throw(INTERP_KERNEL::Exception); + MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const throw(INTERP_KERNEL::Exception); void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception); %extend { @@ -2236,7 +2236,7 @@ namespace ParaMEDMEM return MEDFileFields::New(); } - MEDFileFields(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception) + MEDFileFields(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception) { return MEDFileFields::New(fileName,loadAll); } @@ -2410,9 +2410,9 @@ namespace ParaMEDMEM class MEDFileParameterTinyInfo : public MEDFileWritable { public: - void setDescription(const char *name); + void setDescription(const std::string& name); std::string getDescription() const; - void setTimeUnit(const char *unit); + void setTimeUnit(const std::string& unit); std::string getTimeUnit() const; }; @@ -2420,14 +2420,14 @@ namespace ParaMEDMEM { public: static MEDFileParameterDouble1TS *New(); - static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception); - static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception); - static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception); + static MEDFileParameterDouble1TS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception); + static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception); + static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it) throw(INTERP_KERNEL::Exception); 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); + void setName(const std::string& name) 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 write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); %extend { MEDFileParameterDouble1TS() @@ -2435,17 +2435,17 @@ namespace ParaMEDMEM return MEDFileParameterDouble1TS::New(); } - MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception) + MEDFileParameterDouble1TS(const std::string& fileName) throw(INTERP_KERNEL::Exception) { return MEDFileParameterDouble1TS::New(fileName); } - MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception) + MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception) { return MEDFileParameterDouble1TS::New(fileName,paramName); } - MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception) + MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it) throw(INTERP_KERNEL::Exception) { return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it); } @@ -2473,12 +2473,12 @@ namespace ParaMEDMEM { public: 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); + static MEDFileParameterMultiTS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception); + static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception); std::string getName() const; - void setName(const char *name); + void setName(const std::string& name); MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception); - void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); + void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); std::string simpleRepr() const throw(INTERP_KERNEL::Exception); void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception); double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception); @@ -2491,12 +2491,12 @@ namespace ParaMEDMEM return MEDFileParameterMultiTS::New(); } - MEDFileParameterMultiTS(const char *fileName) + MEDFileParameterMultiTS(const std::string& fileName) { return MEDFileParameterMultiTS::New(fileName); } - MEDFileParameterMultiTS(const char *fileName, const char *paramName) + MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName) { return MEDFileParameterMultiTS::New(fileName,paramName); } @@ -2666,16 +2666,16 @@ namespace ParaMEDMEM { public: static MEDFileParameters *New(); - static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception); + static MEDFileParameters *New(const std::string& fileName) throw(INTERP_KERNEL::Exception); MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception); - void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); + void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); std::vector getParamsNames() const throw(INTERP_KERNEL::Exception); std::string simpleRepr() const throw(INTERP_KERNEL::Exception); void resize(int newSize) throw(INTERP_KERNEL::Exception); void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception); void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception); void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception); - int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception); + int getPosFromParamName(const std::string& paramName) const throw(INTERP_KERNEL::Exception); int getNumberOfParams() const throw(INTERP_KERNEL::Exception); %extend { @@ -2684,7 +2684,7 @@ namespace ParaMEDMEM return MEDFileParameters::New(); } - MEDFileParameters(const char *fileName) + MEDFileParameters(const std::string& fileName) { return MEDFileParameters::New(fileName); } @@ -2727,7 +2727,7 @@ namespace ParaMEDMEM return ret; } - MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception) + MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const throw(INTERP_KERNEL::Exception) { MEDFileParameterMultiTS *ret=self->getParamWithName(paramName); if(ret) @@ -2752,7 +2752,7 @@ namespace ParaMEDMEM class MEDFileData : public RefCountObject, public MEDFileWritable { public: - static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception); + static MEDFileData *New(const std::string& fileName) throw(INTERP_KERNEL::Exception); static MEDFileData *New(); MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception); void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception); @@ -2762,13 +2762,13 @@ namespace ParaMEDMEM int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception); int getNumberOfParams() const throw(INTERP_KERNEL::Exception); // - bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception); + bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName) throw(INTERP_KERNEL::Exception); bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception); // - void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); + void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); %extend { - MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception) + MEDFileData(const std::string& fileName) throw(INTERP_KERNEL::Exception) { return MEDFileData::New(fileName); } @@ -2818,11 +2818,11 @@ namespace ParaMEDMEM class SauvReader : public RefCountObject { public: - static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception); + static SauvReader* New(const std::string& fileName) throw(INTERP_KERNEL::Exception); MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception); %extend { - SauvReader(const char *fileName) throw(INTERP_KERNEL::Exception) + SauvReader(const std::string& fileName) throw(INTERP_KERNEL::Exception) { return SauvReader::New(fileName); } @@ -2834,7 +2834,7 @@ namespace ParaMEDMEM public: static SauvWriter * New(); void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception); - void write(const char* fileName) throw(INTERP_KERNEL::Exception); + void write(const std::string& fileName) throw(INTERP_KERNEL::Exception); void setCpyGrpIfOnASingleFamilyStatus(bool status) throw(INTERP_KERNEL::Exception); bool getCpyGrpIfOnASingleFamilyStatus() const throw(INTERP_KERNEL::Exception); %extend diff --git a/src/MEDOP/cmp/MEDDataManager_i.cxx b/src/MEDOP/cmp/MEDDataManager_i.cxx index 2e1e492a5..aed1ba60e 100644 --- a/src/MEDOP/cmp/MEDDataManager_i.cxx +++ b/src/MEDOP/cmp/MEDDataManager_i.cxx @@ -57,17 +57,18 @@ MEDDataManager_i::~MEDDataManager_i() LOG("Deleting MEDDataManager_i instance"); } -const char * MEDDataManager_i::file_to_source(const char * filepath) +std::string MEDDataManager_i::file_to_source(const char * filepath) { - string * source = new string("file://"); - source->append(filepath); - return source->c_str();; + string source("file://"); + source.append(filepath); + return source; } -const char * MEDDataManager_i::source_to_file(const char * source) + +std::string MEDDataManager_i::source_to_file(const char * source) { - string * filepath = new string(source); - filepath->replace(0,7,""); - return filepath->c_str(); + string filepath(source); + filepath.replace(0,7,""); + return filepath; } /*! @@ -93,7 +94,8 @@ MEDOP::DatasourceHandler * MEDDataManager_i::addDatasource(const char *filepath) MEDOP::DatasourceHandler * datasourceHandler = new MEDOP::DatasourceHandler(); datasourceHandler->id = _sourceLastId; _sourceLastId++; datasourceHandler->name = (Kernel_Utils::GetBaseName(filepath)).c_str(); - datasourceHandler->uri = file_to_source(filepath); + std::string tmp(file_to_source(filepath)); + datasourceHandler->uri = CORBA::string_dup(tmp.c_str()); _datasourceHandlerMap[datasourceHandler->id] = datasourceHandler; // We start by read the list of meshes (spatial supports of fields) @@ -189,10 +191,10 @@ MEDOP::DatasourceHandler * MEDDataManager_i::addDatasource(const char *filepath) } long MEDDataManager_i::getDatasourceId(const char *filepath) { - const char * uri = file_to_source(filepath); + std::string uri(file_to_source(filepath)); DatasourceHandlerMapIterator it = _datasourceHandlerMap.begin(); while ( it != _datasourceHandlerMap.end() ) { - if ( strcmp(it->second->uri,uri) == 0 ) { + if ( strcmp(it->second->uri,uri.c_str()) == 0 ) { return it->first; } ++it; @@ -508,7 +510,7 @@ MEDCouplingUMesh * MEDDataManager_i::getUMesh(long meshHandlerId) { } long sourceid = _meshHandlerMap[meshHandlerId]->sourceid; - const char * filepath = source_to_file((_datasourceHandlerMap[sourceid])->uri); + std::string filepath(source_to_file((_datasourceHandlerMap[sourceid])->uri)); const char * meshName = _meshHandlerMap[meshHandlerId]->name; int meshDimRelToMax = 0; myMesh = MEDLoader::ReadUMeshFromFile(filepath,meshName,meshDimRelToMax); @@ -582,16 +584,16 @@ MEDCouplingFieldDouble * MEDDataManager_i::getFieldDouble(const MEDOP::FieldHand long sourceid = _meshHandlerMap[meshid]->sourceid; - const char * filepath = source_to_file((_datasourceHandlerMap[sourceid])->uri); + std::string filepath(source_to_file((_datasourceHandlerMap[sourceid])->uri)); std::string meshName(myMesh->getName()); LOG("getFieldDouble: field "<fieldname<<" loaded from file "<type; int meshDimRelToMax = 0; MEDCouplingFieldDouble * myField = MEDLoader::ReadField(type, filepath, - meshName.c_str(), + meshName, meshDimRelToMax, - fieldHandler->fieldname, + std::string(fieldHandler->fieldname), fieldHandler->iteration, fieldHandler->order); myField->setMesh(myMesh); diff --git a/src/MEDOP/cmp/MEDDataManager_i.hxx b/src/MEDOP/cmp/MEDDataManager_i.hxx index 7c54bf5d9..5be3a86ea 100644 --- a/src/MEDOP/cmp/MEDDataManager_i.hxx +++ b/src/MEDOP/cmp/MEDDataManager_i.hxx @@ -149,8 +149,8 @@ private: long order, const char * source); - const char * file_to_source(const char * filepath); - const char * source_to_file(const char * source); + std::string file_to_source(const char * filepath); + std::string source_to_file(const char * source); long getDatasourceId(const char *filepath); MEDCouplingUMesh * getUMesh(long meshHandlerId); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx index 59a590bb3..ab1f66d8e 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx @@ -1270,7 +1270,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, Para \n \ \n \ \n"; - std::vector meshNames=MEDLoader::GetMeshNames(myfile.c_str()); + std::vector meshNames=MEDLoader::GetMeshNames(myfile); xml.replace(xml.find("$fileName"),9,myfile); xml.replace(xml.find("$meshName"),9,meshNames[0]); xml.replace(xml.find("$meshName"),9,meshNames[0]); @@ -2003,13 +2003,13 @@ void MEDPARTITIONER::MeshCollection::setDomainNames(const std::string& name) std::ostringstream oss; oss<isMyDomain(i)) - _mesh[i]->setName(oss.str().c_str()); + _mesh[i]->setName(oss.str()); } } ParaMEDMEM::DataArrayDouble *MEDPARTITIONER::MeshCollection::getField(std::string descriptionField, int iold) //getField look for and read it if not done, and assume decrRef() in ~MeshCollection; -//something like MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(name.c_str(),f1->getMesh()->getName(),0,f1->getName(),0,1); +//something like MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(name,f1->getMesh()->getName(),0,f1->getName(),0,1); { int rank=MyGlobals::_Rank; std::string tag="ioldFieldDouble="+IntToStr(iold); @@ -2032,7 +2032,7 @@ ParaMEDMEM::DataArrayDouble *MEDPARTITIONER::MeshCollection::getField(std::strin meshName=MyGlobals::_Mesh_Names[iold]; ParaMEDMEM::MEDCouplingFieldDouble* f2=MEDLoader::ReadField((ParaMEDMEM::TypeOfField) typeField, - fileName.c_str(), meshName.c_str(), 0, fieldName.c_str(), DT, IT); + fileName, meshName, 0, fieldName, DT, IT); ParaMEDMEM::DataArrayDouble* res=f2->getArray(); //to know names of components diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx index 9c6001bc0..3ff67ebdc 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx @@ -97,7 +97,7 @@ void MeshCollectionDriver::readSubdomain(std::vector& cellglobal, std::string meshname=MyGlobals::_Mesh_Names[idomain]; std::string file=MyGlobals::_File_Names[idomain]; - ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(file.c_str(),meshname.c_str()); + ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(file,meshname); std::vector nonEmpty=mfm->getNonEmptyLevels(); try @@ -163,7 +163,7 @@ void MeshCollectionDriver::readSubdomain(int idomain) std::string meshname=MyGlobals::_Mesh_Names[idomain]; std::string file=MyGlobals::_File_Names[idomain]; - ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(file.c_str(),meshname.c_str()); + ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(file,meshname); std::vector nonEmpty=mfm->getNonEmptyLevels(); try @@ -240,7 +240,7 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile // faceMeshFilter=(ParaMEDMEM::MEDCouplingUMesh *) faceMesh->buildPartOfMySelf(index,index+filter->getNbOfElems(),true); // faceMesh=faceMeshFilter; // } - cellMesh->setName(finalMeshName.c_str()); + cellMesh->setName(finalMeshName); meshes.push_back(cellMesh); faceMesh->checkCoherency(); @@ -259,17 +259,17 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile // boundaryMesh->setName("boundaryMesh"); // } - MEDLoader::WriteUMeshes(distfilename.c_str(), meshes, true); + MEDLoader::WriteUMeshes(distfilename, meshes, true); // if (faceMeshFilter!=0) // faceMeshFilter->decrRef(); // if (boundaryMesh!=0) // { // //doing that testMesh becomes second mesh sorted by alphabetical order of name - // MEDLoader::WriteUMesh(distfilename.c_str(), boundaryMesh, false); + // MEDLoader::WriteUMesh(distfilename, boundaryMesh, false); // boundaryMesh->decrRef(); // } - ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(distfilename.c_str(), _collection->getMesh(idomain)->getName().c_str()); + ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(distfilename, _collection->getMesh(idomain)->getName()); mfm->setFamilyInfo(_collection->getFamilyInfo()); mfm->setGroupInfo(_collection->getGroupInfo()); @@ -286,7 +286,7 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile if (_collection->getMapDataArrayInt().find(key)!=_collection->getMapDataArrayInt().end()) mfm->setFamilyFieldArr(0,_collection->getMapDataArrayInt().find(key)->second); - mfm->write(distfilename.c_str(),0); + mfm->write(distfilename,0); key="/inewFieldDouble="+IntToStr(idomain)+"/"; std::map::iterator it; @@ -327,7 +327,7 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile continue; } nbfFieldFound++; - field->setName(fieldName.c_str()); + field->setName(fieldName); field->setMesh(mfm->getLevel0Mesh(false)); ParaMEDMEM::DataArrayDouble *da=(*it).second; @@ -337,12 +337,12 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile r1=SelectTagsInVectorOfString(r1,"typeField="+IntToStr(typeField)); r1=SelectTagsInVectorOfString(r1,"DT="+IntToStr(DT)); r1=SelectTagsInVectorOfString(r1,"IT="+IntToStr(IT)); - //not saved in file? field->setDescription(ExtractFromDescription(r1[0], "fieldDescription=").c_str()); + //not saved in file? field->setDescription(ExtractFromDescription(r1[0], "fieldDescription=")); int nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents=")); if (nbc==da->getNumberOfComponents()) { for (int i=0; isetInfoOnComponent(i,ExtractFromDescription(r1[0], "componentInfo"+IntToStr(i)+"=").c_str()); + da->setInfoOnComponent(i,ExtractFromDescription(r1[0], "componentInfo"+IntToStr(i)+"=")); } else { @@ -354,7 +354,7 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile field->checkCoherency(); try { - MEDLoader::WriteField(distfilename.c_str(),field,false); + MEDLoader::WriteField(distfilename,field,false); } catch(INTERP_KERNEL::Exception& e) { @@ -363,7 +363,7 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile tmp+="_"+fieldName+"_"+IntToStr(nbfFieldFound)+".med"; newName.replace(newName.find(".med"),4,tmp); std::cout << "WARNING : writeMedFile : create a new file name with only one field because MEDLoader::WriteField throw:" << newName << std::endl; - MEDLoader::WriteField(newName.c_str(),field,true); + MEDLoader::WriteField(newName,field,true); } } mfm->decrRef(); diff --git a/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx b/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx index 12538cf5f..6fd6a42ea 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx @@ -559,20 +559,20 @@ std::vector MEDPARTITIONER::BrowseFieldDouble(const ParaMEDMEM::MED std::vector MEDPARTITIONER::BrowseAllFields(const std::string& myfile) { std::vector res; - std::vector meshNames=MEDLoader::GetMeshNames(myfile.c_str()); + std::vector meshNames=MEDLoader::GetMeshNames(myfile); for (std::size_t i=0; i fieldNames= - MEDLoader::GetAllFieldNamesOnMesh(myfile.c_str(),meshNames[i].c_str()); + MEDLoader::GetAllFieldNamesOnMesh(myfile,meshNames[i]); for (std::size_t j = 0; j < fieldNames.size(); j++) { std::vector< ParaMEDMEM::TypeOfField > typeFields= - MEDLoader::GetTypesOfField(myfile.c_str(), meshNames[i].c_str(), fieldNames[j].c_str()); + MEDLoader::GetTypesOfField(myfile, meshNames[i], fieldNames[j]); for (std::size_t k = 0; k < typeFields.size(); k++) { std::vector< std::pair< int, int > > its= - MEDLoader::GetFieldIterations(typeFields[k], myfile.c_str(), meshNames[i].c_str(), fieldNames[j].c_str()); + MEDLoader::GetFieldIterations(typeFields[k], myfile, meshNames[i], fieldNames[j]); if (MyGlobals::_Is0verbose>100) std::cout<< "fieldName " << fieldNames[j] << " typeField " << typeFields[k] << " its.size() " << its.size() << std::endl; for (std::size_t m = 0; m < its.size(); m++) diff --git a/src/ParaMEDMEM/InterpolationMatrix.cxx b/src/ParaMEDMEM/InterpolationMatrix.cxx index dd96381ba..fc122596e 100644 --- a/src/ParaMEDMEM/InterpolationMatrix.cxx +++ b/src/ParaMEDMEM/InterpolationMatrix.cxx @@ -119,19 +119,19 @@ namespace ParaMEDMEM { MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(source_supportC); INTERP_KERNEL::Interpolation2D interpolation(*this); - interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth.c_str()); + interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth); } else if(source_supportC->getMeshDimension()==3 && source_supportC->getSpaceDimension()==3) { MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(source_supportC); INTERP_KERNEL::Interpolation3D interpolation(*this); - interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth.c_str()); + interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth); } else if(source_supportC->getMeshDimension()==2 && source_supportC->getSpaceDimension()==3) { MEDCouplingNormalizedUnstructuredMesh<3,2> source_mesh_wrapper(source_supportC); INTERP_KERNEL::Interpolation3DSurf interpolation(*this); - interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth.c_str()); + interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth); } else throw INTERP_KERNEL::Exception("No para interpolation available for the given mesh and space dimension of source mesh to -1D targetMesh"); @@ -142,19 +142,19 @@ namespace ParaMEDMEM { MEDCouplingNormalizedUnstructuredMesh<2,2> distant_mesh_wrapper(distant_supportC); INTERP_KERNEL::Interpolation2D interpolation(*this); - interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth.c_str()); + interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth); } else if(distant_supportC->getMeshDimension()==3 && distant_supportC->getSpaceDimension()==3) { MEDCouplingNormalizedUnstructuredMesh<3,3> distant_mesh_wrapper(distant_supportC); INTERP_KERNEL::Interpolation3D interpolation(*this); - interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth.c_str()); + interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth); } else if(distant_supportC->getMeshDimension()==2 && distant_supportC->getSpaceDimension()==3) { MEDCouplingNormalizedUnstructuredMesh<3,2> distant_mesh_wrapper(distant_supportC); INTERP_KERNEL::Interpolation3DSurf interpolation(*this); - interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth.c_str()); + interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth); } else throw INTERP_KERNEL::Exception("No para interpolation available for the given mesh and space dimension of distant mesh to -1D sourceMesh"); @@ -166,7 +166,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<3,3> target_wrapper(distant_supportC); MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(source_supportC); INTERP_KERNEL::Interpolation3D2D interpolator (*this); - interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str()); + interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod); target_wrapper.releaseTempArrays(); source_wrapper.releaseTempArrays(); } @@ -177,7 +177,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<2,2> target_wrapper(distant_supportC); MEDCouplingNormalizedUnstructuredMesh<2,2> source_wrapper(source_supportC); INTERP_KERNEL::Interpolation2D1D interpolator (*this); - interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str()); + interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod); target_wrapper.releaseTempArrays(); source_wrapper.releaseTempArrays(); } @@ -192,7 +192,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<1,1> source_wrapper(source_supportC); INTERP_KERNEL::Interpolation1D interpolation(*this); - interpolation.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str()); + interpolation.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod); target_wrapper.releaseTempArrays(); source_wrapper.releaseTempArrays(); } @@ -203,7 +203,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<2,1> source_wrapper(source_supportC); INTERP_KERNEL::Interpolation2DCurve interpolation(*this); - interpolation.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str()); + interpolation.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod); target_wrapper.releaseTempArrays(); source_wrapper.releaseTempArrays(); } @@ -214,7 +214,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<3,2> source_wrapper(source_supportC); INTERP_KERNEL::Interpolation3DSurf interpolator (*this); - interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str()); + interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod); target_wrapper.releaseTempArrays(); source_wrapper.releaseTempArrays(); } @@ -225,7 +225,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<2,2> source_wrapper(source_supportC); INTERP_KERNEL::Interpolation2D interpolator (*this); - interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str()); + interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod); target_wrapper.releaseTempArrays(); source_wrapper.releaseTempArrays(); } @@ -236,7 +236,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(source_supportC); INTERP_KERNEL::Interpolation3D interpolator (*this); - interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str()); + interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod); target_wrapper.releaseTempArrays(); source_wrapper.releaseTempArrays(); } diff --git a/src/ParaMEDMEM/NonCoincidentDEC.cxx b/src/ParaMEDMEM/NonCoincidentDEC.cxx index 4015ee7e0..077539bfa 100644 --- a/src/ParaMEDMEM/NonCoincidentDEC.cxx +++ b/src/ParaMEDMEM/NonCoincidentDEC.cxx @@ -98,7 +98,8 @@ namespace ParaMEDMEM fvm_nodal_t* medmemMeshToFVMMesh(const MEDMEM::MESH* mesh) { // create an FVM structure from the paramesh structure - fvm_nodal_t * fvm_nodal = fvm_nodal_create(mesh->getName().c_str(),mesh->getMeshDimension()); + std::string meshName(mesh->getName());//this line avoid that mesh->getName() object killed before fvm_nodal_create read the const char *. + fvm_nodal_t * fvm_nodal = fvm_nodal_create(meshName.c_str(),mesh->getMeshDimension()); //loop on cell types int nbtypes = mesh->getNumberOfTypes(MED_EN::MED_CELL); @@ -168,7 +169,8 @@ namespace ParaMEDMEM { // create an FVM structure from the paramesh structure - fvm_nodal_t * fvm_nodal = fvm_nodal_create(support->getName().c_str(),1); + std::string supportName(support->getName());//this line avoid that support->getName() object killed before fvm_nodal_create read the const char *. + fvm_nodal_t * fvm_nodal = fvm_nodal_create(supportName.c_str(),1); const MEDMEM::MESH* mesh= support->getMesh(); diff --git a/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx b/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx index 82e15236a..6c85fc105 100644 --- a/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx +++ b/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx @@ -95,19 +95,19 @@ namespace ParaMEDMEM { MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(trgC); INTERP_KERNEL::Interpolation2D interpolation(*this); - colSize=interpolation.fromIntegralUniform(target_mesh_wrapper,surfaces,trgMeth.c_str()); + colSize=interpolation.fromIntegralUniform(target_mesh_wrapper,surfaces,trgMeth); } else if(trgC->getMeshDimension()==3 && trgC->getSpaceDimension()==3) { MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(trgC); INTERP_KERNEL::Interpolation3D interpolation(*this); - colSize=interpolation.fromIntegralUniform(target_mesh_wrapper,surfaces,trgMeth.c_str()); + colSize=interpolation.fromIntegralUniform(target_mesh_wrapper,surfaces,trgMeth); } else if(trgC->getMeshDimension()==2 && trgC->getSpaceDimension()==3) { MEDCouplingNormalizedUnstructuredMesh<3,2> target_mesh_wrapper(trgC); INTERP_KERNEL::Interpolation3DSurf interpolation(*this); - colSize=interpolation.fromIntegralUniform(target_mesh_wrapper,surfaces,trgMeth.c_str()); + colSize=interpolation.fromIntegralUniform(target_mesh_wrapper,surfaces,trgMeth); } else throw INTERP_KERNEL::Exception("No para interpolation available for the given mesh and space dimension of source mesh to -1D targetMesh"); @@ -118,19 +118,19 @@ namespace ParaMEDMEM { MEDCouplingNormalizedUnstructuredMesh<2,2> local_mesh_wrapper(srcC); INTERP_KERNEL::Interpolation2D interpolation(*this); - colSize=interpolation.toIntegralUniform(local_mesh_wrapper,surfaces,srcMeth.c_str()); + colSize=interpolation.toIntegralUniform(local_mesh_wrapper,surfaces,srcMeth); } else if(srcC->getMeshDimension()==3 && srcC->getSpaceDimension()==3) { MEDCouplingNormalizedUnstructuredMesh<3,3> local_mesh_wrapper(srcC); INTERP_KERNEL::Interpolation3D interpolation(*this); - colSize=interpolation.toIntegralUniform(local_mesh_wrapper,surfaces,srcMeth.c_str()); + colSize=interpolation.toIntegralUniform(local_mesh_wrapper,surfaces,srcMeth); } else if(srcC->getMeshDimension()==2 && srcC->getSpaceDimension()==3) { MEDCouplingNormalizedUnstructuredMesh<3,2> local_mesh_wrapper(srcC); INTERP_KERNEL::Interpolation3DSurf interpolation(*this); - colSize=interpolation.toIntegralUniform(local_mesh_wrapper,surfaces,srcMeth.c_str()); + colSize=interpolation.toIntegralUniform(local_mesh_wrapper,surfaces,srcMeth); } else throw INTERP_KERNEL::Exception("No para interpolation available for the given mesh and space dimension of distant mesh to -1D sourceMesh"); @@ -142,7 +142,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(srcC); INTERP_KERNEL::Interpolation3D2D interpolator (*this); - colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod.c_str()); + colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod); target_wrapper.releaseTempArrays(); source_wrapper.releaseTempArrays(); } @@ -154,7 +154,7 @@ namespace ParaMEDMEM INTERP_KERNEL::Interpolation3D2D interpolator (*this); vector > surfacesTranspose; - colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());//not a bug target in source. + colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod);//not a bug target in source. TransposeMatrix(surfacesTranspose,colSize,surfaces); colSize=surfacesTranspose.size(); target_wrapper.releaseTempArrays(); @@ -167,7 +167,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<2,2> source_wrapper(srcC); INTERP_KERNEL::Interpolation2D1D interpolator (*this); - colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod.c_str()); + colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod); target_wrapper.releaseTempArrays(); source_wrapper.releaseTempArrays(); } @@ -179,7 +179,7 @@ namespace ParaMEDMEM INTERP_KERNEL::Interpolation2D1D interpolator (*this); vector > surfacesTranspose; - colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfacesTranspose,interpMethod.c_str());//not a bug target in source. + colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfacesTranspose,interpMethod);//not a bug target in source. TransposeMatrix(surfacesTranspose,colSize,surfaces); colSize=surfacesTranspose.size(); target_wrapper.releaseTempArrays(); @@ -196,7 +196,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<1,1> source_wrapper(srcC); INTERP_KERNEL::Interpolation1D interpolation(*this); - colSize=interpolation.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod.c_str()); + colSize=interpolation.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod); target_wrapper.releaseTempArrays(); source_wrapper.releaseTempArrays(); } @@ -207,7 +207,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<2,1> source_wrapper(srcC); INTERP_KERNEL::Interpolation2DCurve interpolation(*this); - colSize=interpolation.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod.c_str()); + colSize=interpolation.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod); target_wrapper.releaseTempArrays(); source_wrapper.releaseTempArrays(); } @@ -218,7 +218,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<3,2> source_wrapper(srcC); INTERP_KERNEL::Interpolation3DSurf interpolator (*this); - colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod.c_str()); + colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod); target_wrapper.releaseTempArrays(); source_wrapper.releaseTempArrays(); } @@ -229,7 +229,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<2,2> source_wrapper(srcC); INTERP_KERNEL::Interpolation2D interpolator (*this); - colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod.c_str()); + colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod); target_wrapper.releaseTempArrays(); source_wrapper.releaseTempArrays(); } @@ -240,7 +240,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(srcC); INTERP_KERNEL::Interpolation3D interpolator (*this); - colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod.c_str()); + colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod); target_wrapper.releaseTempArrays(); source_wrapper.releaseTempArrays(); } diff --git a/src/RENUMBER/renumbering.cxx b/src/RENUMBER/renumbering.cxx index 41c6938f4..6af7b38be 100644 --- a/src/RENUMBER/renumbering.cxx +++ b/src/RENUMBER/renumbering.cxx @@ -57,8 +57,8 @@ int main(int argc, char** argv) } // Reading file structure cout << "Reading : " << flush; - MEDCouplingAutoRefCountObjectPtr fd=MEDFileData::New(filename_in.c_str()); - MEDFileMesh *m=fd->getMeshes()->getMeshWithName(meshname.c_str()); + MEDCouplingAutoRefCountObjectPtr fd(MEDFileData::New(filename_in)); + MEDFileMesh *m=fd->getMeshes()->getMeshWithName(meshname); MEDFileUMesh *mc=dynamic_cast(m); if(!mc) { @@ -96,7 +96,7 @@ int main(int argc, char** argv) MEDCouplingAutoRefCountObjectPtr famField2=famField->renumber(perm->begin()); mc->setFamilyFieldArr(0,famField2); } - mc->write(filename_out.c_str(),2); + mc->write(filename_out,2); t_family=clock(); cout << " : " << (t_family-t_compute_graph)/(double) CLOCKS_PER_SEC << "s" << endl << flush; // Fields @@ -119,8 +119,8 @@ int main(int argc, char** argv) } } } - fs->write(filename_out.c_str(),0); - //fs->renumberEntitiesLyingOnMesh(meshname.c_str(),code,code,o2n); bugged + fs->write(filename_out,0); + //fs->renumberEntitiesLyingOnMesh(meshname,code,code,o2n); bugged } t_field=clock(); cout << " : " << (t_field-t_family)/(double) CLOCKS_PER_SEC << "s" << endl << flush; -- 2.39.2