+/*!
+ * \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(DataArrayIdType *& famIds, bool& isWithoutCopy) const
+{
+ const DataArrayIdType *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 DataArrayIdType *pfl(_pfls[i]);
+ if(pfl)
+ presenceOfPfls=true;
+ }
+ if(!presenceOfPfls)
+ { famIds=const_cast<DataArrayIdType *>(fids); famIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(famIds); return ; }
+ //bad luck the slowest part
+ isWithoutCopy=false;
+ std::vector< MCAuto<DataArrayIdType> > retSafe(sz);
+ std::vector< const DataArrayIdType *> ret(sz);
+ mcIdType start(0);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ const DataArrayIdType *pfl(_pfls[i]);
+ mcIdType lgth(_nb_entities[i]);
+ if(pfl)
+ {
+ MCAuto<DataArrayIdType> tmp(fids->selectByTupleIdSafeSlice(start,start+lgth,1));
+ retSafe[i]=tmp->selectByTupleIdSafe(pfl->begin(),pfl->end());
+ }
+ else
+ {
+ retSafe[i]=fids->selectByTupleIdSafeSlice(start,start+lgth,1);
+ }
+ ret[i]=retSafe[i];
+ start+=lgth;
+ }
+ famIds=DataArrayIdType::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(DataArrayIdType *& numIds, bool& isWithoutCopy) const
+{
+ const DataArrayIdType *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 DataArrayIdType *pfl(_pfls[i]);
+ if(pfl)
+ presenceOfPfls=true;
+ }
+ if(!presenceOfPfls)
+ { numIds=const_cast<DataArrayIdType *>(nids); numIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(numIds); return ; }
+ //bad luck the slowest part
+ isWithoutCopy=false;
+ std::vector< MCAuto<DataArrayIdType> > retSafe(sz);
+ std::vector< const DataArrayIdType *> ret(sz);
+ mcIdType start(0);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ const DataArrayIdType *pfl(_pfls[i]);
+ mcIdType lgth(_nb_entities[i]);
+ if(pfl)
+ {
+ MCAuto<DataArrayIdType> tmp(nids->selectByTupleIdSafeSlice(start,start+lgth,1));
+ retSafe[i]=tmp->selectByTupleIdSafe(pfl->begin(),pfl->end());
+ }
+ else
+ {
+ retSafe[i]=nids->selectByTupleIdSafeSlice(start,start+lgth,1);
+ }
+ ret[i]=retSafe[i];
+ start+=lgth;
+ }
+ numIds=DataArrayIdType::Aggregate(ret);
+}
+
+/*!
+ * \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::retrieveFamilyIdsOnNodes(DataArrayIdType *& famIds, bool& isWithoutCopy) const
+{
+ const DataArrayIdType *fids(_node_fam_ids);
+ if(!fids)
+ { famIds=0; isWithoutCopy=true; return ; }
+ const DataArrayIdType *nr(_node_reduction);
+ if(nr)
+ {
+ isWithoutCopy=false;
+ famIds=fids->selectByTupleIdSafe(nr->begin(),nr->end());
+ }
+ else
+ {
+ famIds=const_cast<DataArrayIdType *>(fids); famIds->incrRef();
+ isWithoutCopy=_mesh->isObjectInTheProgeny(famIds);
+ }
+}
+
+/*!
+ * \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::retrieveNumberIdsOnNodes(DataArrayIdType *& numIds, bool& isWithoutCopy) const
+{
+ const DataArrayIdType *fids(_node_num_ids);
+ if(!fids)
+ { numIds=0; isWithoutCopy=true; return ; }
+ const DataArrayIdType *nr(_node_reduction);
+ if(nr)
+ {
+ isWithoutCopy=false;
+ numIds=fids->selectByTupleIdSafe(nr->begin(),nr->end());
+ }
+ else
+ {
+ numIds=const_cast<DataArrayIdType *>(fids); numIds->incrRef();
+ isWithoutCopy=_mesh->isObjectInTheProgeny(numIds);
+ }
+}
+
+/*!
+ * This method returns, if any, a new object containing the global node ids **BUT CONTRARY TO OTHER RETRIEVE METHODS** the returned object is always a NON AGGREGATED object. So the returned object if not null
+ * can be used as this safely.
+ */
+DataArrayIdType *MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny() const
+{
+ const MEDFileUMesh *umesh(dynamic_cast<const MEDFileUMesh *>(_mesh));
+ if(!umesh)
+ return nullptr;
+ const PartDefinition *pd(umesh->getPartDefAtLevel(1));
+ if(!pd)
+ {
+ MCAuto<DataArrayIdType> gni = umesh->getGlobalNumFieldAtLevel(1);
+ if(gni.isNull())
+ return nullptr;
+ return gni->deepCopy();
+ }
+ MCAuto<DataArrayIdType> tmp(pd->toDAI());
+ const DataArrayIdType *tmpCpp(tmp);
+ if(!tmpCpp)
+ return nullptr;
+ //
+ const DataArrayIdType *nr(_node_reduction);
+ if(nr)
+ return tmp->selectByTupleIdSafe(nr->begin(),nr->end());
+ else
+ return tmp->deepCopy();// Yes a deep copy is needed because this method has to return a non aggregated object !
+}
+
+std::vector< INTERP_KERNEL::NormalizedCellType > MEDMeshMultiLev::getGeoTypes() const
+{
+ return _geo_types;
+}
+
+void MEDMeshMultiLev::setFamilyIdsOnCells(DataArrayIdType *famIds)
+{
+ _cell_fam_ids=famIds;
+ if(famIds)
+ famIds->incrRef();
+}
+
+void MEDMeshMultiLev::setNumberIdsOnCells(DataArrayIdType *numIds)
+{
+ _cell_num_ids=numIds;
+ if(numIds)
+ numIds->incrRef();
+}
+
+void MEDMeshMultiLev::setFamilyIdsOnNodes(DataArrayIdType *famIds)
+{
+ _node_fam_ids=famIds;
+ if(famIds)
+ famIds->incrRef();
+}
+
+void MEDMeshMultiLev::setNumberIdsOnNodes(DataArrayIdType *numIds)
+{
+ _node_num_ids=numIds;
+ if(numIds)
+ numIds->incrRef();
+}
+