From: ageay Date: Wed, 27 Nov 2013 10:49:13 +0000 (+0000) Subject: Most effective and safe method to state if the data returned is the same than inside... X-Git-Tag: V7_3_1b1~45 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FBR_imps_2013;p=tools%2Fmedcoupling.git Most effective and safe method to state if the data returned is the same than inside the code. --- diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index bb4299546..c9c047ef6 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -638,32 +638,25 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * } } } - bool ret(true); if(!isPolyh) - ret=reorderNodesIfNecessary(a,d,0); + reorderNodesIfNecessary(a,d,0); else - ret=reorderNodesIfNecessary(a,d,f); + reorderNodesIfNecessary(a,d,f); if(a->getNumberOfComponents()!=3) - { - a=a->changeNbOfComponents(3,0.); - ret=false; - } + a=a->changeNbOfComponents(3,0.); coords=a.retn(); types=b.retn(); cellLocations=c.retn(); cells=d.retn(); if(!isPolyh) { faceLocations=0; faces=0; } else { faceLocations=e.retn(); faces=f.retn(); } - return ret; + return tmp==((DataArrayDouble *)a); } -/*! - * If returned value is false in/output pointer \a coords is modified. If returned value is true in/output pointer \a coords is not modifed. - */ -bool MEDUMeshMultiLev::reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const +void MEDUMeshMultiLev::reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const { const DataArrayInt *nr(_node_reduction); if(!nr) - return true; + return ; int sz(coords->getNumberOfTuples()); std::vector b(sz,false); const int *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end()); @@ -732,7 +725,6 @@ bool MEDUMeshMultiLev::reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr< } } coords=(coords->selectByTupleIdSafe(nr->begin(),nr->end())); - return false; } //= diff --git a/src/MEDLoader/MEDFileFieldOverView.hxx b/src/MEDLoader/MEDFileFieldOverView.hxx index 4531d4f24..ff4ce6c41 100644 --- a/src/MEDLoader/MEDFileFieldOverView.hxx +++ b/src/MEDLoader/MEDFileFieldOverView.hxx @@ -114,7 +114,7 @@ namespace ParaMEDMEM MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MEDCouplingAutoRefCountObjectPtr& part); MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const; private: - bool reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const; + void reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const; private: MEDUMeshMultiLev(const MEDUMeshMultiLev& other); MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& levs);