From: ageay Date: Tue, 30 Jul 2013 06:48:55 +0000 (+0000) Subject: MEDReader -> debugging session X-Git-Tag: B4PolyhIntersect~22 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9eaf1aafc86eab3de07186d3c62e13f21b2d89af;p=modules%2Fmed.git MEDReader -> debugging session --- diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index c6bc51e1a..e8d6f8b7c 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -434,21 +434,30 @@ void MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * MEDCouplingAutoRefCountObjectPtr a(const_cast(tmp)); tmp->incrRef(); int szBCE(0),szD(0),szF(0); bool isPolyh(false); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_parts.begin();it!=_parts.end();it++) + int iii(0); + for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++) { const MEDCoupling1GTUMesh *cur(*it); if(!cur) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : a part is null !"); + // + const DataArrayInt *pfl(_pfls[iii]); + MEDCouplingAutoRefCountObjectPtr cur2; + if(!pfl) + { cur2=const_cast(cur); cur2->incrRef(); } + else + { cur2=dynamic_cast(cur->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); cur=cur2; } + // int curNbCells(cur->getNumberOfCells()); szBCE+=curNbCells; if((*it)->getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED) - szD+=(*it)->getNodalConnectivity()->getNumberOfTuples()+curNbCells; + szD+=cur->getNodalConnectivity()->getNumberOfTuples()+curNbCells; else { isPolyh=true; - MEDCouplingAutoRefCountObjectPtr tmp((*it)->computeEffectiveNbOfNodesPerCell()); + MEDCouplingAutoRefCountObjectPtr tmp(cur->computeEffectiveNbOfNodesPerCell()); szD+=tmp->accumulate(0)+curNbCells; - szF+=2*curNbCells+(*it)->getNodalConnectivity()->getNumberOfTuples(); + szF+=2*curNbCells+cur->getNodalConnectivity()->getNumberOfTuples(); } } MEDCouplingAutoRefCountObjectPtr b(DataArrayByte::New()); b->alloc(szBCE,1); char *bPtr(b->getPointer()); @@ -458,9 +467,18 @@ void MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * if(isPolyh) { e->alloc(szBCE,1); ePtr=e->getPointer(); f->alloc(szF,1); fPtr=f->getPointer(); } int k(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_parts.begin();it!=_parts.end();it++) + iii=0; + for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++) { const MEDCoupling1GTUMesh *cur(*it); + // + const DataArrayInt *pfl(_pfls[iii]); + MEDCouplingAutoRefCountObjectPtr cur2; + if(!pfl) + { cur2=const_cast(cur); cur2->incrRef(); } + else + { cur2=dynamic_cast(cur->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); cur=cur2; } + // int curNbCells(cur->getNumberOfCells()); int gt((int)cur->getCellModelEnum()); if(gt<0 || gt>=PARAMEDMEM_2_VTKTYPE_LGTH) @@ -545,7 +563,7 @@ void MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * { faceLocations=e.retn(); faces=f.retn(); } } -void MEDUMeshMultiLev::reorderNodesIfNecessary(DataArrayDouble *coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const throw(INTERP_KERNEL::Exception) +void MEDUMeshMultiLev::reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const throw(INTERP_KERNEL::Exception) { const DataArrayInt *nr(_node_reduction); if(!nr) @@ -617,8 +635,7 @@ void MEDUMeshMultiLev::reorderNodesIfNecessary(DataArrayDouble *coords, DataArra } } } - MEDCouplingAutoRefCountObjectPtr coo(coords->selectByTupleIdSafe(nr->begin(),nr->end())); - coords->cpyFrom(*coo); + coords=(coords->selectByTupleIdSafe(nr->begin(),nr->end())); } //= diff --git a/src/MEDLoader/MEDFileFieldOverView.hxx b/src/MEDLoader/MEDFileFieldOverView.hxx index 8be4e20a1..f0c6e6b22 100644 --- a/src/MEDLoader/MEDFileFieldOverView.hxx +++ b/src/MEDLoader/MEDFileFieldOverView.hxx @@ -109,7 +109,7 @@ namespace ParaMEDMEM MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MEDCouplingAutoRefCountObjectPtr& part); MEDLOADER_EXPORT void buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const throw(INTERP_KERNEL::Exception); private: - void reorderNodesIfNecessary(DataArrayDouble *coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const throw(INTERP_KERNEL::Exception); + void reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const throw(INTERP_KERNEL::Exception); private: MEDUMeshMultiLev(const MEDUMeshMultiLev& other); MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& levs);