//=
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m):MEDMeshMultiLev(m),_is_internal(true)
+MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector<int>& lev):MEDMeshMultiLev(m),_is_internal(true)
{
+ initStdFieldOfIntegers(m);
}
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector<int>& lev):MEDMeshMultiLev(m),_is_internal(true)
+MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(m,nbOfNodes,gts,pfls,nbEntities),_is_internal(true)
+{
+ initStdFieldOfIntegers(m);
+}
+
+MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other):MEDMeshMultiLev(other),_is_internal(true),_face_fam_ids(other._face_fam_ids),_face_fam_ids_nocpy(other._face_fam_ids_nocpy),_face_num_ids(other._face_num_ids),_face_num_ids_nocpy(other._face_num_ids_nocpy)
+{
+}
+
+void MEDStructuredMeshMultiLev::initStdFieldOfIntegers(const MEDFileStructuredMesh *m)
{
// ids fields management
_cell_fam_ids_nocpy=true; _cell_num_ids_nocpy=true;
tmp->incrRef();
_node_num_ids=const_cast<DataArrayInt *>(tmp);
}
-}
-
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(m,nbOfNodes,gts,pfls,nbEntities),_is_internal(true)
-{
- // 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);
- }
- //
- _node_fam_ids_nocpy=true; _node_num_ids_nocpy=true;
- tmp=0;
- tmp=m->getFamilyFieldAtLevel(1);
+ // faces (if any)
+ _face_fam_ids_nocpy=true; _face_num_ids_nocpy=true;
+ tmp=m->getFamilyFieldAtLevel(-1);
if(tmp)
{
tmp->incrRef();
- _node_fam_ids=const_cast<DataArrayInt *>(tmp);
+ _face_fam_ids=const_cast<DataArrayInt *>(tmp);
}
- tmp=m->getNumberFieldAtLevel(1);
+ tmp=m->getNumberFieldAtLevel(-1);
if(tmp)
{
tmp->incrRef();
- _node_num_ids=const_cast<DataArrayInt *>(tmp);
+ _face_num_ids=const_cast<DataArrayInt *>(tmp);
}
}
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other):MEDMeshMultiLev(other),_is_internal(true)
+void MEDStructuredMeshMultiLev::moveFaceToCell() const
{
+ const_cast<MEDStructuredMeshMultiLev *>(this)->_cell_fam_ids_nocpy=_face_fam_ids_nocpy;
+ const_cast<MEDStructuredMeshMultiLev *>(this)->_cell_num_ids_nocpy=_face_num_ids_nocpy;
+ const_cast<MEDStructuredMeshMultiLev *>(this)->_cell_fam_ids=_face_fam_ids; const_cast<MEDStructuredMeshMultiLev *>(this)->_face_fam_ids=0;
+ const_cast<MEDStructuredMeshMultiLev *>(this)->_cell_num_ids=_face_num_ids; const_cast<MEDStructuredMeshMultiLev *>(this)->_face_num_ids=0;
}
bool MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase(MEDMeshMultiLev *&ret) const
if(!_pfls.empty())
pfl=_pfls[0];
MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> facesIfPresent2(facesIfPresent); facesIfPresent->incrRef();
+ moveFaceToCell();
MEDCouplingAutoRefCountObjectPtr<MEDUMeshMultiLev> ret2(new MEDUMeshMultiLev(*this,facesIfPresent2));
if(pfl)
- {
- ret2->setCellReduction(pfl);
- //throw INTERP_KERNEL::Exception("MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase : case is not treated yet for profile on implicit unstructured mesh.");
- }
+ ret2->setCellReduction(pfl);
if(nr)
throw INTERP_KERNEL::Exception("MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase : case is not treated yet for node reduction on implicit unstructured mesh.");
ret=ret2.retn();
void selectPartOfNodes(const DataArrayInt *pflNodes);
virtual std::vector<int> getNodeGridStructure() const = 0;
protected:
- MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m);
MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other);
MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector<int>& lev);
MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
void dealWithImplicitUnstructuredMesh(const MEDFileMesh *m);
protected:
+ void moveFaceToCell() const;
bool prepareForImplicitUnstructuredMeshCase(MEDMeshMultiLev *&ret) const;
+ private:
+ void initStdFieldOfIntegers(const MEDFileStructuredMesh *m);
protected:
bool _is_internal;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _face_fam_ids;
+ bool _face_fam_ids_nocpy;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _face_num_ids;
+ bool _face_num_ids_nocpy;
};
class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
self.assertTrue(a3.isEqual(DataArrayInt([4,0,12,15,3,4,12,24,27,15,4,24,36,39,27,4,36,48,51,39,4,3,15,18,6,4,15,27,30,18,4,27,39,42,30,4,39,51,54,42,4,6,18,21,9,4,18,30,33,21,4,30,42,45,33,4,42,54,57,45,4,1,13,16,4,4,13,25,28,16,4,25,37,40,28,4,37,49,52,40,4,4,16,19,7,4,16,28,31,19,4,28,40,43,31,4,40,52,55,43,4,7,19,22,10,4,19,31,34,22,4,31,43,46,34,4,43,55,58,46,4,2,14,17,5,4,14,26,29,17,4,26,38,41,29,4,38,50,53,41,4,5,17,20,8,4,17,29,32,20,4,29,41,44,32])))
self.assertTrue(a4 is None)
self.assertTrue(a5 is None)
+ a6,a7=mml2.retrieveFamilyIdsOnCells()
+ self.assertTrue(a6 is None)
+ self.assertTrue(a7)
for i in xrange(30):
ffCell=allFMTSLeavesPerCommonSupport1[1][0][0][i]
fsst=MEDFileField1TSStructItem.BuildItemFrom(ffCell,mst)