X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileField.cxx;h=bbb30fc38a7510a4d2bb47248788d7a12db1ed92;hb=f7d02840b72f0b678924722d17c6fdc0329e8989;hp=e757a6f82dd5211abbc52b75195fdff0f4be8923;hpb=df138a71c1f646f44f33ff3a2539cd9be1c8e377;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index e757a6f82..bbb30fc38 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -39,7 +39,7 @@ extern INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO]; extern med_geometry_type typmainoeud[1]; extern med_geometry_type typmai3[34]; -using namespace ParaMEDMEM; +using namespace MEDCoupling; const char MEDFileField1TSWithoutSDA::TYPE_STR[]="FLOAT64"; const char MEDFileIntField1TSWithoutSDA::TYPE_STR[]="INT32"; @@ -105,7 +105,7 @@ MEDFileFieldLoc::MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::Norm _nb_gauss_pt=_w.size(); } -MEDFileFieldLoc *MEDFileFieldLoc::deepCpy() const +MEDFileFieldLoc *MEDFileFieldLoc::deepCopy() const { return new MEDFileFieldLoc(*this); } @@ -214,16 +214,16 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off { case ON_CELLS: { - getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,offset,offset+nbOfCells,1); + getOrCreateAndGetArray()->setContigPartOfSelectedValuesSlice(_start,arrr,offset,offset+nbOfCells,1); _end=_start+nbOfCells; _nval=nbOfCells; break; } case ON_GAUSS_NE: { - MEDCouplingAutoRefCountObjectPtr arr=field->getDiscretization()->getOffsetArr(field->getMesh()); + MCAuto arr=field->getDiscretization()->getOffsetArr(field->getMesh()); const int *arrPtr=arr->getConstPointer(); - getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,arrPtr[offset],arrPtr[offset+nbOfCells],1); + getOrCreateAndGetArray()->setContigPartOfSelectedValuesSlice(_start,arrr,arrPtr[offset],arrPtr[offset+nbOfCells],1); _end=_start+(arrPtr[offset+nbOfCells]-arrPtr[offset]); _nval=nbOfCells; break; @@ -236,11 +236,11 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off if(!disc2) throw INTERP_KERNEL::Exception("assignFieldNoProfile : invalid call to this method ! Internal Error !"); const DataArrayInt *dai=disc2->getArrayOfDiscIds(); - MEDCouplingAutoRefCountObjectPtr dai2=disc2->getOffsetArr(field->getMesh()); + MCAuto dai2=disc2->getOffsetArr(field->getMesh()); const int *dai2Ptr=dai2->getConstPointer(); int nbi=gsLoc.getWeights().size(); - MEDCouplingAutoRefCountObjectPtr da2=dai->selectByTupleId2(offset,offset+nbOfCells,1); - MEDCouplingAutoRefCountObjectPtr da3=da2->getIdsEqual(_loc_id); + MCAuto da2=dai->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1); + MCAuto da3=da2->findIdsEqual(_loc_id); const int *da3Ptr=da3->getConstPointer(); if(da3->getNumberOfTuples()!=nbOfCells) {//profile : for gauss even in NoProfile !!! @@ -249,7 +249,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off da3->setName(_profile.c_str()); glob.appendProfile(da3); } - MEDCouplingAutoRefCountObjectPtr da4=DataArrayInt::New(); + MCAuto da4=DataArrayInt::New(); _nval=da3->getNbOfElems(); da4->alloc(_nval*nbi,1); int *da4Ptr=da4->getPointer(); @@ -311,7 +311,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& case ON_NODES: { _nval=idsInPfl->getNumberOfTuples(); - getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,0,arrr->getNumberOfTuples(),1); + getOrCreateAndGetArray()->setContigPartOfSelectedValuesSlice(_start,arrr,0,arrr->getNumberOfTuples(),1); _end=_start+_nval; break; } @@ -324,11 +324,11 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& } case ON_GAUSS_NE: { - MEDCouplingAutoRefCountObjectPtr arr=field->getDiscretization()->getOffsetArr(mesh); - MEDCouplingAutoRefCountObjectPtr arr2=arr->deltaShiftIndex(); - MEDCouplingAutoRefCountObjectPtr arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end()); - arr3->computeOffsets2(); - MEDCouplingAutoRefCountObjectPtr tmp=idsInPfl->buildExplicitArrByRanges(arr3); + MCAuto arr=field->getDiscretization()->getOffsetArr(mesh); + MCAuto arr2=arr->deltaShiftIndex(); + MCAuto arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end()); + arr3->computeOffsetsFull(); + MCAuto tmp=idsInPfl->buildExplicitArrByRanges(arr3); int trueNval=tmp->getNumberOfTuples(); _nval=idsInPfl->getNumberOfTuples(); getOrCreateAndGetArray()->setContigPartOfSelectedValues(_start,arrr,tmp); @@ -342,14 +342,14 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !"); const DataArrayInt *da1=disc2->getArrayOfDiscIds(); const MEDCouplingGaussLocalization& gsLoc=field->getGaussLocalization(_loc_id); - MEDCouplingAutoRefCountObjectPtr da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end()); - MEDCouplingAutoRefCountObjectPtr da3=da2->getIdsEqual(_loc_id); - MEDCouplingAutoRefCountObjectPtr da4=idsInPfl->selectByTupleId(da3->begin(),da3->end()); + MCAuto da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end()); + MCAuto da3=da2->findIdsEqual(_loc_id); + MCAuto da4=idsInPfl->selectByTupleId(da3->begin(),da3->end()); // - MEDCouplingAutoRefCountObjectPtr mesh2=mesh->buildPart(multiTypePfl->begin(),multiTypePfl->end()); - MEDCouplingAutoRefCountObjectPtr arr=disc2->getOffsetArr(mesh2); + MCAuto mesh2=mesh->buildPart(multiTypePfl->begin(),multiTypePfl->end()); + MCAuto arr=disc2->getOffsetArr(mesh2); // - MEDCouplingAutoRefCountObjectPtr tmp=DataArrayInt::New(); + MCAuto tmp=DataArrayInt::New(); int trueNval=0; for(const int *pt=da4->begin();pt!=da4->end();pt++) trueNval+=arr->getIJ(*pt+1,0)-arr->getIJ(*pt,0); @@ -365,14 +365,14 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& oss << "_loc_" << _loc_id; if(locIds) { - MEDCouplingAutoRefCountObjectPtr da5=locIds->selectByTupleId(da3->begin(),da3->end()); + MCAuto da5=locIds->selectByTupleId(da3->begin(),da3->end()); da5->setName(oss.str().c_str()); glob.appendProfile(da5); _profile=oss.str(); } else { - if(!da3->isIdentity2(nbOfEltsInWholeMesh)) + if(!da3->isIota(nbOfEltsInWholeMesh)) { da3->setName(oss.str().c_str()); glob.appendProfile(da3); @@ -394,7 +394,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(int& start, con { _start=start; _nval=arrr->getNumberOfTuples(); - getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,0,_nval,1); + getOrCreateAndGetArray()->setContigPartOfSelectedValuesSlice(_start,arrr,0,_nval,1); _end=_start+_nval; start=_end; } @@ -426,9 +426,9 @@ std::vector MEDFileFieldPerMeshPerTypePerDisc::getDirec return ret; } -MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::deepCpy(MEDFileFieldPerMeshPerType *father) const +MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::deepCopy(MEDFileFieldPerMeshPerType *father) const { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileFieldPerMeshPerTypePerDisc(*this); + MCAuto ret=new MEDFileFieldPerMeshPerTypePerDisc(*this); ret->_father=father; return ret.retn(); } @@ -497,21 +497,22 @@ void MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile(med_idt fid, const const DataArrayPartDefinition *dpd(dynamic_cast(pd)); if(dpd) { - dpd->checkCoherency(); - MEDCouplingAutoRefCountObjectPtr myIds(dpd->toDAI()); + dpd->checkConsistencyLight(); + MCAuto myIds(dpd->toDAI()); int a(myIds->getMinValueInArray()),b(myIds->getMaxValueInArray()); + myIds=myIds->deepCopy();// WARNING deep copy here because _pd is modified by applyLin !!! myIds->applyLin(1,-a); int nbOfEltsToLoad(b-a+1); med_filter filter=MED_FILTER_INIT; {//TODO : manage int32 ! - MEDCouplingAutoRefCountObjectPtr tmp(DataArrayDouble::New()); + MCAuto tmp(DataArrayDouble::New()); tmp->alloc(nbOfEltsToLoad,nbOfCompo); MEDfilterBlockOfEntityCr(fid,/*nentity*/overallNval,/*nvaluesperentity*/nbi,/*nconstituentpervalue*/nbOfCompo, MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, /*start*/a+1,/*stride*/1,/*count*/1,/*blocksize*/nbOfEltsToLoad, /*lastblocksize=useless because count=1*/0,&filter); MEDFILESAFECALLERRD0(MEDfieldValueAdvancedRd,(fid,fieldName.c_str(),iteration,order,menti,mgeoti,&filter,reinterpret_cast(tmp->getPointer()))); - MEDCouplingAutoRefCountObjectPtr feeder(DataArrayDouble::New()); + MCAuto feeder(DataArrayDouble::New()); feeder->useExternalArrayWithRWAccess(reinterpret_cast(startFeedingPtr),_nval,nbOfCompo); feeder->setContigPartOfSelectedValues(0,tmp,myIds); } @@ -906,7 +907,7 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(int offset, const std::ve const DataArrayInt *explicitIdsInMesh, const std::vector& newCode, MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, - std::vector< MEDCouplingAutoRefCountObjectPtr >& result) + std::vector< MCAuto >& result) { if(entriesOnSameDisc.empty()) return false; @@ -917,35 +918,35 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(int offset, const std::ve int nbi=szTuples/szEntities; if(szTuples%szEntities!=0) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks : internal error the splitting into same dicretization failed !"); - MEDCouplingAutoRefCountObjectPtr renumTuples=DataArrayInt::New(); renumTuples->alloc(szTuples,1); - MEDCouplingAutoRefCountObjectPtr ranges=MEDCouplingUMesh::ComputeRangesFromTypeDistribution(newCode); - std::vector< MEDCouplingAutoRefCountObjectPtr > newGeoTypesPerChunk(entriesOnSameDisc.size()); + MCAuto renumTuples=DataArrayInt::New(); renumTuples->alloc(szTuples,1); + MCAuto ranges=MEDCouplingUMesh::ComputeRangesFromTypeDistribution(newCode); + std::vector< MCAuto > newGeoTypesPerChunk(entriesOnSameDisc.size()); std::vector< const DataArrayInt * > newGeoTypesPerChunk2(entriesOnSameDisc.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > newGeoTypesPerChunk_bis(entriesOnSameDisc.size()); + std::vector< MCAuto > newGeoTypesPerChunk_bis(entriesOnSameDisc.size()); std::vector< const DataArrayInt * > newGeoTypesPerChunk3(entriesOnSameDisc.size()); - MEDCouplingAutoRefCountObjectPtr newGeoTypesPerChunk4=DataArrayInt::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi); + MCAuto newGeoTypesPerChunk4=DataArrayInt::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi); int id=0; for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++,id++) { int startOfEltIdOfChunk=(*it)->_start; - MEDCouplingAutoRefCountObjectPtr newEltIds=explicitIdsInMesh->substr(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval); - MEDCouplingAutoRefCountObjectPtr rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges); - MEDCouplingAutoRefCountObjectPtr idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges); + MCAuto newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval); + MCAuto rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges); + MCAuto idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges); // - MEDCouplingAutoRefCountObjectPtr tmp=rangeIdsForChunk->duplicateEachTupleNTimes(nbi); rangeIdsForChunk->rearrange(nbi); + MCAuto tmp=rangeIdsForChunk->duplicateEachTupleNTimes(nbi); rangeIdsForChunk->rearrange(nbi); newGeoTypesPerChunk4->setPartOfValues1(tmp,(*it)->_tmp_work1-offset,(*it)->_tmp_work1+(*it)->_nval*nbi-offset,1,0,nbi,1); // newGeoTypesPerChunk[id]=rangeIdsForChunk; newGeoTypesPerChunk2[id]=rangeIdsForChunk; newGeoTypesPerChunk_bis[id]=idsInRrangeForChunk; newGeoTypesPerChunk3[id]=idsInRrangeForChunk; } - MEDCouplingAutoRefCountObjectPtr newGeoTypesEltIdsAllGather=DataArrayInt::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear(); - MEDCouplingAutoRefCountObjectPtr newGeoTypesEltIdsAllGather2=DataArrayInt::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear(); - MEDCouplingAutoRefCountObjectPtr diffVals=newGeoTypesEltIdsAllGather->getDifferentValues(); - MEDCouplingAutoRefCountObjectPtr renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel(); + MCAuto newGeoTypesEltIdsAllGather=DataArrayInt::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear(); + MCAuto newGeoTypesEltIdsAllGather2=DataArrayInt::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear(); + MCAuto diffVals=newGeoTypesEltIdsAllGather->getDifferentValues(); + MCAuto renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel(); // - MEDCouplingAutoRefCountObjectPtr renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel(); + MCAuto renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel(); // - MEDCouplingAutoRefCountObjectPtr arrPart=arr->substr(offset,offset+szTuples); + MCAuto arrPart=arr->subArray(offset,offset+szTuples); arrPart->renumberInPlace(renumTupleIds->begin()); arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,arrPart->getNumberOfComponents(),1); bool ret=false; @@ -954,12 +955,12 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(int offset, const std::ve int offset2=0; for(int i=0;igetNumberOfTuples();i++,idIt++) { - MEDCouplingAutoRefCountObjectPtr ids=newGeoTypesEltIdsAllGather->getIdsEqual(*idIt); - MEDCouplingAutoRefCountObjectPtr subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end()); + MCAuto ids=newGeoTypesEltIdsAllGather->findIdsEqual(*idIt); + MCAuto subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end()); int nbEntityElts=subIds->getNumberOfTuples(); bool ret2; - MEDCouplingAutoRefCountObjectPtr eltToAdd=MEDFileFieldPerMeshPerTypePerDisc:: - NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIdentity2(newCode[3*(*idIt)+1]),nbi, + MCAuto eltToAdd=MEDFileFieldPerMeshPerTypePerDisc:: + NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIota(newCode[3*(*idIt)+1]),nbi, offset+offset2, li,glob,ret2); ret=ret || ret2; @@ -1052,26 +1053,26 @@ MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerType::New(MEDFileFieldPerMesh std::size_t MEDFileFieldPerMeshPerType::getHeapMemorySizeWithoutChildren() const { - return _field_pm_pt_pd.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); + return _field_pm_pt_pd.capacity()*sizeof(MCAuto); } std::vector MEDFileFieldPerMeshPerType::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) ret.push_back((const MEDFileFieldPerMeshPerTypePerDisc *)*it); return ret; } -MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerType::deepCpy(MEDFileFieldPerMesh *father) const +MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerType::deepCopy(MEDFileFieldPerMesh *father) const { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileFieldPerMeshPerType(*this); + MCAuto ret=new MEDFileFieldPerMeshPerType(*this); ret->_father=father; std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) { if((const MEDFileFieldPerMeshPerTypePerDisc *)*it) - ret->_field_pm_pt_pd[i]=(*it)->deepCpy((MEDFileFieldPerMeshPerType *)ret); + ret->_field_pm_pt_pd[i]=(*it)->deepCopy((MEDFileFieldPerMeshPerType *)ret); } return ret.retn(); } @@ -1108,7 +1109,7 @@ void MEDFileFieldPerMeshPerType::assignNodeFieldNoProfile(int& start, const MEDC void MEDFileFieldPerMeshPerType::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - MEDCouplingAutoRefCountObjectPtr pfl2=pfl->deepCpy(); + MCAuto pfl2=pfl->deepCopy(); if(!arr || !arr->isAllocated()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerType::assignNodeFieldProfile : input array is null, or not allocated !"); _field_pm_pt_pd.resize(1); @@ -1180,8 +1181,8 @@ std::vector MEDFileFieldPerMeshPerType::addNewEntryIfNecessaryGauss(const M const DataArrayInt *da=disc2->getArrayOfDiscIds(); if(!da) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss (no profile) : no localization ids per cell array available ! The input Gauss node field is maybe invalid !"); - MEDCouplingAutoRefCountObjectPtr da2=da->selectByTupleId2(offset,offset+nbOfCells,1); - MEDCouplingAutoRefCountObjectPtr retTmp=da2->getDifferentValues(); + MCAuto da2=da->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1); + MCAuto retTmp=da2->getDifferentValues(); if(retTmp->presenceOfValue(-1)) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !"); std::vector ret(retTmp->begin(),retTmp->end()); @@ -1252,8 +1253,8 @@ std::vector MEDFileFieldPerMeshPerType::addNewEntryIfNecessaryGauss(const M const DataArrayInt *da=disc2->getArrayOfDiscIds(); if(!da) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : no localization ids per cell array available ! The input Gauss node field is maybe invalid !"); - MEDCouplingAutoRefCountObjectPtr da2=da->selectByTupleIdSafe(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples()); - MEDCouplingAutoRefCountObjectPtr retTmp=da2->getDifferentValues(); + MCAuto da2=da->selectByTupleIdSafe(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples()); + MCAuto retTmp=da2->getDifferentValues(); if(retTmp->presenceOfValue(-1)) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !"); std::vector ret(retTmp->begin(),retTmp->end()); @@ -1274,7 +1275,7 @@ void MEDFileFieldPerMeshPerType::getDimension(int& dim) const void MEDFileFieldPerMeshPerType::fillTypesOfFieldAvailable(std::set& types) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) { (*it)->fillTypesOfFieldAvailable(types); } @@ -1325,7 +1326,7 @@ void MEDFileFieldPerMeshPerType::simpleRepr(int bkOffset, std::ostream& oss, int oss << startLine3 << "Entry geometry type #" << id << " is lying on NODES." << std::endl; oss << startLine3 << "Entry is defined on " << _field_pm_pt_pd.size() << " localizations." << std::endl; int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) { const MEDFileFieldPerMeshPerTypePerDisc *cur=(*it); if(cur) @@ -1339,7 +1340,7 @@ void MEDFileFieldPerMeshPerType::simpleRepr(int bkOffset, std::ostream& oss, int void MEDFileFieldPerMeshPerType::getSizes(int& globalSz, int& nbOfEntries) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) { globalSz+=(*it)->getNumberOfTuples(); } @@ -1360,7 +1361,7 @@ int MEDFileFieldPerMeshPerType::getNumberOfComponents() const bool MEDFileFieldPerMeshPerType::presenceOfMultiDiscPerGeoType() const { std::size_t nb(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) { const MEDFileFieldPerMeshPerTypePerDisc *fmtd(*it); if(fmtd) @@ -1389,7 +1390,7 @@ std::vector MEDFileFieldPerMeshPerType::getPflsReallyUsed() const { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) + for(std::vector< MCAuto >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) { std::string tmp=(*it1)->getProfile(); if(!tmp.empty()) @@ -1406,7 +1407,7 @@ std::vector MEDFileFieldPerMeshPerType::getLocsReallyUsed() const { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) + for(std::vector< MCAuto >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) { std::string tmp=(*it1)->getLocalization(); if(!tmp.empty() && tmp!=MED_GAUSS_ELNO) @@ -1423,7 +1424,7 @@ std::vector MEDFileFieldPerMeshPerType::getPflsReallyUsedMulti() co { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) + for(std::vector< MCAuto >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) { std::string tmp=(*it1)->getProfile(); if(!tmp.empty()) @@ -1435,7 +1436,7 @@ std::vector MEDFileFieldPerMeshPerType::getPflsReallyUsedMulti() co std::vector MEDFileFieldPerMeshPerType::getLocsReallyUsedMulti() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) + for(std::vector< MCAuto >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) { std::string tmp=(*it1)->getLocalization(); if(!tmp.empty() && tmp!=MED_GAUSS_ELNO) @@ -1446,13 +1447,13 @@ std::vector MEDFileFieldPerMeshPerType::getLocsReallyUsedMulti() co void MEDFileFieldPerMeshPerType::changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) + for(std::vector< MCAuto >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) (*it1)->changePflsRefsNamesGen(mapOfModif); } void MEDFileFieldPerMeshPerType::changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) + for(std::vector< MCAuto >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) (*it1)->changeLocsRefsNamesGen(mapOfModif); } @@ -1498,23 +1499,23 @@ void MEDFileFieldPerMeshPerType::getFieldAtLevel(int meshDim, TypeOfField type, if(meshDim!=(int)cm.getDimension()) return ; } - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) (*it)->getFieldAtLevel(type,glob,dads,pfls,locs,geoTypes); } void MEDFileFieldPerMeshPerType::fillValues(int& startEntryId, std::vector< std::pair,std::pair > >& entries) const { int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) { (*it)->fillValues(i,startEntryId,entries); } } -void MEDFileFieldPerMeshPerType::setLeaves(const std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) +void MEDFileFieldPerMeshPerType::setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) { _field_pm_pt_pd=leaves; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) (*it)->setFather(this); } @@ -1526,8 +1527,8 @@ void MEDFileFieldPerMeshPerType::setLeaves(const std::vector< MEDCouplingAutoRef bool MEDFileFieldPerMeshPerType::keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its) { bool ret(false); - std::vector< MEDCouplingAutoRefCountObjectPtr > newPmPtPd; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + std::vector< MCAuto > newPmPtPd; + for(std::vector< MCAuto >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) if((*it)->getType()==tof) { newPmPtPd.push_back(*it); @@ -1551,8 +1552,8 @@ bool MEDFileFieldPerMeshPerType::keepOnlyGaussDiscretization(std::size_t idOfDis { if(_field_pm_pt_pd.size()<=idOfDisc) return false; - MEDCouplingAutoRefCountObjectPtr elt(_field_pm_pt_pd[idOfDisc]); - std::vector< MEDCouplingAutoRefCountObjectPtr > newPmPtPd(1,elt); + MCAuto elt(_field_pm_pt_pd[idOfDisc]); + std::vector< MCAuto > newPmPtPd(1,elt); std::pair bgEnd; bgEnd.first=_field_pm_pt_pd[idOfDisc]->getStart(); bgEnd.second=_field_pm_pt_pd[idOfDisc]->getEnd(); elt->setNewStart(globalNum); globalNum=elt->getEnd(); @@ -1587,19 +1588,19 @@ MEDFileFieldPerMeshPerType::MEDFileFieldPerMeshPerType(med_idt fid, MEDFileField void MEDFileFieldPerMeshPerType::loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) (*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc); } void MEDFileFieldPerMeshPerType::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) (*it)->loadBigArray(fid,nasc); } void MEDFileFieldPerMeshPerType::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) { (*it)->copyOptionsFrom(*this); (*it)->writeLL(fid,nasc); @@ -1640,26 +1641,26 @@ MEDFileFieldPerMesh *MEDFileFieldPerMesh::New(MEDFileAnyTypeField1TSWithoutSDA * std::size_t MEDFileFieldPerMesh::getHeapMemorySizeWithoutChildren() const { - return _mesh_name.capacity()+_field_pm_pt.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType >); + return _mesh_name.capacity()+_field_pm_pt.capacity()*sizeof(MCAuto< MEDFileFieldPerMeshPerType >); } std::vector MEDFileFieldPerMesh::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) ret.push_back((const MEDFileFieldPerMeshPerType *)*it); return ret; } -MEDFileFieldPerMesh *MEDFileFieldPerMesh::deepCpy(MEDFileAnyTypeField1TSWithoutSDA *father) const +MEDFileFieldPerMesh *MEDFileFieldPerMesh::deepCopy(MEDFileAnyTypeField1TSWithoutSDA *father) const { - MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > ret=new MEDFileFieldPerMesh(*this); + MCAuto< MEDFileFieldPerMesh > ret=new MEDFileFieldPerMesh(*this); ret->_father=father; std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) { if((const MEDFileFieldPerMeshPerType *)*it) - ret->_field_pm_pt[i]=(*it)->deepCpy((MEDFileFieldPerMesh *)(ret)); + ret->_field_pm_pt[i]=(*it)->deepCopy((MEDFileFieldPerMesh *)(ret)); } return ret.retn(); } @@ -1670,7 +1671,7 @@ void MEDFileFieldPerMesh::simpleRepr(int bkOffset, std::ostream& oss, int id) co oss << startLine << "## Field part (" << id << ") lying on mesh \"" << _mesh_name << "\", Mesh iteration=" << _mesh_iteration << ". Mesh order=" << _mesh_order << "." << std::endl; oss << startLine << "## Field is defined on " << _field_pm_pt.size() << " types." << std::endl; int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) { const MEDFileFieldPerMeshPerType *cur=*it; if(cur) @@ -1746,13 +1747,13 @@ void MEDFileFieldPerMesh::assignNodeFieldProfile(int& start, const DataArrayInt void MEDFileFieldPerMesh::loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc); } void MEDFileFieldPerMesh::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->loadBigArraysRecursively(fid,nasc); } @@ -1768,13 +1769,13 @@ void MEDFileFieldPerMesh::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc void MEDFileFieldPerMesh::getDimension(int& dim) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->getDimension(dim); } void MEDFileFieldPerMesh::fillTypesOfFieldAvailable(std::set& types) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->fillTypesOfFieldAvailable(types); } @@ -1814,7 +1815,7 @@ int MEDFileFieldPerMesh::getNumberOfComponents() const bool MEDFileFieldPerMesh::presenceOfMultiDiscPerGeoType() const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { const MEDFileFieldPerMeshPerType *fpmt(*it); if(!fpmt) @@ -1929,7 +1930,7 @@ std::vector MEDFileFieldPerMesh::getPflsReallyUsed() const { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { std::vector tmp=(*it)->getPflsReallyUsed(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -1945,7 +1946,7 @@ std::vector MEDFileFieldPerMesh::getPflsReallyUsed() const std::vector MEDFileFieldPerMesh::getPflsReallyUsedMulti() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { std::vector tmp=(*it)->getPflsReallyUsedMulti(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -1957,7 +1958,7 @@ std::vector MEDFileFieldPerMesh::getLocsReallyUsed() const { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { std::vector tmp=(*it)->getLocsReallyUsed(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -1973,7 +1974,7 @@ std::vector MEDFileFieldPerMesh::getLocsReallyUsed() const std::vector MEDFileFieldPerMesh::getLocsReallyUsedMulti() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { std::vector tmp=(*it)->getLocsReallyUsedMulti(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -2024,9 +2025,9 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam else otherEntries.push_back(getLeafGivenTypeAndLocId((*it).first.first,(*it).first.second)); } - MEDCouplingAutoRefCountObjectPtr renumDefrag=DataArrayInt::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero(); + MCAuto renumDefrag=DataArrayInt::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero(); //////////////////// - MEDCouplingAutoRefCountObjectPtr explicitIdsOldInMesh=DataArrayInt::New(); explicitIdsOldInMesh->alloc(sz,1);//sz is a majorant of the real size. A realloc will be done after + MCAuto explicitIdsOldInMesh=DataArrayInt::New(); explicitIdsOldInMesh->alloc(sz,1);//sz is a majorant of the real size. A realloc will be done after int *workI2=explicitIdsOldInMesh->getPointer(); int sz1=0,sz2=0,sid=1; std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptML=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKept); @@ -2034,7 +2035,7 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator itL1=entriesKeptML.begin();itL1!=entriesKeptML.end();itL1++,sid++) { // tupleIdOfStartOfNewChuncksV[sid-1]=sz2; - MEDCouplingAutoRefCountObjectPtr explicitIdsOldInArr=DataArrayInt::New(); explicitIdsOldInArr->alloc(sz,1); + MCAuto explicitIdsOldInArr=DataArrayInt::New(); explicitIdsOldInArr->alloc(sz,1); int *workI=explicitIdsOldInArr->getPointer(); for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator itL2=(*itL1).begin();itL2!=(*itL1).end();itL2++) { @@ -2048,20 +2049,20 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam explicitIdsOldInMesh->reAlloc(sz2); int tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2; //////////////////// - MEDCouplingAutoRefCountObjectPtr permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0; + MCAuto permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0; // perform redispatching of non concerned MEDFileFieldPerMeshPerTypePerDisc - std::vector< MEDCouplingAutoRefCountObjectPtr > otherEntriesNew; + std::vector< MCAuto > otherEntriesNew; for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=otherEntries.begin();it!=otherEntries.end();it++) { otherEntriesNew.push_back(MEDFileFieldPerMeshPerTypePerDisc::New(*(*it))); otherEntriesNew.back()->setNewStart(permArrDefrag->getIJ((*it)->getStart(),0)); otherEntriesNew.back()->setLocId((*it)->getGeoType()); } - std::vector< MEDCouplingAutoRefCountObjectPtr > entriesKeptNew; + std::vector< MCAuto > entriesKeptNew; std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> entriesKeptNew2; for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesKept.begin();it!=entriesKept.end();it++) { - MEDCouplingAutoRefCountObjectPtr elt=MEDFileFieldPerMeshPerTypePerDisc::New(*(*it)); + MCAuto elt=MEDFileFieldPerMeshPerTypePerDisc::New(*(*it)); int newStart=elt->getLocId(); elt->setLocId((*it)->getGeoType()); elt->setNewStart(newStart); @@ -2069,9 +2070,9 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam entriesKeptNew.push_back(elt); entriesKeptNew2.push_back(elt); } - MEDCouplingAutoRefCountObjectPtr arr2=arr->renumber(permArrDefrag->getConstPointer()); + MCAuto arr2=arr->renumber(permArrDefrag->getConstPointer()); // perform redispatching of concerned MEDFileFieldPerMeshPerTypePerDisc -> values are in arr2 - MEDCouplingAutoRefCountObjectPtr explicitIdsNewInMesh=renumO2N->selectByTupleId(explicitIdsOldInMesh->begin(),explicitIdsOldInMesh->end()); + MCAuto explicitIdsNewInMesh=renumO2N->selectByTupleId(explicitIdsOldInMesh->begin(),explicitIdsOldInMesh->end()); std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptPerDisc=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKeptNew2); bool ret=false; for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator it4=entriesKeptPerDisc.begin();it4!=entriesKeptPerDisc.end();it4++) @@ -2089,7 +2090,7 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam return false; // Assign new dispatching assignNewLeaves(otherEntriesNew); - arr->cpyFrom(*arr2); + arr->deepCopyFrom(*arr2); return true; } @@ -2099,8 +2100,8 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam */ void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its) { - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > > ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + std::vector< MCAuto< MEDFileFieldPerMeshPerType > > ret; + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { std::vector< std::pair > its2; if((*it)->keepOnlySpatialDiscretization(tof,globalNum,its2)) @@ -2118,8 +2119,8 @@ void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, int &gl */ void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair >& its) { - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > > ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + std::vector< MCAuto< MEDFileFieldPerMeshPerType > > ret; + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { std::vector< std::pair > its2; if((*it)->keepOnlyGaussDiscretization(idOfDisc,globalNum,its2)) @@ -2131,18 +2132,18 @@ void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, int _field_pm_pt=ret; } -void MEDFileFieldPerMesh::assignNewLeaves(const std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) +void MEDFileFieldPerMesh::assignNewLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) { - std::map > > types; - for( std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >::const_iterator it=leaves.begin();it!=leaves.end();it++) + std::map > > types; + for( std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >::const_iterator it=leaves.begin();it!=leaves.end();it++) types[(INTERP_KERNEL::NormalizedCellType)(*it)->getLocId()].push_back(*it); // - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > > fieldPmPt(types.size()); - std::map > >::const_iterator it1=types.begin(); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it2=fieldPmPt.begin(); + std::vector< MCAuto< MEDFileFieldPerMeshPerType > > fieldPmPt(types.size()); + std::map > >::const_iterator it1=types.begin(); + std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it2=fieldPmPt.begin(); for(;it1!=types.end();it1++,it2++) { - MEDCouplingAutoRefCountObjectPtr elt=MEDFileFieldPerMeshPerType::New(this,(INTERP_KERNEL::NormalizedCellType)((*it1).second[0]->getLocId())); + MCAuto elt=MEDFileFieldPerMeshPerType::New(this,(INTERP_KERNEL::NormalizedCellType)((*it1).second[0]->getLocId())); elt->setLeaves((*it1).second); *it2=elt; } @@ -2151,20 +2152,20 @@ void MEDFileFieldPerMesh::assignNewLeaves(const std::vector< MEDCouplingAutoRefC void MEDFileFieldPerMesh::changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->changePflsRefsNamesGen(mapOfModif); } void MEDFileFieldPerMesh::changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->changeLocsRefsNamesGen(mapOfModif); } /*! * \param [in] mesh is the whole mesh */ -MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const +MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { if(_field_pm_pt.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !"); @@ -2174,7 +2175,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t std::vector notNullPflsPerGeoType; std::vector locs,code; std::vector geoTypes; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes); // Sort by types SortArraysPerType(glob,type,geoTypes,dads,pfls,locs,code,notNullPflsPerGeoType); @@ -2184,7 +2185,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t throw INTERP_KERNEL::Exception(oss.str().c_str()); } // - std::vector< MEDCouplingAutoRefCountObjectPtr > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); + std::vector< MCAuto > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); if(type!=ON_NODES) { @@ -2193,7 +2194,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc); else { - MEDCouplingAutoRefCountObjectPtr arr2(arr); + MCAuto arr2(arr); return finishField2(type,glob,dads,locs,geoTypes,mesh,arr,isPfl,arrOut,nasc); } } @@ -2227,7 +2228,7 @@ DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, c std::vector notNullPflsPerGeoType; std::vector locs,code; std::vector geoTypes; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes); // Sort by types SortArraysPerType(glob,type,geoTypes,dads,pfls,locs,code,notNullPflsPerGeoType); @@ -2236,11 +2237,11 @@ DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, c std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl : " << "The field \"" << nasc.getName() << "\" exists but not with such spatial discretization or such dimension specified !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::vector< MEDCouplingAutoRefCountObjectPtr > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); + std::vector< MCAuto > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); if(type!=ON_NODES) { - MEDCouplingAutoRefCountObjectPtr arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3); + MCAuto arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3); return finishField4(dads,arr,mesh->getNumberOfCells(),pfl); } else @@ -2267,13 +2268,13 @@ void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { (*it)->getSizes(globalSz,nbOfEntries); } entries.resize(nbOfEntries); nbOfEntries=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { (*it)->fillValues(nbOfEntries,entries); } @@ -2281,7 +2282,7 @@ void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { if((*it)->getGeoType()==typ) return (*it)->getLeafGivenLocId(locId); @@ -2289,7 +2290,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ); std::ostringstream oss; oss << "MEDFileFieldPerMesh::getLeafGivenTypeAndLocId : no such geometric type \"" << cm.getRepr() << "\" in this !" << std::endl; oss << "Possiblities are : "; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel((*it)->getGeoType()); oss << "\"" << cm2.getRepr() << "\", "; @@ -2299,7 +2300,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { if((*it)->getGeoType()==typ) return (*it)->getLeafGivenLocId(locId); @@ -2307,7 +2308,7 @@ const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAn const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ); std::ostringstream oss; oss << "MEDFileFieldPerMesh::getLeafGivenTypeAndLocId : no such geometric type \"" << cm.getRepr() << "\" in this !" << std::endl; oss << "Possiblities are : "; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel((*it)->getGeoType()); oss << "\"" << cm2.getRepr() << "\", "; @@ -2319,8 +2320,8 @@ int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellTyp { int i=0; int pos=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,type)); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it2=_field_pm_pt.begin(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) + std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it2=_field_pm_pt.begin(); + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) { INTERP_KERNEL::NormalizedCellType curType=(*it)->getGeoType(); if(type==curType) @@ -2343,12 +2344,12 @@ int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellTyp */ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob, const std::vector< std::pair >& dads, const std::vector& locs, - const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const + const MEDCouplingMesh *mesh, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { isPfl=false; - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(type,ONE_TIME); + MCAuto ret=MEDCouplingFieldDouble::New(type,ONE_TIME); ret->setMesh(mesh); ret->setName(nasc.getName().c_str()); ret->setTime(getTime(),getIteration(),getOrder()); ret->setTimeUnit(nasc.getDtUnit().c_str()); - MEDCouplingAutoRefCountObjectPtr da=getOrCreateAndGetArray()->selectByTupleRanges(dads); + MCAuto da=getOrCreateAndGetArray()->selectByTupleRanges(dads); const std::vector& infos=getInfo(); da->setInfoOnComponents(infos); da->setName(""); @@ -2361,7 +2362,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const std::vector > dads2(1,dads[i]); const std::vector locs2(1,locs[i]); const std::vector geoTypes2(1,INTERP_KERNEL::NORM_ERROR); int nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2); - MEDCouplingAutoRefCountObjectPtr di=DataArrayInt::New(); + MCAuto di=DataArrayInt::New(); di->alloc(nbOfElems,1); di->iota(offset); const MEDFileFieldLoc& fl=glob->getLocalizationFromId(locs[i]); @@ -2383,13 +2384,13 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob, const std::vector >& dads, const std::vector& locs, const std::vector& geoTypes, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const + const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { - if(da->isIdentity2(mesh->getNumberOfCells())) + if(da->isIota(mesh->getNumberOfCells())) return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc); - MEDCouplingAutoRefCountObjectPtr m2=mesh->buildPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); + MCAuto m2=mesh->buildPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); m2->setName(mesh->getName().c_str()); - MEDCouplingAutoRefCountObjectPtr ret=finishField(type,glob,dads,locs,m2,isPfl,arrOut,nasc); + MCAuto ret=finishField(type,glob,dads,locs,m2,isPfl,arrOut,nasc); isPfl=true; return ret.retn(); } @@ -2399,9 +2400,9 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, cons */ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileFieldGlobsReal *glob, const std::vector >& dads, const std::vector& locs, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const + const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { - if(da->isIdentity2(mesh->getNumberOfNodes())) + if(da->isIota(mesh->getNumberOfNodes())) return finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc); // Treatment of particular case where nodal field on pfl is requested with a meshDimRelToMax=1. const MEDCouplingUMesh *meshu=dynamic_cast(mesh); @@ -2409,7 +2410,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField { if(meshu->getNodalConnectivity()==0) { - MEDCouplingAutoRefCountObjectPtr ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl,arrOut,nasc); + MCAuto ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl,arrOut,nasc); int nb=da->getNbOfElems(); const int *ptr=da->getConstPointer(); MEDCouplingUMesh *meshuc=const_cast(meshu); @@ -2425,16 +2426,16 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField } } // - MEDCouplingAutoRefCountObjectPtr ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc); + MCAuto ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc); isPfl=true; DataArrayInt *arr2=0; - MEDCouplingAutoRefCountObjectPtr cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); - MEDCouplingAutoRefCountObjectPtr mesh2=mesh->buildPartAndReduceNodes(cellIds->getConstPointer(),cellIds->getConstPointer()+cellIds->getNbOfElems(),arr2); - MEDCouplingAutoRefCountObjectPtr arr3(arr2); + MCAuto cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); + MCAuto mesh2=mesh->buildPartAndReduceNodes(cellIds->getConstPointer(),cellIds->getConstPointer()+cellIds->getNbOfElems(),arr2); + MCAuto arr3(arr2); int nnodes=mesh2->getNumberOfNodes(); if(nnodes==(int)da->getNbOfElems()) { - MEDCouplingAutoRefCountObjectPtr da3=da->transformWithIndArrR(arr2->begin(),arr2->end()); + MCAuto da3=da->transformWithIndArrR(arr2->begin(),arr2->end()); arrOut->renumberInPlace(da3->getConstPointer()); mesh2->setName(mesh->getName().c_str()); ret->setMesh(mesh2); @@ -2469,8 +2470,8 @@ DataArray *MEDFileFieldPerMesh::finishField4(const std::vector(pflIn); pflOut->incrRef(); } - MEDCouplingAutoRefCountObjectPtr safePfl(pflOut); - MEDCouplingAutoRefCountObjectPtr da=getOrCreateAndGetArray()->selectByTupleRanges(dads); + MCAuto safePfl(pflOut); + MCAuto da=getOrCreateAndGetArray()->selectByTupleRanges(dads); const std::vector& infos=getInfo(); int nbOfComp=infos.size(); for(int i=0;i cpy=_pfls[i]->deepCpy(); + MCAuto cpy=_pfls[i]->deepCopy(); cpy->applyLin(1,1,0); INTERP_KERNEL::AutoPtr pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); MEDLoaderBase::safeStrCpy(_pfls[i]->getName().c_str(),MED_NAME_SIZE,pflName,opt.getTooLongStrPolicy()); @@ -2656,7 +2657,7 @@ void MEDFileFieldGlobs::writeGlobals(med_idt fid, const MEDFileWritable& opt) co void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps) { std::vector pfls=getPfls(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++) + for(std::vector< MCAuto >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++) { std::vector::iterator it2=std::find(pfls.begin(),pfls.end(),(*it)->getName()); if(it2==pfls.end()) @@ -2674,7 +2675,7 @@ void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps) } } std::vector locs=getLocs(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=other._locs.begin();it!=other._locs.end();it++) + for(std::vector< MCAuto >::const_iterator it=other._locs.begin();it!=other._locs.end();it++) { std::vector::iterator it2=std::find(locs.begin(),locs.end(),(*it)->getName()); if(it2==locs.end()) @@ -2745,33 +2746,33 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::New() std::size_t MEDFileFieldGlobs::getHeapMemorySizeWithoutChildren() const { - return _file_name.capacity()+_pfls.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr)+_locs.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); + return _file_name.capacity()+_pfls.capacity()*sizeof(MCAuto)+_locs.capacity()*sizeof(MCAuto); } std::vector MEDFileFieldGlobs::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< DataArrayInt > >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) + for(std::vector< MCAuto< DataArrayInt > >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) ret.push_back((const DataArrayInt *)*it); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_locs.begin();it!=_locs.end();it++) + for(std::vector< MCAuto >::const_iterator it=_locs.begin();it!=_locs.end();it++) ret.push_back((const MEDFileFieldLoc *)*it); return ret; } -MEDFileFieldGlobs *MEDFileFieldGlobs::deepCpy() const +MEDFileFieldGlobs *MEDFileFieldGlobs::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileFieldGlobs(*this); + MCAuto ret=new MEDFileFieldGlobs(*this); std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { if((const DataArrayInt *)*it) - ret->_pfls[i]=(*it)->deepCpy(); + ret->_pfls[i]=(*it)->deepCopy(); } i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_locs.begin();it!=_locs.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_locs.begin();it!=_locs.end();it++,i++) { if((const MEDFileFieldLoc*)*it) - ret->_locs[i]=(*it)->deepCpy(); + ret->_locs[i]=(*it)->deepCopy(); } return ret.retn(); } @@ -2783,14 +2784,14 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::deepCpy() const */ MEDFileFieldGlobs *MEDFileFieldGlobs::shallowCpyPart(const std::vector& pfls, const std::vector& locs) const { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileFieldGlobs::New(); + MCAuto ret=MEDFileFieldGlobs::New(); for(std::vector::const_iterator it1=pfls.begin();it1!=pfls.end();it1++) { DataArrayInt *pfl=const_cast(getProfile((*it1).c_str())); if(!pfl) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::shallowCpyPart : internal error ! pfl null !"); pfl->incrRef(); - MEDCouplingAutoRefCountObjectPtr pfl2(pfl); + MCAuto pfl2(pfl); ret->_pfls.push_back(pfl2); } for(std::vector::const_iterator it2=locs.begin();it2!=locs.end();it2++) @@ -2799,7 +2800,7 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::shallowCpyPart(const std::vectorincrRef(); - MEDCouplingAutoRefCountObjectPtr loc2(loc); + MCAuto loc2(loc); ret->_locs.push_back(loc2); } ret->setFileName(getFileName()); @@ -2813,20 +2814,20 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::shallowCpyPart(const std::vector& pfls, const std::vector& locs) const { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileFieldGlobs::New(); + MCAuto ret=MEDFileFieldGlobs::New(); for(std::vector::const_iterator it1=pfls.begin();it1!=pfls.end();it1++) { DataArrayInt *pfl=const_cast(getProfile((*it1).c_str())); if(!pfl) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::deepCpyPart : internal error ! pfl null !"); - ret->_pfls.push_back(pfl->deepCpy()); + ret->_pfls.push_back(pfl->deepCopy()); } for(std::vector::const_iterator it2=locs.begin();it2!=locs.end();it2++) { MEDFileFieldLoc *loc=const_cast(&getLocalization((*it2).c_str())); if(!loc) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::deepCpyPart : internal error ! loc null !"); - ret->_locs.push_back(loc->deepCpy()); + ret->_locs.push_back(loc->deepCopy()); } ret->setFileName(getFileName()); return ret.retn(); @@ -2877,7 +2878,7 @@ void MEDFileFieldGlobs::setFileName(const std::string& fileName) void MEDFileFieldGlobs::changePflsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_pfls.begin();it!=_pfls.end();it++) + for(std::vector< MCAuto >::iterator it=_pfls.begin();it!=_pfls.end();it++) { DataArrayInt *elt(*it); if(elt) @@ -2897,7 +2898,7 @@ void MEDFileFieldGlobs::changePflsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_locs.begin();it!=_locs.end();it++) + for(std::vector< MCAuto >::iterator it=_locs.begin();it!=_locs.end();it++) { MEDFileFieldLoc *elt(*it); if(elt) @@ -2935,13 +2936,13 @@ const MEDFileFieldLoc& MEDFileFieldGlobs::getLocalizationFromId(int locId) const } /// @cond INTERNAL -namespace ParaMEDMEMImpl +namespace MEDCouplingImpl { class LocFinder { public: LocFinder(const std::string& loc):_loc(loc) { } - bool operator() (const MEDCouplingAutoRefCountObjectPtr& loc) { return loc->isName(_loc); } + bool operator() (const MCAuto& loc) { return loc->isName(_loc); } private: const std::string &_loc; }; @@ -2950,7 +2951,7 @@ namespace ParaMEDMEMImpl { public: PflFinder(const std::string& pfl):_pfl(pfl) { } - bool operator() (const MEDCouplingAutoRefCountObjectPtr& pfl) { return _pfl==pfl->getName(); } + bool operator() (const MCAuto& pfl) { return _pfl==pfl->getName(); } private: const std::string& _pfl; }; @@ -2959,7 +2960,7 @@ namespace ParaMEDMEMImpl int MEDFileFieldGlobs::getLocalizationId(const std::string& loc) const { - std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=std::find_if(_locs.begin(),_locs.end(),ParaMEDMEMImpl::LocFinder(loc)); + std::vector< MCAuto >::const_iterator it=std::find_if(_locs.begin(),_locs.end(),MEDCouplingImpl::LocFinder(loc)); if(it==_locs.end()) { std::ostringstream oss; oss << "MEDFileFieldGlobs::getLocalisationId : no such localisation name : \"" << loc << "\" Possible localizations are : "; @@ -2976,7 +2977,7 @@ int MEDFileFieldGlobs::getLocalizationId(const std::string& loc) const const DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) const { std::string pflNameCpp(pflName); - std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),ParaMEDMEMImpl::PflFinder(pflNameCpp)); + std::vector< MCAuto >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp)); if(it==_pfls.end()) { std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfile: no such profile name : \"" << pflNameCpp << "\" Possible profiles are : "; @@ -3012,7 +3013,7 @@ MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const std::string& locName) DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) { std::string pflNameCpp(pflName); - std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),ParaMEDMEMImpl::PflFinder(pflNameCpp)); + std::vector< MCAuto >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp)); if(it==_pfls.end()) { std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfile: no such profile name : \"" << pflNameCpp << "\" Possible profiles are : "; @@ -3032,9 +3033,9 @@ DataArrayInt *MEDFileFieldGlobs::getProfileFromId(int pflId) void MEDFileFieldGlobs::killProfileIds(const std::vector& pflIds) { - std::vector< MEDCouplingAutoRefCountObjectPtr > newPfls; + std::vector< MCAuto > newPfls; int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { if(std::find(pflIds.begin(),pflIds.end(),i)==pflIds.end()) newPfls.push_back(*it); @@ -3044,9 +3045,9 @@ void MEDFileFieldGlobs::killProfileIds(const std::vector& pflIds) void MEDFileFieldGlobs::killLocalizationIds(const std::vector& locIds) { - std::vector< MEDCouplingAutoRefCountObjectPtr > newLocs; + std::vector< MCAuto > newLocs; int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_locs.begin();it!=_locs.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_locs.begin();it!=_locs.end();it++,i++) { if(std::find(locIds.begin(),locIds.end(),i)==locIds.end()) newLocs.push_back(*it); @@ -3090,7 +3091,7 @@ std::vector< std::vector > MEDFileFieldGlobs::whichAreEqualProfiles() const { std::map > m; int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { const DataArrayInt *tmp=(*it); if(tmp) @@ -3136,7 +3137,7 @@ void MEDFileFieldGlobs::appendProfile(DataArrayInt *pfl) std::string name(pfl->getName()); if(name.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::appendProfile : unsupported profiles with no name !"); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) if(name==(*it)->getName()) { if(!pfl->isEqual(*(*it))) @@ -3154,8 +3155,8 @@ void MEDFileFieldGlobs::appendLoc(const std::string& locName, INTERP_KERNEL::Nor std::string name(locName); if(name.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::appendLoc : unsupported localizations with no name !"); - MEDCouplingAutoRefCountObjectPtr obj=MEDFileFieldLoc::New(locName,geoType,refCoo,gsCoo,w); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_locs.begin();it!=_locs.end();it++) + MCAuto obj=MEDFileFieldLoc::New(locName,geoType,refCoo,gsCoo,w); + for(std::vector< MCAuto >::const_iterator it=_locs.begin();it!=_locs.end();it++) if((*it)->isName(locName)) { if(!(*it)->isEqual(*obj,1e-12)) @@ -3280,7 +3281,7 @@ void MEDFileFieldGlobsReal::deepCpyGlobs(const MEDFileFieldGlobsReal& other) { _globals=other._globals; if((const MEDFileFieldGlobs *)_globals) - _globals=other._globals->deepCpy(); + _globals=other._globals->deepCopy(); } /*! @@ -3809,10 +3810,10 @@ void MEDFileAnyTypeField1TSWithoutSDA::deepCpyLeavesFrom(const MEDFileAnyTypeFie { _field_per_mesh.resize(other._field_per_mesh.size()); std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=other._field_per_mesh.begin();it!=other._field_per_mesh.end();it++,i++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=other._field_per_mesh.begin();it!=other._field_per_mesh.end();it++,i++) { if((const MEDFileFieldPerMesh *)*it) - _field_per_mesh[i]=(*it)->deepCpy(this); + _field_per_mesh[i]=(*it)->deepCopy(this); } } @@ -3860,7 +3861,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::simpleRepr(int bkOffset, std::ostream& os if(!_field_per_mesh.empty()) { int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it2=_field_per_mesh.begin();it2!=_field_per_mesh.end();it2++,i++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it2=_field_per_mesh.begin();it2!=_field_per_mesh.end();it2++,i++) { const MEDFileFieldPerMesh *cur=(*it2); if(cur) @@ -3876,18 +3877,18 @@ void MEDFileAnyTypeField1TSWithoutSDA::simpleRepr(int bkOffset, std::ostream& os oss << startOfLine << "----------------------" << std::endl; } -std::vector< MEDCouplingAutoRefCountObjectPtr > MEDFileAnyTypeField1TSWithoutSDA::splitComponents() const +std::vector< MCAuto > MEDFileAnyTypeField1TSWithoutSDA::splitComponents() const { const DataArray *arr(getUndergroundDataArray()); if(!arr) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::splitComponents : no array defined !"); int nbOfCompo=arr->getNumberOfComponents(); - std::vector< MEDCouplingAutoRefCountObjectPtr > ret(nbOfCompo); + std::vector< MCAuto > ret(nbOfCompo); for(int i=0;i v(1,i); - MEDCouplingAutoRefCountObjectPtr arr2=arr->keepSelectedComponents(v); + MCAuto arr2=arr->keepSelectedComponents(v); ret[i]->setArray(arr2); } return ret; @@ -3909,7 +3910,7 @@ MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA():_iteration( int MEDFileAnyTypeField1TSWithoutSDA::getDimension() const { int ret=-2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->getDimension(ret); return ret; } @@ -3937,7 +3938,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::setMeshName(const std::string& newMeshNam bool MEDFileAnyTypeField1TSWithoutSDA::changeMeshNames(const std::vector< std::pair >& modifTab) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { MEDFileFieldPerMesh *cur(*it); if(cur) @@ -4015,7 +4016,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::fillIteration(std::pair& p) cons void MEDFileAnyTypeField1TSWithoutSDA::fillTypesOfFieldAvailable(std::vector& types) const { std::set types2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { (*it)->fillTypesOfFieldAvailable(types2); } @@ -4039,7 +4040,7 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getPflsReallyUsed2() { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { std::vector tmp=(*it)->getPflsReallyUsed(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -4056,7 +4057,7 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsed2() { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { std::vector tmp=(*it)->getLocsReallyUsed(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -4072,7 +4073,7 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsed2() std::vector MEDFileAnyTypeField1TSWithoutSDA::getPflsReallyUsedMulti2() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { std::vector tmp=(*it)->getPflsReallyUsedMulti(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -4084,7 +4085,7 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsedMult { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { std::vector tmp=(*it)->getLocsReallyUsedMulti(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -4094,13 +4095,13 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsedMult void MEDFileAnyTypeField1TSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->changePflsRefsNamesGen(mapOfModif); } void MEDFileAnyTypeField1TSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->changeLocsRefsNamesGen(mapOfModif); } @@ -4111,7 +4112,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::changeLocsRefsNamesGen2(const std::vector * Thus all sequences returned by this method are of the same length equal to number * of different types of supporting entities.
* A field part can include sub-parts with several different spatial discretizations, - * \ref ParaMEDMEM::ON_CELLS "ON_CELLS" and \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT" + * \ref MEDCoupling::ON_CELLS "ON_CELLS" and \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT" * for example. Hence, some of the returned sequences contains nested sequences, and an item * of a nested sequence corresponds to a type of spatial discretization.
* This method allows for iteration over MEDFile DataStructure without any overhead. @@ -4150,11 +4151,11 @@ std::vector< std::vector< std::pair > > MEDFileAnyTypeField1TSWithoutSD * maximal absolute dimension and values returned via the out parameter \a levs are * dimensions relative to the maximal absolute dimension.
* This method is designed for MEDFileField1TS instances that have a discretization - * \ref ParaMEDMEM::ON_CELLS "ON_CELLS", - * \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT", - * \ref ParaMEDMEM::ON_GAUSS_NE "ON_GAUSS_NE". + * \ref MEDCoupling::ON_CELLS "ON_CELLS", + * \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT", + * \ref MEDCoupling::ON_GAUSS_NE "ON_GAUSS_NE". * Only these 3 discretizations will be taken into account here. If \a this is - * \ref ParaMEDMEM::ON_NODES "ON_NODES", -1 is returned and \a levs are empty.
+ * \ref MEDCoupling::ON_NODES "ON_NODES", -1 is returned and \a levs are empty.
* This method is useful to make the link between the dimension of the underlying mesh * and the levels of \a this, because it is possible that the highest dimension of \a this * field is not equal to the dimension of the underlying mesh. @@ -4248,7 +4249,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::getMeshIdFromMeshName(const std::string& m std::string mName2(mName); int ret=0; std::vector msg; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++,ret++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++,ret++) if(mName2==(*it)->getMeshName()) return ret; else @@ -4267,7 +4268,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary(const MEDCouplingMe std::string tmp(mesh->getName()); if(tmp.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::addNewEntryIfNecessary : empty mesh name ! unsupported by MED file !"); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin(); + std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin(); int i=0; for(;it!=_field_per_mesh.end();it++,i++) { @@ -4284,7 +4285,7 @@ bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::st MEDFileFieldGlobsReal& glob) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { MEDFileFieldPerMesh *fpm(*it); if(fpm) @@ -4299,7 +4300,7 @@ bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::st * * \sa splitMultiDiscrPerGeoTypes */ -std::vector< MEDCouplingAutoRefCountObjectPtr > MEDFileAnyTypeField1TSWithoutSDA::splitDiscretizations() const +std::vector< MCAuto > MEDFileAnyTypeField1TSWithoutSDA::splitDiscretizations() const { std::vector types; std::vector< std::vector > typesF; @@ -4309,7 +4310,7 @@ std::vector< MEDCouplingAutoRefCountObjectPtr for(std::vector< std::vector >::const_iterator it1=typesF.begin();it1!=typesF.end();it1++) for(std::vector::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) allEnt.insert(*it2); - std::vector< MEDCouplingAutoRefCountObjectPtr > ret(allEnt.size()); + std::vector< MCAuto > ret(allEnt.size()); std::set::const_iterator it3(allEnt.begin()); for(std::size_t i=0;i * * \sa splitDiscretizations */ -std::vector< MEDCouplingAutoRefCountObjectPtr > MEDFileAnyTypeField1TSWithoutSDA::splitMultiDiscrPerGeoTypes() const +std::vector< MCAuto > MEDFileAnyTypeField1TSWithoutSDA::splitMultiDiscrPerGeoTypes() const { std::vector types; std::vector< std::vector > typesF; @@ -4347,11 +4348,11 @@ std::vector< MEDCouplingAutoRefCountObjectPtr throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::splitMultiDiscrPerGeoTypes : empty field !"); if(nbOfMDPGT==1) { - std::vector< MEDCouplingAutoRefCountObjectPtr > ret0(1); + std::vector< MCAuto > ret0(1); ret0[0]=const_cast(this); this->incrRef(); return ret0; } - std::vector< MEDCouplingAutoRefCountObjectPtr > ret(nbOfMDPGT); + std::vector< MCAuto > ret(nbOfMDPGT); for(std::size_t i=0;i > its; @@ -4365,7 +4366,7 @@ std::vector< MEDCouplingAutoRefCountObjectPtr int MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair >& its) { int globalCounter(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->keepOnlySpatialDiscretization(tof,globalCounter,its); return globalCounter; } @@ -4373,7 +4374,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField int MEDFileAnyTypeField1TSWithoutSDA::keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair >& its) { int globalCounter(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->keepOnlyGaussDiscretization(idOfDisc,globalCounter,its); return globalCounter; } @@ -4386,7 +4387,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::updateData(int newLgth, const std::vector const DataArray *oldArr(getUndergroundDataArray()); if(oldArr) { - MEDCouplingAutoRefCountObjectPtr newArr(createNewEmptyDataArrayInstance()); + MCAuto newArr(createNewEmptyDataArrayInstance()); newArr->setInfoAndChangeNbOfCompo(oldArr->getInfoOnComponents()); setArray(newArr); _nb_of_tuples_to_be_allocated=newLgth;//force the _nb_of_tuples_to_be_allocated because setArray has been used specialy @@ -4400,7 +4401,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::updateData(int newLgth, const std::vector const DataArray *oldArr(getUndergroundDataArray()); if(!oldArr || !oldArr->isAllocated()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::updateData : internal error 1 !"); - MEDCouplingAutoRefCountObjectPtr newArr(createNewEmptyDataArrayInstance()); + MCAuto newArr(createNewEmptyDataArrayInstance()); newArr->alloc(newLgth,getNumberOfComponents()); if(oldArr) newArr->copyStringInfoFrom(*oldArr); @@ -4409,7 +4410,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::updateData(int newLgth, const std::vector { if((*it).second<(*it).first) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::updateData : the range in the leaves was invalid !"); - newArr->setContigPartOfSelectedValues2(pos,oldArr,(*it).first,(*it).second,1); + newArr->setContigPartOfSelectedValuesSlice(pos,oldArr,(*it).first,(*it).second,1); pos+=(*it).second-(*it).first; } setArray(newArr); @@ -4480,14 +4481,14 @@ void MEDFileAnyTypeField1TSWithoutSDA::loadOnlyStructureOfDataRecursively(med_id void MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) { allocIfNecessaryTheArrayToReceiveDataFromFile(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->loadBigArraysRecursively(fid,nasc); } void MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc) { if(allocIfNecessaryTheArrayToReceiveDataFromFile()) - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->loadBigArraysRecursively(fid,nasc); } @@ -4509,7 +4510,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::unloadArrays() std::size_t MEDFileAnyTypeField1TSWithoutSDA::getHeapMemorySizeWithoutChildren() const { - return _dt_unit.capacity()+_field_per_mesh.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh >); + return _dt_unit.capacity()+_field_per_mesh.capacity()*sizeof(MCAuto< MEDFileFieldPerMesh >); } std::vector MEDFileAnyTypeField1TSWithoutSDA::getDirectChildrenWithNull() const @@ -4517,7 +4518,7 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getDirect std::vector ret; if(getUndergroundDataArray()) ret.push_back(getUndergroundDataArray()); - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) ret.push_back((const MEDFileFieldPerMesh *)*it); return ret; } @@ -4587,15 +4588,15 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const MEDCouplingFieldDou std::vector idsInPflPerType; std::vector idsPerType; std::vector code,code2; - MEDCouplingAutoRefCountObjectPtr m(mesh->getMeshAtLevel(meshDimRelToMax)); + MCAuto m(mesh->getMeshAtLevel(meshDimRelToMax)); if(type!=ON_NODES) { m->splitProfilePerType(profile,code,idsInPflPerType,idsPerType); - std::vector< MEDCouplingAutoRefCountObjectPtr > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin()); - std::vector< MEDCouplingAutoRefCountObjectPtr > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin()); + std::vector< MCAuto > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin()); + std::vector< MCAuto > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin()); std::vector idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin()); // start of check - MEDCouplingAutoRefCountObjectPtr field2=field->clone(false); + MCAuto field2=field->clone(false); int nbOfTuplesExp=field2->getNumberOfTuplesExpectedRegardingCode(code,idsPerType3); if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples()) { @@ -4724,7 +4725,7 @@ std::vector& MEDFileAnyTypeField1TSWithoutSDA::getInfo() bool MEDFileAnyTypeField1TSWithoutSDA::presenceOfMultiDiscPerGeoType() const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { const MEDFileFieldPerMesh *fpm(*it); if(!fpm) @@ -4756,9 +4757,9 @@ bool MEDFileAnyTypeField1TSWithoutSDA::presenceOfMultiDiscPerGeoType() const * \throw If no field of \a this is lying on the mesh \a mName. * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. */ -MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const +MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { - MEDCouplingAutoRefCountObjectPtr mm; + MCAuto mm; if(mName.empty()) mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder()); else @@ -4786,9 +4787,9 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOf * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh. * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. */ -MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const +MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { - MEDCouplingAutoRefCountObjectPtr m(mesh->getMeshAtLevel(meshDimRelToMax,false)); + MCAuto m(mesh->getMeshAtLevel(meshDimRelToMax,false)); const DataArrayInt *d=mesh->getNumberFieldAtLevel(meshDimRelToMax); const DataArrayInt *e=mesh->getNumberFieldAtLevel(1); if(meshDimRelToMax==1) @@ -4816,9 +4817,9 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( * \throw If there are no mesh entities in the mesh. * \throw If no field values of the given \a type are available. */ -MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const +MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { - MEDCouplingAutoRefCountObjectPtr mm; + MCAuto mm; if(mName.empty()) mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder()); else @@ -4850,12 +4851,12 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(Typ * \throw If no field of \a this is lying on \a mesh. * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. */ -MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const +MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { static const char msg1[]="MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : request for a renumbered field following mesh numbering whereas it is a profile field !"; int meshId=getMeshIdFromMeshName(mesh->getName()); bool isPfl=false; - MEDCouplingAutoRefCountObjectPtr ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl,arrOut,nasc); + MCAuto ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl,arrOut,nasc); switch(renumPol) { case 0: @@ -4900,7 +4901,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( oss << "\"" << nasc.getName() << "\" not defined on all nodes !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDCouplingAutoRefCountObjectPtr nodeRenumSafe=nodeRenum->checkAndPreparePermutation(); + MCAuto nodeRenumSafe=nodeRenum->checkAndPreparePermutation(); if(!dynamic_cast((DataArray *)arrOut)) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : node renumbering not implemented for not double DataArrays !"); ret->renumberNodes(nodeRenumSafe->getConstPointer()); @@ -4930,9 +4931,9 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( */ DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const { - MEDCouplingAutoRefCountObjectPtr m(mesh->getMeshAtLevel(meshDimRelToMax)); + MCAuto m(mesh->getMeshAtLevel(meshDimRelToMax)); int meshId=getMeshIdFromMeshName(mesh->getName().c_str()); - MEDCouplingAutoRefCountObjectPtr ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc); + MCAuto ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc); ret->setName(nasc.getName().c_str()); return ret.retn(); } @@ -4967,13 +4968,13 @@ std::vector MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh * std::set geoTypes=mesh->getAllGeoTypes(); int nbOfTypes=geoTypes.size(); std::vector code(3*nbOfTypes); - MEDCouplingAutoRefCountObjectPtr arr1=DataArrayInt::New(); + MCAuto arr1=DataArrayInt::New(); arr1->alloc(nbOfTypes,1); int *arrPtr=arr1->getPointer(); std::set::const_iterator it=geoTypes.begin(); for(int i=0;i arr2=arr1->checkAndPreparePermutation(); + MCAuto arr2=arr1->checkAndPreparePermutation(); const int *arrPtr2=arr2->getConstPointer(); int i=0; for(it=geoTypes.begin();it!=geoTypes.end();it++,i++) @@ -5006,7 +5007,7 @@ MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const std::string& fie * Thus all sequences returned by this method are of the same length equal to number * of different types of supporting entities.
* A field part can include sub-parts with several different spatial discretizations, - * \ref ParaMEDMEM::ON_CELLS "ON_CELLS" and \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT" + * \ref MEDCoupling::ON_CELLS "ON_CELLS" and \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT" * for example. Hence, some of the returned sequences contains nested sequences, and an item * of a nested sequence corresponds to a type of spatial discretization.
* This method allows for iteration over MEDFile DataStructure with a reduced overhead. @@ -5018,8 +5019,8 @@ MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const std::string& fie * a field part is returned. * \param [in,out] typesF - a sequence of sequences of types of spatial discretizations. * A field part can include sub-parts with several different spatial discretizations, - * \ref ParaMEDMEM::ON_CELLS "ON_CELLS" and - * \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT" for example. + * \ref MEDCoupling::ON_CELLS "ON_CELLS" and + * \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT" for example. * This sequence is of the same length as \a types. * \param [in,out] pfls - a sequence returning a profile name per each type of spatial * discretization. A profile name can be empty. @@ -5051,7 +5052,7 @@ std::vector< std::vector > MEDFileField1TSWithoutSDA::getFiel ret[i].resize(nbOfRet1); for(int j=0;jselectByTupleId2(p[j].first,p[j].second,1); + DataArrayDouble *tmp=_arr->selectByTupleIdSafeSlice(p[j].first,p[j].second,1); ret[i][j]=tmp; } } @@ -5081,13 +5082,13 @@ const char *MEDFileField1TSWithoutSDA::getTypeStr() const MEDFileIntField1TSWithoutSDA *MEDFileField1TSWithoutSDA::convertToInt() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileIntField1TSWithoutSDA); + MCAuto ret(new MEDFileIntField1TSWithoutSDA); ret->MEDFileAnyTypeField1TSWithoutSDA::operator =(*this); ret->deepCpyLeavesFrom(*this); const DataArrayDouble *arr(_arr); if(arr) { - MEDCouplingAutoRefCountObjectPtr arr2(arr->convertToIntArr()); + MCAuto arr2(arr->convertToIntArr()); ret->setArray(arr2); } return ret.retn(); @@ -5164,16 +5165,16 @@ MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA():MEDFileAnyTypeField1TSWit MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::shallowCpy() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileField1TSWithoutSDA(*this)); + MCAuto ret(new MEDFileField1TSWithoutSDA(*this)); ret->deepCpyLeavesFrom(*this); return ret.retn(); } -MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCpy() const +MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=static_cast(shallowCpy()); + MCAuto ret=static_cast(shallowCpy()); if((const DataArrayDouble *)_arr) - ret->_arr=_arr->deepCpy(); + ret->_arr=_arr->deepCopy(); return ret.retn(); } @@ -5253,13 +5254,13 @@ const char *MEDFileIntField1TSWithoutSDA::getTypeStr() const MEDFileField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::convertToDouble() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileField1TSWithoutSDA); + MCAuto ret(new MEDFileField1TSWithoutSDA); ret->MEDFileAnyTypeField1TSWithoutSDA::operator =(*this); ret->deepCpyLeavesFrom(*this); const DataArrayInt *arr(_arr); if(arr) { - MEDCouplingAutoRefCountObjectPtr arr2(arr->convertToDblArr()); + MCAuto arr2(arr->convertToDblArr()); ret->setArray(arr2); } return ret.retn(); @@ -5342,16 +5343,16 @@ DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::v MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::shallowCpy() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileIntField1TSWithoutSDA(*this)); + MCAuto ret(new MEDFileIntField1TSWithoutSDA(*this)); ret->deepCpyLeavesFrom(*this); return ret.retn(); } -MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::deepCpy() const +MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=static_cast(shallowCpy()); + MCAuto ret=static_cast(shallowCpy()); if((const DataArrayInt *)_arr) - ret->_arr=_arr->deepCpy(); + ret->_arr=_arr->deepCopy(); return ret.retn(); } @@ -5419,7 +5420,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i std::vector infos; std::string dtunit,fieldName; LocateField2(fid,fileName,0,true,fieldName,typcha,infos,dtunit); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(typcha) { case MED_FLOAT64: @@ -5473,7 +5474,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i std::string dtunit; int iii=-1; int nbSteps=LocateField(fid,fileName,fieldName,iii,typcha,infos,dtunit); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(typcha) { case MED_FLOAT64: @@ -5532,14 +5533,14 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::BuildNewInstanceFromContent(MEDF throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !"); if(dynamic_cast(c)) { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileField1TS::New(); + MCAuto ret=MEDFileField1TS::New(); ret->setFileName(fileName); ret->_content=c; c->incrRef(); return ret.retn(); } if(dynamic_cast(c)) { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileIntField1TS::New(); + MCAuto ret=MEDFileIntField1TS::New(); ret->setFileName(fileName); ret->_content=c; c->incrRef(); return ret.retn(); @@ -5551,8 +5552,8 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - MEDCouplingAutoRefCountObjectPtr c=BuildContentFrom(fid,fileName,loadAll,0); - MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); + MCAuto c=BuildContentFrom(fid,fileName,loadAll,0); + MCAuto ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); return ret.retn(); } @@ -5561,8 +5562,8 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - MEDCouplingAutoRefCountObjectPtr c=BuildContentFrom(fid,fileName,fieldName,loadAll,0); - MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); + MCAuto c=BuildContentFrom(fid,fileName,fieldName,loadAll,0); + MCAuto ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); return ret.retn(); } @@ -5571,8 +5572,8 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - MEDCouplingAutoRefCountObjectPtr c=BuildContentFrom(fid,fileName,fieldName,iteration,order,loadAll,0); - MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); + MCAuto c=BuildContentFrom(fid,fileName,fieldName,iteration,order,loadAll,0); + MCAuto ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); return ret.retn(); } @@ -5584,7 +5585,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i std::string dtunit; int iii=-1; int nbOfStep2=LocateField(fid,fileName,fieldName,iii,typcha,infos,dtunit); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(typcha) { case MED_FLOAT64: @@ -6134,14 +6135,14 @@ std::vector< std::vector > > MEDFileAnyTypeField1TS::getField * The returned instances are deep copy of \a this except that for globals that are share with those contained in \a this. * ** WARNING ** do no forget to rename the ouput instances to avoid to write n-times in the same MED file field ! */ -std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitComponents() const +std::vector< MCAuto< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitComponents() const { const MEDFileAnyTypeField1TSWithoutSDA *content(_content); if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitComponents : no content in this ! Unable to split components !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > contentsSplit=content->splitComponents(); + std::vector< MCAuto > contentsSplit=content->splitComponents(); std::size_t sz(contentsSplit.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret(sz); + std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret(sz); for(std::size_t i=0;i > MEDFil * This method returns as MEDFileAnyTypeField1TS new instances as number of spatial discretizations in \a this. * The returned instances are shallowed copied of \a this except that for globals that are share with those contained in \a this. */ -std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitDiscretizations() const +std::vector< MCAuto< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitDiscretizations() const { const MEDFileAnyTypeField1TSWithoutSDA *content(_content); if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitDiscretizations : no content in this ! Unable to split discretization !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > contentsSplit(content->splitDiscretizations()); + std::vector< MCAuto > contentsSplit(content->splitDiscretizations()); std::size_t sz(contentsSplit.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret(sz); + std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret(sz); for(std::size_t i=0;i > MEDFil * This method returns as MEDFileAnyTypeField1TS new instances as number of maximal number of discretization in \a this. * The returned instances are shallowed copied of \a this except that for globals that are share with those contained in \a this. */ -std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitMultiDiscrPerGeoTypes() const +std::vector< MCAuto< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitMultiDiscrPerGeoTypes() const { const MEDFileAnyTypeField1TSWithoutSDA *content(_content); if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitMultiDiscrPerGeoTypes : no content in this ! Unable to split discretization !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > contentsSplit(content->splitMultiDiscrPerGeoTypes()); + std::vector< MCAuto > contentsSplit(content->splitMultiDiscrPerGeoTypes()); std::size_t sz(contentsSplit.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret(sz); + std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret(sz); for(std::size_t i=0;i > MEDFil return ret; } -MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::deepCpy() const +MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=shallowCpy(); + MCAuto ret=shallowCpy(); if((const MEDFileAnyTypeField1TSWithoutSDA *)_content) - ret->_content=_content->deepCpy(); + ret->_content=_content->deepCopy(); ret->deepCpyGlobs(*this); return ret.retn(); } @@ -6216,7 +6217,7 @@ int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field */ MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileField1TS(fileName,loadAll,0)); + MCAuto ret(new MEDFileField1TS(fileName,loadAll,0)); ret->contentNotNull(); return ret.retn(); } @@ -6233,7 +6234,7 @@ MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, bool loadAll) */ MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileField1TS(fileName,fieldName,loadAll,0)); + MCAuto ret(new MEDFileField1TS(fileName,fieldName,loadAll,0)); ret->contentNotNull(); return ret.retn(); } @@ -6253,7 +6254,7 @@ MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::st */ MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileField1TS(fileName,fieldName,iteration,order,loadAll,0)); + MCAuto ret(new MEDFileField1TS(fileName,fieldName,iteration,order,loadAll,0)); ret->contentNotNull(); return ret.retn(); } @@ -6272,7 +6273,7 @@ MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::st */ MEDFileField1TS *MEDFileField1TS::New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent) { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileField1TS(other,shallowCopyOfContent); + MCAuto ret=new MEDFileField1TS(other,shallowCopyOfContent); ret->contentNotNull(); return ret.retn(); } @@ -6284,7 +6285,7 @@ MEDFileField1TS *MEDFileField1TS::New(const MEDFileField1TSWithoutSDA& other, bo */ MEDFileField1TS *MEDFileField1TS::New() { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileField1TS; + MCAuto ret=new MEDFileField1TS; ret->contentNotNull(); return ret.retn(); } @@ -6299,14 +6300,14 @@ MEDFileField1TS *MEDFileField1TS::New() */ MEDFileIntField1TS *MEDFileField1TS::convertToInt(bool isDeepCpyGlobs) const { - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; const MEDFileAnyTypeField1TSWithoutSDA *content(_content); if(content) { const MEDFileField1TSWithoutSDA *contc=dynamic_cast(content); if(!contc) throw INTERP_KERNEL::Exception("MEDFileField1TS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !"); - MEDCouplingAutoRefCountObjectPtr newc(contc->convertToInt()); + MCAuto newc(contc->convertToInt()); ret=static_cast(MEDFileAnyTypeField1TS::BuildNewInstanceFromContent((MEDFileIntField1TSWithoutSDA *)newc,getFileName())); } else @@ -6340,7 +6341,7 @@ MEDFileField1TSWithoutSDA *MEDFileField1TS::contentNotNull() return ret; } -void MEDFileField1TS::SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MEDCouplingAutoRefCountObjectPtr& arr) +void MEDFileField1TS::SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MCAuto& arr) { if(!f) throw INTERP_KERNEL::Exception("MEDFileField1TS::SetDataArrayDoubleInField : input field is NULL !"); @@ -6352,7 +6353,7 @@ void MEDFileField1TS::SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MEDCo f->setArray(arrOutC); } -DataArrayDouble *MEDFileField1TS::ReturnSafelyDataArrayDouble(MEDCouplingAutoRefCountObjectPtr& arr) +DataArrayDouble *MEDFileField1TS::ReturnSafelyDataArrayDouble(MCAuto& arr) { if(!((DataArray*)arr)) throw INTERP_KERNEL::Exception("MEDFileField1TS::ReturnSafelyDataArrayDouble : no array !"); @@ -6363,6 +6364,53 @@ DataArrayDouble *MEDFileField1TS::ReturnSafelyDataArrayDouble(MEDCouplingAutoRef return arrOutC; } +/*! + * Return an extraction of \a this using \a extractDef map to specify the extraction. + * The keys of \a extractDef is level relative to max ext of \a mm mesh. + * + * \return A new object that the caller is responsible to deallocate. + */ +MEDFileField1TS *MEDFileField1TS::extractPart(const std::map >& extractDef, MEDFileMesh *mm) const +{ + if(!mm) + throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : input mesh is NULL !"); + MCAuto ret(MEDFileField1TS::New()); + std::vector tof(getTypesOfFieldAvailable()); + for(std::vector::const_iterator it0=tof.begin();it0!=tof.end();it0++) + { + if((*it0)!=ON_NODES) + { + std::vector levs; + getNonEmptyLevels(mm->getName(),levs); + for(std::vector::const_iterator lev=levs.begin();lev!=levs.end();lev++) + { + std::map >::const_iterator it2(extractDef.find(*lev)); + if(it2!=extractDef.end()) + { + MCAuto t((*it2).second); + MCAuto f(getFieldOnMeshAtLevel(ON_CELLS,(*lev),mm)); + MCAuto fOut(f->buildSubPart(t)); + ret->setFieldNoProfileSBT(fOut); + } + } + } + else + { + std::map >::const_iterator it2(extractDef.find(1)); + if(it2==extractDef.end()) + throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a NODE field and no extract array available for NODE !"); + MCAuto t((*it2).second); + MCAuto f(getFieldOnMeshAtLevel(ON_NODES,0,mm)); + MCAuto fOut(f->deepCopy()); + DataArrayDouble *arr(f->getArray()); + MCAuto newArr(arr->selectByTupleIdSafe(t->begin(),t->end())); + fOut->setArray(newArr); + ret->setFieldNoProfileSBT(fOut); + } + } + return ret.retn(); +} + MEDFileField1TS::MEDFileField1TS(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms) try:MEDFileAnyTypeField1TS(fileName,loadAll,ms) { @@ -6429,8 +6477,8 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevel(TypeOfField type, int m { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNull()); + MCAuto arrOut; + MCAuto ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNull()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -6461,8 +6509,8 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtTopLevel(TypeOfField type, in { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtTopLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtTopLevel method instead !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNull()); + MCAuto arrOut; + MCAuto ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNull()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -6489,8 +6537,8 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtTopLevel(TypeOfField type, in */ MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol) const { - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNull()); + MCAuto arrOut; + MCAuto ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNull()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -6518,8 +6566,8 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, */ MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const { - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNull()); + MCAuto arrOut; + MCAuto ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNull()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -6554,8 +6602,8 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevelOld(TypeOfField type, co { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNull()); + MCAuto arrOut; + MCAuto ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNull()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -6578,7 +6626,7 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevelOld(TypeOfField type, co */ DataArrayDouble *MEDFileField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const { - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull()); + MCAuto ret=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull()); return MEDFileField1TS::ReturnSafelyDataArrayDouble(ret); } @@ -6654,35 +6702,35 @@ std::vector< std::vector > MEDFileField1TS::getFieldSplitedBy MEDFileIntField1TS *MEDFileIntField1TS::New() { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntField1TS; + MCAuto ret=new MEDFileIntField1TS; ret->contentNotNull(); return ret.retn(); } MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileIntField1TS(fileName,loadAll,0)); + MCAuto ret(new MEDFileIntField1TS(fileName,loadAll,0)); ret->contentNotNull(); return ret.retn(); } MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileIntField1TS(fileName,fieldName,loadAll,0)); + MCAuto ret(new MEDFileIntField1TS(fileName,fieldName,loadAll,0)); ret->contentNotNull(); return ret.retn(); } MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileIntField1TS(fileName,fieldName,iteration,order,loadAll,0)); + MCAuto ret(new MEDFileIntField1TS(fileName,fieldName,iteration,order,loadAll,0)); ret->contentNotNull(); return ret.retn(); } MEDFileIntField1TS *MEDFileIntField1TS::New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent) { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntField1TS(other,shallowCopyOfContent); + MCAuto ret=new MEDFileIntField1TS(other,shallowCopyOfContent); ret->contentNotNull(); return ret.retn(); } @@ -6738,14 +6786,14 @@ MEDFileAnyTypeField1TS *MEDFileIntField1TS::shallowCpy() const */ MEDFileField1TS *MEDFileIntField1TS::convertToDouble(bool isDeepCpyGlobs) const { - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; const MEDFileAnyTypeField1TSWithoutSDA *content(_content); if(content) { const MEDFileIntField1TSWithoutSDA *contc=dynamic_cast(content); if(!contc) throw INTERP_KERNEL::Exception("MEDFileIntField1TS::convertToInt : the content inside this is not INT32 ! This is incoherent !"); - MEDCouplingAutoRefCountObjectPtr newc(contc->convertToDouble()); + MCAuto newc(contc->convertToDouble()); ret=static_cast(MEDFileAnyTypeField1TS::BuildNewInstanceFromContent((MEDFileField1TSWithoutSDA *)newc,getFileName())); } else @@ -6821,8 +6869,8 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevel(TypeOfField type, in { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !"); - MEDCouplingAutoRefCountObjectPtr arrOut2; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut2,*contentNotNull()); + MCAuto arrOut2; + MCAuto ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut2,*contentNotNull()); DataArrayInt *arrOutC=dynamic_cast((DataArray *)arrOut2); if(!arrOutC) throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevelOld : mismatch between dataArrays type and MEDFileIntField1TS ! Expected int32 !"); @@ -6831,7 +6879,7 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevel(TypeOfField type, in return ret.retn(); } -DataArrayInt *MEDFileIntField1TS::ReturnSafelyDataArrayInt(MEDCouplingAutoRefCountObjectPtr& arr) +DataArrayInt *MEDFileIntField1TS::ReturnSafelyDataArrayInt(MCAuto& arr) { if(!((DataArray *)arr)) throw INTERP_KERNEL::Exception("MEDFileIntField1TS::ReturnSafelyDataArrayInt : input DataArray is NULL !"); @@ -6842,6 +6890,11 @@ DataArrayInt *MEDFileIntField1TS::ReturnSafelyDataArrayInt(MEDCouplingAutoRefCou return arrC; } +MEDFileIntField1TS *MEDFileIntField1TS::extractPart(const std::map >& extractDef, MEDFileMesh *mm) const +{ + throw INTERP_KERNEL::Exception("MEDFileIntField1TS::extractPart : not implemented yet !"); +} + /*! * Returns a new MEDCouplingFieldDouble of a given type lying on * the top level cells of the first mesh in MED file. If \a this field @@ -6869,8 +6922,8 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtTopLevel(TypeOfField type, { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtTopLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtTopLevel method instead !"); - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNull()); + MCAuto arr; + MCAuto ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNull()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -6898,8 +6951,8 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtTopLevel(TypeOfField type, */ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol) const { - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNull()); + MCAuto arr; + MCAuto ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNull()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -6928,8 +6981,8 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField ty */ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol) const { - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNull()); + MCAuto arr; + MCAuto ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNull()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -6965,8 +7018,8 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevelOld(TypeOfField type, { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !"); - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNull()); + MCAuto arr; + MCAuto ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNull()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -6989,7 +7042,7 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevelOld(TypeOfField type, */ DataArrayInt *MEDFileIntField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const { - MEDCouplingAutoRefCountObjectPtr arr=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull()); + MCAuto arr=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull()); return MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); } @@ -7044,7 +7097,7 @@ catch(INTERP_KERNEL::Exception& e) std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySizeWithoutChildren() const { - std::size_t ret(_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr)); + std::size_t ret(_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MCAuto)); for(std::vector::const_iterator it=_infos.begin();it!=_infos.end();it++) ret+=(*it).capacity(); return ret; @@ -7053,7 +7106,7 @@ std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySizeWithoutChildr std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)*it); return ret; } @@ -7064,7 +7117,7 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getDi */ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds(const int *startIds, const int *endIds) const { - MEDCouplingAutoRefCountObjectPtr ret=createNew(); + MCAuto ret=createNew(); ret->setInfo(_infos); int sz=(int)_time_steps.size(); for(const int *id=startIds;id!=endIds;id++) @@ -7072,7 +7125,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buil if(*id>=0 && *id tse2; + MCAuto tse2; if(tse) { tse->incrRef(); @@ -7101,7 +7154,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buil { static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2"; int nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg); - MEDCouplingAutoRefCountObjectPtr ret=createNew(); + MCAuto ret=createNew(); ret->setInfo(_infos); int sz=(int)_time_steps.size(); int j=bg; @@ -7110,7 +7163,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buil if(j>=0 && j tse2; + MCAuto tse2; if(tse) { tse->incrRef(); @@ -7134,8 +7187,8 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buil MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const { int id=0; - MEDCouplingAutoRefCountObjectPtr ids=DataArrayInt::New(); ids->alloc(0,1); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++) + MCAuto ids=DataArrayInt::New(); ids->alloc(0,1); + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++) { const MEDFileAnyTypeField1TSWithoutSDA *cur(*it); if(!cur) @@ -7150,8 +7203,8 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::part MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const { int id=0; - MEDCouplingAutoRefCountObjectPtr ids=DataArrayInt::New(); ids->alloc(0,1); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++) + MCAuto ids=DataArrayInt::New(); ids->alloc(0,1); + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++) { const MEDFileAnyTypeField1TSWithoutSDA *cur(*it); if(!cur) @@ -7165,7 +7218,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::part bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfMultiDiscPerGeoType() const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { const MEDFileAnyTypeField1TSWithoutSDA *cur(*it); if(!cur) @@ -7189,7 +7242,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::setInfo(const std::vector >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) { const MEDFileAnyTypeField1TSWithoutSDA *pt(*it); if(pt->isDealingTS(iteration,order)) @@ -7230,7 +7283,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::setMeshName(const std::string& newMes bool MEDFileAnyTypeFieldMultiTSWithoutSDA::changeMeshNames(const std::vector< std::pair >& modifTab) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { MEDFileAnyTypeField1TSWithoutSDA *cur(*it); if(cur) @@ -7259,7 +7312,7 @@ bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std MEDFileFieldGlobsReal& glob) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { MEDFileAnyTypeField1TSWithoutSDA *f1ts(*it); if(f1ts) @@ -7281,7 +7334,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::simpleRepr(int bkOffset, std::ostream oss << startLine << " - \"" << *it << "\"" << std::endl; } int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) { std::string chapter(17,'0'+i); oss << startLine << chapter << std::endl; @@ -7315,7 +7368,7 @@ std::vector< std::pair > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeS return ret; } -void MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep(MEDCouplingAutoRefCountObjectPtr& tse) +void MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep(MCAuto& tse) { MEDFileAnyTypeField1TSWithoutSDA *tse2(tse); if(!tse2) @@ -7333,7 +7386,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep(MEDCouplingAutoRefCo void MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope() { std::size_t nbOfCompo=_infos.size(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { MEDFileAnyTypeField1TSWithoutSDA *cur=(*it); if(cur) @@ -7408,7 +7461,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::writeLL(med_idt fid, const MEDFileWri void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { MEDFileAnyTypeField1TSWithoutSDA *elt(*it); if(elt) @@ -7418,7 +7471,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursively(med_idt fid, void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { MEDFileAnyTypeField1TSWithoutSDA *elt(*it); if(elt) @@ -7428,7 +7481,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursivelyIfNecessary(m void MEDFileAnyTypeFieldMultiTSWithoutSDA::unloadArrays() { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { MEDFileAnyTypeField1TSWithoutSDA *elt(*it); if(elt) @@ -7443,8 +7496,8 @@ int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNumberOfTS() const void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS() { - std::vector< MEDCouplingAutoRefCountObjectPtr > newTS; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + std::vector< MCAuto > newTS; + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { const MEDFileAnyTypeField1TSWithoutSDA *tmp=(*it); if(tmp) @@ -7455,7 +7508,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS() void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds(const int *startIds, const int *endIds) { - std::vector< MEDCouplingAutoRefCountObjectPtr > newTS; + std::vector< MCAuto > newTS; int maxId=(int)_time_steps.size(); int ii=0; std::set idsToDel; @@ -7488,7 +7541,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2(int bg, int end, in int j=bg; for(int i=0;i > newTS; + std::vector< MCAuto > newTS; for(std::size_t i=0;i >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) { const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it); if(tmp) @@ -7520,7 +7573,7 @@ int MEDFileAnyTypeFieldMultiTSWithoutSDA::getPosGivenTime(double time, double ep int ret=0; std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosGivenTime : No such time step " << time << "! \nPossibilities are : "; oss.precision(15); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) { const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it); if(tmp) @@ -7619,7 +7672,7 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsed { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { std::vector tmp=(*it)->getPflsReallyUsed2(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -7636,7 +7689,7 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsed { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { std::vector tmp=(*it)->getLocsReallyUsed2(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -7652,7 +7705,7 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsed std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsedMulti2() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { std::vector tmp=(*it)->getPflsReallyUsedMulti2(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -7663,7 +7716,7 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsed std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsedMulti2() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { std::vector tmp=(*it)->getLocsReallyUsedMulti2(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -7673,13 +7726,13 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsed void MEDFileAnyTypeFieldMultiTSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) (*it)->changePflsRefsNamesGen2(mapOfModif); } void MEDFileAnyTypeFieldMultiTSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) (*it)->changeLocsRefsNamesGen2(mapOfModif); } @@ -7700,23 +7753,23 @@ std::vector< std::vector< std::pair > > MEDFileAnyTypeFieldMultiTSWitho return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs); } -MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::deepCpy() const +MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=shallowCpy(); + MCAuto ret=shallowCpy(); std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) { if((const MEDFileAnyTypeField1TSWithoutSDA *)*it) - ret->_time_steps[i]=(*it)->deepCpy(); + ret->_time_steps[i]=(*it)->deepCopy(); } return ret.retn(); } -std::vector< MEDCouplingAutoRefCountObjectPtr > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents() const +std::vector< MCAuto > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents() const { std::size_t sz(_infos.size()),sz2(_time_steps.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > ret(sz); - std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > > ts(sz2); + std::vector< MCAuto > ret(sz); + std::vector< std::vector< MCAuto > > ts(sz2); for(std::size_t i=0;i > ret1=_time_steps[i]->splitComponents(); + std::vector< MCAuto > ret1=_time_steps[i]->splitComponents(); if(ret1.size()!=sz) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents : At rank #" << i << " number of components is " << ret1.size() << " whereas it should be for all time steps " << sz << " !"; @@ -7742,10 +7795,10 @@ std::vector< MEDCouplingAutoRefCountObjectPtr > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations() const +std::vector< MCAuto > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations() const { std::size_t sz(_time_steps.size()); - std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > > items(sz); + std::vector< std::vector< MCAuto > > items(sz); for(std::size_t i=0;isplitDiscretizations(); } // - std::vector< MEDCouplingAutoRefCountObjectPtr > ret; - std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > > ret2; + std::vector< MCAuto > ret; + std::vector< std::vector< MCAuto > > ret2; std::vector< TypeOfField > types; - for(std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > >::const_iterator it0=items.begin();it0!=items.end();it0++) - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) + for(std::vector< std::vector< MCAuto > >::const_iterator it0=items.begin();it0!=items.end();it0++) + for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) { std::vector ts=(*it1)->getTypesOfFieldAvailable(); if(ts.size()!=1) @@ -7771,8 +7824,8 @@ std::vector< MEDCouplingAutoRefCountObjectPtr > >::const_iterator it0=items.begin();it0!=items.end();it0++) - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) + for(std::vector< std::vector< MCAuto > >::const_iterator it0=items.begin();it0!=items.end();it0++) + for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) { TypeOfField typ=(*it1)->getTypesOfFieldAvailable()[0]; std::size_t pos=std::distance(types.begin(),std::find(types.begin(),types.end(),typ)); @@ -7780,8 +7833,8 @@ std::vector< MEDCouplingAutoRefCountObjectPtr elt(createNew()); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it1=ret2[i].begin();it1!=ret2[i].end();it1++) + MCAuto elt(createNew()); + for(std::vector< MCAuto >::iterator it1=ret2[i].begin();it1!=ret2[i].end();it1++) elt->pushBackTimeStep(*it1);//also updates infos in elt ret[i]=elt; elt->MEDFileFieldNameScope::operator=(*this); @@ -7792,10 +7845,10 @@ std::vector< MEDCouplingAutoRefCountObjectPtr > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes() const +std::vector< MCAuto > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes() const { std::size_t sz(_time_steps.size()); - std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > > items(sz); + std::vector< std::vector< MCAuto > > items(sz); std::size_t szOut(std::numeric_limits::max()); for(std::size_t i=0;i::max()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : empty field !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > ret(szOut); + std::vector< MCAuto > ret(szOut); for(std::size_t i=0;i elt(createNew()); + MCAuto elt(createNew()); for(std::size_t j=0;jpushBackTimeStep(items[j][i]); ret[i]=elt; @@ -7874,7 +7927,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatNbOfCompoOfTSMatchThis() con { std::size_t sz=_infos.size(); int j=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,j++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,j++) { const MEDFileAnyTypeField1TSWithoutSDA *elt(*it); if(elt) @@ -7894,7 +7947,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT(const MEDCoup if(!_time_steps.empty()) checkCoherencyOfTinyInfo(field,arr); MEDFileAnyTypeField1TSWithoutSDA *objC=createNew1TSWithoutSDAEmptyInstance(); - MEDCouplingAutoRefCountObjectPtr obj(objC); + MCAuto obj(objC); objC->setFieldNoProfileSBT(field,arr,glob,*this); copyTinyInfoFrom(field,arr); _time_steps.push_back(obj); @@ -7907,13 +7960,13 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingF if(!_time_steps.empty()) checkCoherencyOfTinyInfo(field,arr); MEDFileField1TSWithoutSDA *objC=new MEDFileField1TSWithoutSDA; - MEDCouplingAutoRefCountObjectPtr obj(objC); + MCAuto obj(objC); objC->setFieldProfile(field,arr,mesh,meshDimRelToMax,profile,glob,*this); copyTinyInfoFrom(field,arr); _time_steps.push_back(obj); } -void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MEDCouplingAutoRefCountObjectPtr ts) +void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAuto ts) { int sz=(int)_time_steps.size(); if(i<0 || i>=sz) @@ -8009,10 +8062,10 @@ std::vector< std::vector > MEDFileFieldMultiTSWithoutSDA::get MEDFileIntFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::convertToInt() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileIntFieldMultiTSWithoutSDA); + MCAuto ret(new MEDFileIntFieldMultiTSWithoutSDA); ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this); int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) { const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it); if(eltToConv) @@ -8020,7 +8073,7 @@ MEDFileIntFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::convertToInt() const MEDFileField1TSWithoutSDA *eltToConvC=dynamic_cast(eltToConv); if(!eltToConvC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::convertToInt : presence of an invalid 1TS type ! Should be of type FLOAT64 !"); - MEDCouplingAutoRefCountObjectPtr elt=eltToConvC->convertToInt(); + MCAuto elt=eltToConvC->convertToInt(); ret->setIteration(i,elt); } } @@ -8053,7 +8106,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr std::string dtunit; int i=-1; MEDFileAnyTypeField1TS::LocateField(fid,fileName,fieldName,i,typcha,infos,dtunit); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(typcha) { case MED_FLOAT64: @@ -8083,7 +8136,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr std::vector infos; std::string dtunit,fieldName; MEDFileAnyTypeField1TS::LocateField2(fid,fileName,0,true,fieldName,typcha,infos,dtunit); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(typcha) { case MED_FLOAT64: @@ -8112,14 +8165,14 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromCont throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !"); if(dynamic_cast(c)) { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileFieldMultiTS::New(); + MCAuto ret=MEDFileFieldMultiTS::New(); ret->setFileName(fileName); ret->_content=c; c->incrRef(); return ret.retn(); } if(dynamic_cast(c)) { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileIntFieldMultiTS::New(); + MCAuto ret=MEDFileIntFieldMultiTS::New(); ret->setFileName(fileName); ret->_content=c; c->incrRef(); return ret.retn(); @@ -8203,10 +8256,10 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::createNe MEDFileFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::convertToDouble() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileFieldMultiTSWithoutSDA); + MCAuto ret(new MEDFileFieldMultiTSWithoutSDA); ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this); int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) { const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it); if(eltToConv) @@ -8214,7 +8267,7 @@ MEDFileFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::convertToDouble const MEDFileIntField1TSWithoutSDA *eltToConvC=dynamic_cast(eltToConv); if(!eltToConvC) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::convertToInt : presence of an invalid 1TS type ! Should be of type INT32 !"); - MEDCouplingAutoRefCountObjectPtr elt=eltToConvC->convertToDouble(); + MCAuto elt=eltToConvC->convertToDouble(); ret->setIteration(i,elt); } } @@ -8235,8 +8288,8 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& f { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - MEDCouplingAutoRefCountObjectPtr c=BuildContentFrom(fid,fileName,loadAll,0); - MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); + MCAuto c=BuildContentFrom(fid,fileName,loadAll,0); + MCAuto ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); return ret.retn(); } @@ -8255,8 +8308,8 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& f { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - MEDCouplingAutoRefCountObjectPtr c(BuildContentFrom(fid,fileName,fieldName,loadAll,0,0)); - MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); + MCAuto c(BuildContentFrom(fid,fileName,fieldName,loadAll,0,0)); + MCAuto ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); return ret.retn(); } @@ -8349,16 +8402,16 @@ void MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds2(int bg, int end, int step) MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPart(const int *startIds, const int *endIds) const { - MEDCouplingAutoRefCountObjectPtr c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds); - MEDCouplingAutoRefCountObjectPtr ret=shallowCpy(); + MCAuto c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds); + MCAuto ret=shallowCpy(); ret->_content=c; return ret.retn(); } MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPartSlice(int bg, int end, int step) const { - MEDCouplingAutoRefCountObjectPtr c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step); - MEDCouplingAutoRefCountObjectPtr ret=shallowCpy(); + MCAuto c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step); + MCAuto ret=shallowCpy(); ret->_content=c; return ret.retn(); } @@ -8381,7 +8434,7 @@ void MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps(MEDFileAnyTypeFieldMultiTS *f int nbOfTS(fmts->getNumberOfTS()); for(int i=0;i elt(fmts->getTimeStepAtPos(i)); + MCAuto elt(fmts->getTimeStepAtPos(i)); pushBackTimeStep(elt); } } @@ -8392,10 +8445,10 @@ void MEDFileAnyTypeFieldMultiTS::pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : input pointer is NULL !"); checkCoherencyOfType(f1ts); f1ts->incrRef(); - MEDCouplingAutoRefCountObjectPtr f1tsSafe(f1ts); + MCAuto f1tsSafe(f1ts); MEDFileAnyTypeField1TSWithoutSDA *c=f1ts->contentNotNullBase(); c->incrRef(); - MEDCouplingAutoRefCountObjectPtr cSafe(c); + MCAuto cSafe(c); if(!((MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content)) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : no content in this !"); _content->pushBackTimeStep(cSafe); @@ -8603,14 +8656,14 @@ std::vector MEDFileAnyTypeFieldMultiTS::getDirectChildr * The returned instances are deep copy of \a this except that for globals that are share with those contained in \a this. * ** WARNING ** do no forget to rename the ouput instances to avoid to write n-times in the same MED file field ! */ -std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitComponents() const +std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitComponents() const { const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content); if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitComponents : no content in this ! Unable to split components !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > contentsSplit=content->splitComponents(); + std::vector< MCAuto > contentsSplit=content->splitComponents(); std::size_t sz(contentsSplit.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret(sz); + std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz); for(std::size_t i=0;i > ME * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of discretizations over time steps in \a this. * The returned instances are shallow copied of \a this included globals that are share with those contained in \a this. */ -std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitDiscretizations() const +std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitDiscretizations() const { const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content); if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitDiscretizations : no content in this ! Unable to split discretizations !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > contentsSplit(content->splitDiscretizations()); + std::vector< MCAuto > contentsSplit(content->splitDiscretizations()); std::size_t sz(contentsSplit.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret(sz); + std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz); for(std::size_t i=0;i > ME * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of sub-discretizations over time steps in \a this. * The returned instances are shallow copied of \a this included globals that are share with those contained in \a this. */ -std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes() const +std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes() const { const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content); if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes : no content in this ! Unable to split discretizations !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > contentsSplit(content->splitMultiDiscrPerGeoTypes()); + std::vector< MCAuto > contentsSplit(content->splitMultiDiscrPerGeoTypes()); std::size_t sz(contentsSplit.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret(sz); + std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz); for(std::size_t i=0;i > ME return ret; } -MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::deepCpy() const +MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=shallowCpy(); + MCAuto ret=shallowCpy(); if((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content) - ret->_content=_content->deepCpy(); + ret->_content=_content->deepCopy(); ret->deepCpyGlobs(*this); return ret.retn(); } -MEDCouplingAutoRefCountObjectPtr MEDFileAnyTypeFieldMultiTS::getContent() +MCAuto MEDFileAnyTypeFieldMultiTS::getContent() { return _content; } @@ -8761,7 +8814,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult * \throw If an element in \a vectFMTS is null. * \sa MEDFileAnyTypeFieldMultiTS::AreOnSameSupportAcrossTime */ -std::vector< std::vector > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(const std::vector& vectFMTS, const MEDFileMesh *mesh, std::vector< MEDCouplingAutoRefCountObjectPtr >& fsc) +std::vector< std::vector > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(const std::vector& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto >& fsc) { static const char msg[]="MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : presence of a null instance in the input vector !"; if(!mesh) @@ -8791,7 +8844,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult else vectFMTSNotNodes.push_back(*it); } - std::vector< MEDCouplingAutoRefCountObjectPtr > cmps; + std::vector< MCAuto > cmps; std::vector< std::vector > retCell=SplitPerCommonSupportNotNodesAlg(vectFMTSNotNodes,mesh,cmps); ret=retCell; for(std::vector::const_iterator it2=vectFMTSNodes.begin();it2!=vectFMTSNodes.end();it2++) @@ -8808,7 +8861,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult if(!isFetched) { std::vector tmp(1,*it2); - MEDCouplingAutoRefCountObjectPtr tmp2(MEDFileMeshStruct::New(mesh)); + MCAuto tmp2(MEDFileMeshStruct::New(mesh)); ret.push_back(tmp); retCell.push_back(tmp); cmps.push_back(MEDFileFastCellSupportComparator::New(tmp2,*it2)); } } @@ -8820,7 +8873,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult * WARNING no check here. The caller must be sure that all items in vectFMTS are coherent each other in time steps, only one same spatial discretization and not ON_NODES. * \param [out] cmps - same size than the returned vector. */ -std::vector< std::vector > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupportNotNodesAlg(const std::vector& vectFMTS, const MEDFileMesh *mesh, std::vector< MEDCouplingAutoRefCountObjectPtr >& cmps) +std::vector< std::vector > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupportNotNodesAlg(const std::vector& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto >& cmps) { std::vector< std::vector > ret; std::list lstFMTS(vectFMTS.begin(),vectFMTS.end()); @@ -8830,8 +8883,8 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult MEDFileAnyTypeFieldMultiTS *ref(*it); std::vector elt; elt.push_back(ref); it=lstFMTS.erase(it); - MEDCouplingAutoRefCountObjectPtr mst(MEDFileMeshStruct::New(mesh)); - MEDCouplingAutoRefCountObjectPtr cmp(MEDFileFastCellSupportComparator::New(mst,ref)); + MCAuto mst(MEDFileMeshStruct::New(mesh)); + MCAuto cmp(MEDFileFastCellSupportComparator::New(mst,ref)); while(it!=lstFMTS.end()) { MEDFileAnyTypeFieldMultiTS *curIt(*it); @@ -8880,8 +8933,8 @@ int MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiT return nts; for(int i=0;i f0cur=f0->getTimeStepAtPos(i); - MEDCouplingAutoRefCountObjectPtr f1cur=f1->getTimeStepAtPos(i); + MCAuto f0cur=f0->getTimeStepAtPos(i); + MCAuto f1cur=f1->getTimeStepAtPos(i); std::vector tofs0(f0cur->getTypesOfFieldAvailable()),tofs1(f1cur->getTypesOfFieldAvailable()); if(tofs0.size()!=1 || tofs1.size()!=1) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : All time steps must be defined on only one spatial discretization !"); @@ -8911,6 +8964,27 @@ int MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiT return nts; } +/*! + * Return an extraction of \a this using \a extractDef map to specify the extraction. + * The keys of \a extractDef is level relative to max ext of \a mm mesh. + * + * \return A new object that the caller is responsible to deallocate. + */ +MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::extractPart(const std::map >& extractDef, MEDFileMesh *mm) const +{ + if(!mm) + throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::extractPart : mesh is null !"); + MCAuto fmtsOut(buildNewEmpty()); + int nbTS(getNumberOfTS()); + for(int i=0;i f1ts(getTimeStepAtPos(i)); + MCAuto f1tsOut(f1ts->extractPart(extractDef,mm)); + fmtsOut->pushBackTimeStep(f1tsOut); + } + return fmtsOut.retn(); +} + MEDFileAnyTypeFieldMultiTSIterator *MEDFileAnyTypeFieldMultiTS::iterator() { return new MEDFileAnyTypeFieldMultiTSIterator(this); @@ -8938,7 +9012,7 @@ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New() */ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const std::string& fileName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileFieldMultiTS(fileName,loadAll,0); + MCAuto ret=new MEDFileFieldMultiTS(fileName,loadAll,0); ret->contentNotNull();//to check that content type matches with \a this type. return ret.retn(); } @@ -8955,7 +9029,7 @@ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const std::string& fileName, bool */ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileFieldMultiTS(fileName,fieldName,loadAll,0); + MCAuto ret=new MEDFileFieldMultiTS(fileName,fieldName,loadAll,0); ret->contentNotNull();//to check that content type matches with \a this type. return ret.retn(); } @@ -8979,7 +9053,7 @@ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const MEDFileFieldMultiTSWithoutSD MEDFileFieldMultiTS *MEDFileFieldMultiTS::LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair >& entities, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileFieldMultiTS(fileName,fieldName,loadAll,0,&entities)); + MCAuto ret(new MEDFileFieldMultiTS(fileName,fieldName,loadAll,0,&entities)); ret->contentNotNull();//to check that content type matches with \a this type. return ret.retn(); } @@ -9008,14 +9082,14 @@ void MEDFileFieldMultiTS::checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1t */ MEDFileIntFieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool isDeepCpyGlobs) const { - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content); if(content) { const MEDFileFieldMultiTSWithoutSDA *contc=dynamic_cast(content); if(!contc) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !"); - MEDCouplingAutoRefCountObjectPtr newc(contc->convertToInt()); + MCAuto newc(contc->convertToInt()); ret=static_cast(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileIntFieldMultiTSWithoutSDA *)newc,getFileName())); } else @@ -9034,7 +9108,7 @@ MEDFileIntFieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool isDeepCpyGlobs) c * delete this field using decrRef() as it is no more needed. * \throw If \a pos is not a valid time step id. */ -MEDFileAnyTypeField1TS *MEDFileFieldMultiTS::getTimeStepAtPos(int pos) const +MEDFileField1TS *MEDFileFieldMultiTS::getTimeStepAtPos(int pos) const { const MEDFileAnyTypeField1TSWithoutSDA *item=contentNotNullBase()->getTimeStepAtPos2(pos); if(!item) @@ -9045,7 +9119,7 @@ MEDFileAnyTypeField1TS *MEDFileFieldMultiTS::getTimeStepAtPos(int pos) const const MEDFileField1TSWithoutSDA *itemC=dynamic_cast(item); if(itemC) { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileField1TS::New(*itemC,false); + MCAuto ret=MEDFileField1TS::New(*itemC,false); ret->shallowCpyGlobs(*this); return ret.retn(); } @@ -9081,8 +9155,8 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevel(TypeOfField type, i const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtLevel : mismatch of type of field expecting FLOAT64 !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNullBase()); + MCAuto arrOut; + MCAuto ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNullBase()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -9113,8 +9187,8 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtTopLevel(TypeOfField type const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtTopLevel : mismatch of type of field !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNullBase()); + MCAuto arrOut; + MCAuto ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNullBase()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -9147,8 +9221,8 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField t const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNullBase()); + MCAuto arrOut; + MCAuto ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNullBase()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -9179,8 +9253,8 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField t const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNullBase()); + MCAuto arrOut; + MCAuto ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNullBase()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -9196,8 +9270,8 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevelOld(TypeOfField type const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtLevelOld : mismatch of type of field !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNullBase()); + MCAuto arrOut; + MCAuto ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNullBase()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -9228,7 +9302,7 @@ DataArrayDouble *MEDFileFieldMultiTS::getFieldWithProfile(TypeOfField type, int const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldWithProfile : mismatch of type of field !"); - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase()); + MCAuto ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase()); return MEDFileField1TS::ReturnSafelyDataArrayDouble(ret); } @@ -9341,6 +9415,11 @@ DataArrayDouble *MEDFileFieldMultiTS::getUndergroundDataArrayExt(int iteration, return static_cast(contentNotNull()->getUndergroundDataArrayExt(iteration,order,entries)); } +MEDFileFieldMultiTS *MEDFileFieldMultiTS::buildNewEmpty() const +{ + return MEDFileFieldMultiTS::New(); +} + //= MEDFileAnyTypeFieldMultiTSIterator MEDFileAnyTypeFieldMultiTSIterator::MEDFileAnyTypeFieldMultiTSIterator(MEDFileAnyTypeFieldMultiTS *fmts):_fmts(fmts),_iter_id(0),_nb_iter(0) @@ -9392,7 +9471,7 @@ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New() */ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const std::string& fileName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntFieldMultiTS(fileName,loadAll,0); + MCAuto ret=new MEDFileIntFieldMultiTS(fileName,loadAll,0); ret->contentNotNull();//to check that content type matches with \a this type. return ret.retn(); } @@ -9409,7 +9488,7 @@ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const std::string& fileName, */ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll,0); + MCAuto ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll,0); ret->contentNotNull();//to check that content type matches with \a this type. return ret.retn(); } @@ -9433,7 +9512,7 @@ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const MEDFileIntFieldMultiTS MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair >& entities, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll,0,&entities); + MCAuto ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll,0,&entities); ret->contentNotNull();//to check that content type matches with \a this type. return ret.retn(); } @@ -9448,14 +9527,14 @@ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::LoadSpecificEntities(const std:: */ MEDFileFieldMultiTS *MEDFileIntFieldMultiTS::convertToDouble(bool isDeepCpyGlobs) const { - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content); if(content) { const MEDFileIntFieldMultiTSWithoutSDA *contc=dynamic_cast(content); if(!contc) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::convertToInt : the content inside this is not INT32 ! This is incoherent !"); - MEDCouplingAutoRefCountObjectPtr newc(contc->convertToDouble()); + MCAuto newc(contc->convertToDouble()); ret=static_cast(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileFieldMultiTSWithoutSDA *)newc,getFileName())); } else @@ -9510,8 +9589,8 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevel(TypeOfField type const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldAtLevel : mismatch of type of field expecting INT32 !"); - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arr,*contentNotNullBase()); + MCAuto arr; + MCAuto ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arr,*contentNotNullBase()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -9543,8 +9622,8 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtTopLevel(TypeOfField t const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldAtTopLevel : mismatch of type of field ! INT32 expected !"); - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNullBase()); + MCAuto arr; + MCAuto ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNullBase()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -9578,8 +9657,8 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfFiel const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !"); - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNullBase()); + MCAuto arr; + MCAuto ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNullBase()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -9611,8 +9690,8 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfFiel const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldIntMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !"); - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNullBase()); + MCAuto arr; + MCAuto ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNullBase()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -9628,8 +9707,8 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevelOld(TypeOfField t const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !"); - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNullBase()); + MCAuto arr; + MCAuto ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNullBase()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -9660,7 +9739,7 @@ DataArrayInt *MEDFileIntFieldMultiTS::getFieldWithProfile(TypeOfField type, int const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldWithProfile : mismatch of type of field ! INT32 expected !"); - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase()); + MCAuto ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase()); return MEDFileIntField1TS::ReturnSafelyDataArrayInt(ret); } @@ -9682,7 +9761,7 @@ MEDFileAnyTypeField1TS *MEDFileIntFieldMultiTS::getTimeStepAtPos(int pos) const const MEDFileIntField1TSWithoutSDA *itemC=dynamic_cast(item); if(itemC) { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileIntField1TS::New(*itemC,false); + MCAuto ret=MEDFileIntField1TS::New(*itemC,false); ret->shallowCpyGlobs(*this); return ret.retn(); } @@ -9784,6 +9863,11 @@ DataArrayInt *MEDFileIntFieldMultiTS::getUndergroundDataArray(int iteration, int return static_cast(contentNotNull()->getUndergroundDataArray(iteration,order)); } +MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::buildNewEmpty() const +{ + return MEDFileIntFieldMultiTS::New(); +} + //= MEDFileFields MEDFileFields *MEDFileFields::New() @@ -9809,26 +9893,26 @@ MEDFileFields *MEDFileFields::LoadSpecificEntities(const std::string& fileName, std::size_t MEDFileFields::getHeapMemorySizeWithoutChildren() const { std::size_t ret(MEDFileFieldGlobsReal::getHeapMemorySizeWithoutChildren()); - ret+=_fields.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); + ret+=_fields.capacity()*sizeof(MCAuto); return ret; } std::vector MEDFileFields::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)*it); return ret; } -MEDFileFields *MEDFileFields::deepCpy() const +MEDFileFields *MEDFileFields::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=shallowCpy(); + MCAuto ret=shallowCpy(); std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { if((const MEDFileAnyTypeFieldMultiTSWithoutSDA*)*it) - ret->_fields[i]=(*it)->deepCpy(); + ret->_fields[i]=(*it)->deepCopy(); } ret->deepCpyGlobs(*this); return ret.retn(); @@ -9854,7 +9938,7 @@ std::vector< std::pair > MEDFileFields::getCommonIterations(bool& areTh std::set< std::pair > s; bool firstShot=true; areThereSomeForgottenTS=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { if(!(const MEDFileAnyTypeFieldMultiTSWithoutSDA*)*it) continue; @@ -9884,7 +9968,7 @@ std::vector MEDFileFields::getFieldsNames() const { std::vector ret(_fields.size()); int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *f=(*it); if(f) @@ -9903,7 +9987,7 @@ std::vector MEDFileFields::getFieldsNames() const std::vector MEDFileFields::getMeshesNames() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it); if(cur) @@ -9926,7 +10010,7 @@ void MEDFileFields::simpleRepr(int bkOffset, std::ostream& oss) const std::string startLine(bkOffset,' '); oss << startLine << "There are " << nbOfFields << " fields in this :" << std::endl; int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it); if(cur) @@ -9939,7 +10023,7 @@ void MEDFileFields::simpleRepr(int bkOffset, std::ostream& oss) const } } i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it); std::string chapter(17,'0'+i); @@ -10004,7 +10088,7 @@ void MEDFileFields::writeLL(med_idt fid) const { int i=0; writeGlobals(fid,*this); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt=*it; if(!elt) @@ -10035,7 +10119,7 @@ void MEDFileFields::loadArrays() if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileFields::loadArrays : the structure does not come from a file !"); MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); if(elt) @@ -10055,7 +10139,7 @@ void MEDFileFields::loadArraysIfNecessary() if(!getFileName().empty()) { MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); if(elt) @@ -10073,7 +10157,7 @@ void MEDFileFields::loadArraysIfNecessary() */ void MEDFileFields::unloadArrays() { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); if(elt) @@ -10098,7 +10182,7 @@ std::vector MEDFileFields::getPflsReallyUsed() const { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) { std::vector tmp=(*it)->getPflsReallyUsed2(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -10115,7 +10199,7 @@ std::vector MEDFileFields::getLocsReallyUsed() const { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) { std::vector tmp=(*it)->getLocsReallyUsed2(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -10131,7 +10215,7 @@ std::vector MEDFileFields::getLocsReallyUsed() const std::vector MEDFileFields::getPflsReallyUsedMulti() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) { std::vector tmp=(*it)->getPflsReallyUsedMulti2(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -10142,7 +10226,7 @@ std::vector MEDFileFields::getPflsReallyUsedMulti() const std::vector MEDFileFields::getLocsReallyUsedMulti() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) { std::vector tmp=(*it)->getLocsReallyUsed2(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -10152,13 +10236,13 @@ std::vector MEDFileFields::getLocsReallyUsedMulti() const void MEDFileFields::changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++) (*it)->changePflsRefsNamesGen2(mapOfModif); } void MEDFileFields::changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++) (*it)->changeLocsRefsNamesGen2(mapOfModif); } @@ -10208,7 +10292,7 @@ void MEDFileFields::destroyFieldsAtPos(const int *startIds, const int *endIds) } b[*i]=false; } - std::vector< MEDCouplingAutoRefCountObjectPtr > fields(std::count(b.begin(),b.end(),true)); + std::vector< MCAuto > fields(std::count(b.begin(),b.end(),true)); std::size_t j=0; for(std::size_t i=0;i<_fields.size();i++) if(b[i]) @@ -10231,7 +10315,7 @@ void MEDFileFields::destroyFieldsAtPos2(int bg, int end, int step) } b[k]=false; } - std::vector< MEDCouplingAutoRefCountObjectPtr > fields(std::count(b.begin(),b.end(),true)); + std::vector< MCAuto > fields(std::count(b.begin(),b.end(),true)); std::size_t j=0; for(std::size_t i=0;i<_fields.size();i++) if(b[i]) @@ -10242,7 +10326,7 @@ void MEDFileFields::destroyFieldsAtPos2(int bg, int end, int step) bool MEDFileFields::changeMeshNames(const std::vector< std::pair >& modifTab) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it); if(cur) @@ -10263,7 +10347,7 @@ bool MEDFileFields::changeMeshNames(const std::vector< std::pair& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts(*it); if(fmts) @@ -10274,6 +10358,32 @@ bool MEDFileFields::renumberEntitiesLyingOnMesh(const std::string& meshName, con return ret; } +/*! + * Return an extraction of \a this using \a extractDef map to specify the extraction. + * The keys of \a extractDef is level relative to max ext of \a mm mesh. + * + * \return A new object that the caller is responsible to deallocate. + */ +MEDFileFields *MEDFileFields::extractPart(const std::map >& extractDef, MEDFileMesh *mm) const +{ + if(!mm) + throw INTERP_KERNEL::Exception("MEDFileFields::extractPart : input mesh is NULL !"); + MCAuto fsOut(MEDFileFields::New()); + int nbFields(getNumberOfFields()); + for(int i=0;i fmts(getFieldAtPos(i)); + if(!fmts) + { + std::ostringstream oss; oss << "MEDFileFields::extractPart : at pos #" << i << " field is null !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + MCAuto fmtsOut(fmts->extractPart(extractDef,mm)); + fsOut->pushField(fmtsOut); + } + return fsOut.retn(); +} + MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const { if(i<0 || i>=(int)_fields.size()) @@ -10284,7 +10394,7 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const const MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts=_fields[i]; if(!fmts) return 0; - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; const MEDFileFieldMultiTSWithoutSDA *fmtsC=dynamic_cast(fmts); const MEDFileIntFieldMultiTSWithoutSDA *fmtsC2=dynamic_cast(fmts); if(fmtsC) @@ -10307,9 +10417,9 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const */ MEDFileFields *MEDFileFields::buildSubPart(const int *startIds, const int *endIds) const { - MEDCouplingAutoRefCountObjectPtr ret=shallowCpy(); + MCAuto ret=shallowCpy(); std::size_t sz=std::distance(startIds,endIds); - std::vector< MEDCouplingAutoRefCountObjectPtr > fields(sz); + std::vector< MCAuto > fields(sz); int j=0; for(const int *i=startIds;i!=endIds;i++,j++) { @@ -10337,8 +10447,8 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldWithName(const std::string& f */ bool MEDFileFields::removeFieldsWithoutAnyTimeStep() { - std::vector > newFields; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) + std::vector > newFields; + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); if(elt) @@ -10364,8 +10474,8 @@ bool MEDFileFields::removeFieldsWithoutAnyTimeStep() */ MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileFields::New(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) + MCAuto ret=MEDFileFields::New(); + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it); if(!cur) @@ -10373,7 +10483,7 @@ MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const std::stri if(cur->getMeshName()==meshName) { cur->incrRef(); - MEDCouplingAutoRefCountObjectPtr cur2(const_cast(cur)); + MCAuto cur2(const_cast(cur)); ret->_fields.push_back(cur2); } } @@ -10396,13 +10506,13 @@ MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const std::stri */ MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileFields::New(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) + MCAuto ret=MEDFileFields::New(); + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it); if(!cur) continue; - MEDCouplingAutoRefCountObjectPtr elt=cur->partOfThisLyingOnSpecifiedTimeSteps(timeSteps); + MCAuto elt=cur->partOfThisLyingOnSpecifiedTimeSteps(timeSteps); ret->_fields.push_back(elt); } ret->shallowCpyOnlyUsedGlobs(*this); @@ -10414,13 +10524,13 @@ MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps(const std::vec */ MEDFileFields *MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileFields::New(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) + MCAuto ret=MEDFileFields::New(); + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it); if(!cur) continue; - MEDCouplingAutoRefCountObjectPtr elt=cur->partOfThisNotLyingOnSpecifiedTimeSteps(timeSteps); + MCAuto elt=cur->partOfThisNotLyingOnSpecifiedTimeSteps(timeSteps); if(elt->getNumberOfTS()!=0) ret->_fields.push_back(elt); }