From: ageay Date: Fri, 26 Jul 2013 11:02:30 +0000 (+0000) Subject: MEDReader ready -> debug in process X-Git-Tag: B4PolyhIntersect~41 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a3ce95a1b179922acee7f9eca2d73c356c61f365;p=modules%2Fmed.git MEDReader ready -> debug in process --- diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index 2552ebd47..ee1c95285 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -52,10 +52,7 @@ MEDFileMeshStruct::MEDFileMeshStruct(const MEDFileMesh *mesh):_mesh(mesh) _nb_nodes=mesh->getNumberOfNodes(); _geo_types_distrib.resize(levs.size()); for(std::vector::const_iterator lev=levs.begin();lev!=levs.end();lev++) - { - MEDCouplingAutoRefCountObjectPtr mLev=mesh->getGenMeshAtLevel(*lev); - _geo_types_distrib[-(*lev)]=mLev->getDistributionOfTypes(); - } + _geo_types_distrib[-(*lev)]=mesh->getDistributionOfTypes(*lev); } int MEDFileMeshStruct::getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const throw(INTERP_KERNEL::Exception) @@ -1295,9 +1292,10 @@ std::size_t MEDFileField1TSStructItem::getHeapMemorySize() const MEDMeshMultiLev *MEDFileField1TSStructItem::buildFromScratchDataSetSupportOnCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception) { - std::vector a0; - std::vector a1; - std::vector a2; + std::size_t sz(_items.size()); + std::vector a0(sz); + std::vector a1(sz); + std::vector a2(sz); std::size_t i(0); for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++,i++) { diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 615abd7aa..6f2fac6e9 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -1738,6 +1738,12 @@ void MEDFileMesh::appendFamilyEntries(const DataArrayInt *famIds, const std::vec } } +std::vector MEDFileMesh::getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception) +{ + MEDCouplingAutoRefCountObjectPtr mLev(getGenMeshAtLevel(meshDimRelToMax)); + return mLev->getDistributionOfTypes(); +} + void MEDFileMesh::TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector >& famIdsPerGrp) { famArr->applyLin(offset>0?1:-1,offset,0); @@ -2882,6 +2888,12 @@ MEDCouplingMesh *MEDFileUMesh::getGenMeshAtLevel(int meshDimRelToMax, bool renum return getMeshAtLevel(meshDimRelToMax,renum); } +std::vector MEDFileUMesh::getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception) +{ + const MEDFileUMeshSplitL1 *l1(getMeshAtLevSafe(meshDimRelToMax)); + return l1->getDistributionOfTypes(); +} + /*! * Returns a MEDCouplingUMesh of a relative dimension == 0. * \param [in] renum - if \c true, the returned mesh is permuted according to the @@ -2938,6 +2950,7 @@ MEDCouplingUMesh *MEDFileUMesh::getLevelM3Mesh(bool renum) const throw(INTERP_KE * This method returns a vector of mesh parts containing each exactly one geometric type. * This method will never launch an automatic computation of split by type (an INTERP_KERNEL::Exception will be then thrown). * This method is only for memory aware users. + * The returned pointers are **NOT** new object pointer. No need to mange them. */ std::vector MEDFileUMesh::getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception) { @@ -2948,6 +2961,7 @@ std::vector MEDFileUMesh::getDirectUndergroundSingleGeoTy /*! * This method returns the part of \a this having the geometric type \a gt. * If such part is not existing an exception will be thrown. + * The returned pointer is **NOT** new object pointer. No need to mange it. */ MEDCoupling1GTUMesh *MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception) { diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 595d432df..8492b0b4a 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -73,6 +73,7 @@ namespace ParaMEDMEM virtual void write(med_idt fid) const throw(INTERP_KERNEL::Exception); virtual int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0; virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception) = 0; + virtual std::vector getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception); virtual void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const throw(INTERP_KERNEL::Exception) = 0; // bool areFamsEqual(const MEDFileMesh *other, std::string& what) const; @@ -234,6 +235,7 @@ namespace ParaMEDMEM DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception); + std::vector getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception); diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index d023393e7..a4722e9b4 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -1189,7 +1189,7 @@ int MEDFileUMeshAggregateCompute::getMeshDimension() const } } -std::vector MEDFileUMeshAggregateCompute::getDistributionOfTypes() const +std::vector MEDFileUMeshAggregateCompute::getDistributionOfTypes() const throw(INTERP_KERNEL::Exception) { if(_mp_time<_m_time) { diff --git a/src/MEDLoader/MEDFileMeshLL.hxx b/src/MEDLoader/MEDFileMeshLL.hxx index 9338ea825..56e19db6f 100644 --- a/src/MEDLoader/MEDFileMeshLL.hxx +++ b/src/MEDLoader/MEDFileMeshLL.hxx @@ -154,7 +154,7 @@ namespace ParaMEDMEM void synchronizeTinyInfo(const MEDFileMesh& master) const; bool empty() const; int getMeshDimension() const; - std::vector getDistributionOfTypes() const; + std::vector getDistributionOfTypes() const throw(INTERP_KERNEL::Exception); int getSize() const throw(INTERP_KERNEL::Exception); void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception); private: @@ -193,6 +193,7 @@ namespace ParaMEDMEM MEDCouplingUMesh *getWholeMesh(bool renum) const; std::vector getDirectUndergroundSingleGeoTypeMeshes() const throw(INTERP_KERNEL::Exception) { return _m_by_types.getPartsWithoutComputation(); } MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception) { return _m_by_types.getPartWithoutComputation(gt); } + std::vector getDistributionOfTypes() const throw(INTERP_KERNEL::Exception) { return _m_by_types.getDistributionOfTypes(); } DataArrayInt *getOrCreateAndGetFamilyField() throw(INTERP_KERNEL::Exception); const DataArrayInt *getFamilyField() const; const DataArrayInt *getNumberField() const; diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 864f1307f..62f72f9b3 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -212,6 +212,7 @@ using namespace ParaMEDMEM; %feature("unref") MEDUMeshMultiLev "$this->decrRef();" %feature("unref") MEDCMeshMultiLev "$this->decrRef();" %feature("unref") MEDCurveLinearMeshMultiLev "$this->decrRef();" +%feature("unref") MEDFileMeshStruct "$this->decrRef();" class MEDLoader { @@ -473,6 +474,7 @@ namespace ParaMEDMEM virtual std::vector getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception); virtual std::vector getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception); virtual std::vector getNameArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception); + 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); @@ -703,7 +705,6 @@ namespace ParaMEDMEM MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception); - MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception); // void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception); void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception); @@ -785,6 +786,14 @@ namespace ParaMEDMEM PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); return ret; } + + MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception) + { + MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt)); + if(ret) + ret->incrRef(); + return ret; + } PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception) {