Externalize famIds for new MEDReader to perform filtering on output datasets.
return constructDataArray(fst,globs,vals);
}
+/*!
+ * \param [out] famIds - Can be null. If not null the instance has to be dealt by the caller (decrRef).
+ * \param [out] isWithoutCopy - When true the returned instance \a famIds if not null is directly those in the data structure.
+ */
+void MEDMeshMultiLev::retrieveFamilyIdsOnCells(DataArrayInt *& famIds, bool& isWithoutCopy) const
+{
+ const DataArrayInt *fids(_cell_fam_ids);
+ if(!fids)
+ { famIds=0; isWithoutCopy=true; return ; }
+ std::size_t sz(_geo_types.size());
+ bool presenceOfPfls(false);
+ for(std::size_t i=0;i<sz && !presenceOfPfls;i++)
+ {
+ const DataArrayInt *pfl(_pfls[i]);
+ if(pfl)
+ presenceOfPfls=true;
+ }
+ if(!presenceOfPfls)
+ { famIds=const_cast<DataArrayInt *>(fids); famIds->incrRef(); isWithoutCopy=_cell_fam_ids_nocpy; return ; }
+ //bad luck the slowest part
+ isWithoutCopy=false;
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > retSafe(sz);
+ std::vector< const DataArrayInt *> ret(sz);
+ int start(0);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ const DataArrayInt *pfl(_pfls[i]);
+ int lgth(_nb_entities[i]);
+ if(pfl)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp(fids->selectByTupleId2(start,start+lgth,1));
+ retSafe[i]=tmp->selectByTupleIdSafe(pfl->begin(),pfl->end());
+ }
+ else
+ {
+ retSafe[i]=fids->selectByTupleId2(start,start+lgth,1);
+ }
+ ret[i]=retSafe[i];
+ start+=lgth;
+ }
+ famIds=DataArrayInt::Aggregate(ret);
+}
+
+/*!
+ * \param [out] numIds - Can be null. If not null the instance has to be dealt by the caller (decrRef).
+ * \param [out] isWithoutCopy - When true the returned instance \a numIds if not null is directly those in the data structure.
+ */
+void MEDMeshMultiLev::retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isWithoutCopy) const
+{
+ const DataArrayInt *nids(_cell_num_ids);
+ if(!nids)
+ { numIds=0; isWithoutCopy=true; return ; }
+ std::size_t sz(_geo_types.size());
+ bool presenceOfPfls(false);
+ for(std::size_t i=0;i<sz && !presenceOfPfls;i++)
+ {
+ const DataArrayInt *pfl(_pfls[i]);
+ if(pfl)
+ presenceOfPfls=true;
+ }
+ if(!presenceOfPfls)
+ { numIds=const_cast<DataArrayInt *>(nids); numIds->incrRef(); isWithoutCopy=_cell_num_ids_nocpy; return ; }
+ //bad luck the slowest part
+ isWithoutCopy=false;
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > retSafe(sz);
+ std::vector< const DataArrayInt *> ret(sz);
+ int start(0);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ const DataArrayInt *pfl(_pfls[i]);
+ int lgth(_nb_entities[i]);
+ if(pfl)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp(nids->selectByTupleId2(start,start+lgth,1));
+ retSafe[i]=tmp->selectByTupleIdSafe(pfl->begin(),pfl->end());
+ }
+ else
+ {
+ retSafe[i]=nids->selectByTupleId2(start,start+lgth,1);
+ }
+ ret[i]=retSafe[i];
+ start+=lgth;
+ }
+ numIds=DataArrayInt::Aggregate(ret);
+}
+
std::string MEDMeshMultiLev::getPflNameOfId(int id) const
{
std::size_t sz(_pfls.size());
}
}
-MEDMeshMultiLev::MEDMeshMultiLev()
+MEDMeshMultiLev::MEDMeshMultiLev():_nb_nodes(0),_cell_fam_ids_nocpy(false)
{
}
-MEDMeshMultiLev::MEDMeshMultiLev(int nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):_geo_types(gts),_nb_entities(nbEntities),_nb_nodes(nbNodes)
+MEDMeshMultiLev::MEDMeshMultiLev(int nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):_geo_types(gts),_nb_entities(nbEntities),_nb_nodes(nbNodes),_cell_fam_ids_nocpy(false),_cell_num_ids_nocpy(false)
{
std::size_t sz(_geo_types.size());
if(sz!=pfls.size() || sz!=nbEntities.size())
}
}
-MEDMeshMultiLev::MEDMeshMultiLev(const MEDMeshMultiLev& other):RefCountObject(other),_pfls(other._pfls),_geo_types(other._geo_types),_nb_entities(other._nb_entities),_node_reduction(other._node_reduction),_nb_nodes(other._nb_nodes)
+MEDMeshMultiLev::MEDMeshMultiLev(const MEDMeshMultiLev& other):RefCountObject(other),_pfls(other._pfls),_geo_types(other._geo_types),_nb_entities(other._nb_entities),_node_reduction(other._node_reduction),_nb_nodes(other._nb_nodes),_cell_fam_ids(other._cell_fam_ids),_cell_fam_ids_nocpy(other._cell_fam_ids_nocpy),_cell_num_ids(other._cell_num_ids),_cell_num_ids_nocpy(other._cell_num_ids_nocpy)
{
}
_parts.resize(sz);
_pfls.resize(sz);
_geo_types.resize(sz);
+ _nb_entities.resize(sz);
for(std::size_t i=0;i<sz;i++)
{
MEDCoupling1GTUMesh *obj(v[i]);
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev constructor : presence of a null pointer !");
_parts[i]=obj;
_geo_types[i]=obj->getCellModelEnum();
+ _nb_entities[i]=obj->getNumberOfCells();
+ }
+ // ids fields management
+ _cell_fam_ids_nocpy=(levs.size()==1);
+ if(_cell_fam_ids_nocpy)
+ {
+ const DataArrayInt *tmp(m->getFamilyFieldAtLevel(levs[0]));
+ if(tmp)
+ {
+ tmp->incrRef();
+ _cell_fam_ids=(const_cast<DataArrayInt *>(tmp));
+ }
+ }
+ else
+ {
+ std::vector<const DataArrayInt *> tmps(levs.size());
+ bool f(true);
+ for(std::size_t i=0;i<levs.size();i++)
+ {
+ tmps[i]=m->getFamilyFieldAtLevel(levs[i]);
+ if(!tmps[i])
+ f=false;
+ }
+ if(f)
+ _cell_fam_ids=DataArrayInt::Aggregate(tmps);
+ }
+ _cell_num_ids_nocpy=(levs.size()==1);
+ if(_cell_num_ids_nocpy)
+ {
+ const DataArrayInt *tmp(m->getNumberFieldAtLevel(levs[0]));
+ if(tmp)
+ {
+ tmp->incrRef();
+ _cell_num_ids=(const_cast<DataArrayInt *>(tmp));
+ }
+ }
+ else
+ {
+ std::vector<const DataArrayInt *> tmps(levs.size());
+ bool n(true);
+ for(std::size_t i=0;i<levs.size();i++)
+ {
+ tmps[i]=m->getNumberFieldAtLevel(levs[i]);
+ if(!tmps[i])
+ n=false;
+ }
+ if(n)
+ _cell_num_ids=DataArrayInt::Aggregate(tmps);
}
}
elt->incrRef();
_parts[i]=elt;
}
+ // ids fields management
+ _cell_fam_ids_nocpy=false;
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > famIdsSafe(sz);
+ std::vector<const DataArrayInt *> famIds(sz);
+ bool f(true);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ famIdsSafe[i]=m->extractFamilyFieldOnGeoType(gts[i]);
+ famIds[i]=famIdsSafe[i];
+ if(!famIds[i])
+ f=false;
+ }
+ if(f)
+ _cell_fam_ids=DataArrayInt::Aggregate(famIds);
}
void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes)
throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : presence of null pointer for an vector of double along an axis !");
_coords[i]=elt;
}
+ // ids fields management
+ _cell_fam_ids_nocpy=true; _cell_num_ids_nocpy=true;
+ const DataArrayInt *tmp(0);
+ tmp=m->getFamilyFieldAtLevel(0);
+ if(tmp)
+ {
+ tmp->incrRef();
+ _cell_fam_ids=const_cast<DataArrayInt *>(tmp);
+ }
+ tmp=m->getNumberFieldAtLevel(0);
+ if(tmp)
+ {
+ tmp->incrRef();
+ _cell_num_ids=const_cast<DataArrayInt *>(tmp);
+ }
}
MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDStructuredMeshMultiLev(m->getNumberOfNodes(),gts,pfls,nbEntities)
throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : presence of null pointer for an vector of double along an axis !");
_coords[i]=elt; _coords[i]->incrRef();
}
+ // ids fields management
+ _cell_fam_ids_nocpy=true; _cell_num_ids_nocpy=true;
+ const DataArrayInt *tmp(0);
+ tmp=m->getFamilyFieldAtLevel(0);
+ if(tmp)
+ {
+ tmp->incrRef();
+ _cell_fam_ids=const_cast<DataArrayInt *>(tmp);
+ }
+ tmp=m->getNumberFieldAtLevel(0);
+ if(tmp)
+ {
+ tmp->incrRef();
+ _cell_num_ids=const_cast<DataArrayInt *>(tmp);
+ }
}
MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDCMeshMultiLev& other):MEDStructuredMeshMultiLev(other),_coords(other._coords)
coords->incrRef();
_coords=coords;
_structure=m->getMesh()->getNodeGridStructure();
+ // ids fields management
+ _cell_fam_ids_nocpy=true; _cell_num_ids_nocpy=true;
+ const DataArrayInt *tmp(0);
+ tmp=m->getFamilyFieldAtLevel(0);
+ if(tmp)
+ {
+ tmp->incrRef();
+ _cell_fam_ids=const_cast<DataArrayInt *>(tmp);
+ }
+ tmp=m->getNumberFieldAtLevel(0);
+ if(tmp)
+ {
+ tmp->incrRef();
+ _cell_num_ids=const_cast<DataArrayInt *>(tmp);
+ }
}
MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDStructuredMeshMultiLev(m->getNumberOfNodes(),gts,pfls,nbEntities)
coords->incrRef();
_coords=coords;
_structure=m->getMesh()->getNodeGridStructure();
+ // ids fields management
+ _cell_fam_ids_nocpy=true; _cell_num_ids_nocpy=true;
+ const DataArrayInt *tmp(0);
+ tmp=m->getFamilyFieldAtLevel(0);
+ if(tmp)
+ {
+ tmp->incrRef();
+ _cell_fam_ids=const_cast<DataArrayInt *>(tmp);
+ }
+ tmp=m->getNumberFieldAtLevel(0);
+ if(tmp)
+ {
+ tmp->incrRef();
+ _cell_num_ids=const_cast<DataArrayInt *>(tmp);
+ }
}
MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshMultiLev& other):MEDStructuredMeshMultiLev(other),_coords(other._coords),_structure(other._structure)
void setNodeReduction(const DataArrayInt *nr);
bool isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs) const;
MEDLOADER_EXPORT DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
+ MEDLOADER_EXPORT void retrieveFamilyIdsOnCells(DataArrayInt *& famIds, bool& isWithoutCopy) const;
+ MEDLOADER_EXPORT void retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isWithoutCopy) const;
virtual void selectPartOfNodes(const DataArrayInt *pflNodes) = 0;
virtual MEDMeshMultiLev *prepare() const = 0;
int getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const;
std::vector<int> _nb_entities;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _node_reduction;
int _nb_nodes;
+ //
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _cell_fam_ids;
+ bool _cell_fam_ids_nocpy;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _cell_num_ids;
+ bool _cell_num_ids_nocpy;
public:
static const int PARAMEDMEM_2_VTKTYPE_LGTH=34;
static const unsigned char PARAMEDMEM_2_VTKTYPE[PARAMEDMEM_2_VTKTYPE_LGTH];
return sp->getDirectUndergroundSingleGeoTypeMesh(gt);
}
+/*!
+ * This method extracts from whole family field ids the part relative to the input parameter \a gt.
+ * \param [in] gt - the geometric type for which the family field is asked.
+ * \return DataArrayInt * - a pointer to DataArrayInt that the caller is to
+ * delete using decrRef() as it is no more needed.
+ * \sa MEDFileUMesh::extractNumberFieldOnGeoType
+ */
+DataArrayInt *MEDFileUMesh::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
+{
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt);
+ int lev=(int)cm.getDimension()-getMeshDimension();
+ const MEDFileUMeshSplitL1 *sp(getMeshAtLevSafe(lev));
+ return sp->extractFamilyFieldOnGeoType(gt);
+}
+
+/*!
+ * This method extracts from whole number field ids the part relative to the input parameter \a gt.
+ * \param [in] gt - the geometric type for which the number field is asked.
+ * \return DataArrayInt * - a pointer to DataArrayInt that the caller is to
+ * delete using decrRef() as it is no more needed.
+ * \sa MEDFileUMesh::extractFamilyFieldOnGeoType
+ */
+DataArrayInt *MEDFileUMesh::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
+{
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt);
+ int lev=(int)cm.getDimension()-getMeshDimension();
+ const MEDFileUMeshSplitL1 *sp(getMeshAtLevSafe(lev));
+ return sp->extractNumberFieldOnGeoType(gt);
+}
+
const MEDFileUMeshSplitL1 *MEDFileUMesh::getMeshAtLevSafe(int meshDimRelToMaxExt) const
{
if(meshDimRelToMaxExt==1)
MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const;
MEDLOADER_EXPORT std::vector<MEDCoupling1GTUMesh *> getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const;
MEDLOADER_EXPORT MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const;
+ MEDLOADER_EXPORT DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ MEDLOADER_EXPORT DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
//
MEDLOADER_EXPORT void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
MEDLOADER_EXPORT void setCoords(DataArrayDouble *coords);
{
for(int i=0;i<sz;i++)
fams[i]=v[i]->getFam();
- _fam=DataArrayInt::Aggregate(fams);
+ if(sz!=1)
+ _fam=DataArrayInt::Aggregate(fams);
+ else
+ {
+ fams[0]->incrRef();
+ _fam=const_cast<DataArrayInt *>(fams[0]);
+ }
}
if(l2.isNumDefinedOnLev(id))
{
for(int i=0;i<sz;i++)
nums[i]=v[i]->getNum();
- _num=DataArrayInt::Aggregate(nums);
+ if(sz!=1)
+ _num=DataArrayInt::Aggregate(nums);
+ else
+ {
+ nums[0]->incrRef();
+ _num=const_cast<DataArrayInt *>(nums[0]);
+ }
computeRevNum();
}
if(l2.isNamesDefinedOnLev(id))
return tmp.retn();
}
+DataArrayInt *MEDFileUMeshSplitL1::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
+{
+ const DataArrayInt *fam(_fam);
+ if(!fam)
+ return 0;
+ int start(0),stop(0);
+ _m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop);
+ return fam->selectByTupleId2(start,stop,1);
+}
+
+DataArrayInt *MEDFileUMeshSplitL1::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
+{
+ const DataArrayInt *num(_num);
+ if(!num)
+ return 0;
+ int start(0),stop(0);
+ _m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop);
+ return num->selectByTupleId2(start,stop,1);
+}
+
DataArrayInt *MEDFileUMeshSplitL1::getOrCreateAndGetFamilyField()
{
if((DataArrayInt *)_fam)
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartWithoutComputation : the geometric type is not existing !");
}
+void MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const
+{
+ start=0; stop=0;
+ std::vector<MEDCoupling1GTUMesh *> v(getPartsWithoutComputation());
+ std::size_t sz(v.size());
+ for(std::size_t i=0;i<sz;i++)
+ {
+ if(v[i])
+ {
+ if(v[i]->getCellModelEnum()==gt)
+ {
+ stop=start+v[i]->getNumberOfCells();
+ return;
+ }
+ else
+ start+=v[i]->getNumberOfCells();
+ }
+ }
+ throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation : the geometric type is not existing !");
+}
+
void MEDFileUMeshAggregateCompute::forceComputationOfPartsFromUMesh() const
{
const MEDCouplingUMesh *m(_m);
std::vector<MEDCoupling1GTUMesh *> getParts() const;
std::vector<MEDCoupling1GTUMesh *> getPartsWithoutComputation() const;
MEDCoupling1GTUMesh *getPartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const;
+ void getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const;
std::size_t getTimeOfThis() const;
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildren() const;
MEDCouplingUMesh *getWholeMesh(bool renum) const;
std::vector<MEDCoupling1GTUMesh *> getDirectUndergroundSingleGeoTypeMeshes() const { return _m_by_types.getPartsWithoutComputation(); }
MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const { return _m_by_types.getPartWithoutComputation(gt); }
+ DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
std::vector<int> getDistributionOfTypes() const { return _m_by_types.getDistributionOfTypes(); }
DataArrayInt *getOrCreateAndGetFamilyField();
const DataArrayInt *getFamilyField() const;
%newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
%newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
%newobject ParaMEDMEM::MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh;
+%newobject ParaMEDMEM::MEDFileUMesh::extractFamilyFieldOnGeoType;
+%newobject ParaMEDMEM::MEDFileUMesh::extractNumberFieldOnGeoType;
%newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
%newobject ParaMEDMEM::MEDFileCMesh::New;
%newobject ParaMEDMEM::MEDFileCurveLinearMesh::New;
void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
void optimizeFamilies() throw(INTERP_KERNEL::Exception);
DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
+ DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
%extend
{
MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const throw(INTERP_KERNEL::Exception);
protected:
~MEDMeshMultiLev();
+ public:
+ %extend
+ {
+ PyObject *retrieveFamilyIdsOnCells() const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *famIds(0);
+ bool isWithoutCopy(false);
+ self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
+ PyObject *ret=PyTuple_New(2);
+ PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
+ Py_XINCREF(ret1Py);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,ret1Py);
+ return ret;
+ }
+
+ PyObject *retrieveNumberIdsOnCells() const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *numIds(0);
+ bool isWithoutCopy(false);
+ self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
+ PyObject *ret=PyTuple_New(2);
+ PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
+ Py_XINCREF(ret1Py);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,ret1Py);
+ return ret;
+ }
+ }
};
class MEDUMeshMultiLev : public MEDMeshMultiLev
m.setName("mesh") ; m.getCoords().setInfoOnComponents(["XX [m]","YYY [km]"])
m1=m.buildDescendingConnectivity()[0]
mm=MEDFileUMesh() ; mm.setMeshes([m,m1])
+ fam=DataArrayInt(9) ; fam.iota(0) ; mm.setFamilyFieldArr(0,fam)
+ fam=DataArrayInt(32) ; fam.iota(20) ; mm.setFamilyFieldArr(-1,fam)
#
fieldName="zeField"
fs=MEDFileFieldMultiTS()
self.assertTrue(a3.isEqual(DataArrayInt([2,0,1,2,1,2,2,2,0,2,3,4,2,4,5,2,5,3,2,6,7,2,7,8,2,8,6,2,9,10,2,10,11,2,11,9,2,12,13,2,13,14,2,14,15,2,15,12,2,16,17,2,17,18,2,18,19,2,19,16,2,20,21,2,21,22,2,22,23,2,23,20,2,24,25,2,25,26,2,26,27,2,27,24,2,28,29,2,29,30,2,30,31,2,31,28,3,0,1,2,3,3,4,5,3,6,7,8,3,9,10,11,4,12,13,14,15,4,16,17,18,19,4,20,21,22,23,4,24,25,26,27,4,28,29,30,31])))
self.assertTrue(a4 is None)
self.assertTrue(a5 is None)
+ a6,a7=mml2.retrieveFamilyIdsOnCells()
+ self.assertTrue(a6.isEqual(DataArrayInt([20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,0,1,2,3,4,5,6,7,8])))
+ self.assertTrue(not a7)
for i in xrange(5):
fsst=MEDFileField1TSStructItem.BuildItemFrom(fields[0][i],mst)
fields[0][i].loadArraysIfNecessary()