From: eap Date: Thu, 21 May 2015 15:45:49 +0000 (+0300) Subject: 0022875: Fix SIGSEGV in getCZ() X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bd29c2807abde0c42045a4ca3126ae534021cacb;p=tools%2Fmedcoupling.git 0022875: Fix SIGSEGV in getCZ() --- diff --git a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx index a7676bb6c..d032530a6 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx @@ -52,6 +52,8 @@ MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const std::string& filename, int MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const ParaMEDMEM::MEDFileData* filedata, int ndomains, const std::string& library,bool creates_boundary_faces, bool create_joints, bool mesure_memory) { _input_collection=new MeshCollection(); + std::vector cz; // to fill from filedata + for (int i=0; igetMeshes()->getNumberOfMeshes(); i++) { ParaMEDMEM::MEDFileUMesh *mfm = dynamic_cast(filedata->getMeshes()->getMeshAtPos(i)); @@ -112,7 +114,7 @@ MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const ParaMEDMEM::MEDFileData* fi _input_collection->setNonEmptyMesh(idomain); } - ParallelTopology* aPT = new ParallelTopology((_input_collection->getMesh()), (_input_collection->getCZ()), cellglobal, nodeglobal, faceglobal); + ParallelTopology* aPT = new ParallelTopology((_input_collection->getMesh()), cz, cellglobal, nodeglobal, faceglobal); _input_collection->setTopology(aPT); createPartitionCollection(ndomains, library, creates_boundary_faces, create_joints, mesure_memory); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx index 2755f8d19..3b09c58f4 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx @@ -1819,7 +1819,11 @@ ParaMEDMEM::MEDCouplingUMesh* MEDPARTITIONER::MeshCollection::getFaceMesh(int id std::vector& MEDPARTITIONER::MeshCollection::getCZ() { - return _topology->getCZ(); + if ( _topology ) + return _topology->getCZ(); + + static std::vector noCZ; + return noCZ; } MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::getTopology() const diff --git a/src/MEDPartitioner_Swig/MEDPartitionerTest.py b/src/MEDPartitioner_Swig/MEDPartitionerTest.py index 4f23061f6..71a53f49d 100644 --- a/src/MEDPartitioner_Swig/MEDPartitionerTest.py +++ b/src/MEDPartitioner_Swig/MEDPartitionerTest.py @@ -34,7 +34,7 @@ class MEDPartitionerTest(unittest.TestCase): d=MEDFileData.New("/dn20/salome/imn/SALOME7YA/MED_BUILD/src/MEDLoader/Swig/splitted_blade1.med") #mfd1 = MEDFileData.New() p=MEDPartitioner.New(d,2); - part=MEDPartitioner.Graph(m.generateGraph()) + part=p.Graph(m.generateGraph()) part.partGraph(2) #a=part.getGraph() #n2o,o2n=ren.renumber(a,b)