X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileFieldOverView.cxx;h=42b4759ebdfe0c3ae3eb93582fe4e4059d9b6634;hb=f13ce72017fd205546293a53f7b041824cb50eec;hp=9bea050d6553f251f5dd24e68f43ad93eaa5992e;hpb=41ac0fa9ff58c37d28adb9331e0083a3b2677c52;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index 9bea050d6..42b4759eb 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -209,6 +209,15 @@ void MEDMeshMultiLev::setNodeReduction(const DataArrayInt *nr) _node_reduction=const_cast(nr); } +void MEDMeshMultiLev::setCellReduction(const DataArrayInt *cr) +{ + if(_pfls.size()!=1) + throw INTERP_KERNEL::Exception("MEDMeshMultiLev::setCellReduction : can be used only for single geo type mesh !"); + _pfls[0]=const_cast(cr); + if(cr) + cr->incrRef(); +} + bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs) const { if(fst.getType()==ON_NODES) @@ -1019,7 +1028,7 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * { *dPtr++=connIPtr[1]-connIPtr[0]; dPtr=std::copy(connPtr+connIPtr[0],connPtr+connIPtr[1],dPtr); - *cPtr++=k; k+=connIPtr[1]-connIPtr[0]; + *cPtr++=k; k+=connIPtr[1]-connIPtr[0]+1; } } else @@ -1173,11 +1182,21 @@ void MEDUMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArr //= -MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m):MEDMeshMultiLev(m),_is_internal(true) +MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector& lev):MEDMeshMultiLev(m),_is_internal(true) { + initStdFieldOfIntegers(m); } -MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector& lev):MEDMeshMultiLev(m),_is_internal(true) +MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& 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; @@ -1209,44 +1228,28 @@ MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh tmp->incrRef(); _node_num_ids=const_cast(tmp); } -} - -MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& 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(tmp); - } - tmp=m->getNumberFieldAtLevel(0); - if(tmp) - { - tmp->incrRef(); - _cell_num_ids=const_cast(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(tmp); + _face_fam_ids=const_cast(tmp); } - tmp=m->getNumberFieldAtLevel(1); + tmp=m->getNumberFieldAtLevel(-1); if(tmp) { tmp->incrRef(); - _node_num_ids=const_cast(tmp); + _face_num_ids=const_cast(tmp); } } -MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other):MEDMeshMultiLev(other),_is_internal(true) +void MEDStructuredMeshMultiLev::moveFaceToCell() const { + const_cast(this)->_cell_fam_ids_nocpy=_face_fam_ids_nocpy; + const_cast(this)->_cell_num_ids_nocpy=_face_num_ids_nocpy; + const_cast(this)->_cell_fam_ids=_face_fam_ids; const_cast(this)->_face_fam_ids=0; + const_cast(this)->_cell_num_ids=_face_num_ids; const_cast(this)->_face_num_ids=0; } bool MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase(MEDMeshMultiLev *&ret) const @@ -1266,9 +1269,10 @@ bool MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase(MEDMeshMu if(!_pfls.empty()) pfl=_pfls[0]; MEDCouplingAutoRefCountObjectPtr facesIfPresent2(facesIfPresent); facesIfPresent->incrRef(); + moveFaceToCell(); MEDCouplingAutoRefCountObjectPtr ret2(new MEDUMeshMultiLev(*this,facesIfPresent2)); if(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();