X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileFieldOverView.cxx;h=825a780e57708903c583d795b7d5dbf975257f4c;hb=96bc4e98b56b27856dced632cdb6767afb411179;hp=6d9da01659b9e4b58c16256c919c359ce413e8d4;hpb=b3484c5993a2fb7f31ce22644a39742326007cdb;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index 6d9da0165..825a780e5 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -52,7 +52,7 @@ std::vector MEDFileMeshStruct::getDirectChildren() cons MEDFileMeshStruct::MEDFileMeshStruct(const MEDFileMesh *mesh):_mesh(mesh) { - std::vector levs=mesh->getNonEmptyLevels(); + std::vector levs(mesh->getNonEmptyLevels()); _name=mesh->getName(); _nb_nodes=mesh->getNumberOfNodes(); _geo_types_distrib.resize(levs.size()); @@ -153,8 +153,7 @@ MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector levs(1,0); - MEDCouplingAutoRefCountObjectPtr ret(MEDMeshMultiLev::New(m,levs)); + MEDCouplingAutoRefCountObjectPtr ret(MEDMeshMultiLev::New(m,m->getNonEmptyLevels())); ret->selectPartOfNodes(pflOnNode); return ret.retn(); } @@ -416,7 +415,7 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& MEDCouplingAutoRefCountObjectPtr p2(nr->deepCpy()); p1->sort(true); p2->sort(true); if(!p1->isEqualWithoutConsideringStr(*p2)) - throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 3 !"); + throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : it appears that a profile on nodes does not cover the cells correctly !"); p1=DataArrayInt::FindPermutationFromFirstToSecond(globs->getProfile(pflName.c_str()),nr); MEDCouplingAutoRefCountObjectPtr ret(vals->deepCpy()); ret->renumberInPlace(p1->begin()); @@ -1025,11 +1024,11 @@ void MEDUMeshMultiLev::reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr< //= -MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev() +MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev():_is_internal(true) { } -MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector& lev) +MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector& lev):_is_internal(true) { // ids fields management _cell_fam_ids_nocpy=true; _cell_num_ids_nocpy=true; @@ -1063,7 +1062,7 @@ MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh } } -MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(nbOfNodes,gts,pfls,nbEntities) +MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(nbOfNodes,gts,pfls,nbEntities),_is_internal(true) { // ids fields management _cell_fam_ids_nocpy=true; _cell_num_ids_nocpy=true; @@ -1097,6 +1096,10 @@ MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh } } +MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other):MEDMeshMultiLev(other),_is_internal(true) +{ +} + void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) { if(!pflNodes || !pflNodes->isAllocated()) @@ -1122,10 +1125,6 @@ void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) _pfls[0]=cellIdsSafe; } -MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other):MEDMeshMultiLev(other) -{ -} - //= MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector& levs) @@ -1144,13 +1143,14 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor : null input pointer !"); if(levs.size()!=1 || levs[0]!=0) throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor : levels supported is 0 only !"); - int mdim(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(m->getMeshDimension())); - _coords.resize(mdim); - for(int i=0;igetSpaceDimension()); + _coords.resize(sdim); + for(int i=0;i(m->getMesh()->getCoordsAt(i))); if(!elt) throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : presence of null pointer for an vector of double along an axis !"); + elt->incrRef(); _coords[i]=elt; } } @@ -1189,7 +1189,9 @@ std::vector MEDCMeshMultiLev::getNodeGridStructure() const MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const { - const DataArrayInt *pfl(_pfls[0]),*nr(_node_reduction); + const DataArrayInt *pfl(0),*nr(_node_reduction); + if(!_pfls.empty()) + pfl=_pfls[0]; MEDCouplingAutoRefCountObjectPtr nnr; std::vector cgs,ngs(getNodeGridStructure()); cgs.resize(ngs.size()); @@ -1201,6 +1203,7 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const if(MEDCouplingStructuredMesh::IsPartStructured(pfl->begin(),pfl->end(),cgs,cellParts)) { MEDCouplingAutoRefCountObjectPtr ret(new MEDCMeshMultiLev(*this)); + ret->_is_internal=false; if(nr) { nnr=nr->deepCpy(); nnr->sort(true); ret->setNodeReduction(nnr); } ret->_nb_entities[0]=pfl->getNumberOfTuples(); @@ -1246,8 +1249,12 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const } } -std::vector< DataArrayDouble * > MEDCMeshMultiLev::buildVTUArrays() const +/*! + * \a param [out] isInternal if true the returned pointers are those in main data structure. If false those pointers have been built espacially for that method. + */ +std::vector< DataArrayDouble * > MEDCMeshMultiLev::buildVTUArrays(bool& isInternal) const { + isInternal=_is_internal; std::size_t sz(_coords.size()); std::vector< DataArrayDouble * > ret(sz); for(std::size_t i=0;i MEDCurveLinearMeshMultiLev::getNodeGridStructure() const MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const { - const DataArrayInt *pfl(_pfls[0]),*nr(_node_reduction); + const DataArrayInt *pfl(0),*nr(_node_reduction); + if(!_pfls.empty()) + pfl=_pfls[0]; MEDCouplingAutoRefCountObjectPtr nnr; std::vector cgs,ngs(getNodeGridStructure()); cgs.resize(ngs.size()); @@ -1332,6 +1341,7 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const } MEDCouplingAutoRefCountObjectPtr p(MEDCouplingStructuredMesh::BuildExplicitIdsFrom(ngs,nodeParts)); MEDCouplingAutoRefCountObjectPtr ret(new MEDCurveLinearMeshMultiLev(*this)); + ret->_is_internal=false; if(nr) { nnr=nr->deepCpy(); nnr->sort(true); ret->setNodeReduction(nnr); } ret->_nb_entities[0]=pfl->getNumberOfTuples(); @@ -1373,8 +1383,9 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const } } -void MEDCurveLinearMeshMultiLev::buildVTUArrays(DataArrayDouble *&coords, std::vector& nodeStrct) const +void MEDCurveLinearMeshMultiLev::buildVTUArrays(DataArrayDouble *&coords, std::vector& nodeStrct, bool& isInternal) const { + isInternal=_is_internal; nodeStrct=_structure; const DataArrayDouble *coo(_coords); if(!coo) @@ -1475,7 +1486,7 @@ void MEDFileField1TSStructItem2::checkInRange(int nbOfEntity, int nip, const MED } } -bool MEDFileField1TSStructItem2::isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const char *pflName) const +bool MEDFileField1TSStructItem2::isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const { if(startExp!=_start_end.first) return false; @@ -1817,7 +1828,7 @@ MEDFileField1TSStructItem MEDFileField1TSStructItem::BuildItemFrom(const MEDFile std::vector< std::vector > pfls,locs; std::vector< std::vector > typesF; std::vector geoTypes; - std::vector< std::vector > > strtEnds=ref->getFieldSplitedByType(0,geoTypes,typesF,pfls,locs); + std::vector< std::vector > > strtEnds=ref->getFieldSplitedByType(std::string(),geoTypes,typesF,pfls,locs); std::size_t nbOfGeoTypes(geoTypes.size()); if(nbOfGeoTypes==0) throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : not null by empty ref !"); @@ -1966,9 +1977,8 @@ MEDMeshMultiLev *MEDFileField1TSStruct::buildFromScratchDataSetSupport(const MED else { if(!presenceOfPartialNodeDiscr(pos1)) - {//we have only all nodes, no cell definition info -> level 0; - std::vector levs(1,0); - return MEDMeshMultiLev::New(mst->getTheMesh(),levs); + {//we have only all nodes, no cell definition info -> all existing levels !; + return MEDMeshMultiLev::New(mst->getTheMesh(),mst->getTheMesh()->getNonEmptyLevels()); } else return MEDMeshMultiLev::NewOnlyOnNode(mst->getTheMesh(),_already_checked[pos1][0].getPfl(globs));