_nb_nodes=mesh->getNumberOfNodes();
_geo_types_distrib.resize(levs.size());
for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
- {
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> 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)
MEDMeshMultiLev *MEDFileField1TSStructItem::buildFromScratchDataSetSupportOnCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
{
- std::vector<INTERP_KERNEL::NormalizedCellType> a0;
- std::vector<const DataArrayInt *> a1;
- std::vector<int> a2;
+ std::size_t sz(_items.size());
+ std::vector<INTERP_KERNEL::NormalizedCellType> a0(sz);
+ std::vector<const DataArrayInt *> a1(sz);
+ std::vector<int> a2(sz);
std::size_t i(0);
for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++,i++)
{
}
}
+std::vector<int> MEDFileMesh::getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> mLev(getGenMeshAtLevel(meshDimRelToMax));
+ return mLev->getDistributionOfTypes();
+}
+
void MEDFileMesh::TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector<int> >& famIdsPerGrp)
{
famArr->applyLin(offset>0?1:-1,offset,0);
return getMeshAtLevel(meshDimRelToMax,renum);
}
+std::vector<int> 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
* 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<MEDCoupling1GTUMesh *> MEDFileUMesh::getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception)
{
/*!
* 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)
{
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<int> getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception);
virtual void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const throw(INTERP_KERNEL::Exception) = 0;
//
bool areFamsEqual(const MEDFileMesh *other, std::string& what) const;
DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& 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<int> 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);
}
}
-std::vector<int> MEDFileUMeshAggregateCompute::getDistributionOfTypes() const
+std::vector<int> MEDFileUMeshAggregateCompute::getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
{
if(_mp_time<_m_time)
{
void synchronizeTinyInfo(const MEDFileMesh& master) const;
bool empty() const;
int getMeshDimension() const;
- std::vector<int> getDistributionOfTypes() const;
+ std::vector<int> getDistributionOfTypes() const throw(INTERP_KERNEL::Exception);
int getSize() const throw(INTERP_KERNEL::Exception);
void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
private:
MEDCouplingUMesh *getWholeMesh(bool renum) const;
std::vector<MEDCoupling1GTUMesh *> 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<int> 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;
%feature("unref") MEDUMeshMultiLev "$this->decrRef();"
%feature("unref") MEDCMeshMultiLev "$this->decrRef();"
%feature("unref") MEDCurveLinearMeshMultiLev "$this->decrRef();"
+%feature("unref") MEDFileMeshStruct "$this->decrRef();"
class MEDLoader
{
virtual std::vector<int> getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
virtual std::vector<int> getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
virtual std::vector<int> getNameArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
+ virtual std::vector<int> getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception);
std::vector<int> getNonEmptyLevels() const throw(INTERP_KERNEL::Exception);
std::vector<int> getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
void write(const char *fileName, int mode) 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);
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);
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)
{