From: ageay Date: Mon, 3 Jan 2011 13:30:03 +0000 (+0000) Subject: std::vector -> std::vector X-Git-Tag: V6_main_FINAL~1140 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bc571438755b9366b915dbdf659cc4bcb63b2d63;p=tools%2Fmedcoupling.git std::vector -> std::vector --- diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 338d7140a..9e9040fc3 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -324,9 +324,9 @@ void MEDCouplingUMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *ot throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : Types are not equal !"); if(_coords!=otherC->_coords) throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : meshes do not share the same coordinates ! Use tryToShareSameCoordinates or call checkDeepEquivalWith !"); - std::vector ms(2); - ms[0]=const_cast(this); - ms[1]=const_cast(otherC); + std::vector ms(2); + ms[0]=this; + ms[1]=otherC; MEDCouplingAutoRefCountObjectPtr m=MergeUMeshesOnSameCoords(ms); MEDCouplingAutoRefCountObjectPtr da=m->zipConnectivityTraducer(cellCompPol); int maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+getNumberOfCells()); @@ -3369,8 +3369,8 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshes(std::vector tmp(2); - tmp[0]=const_cast(mesh1); tmp[1]=const_cast(mesh2); + std::vector tmp(2); + tmp[0]=mesh1; tmp[1]=mesh2; return MergeUMeshesOnSameCoords(tmp); } @@ -3378,13 +3378,13 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const MEDCouplingUM * Idem MergeUMeshes except that 'meshes' are expected to lyie on the same coords and 'meshes' have the same meshdim. * 'meshes' must be a non empty vector. */ -MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vector& meshes) +MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vector& meshes) { if(meshes.empty()) throw INTERP_KERNEL::Exception("meshes input parameter is expected to be non empty."); DataArrayDouble *coords=meshes.front()->getCoords(); int meshDim=meshes.front()->getMeshDimension(); - std::vector::const_iterator iter=meshes.begin(); + std::vector::const_iterator iter=meshes.begin(); int meshLgth=0; int meshIndexLgth=0; for(;iter!=meshes.end();iter++) @@ -3392,7 +3392,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vectorgetCoords()) throw INTERP_KERNEL::Exception("meshes does not share the same coords ! Try using tryToShareSameCoords method !"); if(meshDim!=(*iter)->getMeshDimension()) - throw INTERP_KERNEL::Exception("Mesh dimensions mismatches, fuseUMeshesOnSameCoords impossible !"); + throw INTERP_KERNEL::Exception("Mesh dimensions mismatches, FuseUMeshesOnSameCoords impossible !"); meshLgth+=(*iter)->getMeshLength(); meshIndexLgth+=(*iter)->getNumberOfCells(); } @@ -3438,7 +3438,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vector& meshes, int compType, std::vector& corr) +MEDCouplingUMesh *MEDCouplingUMesh::FuseUMeshesOnSameCoords(const std::vector& meshes, int compType, std::vector& corr) { //All checks are delegated to MergeUMeshesOnSameCoords MEDCouplingUMesh *ret=MergeUMeshesOnSameCoords(meshes); diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index 95b32260c..d79efa828 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -141,8 +141,8 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshes(std::vector& a) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception); - MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const std::vector& meshes); - MEDCOUPLING_EXPORT static MEDCouplingUMesh *FuseUMeshesOnSameCoords(const std::vector& meshes, int compType, std::vector& corr); + MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const std::vector& meshes); + MEDCOUPLING_EXPORT static MEDCouplingUMesh *FuseUMeshesOnSameCoords(const std::vector& meshes, int compType, std::vector& corr); MEDCOUPLING_EXPORT static bool IsPolygonWellOriented(const double *vec, const int *begin, const int *end, const double *coords); MEDCOUPLING_EXPORT static bool IsPolyhedronWellOriented(const int *begin, const int *end, const double *coords); MEDCOUPLING_EXPORT static void TryToCorrectPolyhedronOrientation(int *begin, int *end, const double *coords) throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx index eb1ebb9dc..ad2baa704 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx @@ -1319,7 +1319,7 @@ void MEDCouplingBasicsTest::testMergeMeshOnSameCoords1() m1->tryToShareSameCoords(*m2,1e-12); MEDCouplingUMesh *m3=build2DTargetMesh_1(); m3->tryToShareSameCoords(*m2,1e-12); - std::vector meshes; + std::vector meshes; meshes.push_back(m1); meshes.push_back(m2); meshes.push_back(m3); MEDCouplingUMesh *m4=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes); m4->checkCoherency(); @@ -1978,7 +1978,8 @@ void MEDCouplingBasicsTest::testSplitByType() MEDCouplingUMesh *m1=build3DSurfTargetMesh_1(); std::vector v=m1->splitByType(); CPPUNIT_ASSERT_EQUAL(3,(int)v.size()); - MEDCouplingUMesh *m2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(v); + std::vector v2(v.begin(),v.end()); + MEDCouplingUMesh *m2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(v2); m2->setName(m1->getName()); CPPUNIT_ASSERT(m1->isEqual(m2,1.e-12)); for(std::vector::const_iterator iter=v.begin();iter!=v.end();iter++) @@ -1989,7 +1990,7 @@ void MEDCouplingBasicsTest::testSplitByType() void MEDCouplingBasicsTest::testFuseUMeshesOnSameCoords() { - std::vector meshes; + std::vector meshes; MEDCouplingUMesh *m2=build2DTargetMesh_1(); int cells1[3]={2,3,4}; MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true); @@ -2057,7 +2058,7 @@ void MEDCouplingBasicsTest::testFuseUMeshesOnSameCoords2() MEDCouplingUMesh *m3=(MEDCouplingUMesh *)m1->buildPartOfMySelf(part1,part1+5,true); const int part2[4]={5,6,4,7}; MEDCouplingUMesh *m4=(MEDCouplingUMesh *)m1->buildPartOfMySelf(part2,part2+4,true); - std::vector meshes; + std::vector meshes; meshes.push_back(m1); meshes.push_back(m3); meshes.push_back(m3); diff --git a/src/MEDCoupling_Swig/MEDCoupling.i b/src/MEDCoupling_Swig/MEDCoupling.i index 3d676e08b..3222ad870 100644 --- a/src/MEDCoupling_Swig/MEDCoupling.i +++ b/src/MEDCoupling_Swig/MEDCoupling.i @@ -753,25 +753,8 @@ namespace ParaMEDMEM static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception) { - std::vector meshes; - if(PyList_Check(ms)) - { - int sz=PyList_Size(ms); - meshes.resize(sz); - for(int i=0;i(arg); - } - } - else - { - PyErr_SetString(PyExc_TypeError,"MergeUMeshesOnSameCoords : not a list as first parameter"); - PyErr_Print(); - return 0; - } + std::vector meshes; + convertPyObjToVecUMeshesCst(ms,meshes); MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes); return convertMesh(ret, SWIG_POINTER_OWN | 0 ); } @@ -779,8 +762,8 @@ namespace ParaMEDMEM static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception) { int sz; - std::vector meshes; - convertPyObjToVecUMeshes(ms,meshes); + std::vector meshes; + convertPyObjToVecUMeshesCst(ms,meshes); std::vector corr; MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr); sz=corr.size(); diff --git a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i index 42dcee277..af41bf45e 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i @@ -451,35 +451,6 @@ static void fillArrayWithPyListDbl(PyObject *pyLi, double *arrToFill, int sizeOf } } -void convertPyObjToVecUMeshes(PyObject *ms, std::vector& v) throw(INTERP_KERNEL::Exception) -{ - if(PyList_Check(ms)) - { - int size=PyList_Size(ms); - v.resize(size); - for(int i=0;i(argp); - v[i]=arg; - } - } - else - { - const char msg[]="convertPyObjToVecUMeshes : not a list"; - PyErr_SetString(PyExc_TypeError,msg); - throw INTERP_KERNEL::Exception(msg); - } -} - void convertPyObjToVecUMeshesCst(PyObject *ms, std::vector& v) throw(INTERP_KERNEL::Exception) { if(PyList_Check(ms)) diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index fb62b711c..ad71693d6 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -663,7 +663,7 @@ void MEDFileUMesh::setMeshAtRank(int meshDimRelToMax, MEDCouplingUMesh *m) throw } } -void MEDFileUMesh::setGroupsFromScratch(int meshDimRelToMax, const std::vector& ms) throw(INTERP_KERNEL::Exception) +void MEDFileUMesh::setGroupsFromScratch(int meshDimRelToMax, const std::vector& ms) throw(INTERP_KERNEL::Exception) { if(ms.empty()) throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsFromScratch : expecting a non empty vector !"); @@ -690,7 +690,7 @@ void MEDFileUMesh::setGroupsOnSetMesh(int meshDimRelToMax, const std::vector& ms) const throw(INTERP_KERNEL::Exception) +DataArrayDouble *MEDFileUMesh::checkMultiMesh(const std::vector& ms) const throw(INTERP_KERNEL::Exception) { return 0; } diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index d5378c57f..14d812bbe 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -95,7 +95,7 @@ namespace ParaMEDMEM void setFamilyField(DataArrayInt *arr, const std::vector< std::vector< int > > &userfids, const std::vector& grpNames) throw(INTERP_KERNEL::Exception); void addNodeGroup(const std::string& name, const std::vector& ids) throw(INTERP_KERNEL::Exception); void setMeshAtRank(int meshDimRelToMax, MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception); - void setGroupsFromScratch(int meshDimRelToMax, const std::vector& ms) throw(INTERP_KERNEL::Exception); + void setGroupsFromScratch(int meshDimRelToMax, const std::vector& ms) throw(INTERP_KERNEL::Exception); void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector& ms) throw(INTERP_KERNEL::Exception); void optimizeFamilies() throw(INTERP_KERNEL::Exception); private: @@ -104,7 +104,7 @@ namespace ParaMEDMEM const MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception); MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMax) throw(INTERP_KERNEL::Exception); void checkMeshDimCoherency(int meshDim, int meshDimRelToMax) const throw(INTERP_KERNEL::Exception); - DataArrayDouble *checkMultiMesh(const std::vector& ms) const throw(INTERP_KERNEL::Exception); + DataArrayDouble *checkMultiMesh(const std::vector& ms) const throw(INTERP_KERNEL::Exception); private: std::map > _groups; std::map _families; diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 2ca4fb7d7..08e369c06 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -238,7 +238,7 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const char *m if(v.empty()) return; int sz=v.size(); - std::vector ms(sz); + std::vector ms(sz); for(int i=0;igetDim()); @@ -272,7 +272,7 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const char *m else _m=_m_by_types; for(int i=0;idecrRef(); + (const_cast(ms[i]))->decrRef();//const cast under control to avoid a copy of array } MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(MEDCouplingUMesh *m) @@ -339,7 +339,7 @@ void MEDFileUMeshSplitL1::eraseFamilyField() /*! * This method ignores _m and _m_by_types. */ -void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector& ms, std::map& familyIds, +void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector& ms, std::map& familyIds, std::map >& groups) throw(INTERP_KERNEL::Exception) { int sz=ms.size(); diff --git a/src/MEDLoader/MEDFileMeshLL.hxx b/src/MEDLoader/MEDFileMeshLL.hxx index 57ecb634a..26f2d98e9 100644 --- a/src/MEDLoader/MEDFileMeshLL.hxx +++ b/src/MEDLoader/MEDFileMeshLL.hxx @@ -91,7 +91,7 @@ namespace ParaMEDMEM MEDCouplingUMesh *getWholeMesh(bool renum) const; const DataArrayInt *getFamilyField() const; void eraseFamilyField(); - void setGroupsFromScratch(const std::vector& ms, std::map& familyIds, + 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; static std::vector getNewFamiliesNumber(int nb, const std::map& families); diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index ecd95ef43..1e85c07bb 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -185,7 +185,7 @@ namespace MEDLoaderNS void prepareCellFieldDoubleForWriting(const ParaMEDMEM::MEDCouplingFieldDouble *f, const int *cellIds, std::list& split); void fillGaussDataOnField(const char *fileName, const std::list& data, MEDCouplingFieldDouble *f); void writeUMeshesDirectly(const char *fileName, const std::vector& mesh, const std::vector& families, bool forceFromScratch, bool &isRenumbering); - void writeUMeshesPartitionDirectly(const char *fileName, const char *meshName, const std::vector& meshes, bool forceFromScratch); + void writeUMeshesPartitionDirectly(const char *fileName, const char *meshName, const std::vector& meshes, bool forceFromScratch); void writeFieldAndMeshDirectly(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool forceFromScratch); void writeFieldTryingToFitExistingMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f); } @@ -2214,7 +2214,7 @@ void MEDLoaderNS::writeUMeshesDirectly(const char *fileName, const std::vector& meshes, bool forceFromScratch) +void MEDLoaderNS::writeUMeshesPartitionDirectly(const char *fileName, const char *meshName, const std::vector& meshes, bool forceFromScratch) { std::string meshNameCpp(meshName); char *maa=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM); @@ -2666,7 +2666,7 @@ void MEDLoader::WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplin MEDLoaderNS::writeUMeshesDirectly(fileName,meshV,famV,false,isRenumbering); } -void MEDLoader::WriteUMeshesPartition(const char *fileName, const char *meshNameC, const std::vector& meshes, bool writeFromScratch) throw(INTERP_KERNEL::Exception) +void MEDLoader::WriteUMeshesPartition(const char *fileName, const char *meshNameC, const std::vector& meshes, bool writeFromScratch) throw(INTERP_KERNEL::Exception) { std::string meshName(meshNameC); if(meshName.empty()) @@ -2680,11 +2680,11 @@ void MEDLoader::WriteUMeshesPartition(const char *fileName, const char *meshName if(meshes.empty()) throw INTERP_KERNEL::Exception("List of meshes must be not empty !"); DataArrayDouble *coords=meshes.front()->getCoords(); - for(std::vector::const_iterator iter=meshes.begin();iter!=meshes.end();iter++) + for(std::vector::const_iterator iter=meshes.begin();iter!=meshes.end();iter++) if(coords!=(*iter)->getCoords()) throw INTERP_KERNEL::Exception("Meshes does not not share the same coordinates : try method MEDCouplingPointSet::tryToShareSameCoords !"); std::set tmp; - for(std::vector::const_iterator iter=meshes.begin();iter!=meshes.end();iter++) + for(std::vector::const_iterator iter=meshes.begin();iter!=meshes.end();iter++) { if(tmp.find((*iter)->getName())==tmp.end()) tmp.insert((*iter)->getName()); @@ -2716,7 +2716,7 @@ void MEDLoader::WriteUMeshesPartition(const char *fileName, const char *meshName } } -void MEDLoader::WriteUMeshesPartitionDep(const char *fileName, const char *meshNameC, const std::vector& meshes, bool writeFromScratch) throw(INTERP_KERNEL::Exception) +void MEDLoader::WriteUMeshesPartitionDep(const char *fileName, const char *meshNameC, const std::vector& meshes, bool writeFromScratch) throw(INTERP_KERNEL::Exception) { std::string meshName(meshNameC); if(meshName.empty()) @@ -2730,11 +2730,11 @@ void MEDLoader::WriteUMeshesPartitionDep(const char *fileName, const char *meshN if(meshes.empty()) throw INTERP_KERNEL::Exception("List of meshes must be not empty !"); DataArrayDouble *coords=meshes.front()->getCoords(); - for(std::vector::const_iterator iter=meshes.begin();iter!=meshes.end();iter++) + for(std::vector::const_iterator iter=meshes.begin();iter!=meshes.end();iter++) if(coords!=(*iter)->getCoords()) throw INTERP_KERNEL::Exception("Meshes does not not share the same coordinates : try method MEDCouplingPointSet::tryToShareSameCoords !"); std::set tmp; - for(std::vector::const_iterator iter=meshes.begin();iter!=meshes.end();iter++) + for(std::vector::const_iterator iter=meshes.begin();iter!=meshes.end();iter++) { if(tmp.find((*iter)->getName())==tmp.end()) tmp.insert((*iter)->getName()); diff --git a/src/MEDLoader/MEDLoader.hxx b/src/MEDLoader/MEDLoader.hxx index caf103fc5..307dcdade 100644 --- a/src/MEDLoader/MEDLoader.hxx +++ b/src/MEDLoader/MEDLoader.hxx @@ -125,8 +125,8 @@ class MEDLOADER_EXPORT MEDLoader 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 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 WriteUMeshesPartition(const char *fileName, const char *meshName, const std::vector& meshes, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, const std::vector& meshes, bool writeFromScratch) throw(INTERP_KERNEL::Exception); + static void WriteUMeshesPartition(const char *fileName, const char *meshName, const std::vector& meshes, bool writeFromScratch) throw(INTERP_KERNEL::Exception); + static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, const std::vector& meshes, bool writeFromScratch) throw(INTERP_KERNEL::Exception); static void WriteUMeshes(const char *fileName, const std::vector& meshes, 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); diff --git a/src/MEDLoader/Swig/MEDLoader.i b/src/MEDLoader/Swig/MEDLoader.i index e6f960b7a..8226c6c55 100644 --- a/src/MEDLoader/Swig/MEDLoader.i +++ b/src/MEDLoader/Swig/MEDLoader.i @@ -158,19 +158,18 @@ public: } static void WriteUMeshesPartition(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) { - std::vector v=convertFieldDoubleVecFromPy(li); + std::vector v=convertUMeshVecFromPy(li); MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch); } static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) { - std::vector v=convertFieldDoubleVecFromPy(li); + std::vector v=convertUMeshVecFromPy(li); MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch); } static void WriteUMeshes(const char *fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) { - std::vector v=convertFieldDoubleVecFromPy(li); - std::vector v2(v.begin(),v.end()); - MEDLoader::WriteUMeshes(fileName,v2,writeFromScratch); + std::vector v=convertUMeshVecFromPy(li); + MEDLoader::WriteUMeshes(fileName,v,writeFromScratch); } static PyObject *GetTypesOfField(const char *fileName, const char *fieldName, const char *meshName) throw(INTERP_KERNEL::Exception) { diff --git a/src/MEDLoader/Swig/MEDLoaderTypemaps.i b/src/MEDLoader/Swig/MEDLoaderTypemaps.i index b6f40fa23..ef3f2ec78 100644 --- a/src/MEDLoader/Swig/MEDLoaderTypemaps.i +++ b/src/MEDLoader/Swig/MEDLoaderTypemaps.i @@ -153,9 +153,9 @@ static PyObject *convertFieldDoubleVecToPy(const std::vector convertFieldDoubleVecFromPy(PyObject *pyLi) +static std::vector convertUMeshVecFromPy(PyObject *pyLi) { - std::vector ret; + std::vector ret; if(PyList_Check(pyLi)) { int size=PyList_Size(pyLi); diff --git a/src/MEDLoader/Test/MEDLoaderTest.cxx b/src/MEDLoader/Test/MEDLoaderTest.cxx index 83bb4c6ac..c1d9b2468 100644 --- a/src/MEDLoader/Test/MEDLoaderTest.cxx +++ b/src/MEDLoader/Test/MEDLoaderTest.cxx @@ -282,7 +282,7 @@ void MEDLoaderTest::testMultiMeshRW1() mesh4->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn); mesh4->finishInsertingCells(); mesh4->setCoords(mesh1->getCoords()); - std::vector meshes; + std::vector meshes; meshes.push_back(mesh1); meshes.push_back(mesh2); meshes.push_back(mesh3);