From 57c647ecb38ffe0730a91e7110a4e930bd7e8433 Mon Sep 17 00:00:00 2001 From: geay Date: Tue, 3 Jun 2014 13:12:58 +0200 Subject: [PATCH] stash 3 --- src/MEDCoupling/MEDCouplingAMRAttribute.cxx | 101 ++++++++++++++---- src/MEDCoupling/MEDCouplingAMRAttribute.hxx | 8 +- .../MEDCouplingCartesianAMRMesh.cxx | 97 ++++++++++++++++- .../MEDCouplingCartesianAMRMesh.hxx | 5 + src/MEDCoupling_Swig/MEDCouplingCommon.i | 33 +++++- 5 files changed, 216 insertions(+), 28 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx index 433620760..1a91be1b9 100644 --- a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx @@ -70,7 +70,7 @@ std::vector DataArrayDoubleCollection::retrieveFields() const return ret; } -DataArrayDouble *DataArrayDoubleCollection::retrieveFieldWithName(const std::string& name) const +const DataArrayDouble *DataArrayDoubleCollection::getFieldWithName(const std::string& name) const { std::vector vec; for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_arrs.begin();it!=_arrs.end();it++) @@ -79,19 +79,12 @@ DataArrayDouble *DataArrayDoubleCollection::retrieveFieldWithName(const std::str if(obj) { if(obj->getName()==name) - { - DataArrayDouble *ret(const_cast(obj)); - if(ret) - ret->incrRef(); - return ret; - } + return obj; else - { - vec.push_back(obj->getName()); - } + vec.push_back(obj->getName()); } } - std::ostringstream oss; oss << "DataArrayDoubleCollection::retrieveFieldWithName : fieldName \"" << name << "\" does not exist in this ! Possibilities are :"; + std::ostringstream oss; oss << "DataArrayDoubleCollection::getFieldWithName : fieldName \"" << name << "\" does not exist in this ! Possibilities are :"; std::copy(vec.begin(),vec.end(),std::ostream_iterator(oss," ")); throw INTERP_KERNEL::Exception(oss.str().c_str()); } @@ -371,6 +364,19 @@ void MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone(int ghost } } +void MEDCouplingGridCollection::fillIfInTheProgenyOf(const std::string& fieldName, const MEDCouplingCartesianAMRMeshGen *head, std::vector& recurseArrs) const +{ + for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) + { + const MEDCouplingCartesianAMRMeshGen *a((*it).first); + if(head==a || head->isObjectInTheProgeny(a)) + { + const DataArrayDoubleCollection *gc((*it).second); + recurseArrs.push_back(gc->getFieldWithName(fieldName)); + } + } +} + MEDCouplingGridCollection::MEDCouplingGridCollection(const std::vector& ms, const std::vector< std::pair >& fieldNames):_map_of_dadc(ms.size()) { std::size_t sz(ms.size()); @@ -476,18 +482,67 @@ std::vector MEDCouplingAMRAttribute::retrieveFieldsOn(MEDCoup /*! * \sa retrieveFieldsOn */ -DataArrayDouble *MEDCouplingAMRAttribute::retrieveFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const +const DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const +{ + for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_levs.begin();it!=_levs.end();it++) + { + int tmp(-1); + if((*it)->presenceOf(mesh,tmp)) + { + const DataArrayDoubleCollection& ddc((*it)->retrieveFieldsAt(tmp)); + return ddc.getFieldWithName(fieldName); + } + } + throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::retrieveFieldOn : the mesh specified is not in the progeny of this !"); +} + +/*! + * This method returns a field on an unstructured mesh the most refined as possible without overlap. + * Ghost part are not visible here. + * + * \return MEDCouplingFieldDouble * - a field on cells that the caller has to deal with (deallocate it). + */ +MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostLev, MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const +{ + std::vector recurseArrs; + std::size_t lev(0); + for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_levs.begin();it!=_levs.end();it++,lev++) + { + int tmp(-1); + if((*it)->presenceOf(mesh,tmp)) + { + const DataArrayDoubleCollection& ddc((*it)->retrieveFieldsAt(tmp)); + recurseArrs.push_back(ddc.getFieldWithName(fieldName)); + break; + } + } + lev++; + for(std::size_t i=lev;i<_levs.size();i++) + { + const MEDCouplingGridCollection *gc(_levs[i]); + gc->fillIfInTheProgenyOf(fieldName,mesh,recurseArrs); + } + return mesh->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostLev,recurseArrs); +} + +/*! + * This method builds a newly created field on cell just lying on mesh \a mesh without its eventual refinement. + * + * \return MEDCouplingFieldDouble * - a field on cells that the caller has to deal with (deallocate it). + * + */ +MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithGhost(int ghostLev, MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const { for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_levs.begin();it!=_levs.end();it++) - { - int tmp(-1); - if((*it)->presenceOf(mesh,tmp)) - { - const DataArrayDoubleCollection& ddc((*it)->retrieveFieldsAt(tmp)); - return ddc.retrieveFieldWithName(fieldName); - } - } - throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::retrieveFieldOn : the mesh specified is not in the progeny of this !"); + { + int tmp(-1); + if((*it)->presenceOf(mesh,tmp)) + { + const DataArrayDoubleCollection& ddc((*it)->retrieveFieldsAt(tmp)); + const DataArrayDouble *arr(ddc.getFieldWithName(fieldName)); + } + } + throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::buildCellFieldOnWithGhost : the mesh specified is not in the progeny of this !"); } /*! @@ -630,8 +685,8 @@ void MEDCouplingAMRAttribute::updateTime() const MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames):MEDCouplingDataForGodFather(gf) { //gf non empty, checked by constructor - int maxLev(gf->getMaxNumberOfLevelsRelativeToThis()+1); - _levs.resize(maxLev+1); + int maxLev(gf->getMaxNumberOfLevelsRelativeToThis()); + _levs.resize(maxLev); for(int i=0;i patches(gf->retrieveGridsAt(i)); diff --git a/src/MEDCoupling/MEDCouplingAMRAttribute.hxx b/src/MEDCoupling/MEDCouplingAMRAttribute.hxx index 2fe0fdda3..726aac1e9 100644 --- a/src/MEDCoupling/MEDCouplingAMRAttribute.hxx +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.hxx @@ -35,7 +35,7 @@ namespace ParaMEDMEM void dellocTuples(); void spillInfoOnComponents(const std::vector< std::vector >& compNames); std::vector retrieveFields() const; - DataArrayDouble *retrieveFieldWithName(const std::string& name) const; + const DataArrayDouble *getFieldWithName(const std::string& name) const; static void SynchronizeFineToCoarse(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *fine, DataArrayDoubleCollection *coarse); static void SynchronizeCoarseToFine(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine); static void SynchronizeFineEachOther(int patchId, int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, const std::vector& children, const std::vector& fieldsOnFine); @@ -63,6 +63,7 @@ namespace ParaMEDMEM static void SynchronizeCoarseToFine(int ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine); void synchronizeFineEachOther(int ghostLev) const; static void SynchronizeCoarseToFineOnlyInGhostZone(int ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine); + void fillIfInTheProgenyOf(const std::string& fieldName, const MEDCouplingCartesianAMRMeshGen *head, std::vector& recurseArrs) const; private: MEDCouplingGridCollection(const std::vector& ms, const std::vector< std::pair >& fieldNames); std::size_t getHeapMemorySizeWithoutChildren() const; @@ -71,6 +72,7 @@ namespace ParaMEDMEM private: std::vector< std::pair > > _map_of_dadc; }; + /// @endcond class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel @@ -80,7 +82,9 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair > >& fieldNames); MEDCOUPLING_EXPORT void spillInfoOnComponents(const std::vector< std::vector >& compNames); MEDCOUPLING_EXPORT std::vector retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const; - MEDCOUPLING_EXPORT DataArrayDouble *retrieveFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const; + MEDCOUPLING_EXPORT const DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostLev, MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildCellFieldOnWithGhost(int ghostLev, MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const; // MEDCOUPLING_EXPORT void synchronizeFineToCoarse(int ghostLev); MEDCOUPLING_EXPORT void synchronizeCoarseToFine(int ghostLev); diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx index 34aec9711..719dd0646 100644 --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx @@ -19,6 +19,7 @@ // Author : Anthony Geay #include "MEDCouplingCartesianAMRMesh.hxx" +#include "MEDCouplingFieldDouble.hxx" #include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingIMesh.hxx" #include "MEDCouplingUMesh.hxx" @@ -695,6 +696,15 @@ int MEDCouplingCartesianAMRMeshGen::getPatchIdFromChildMesh(const MEDCouplingCar throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchIdFromChildMesh : no such a mesh in my direct progeny !"); } +std::vector< const MEDCouplingCartesianAMRPatch *> MEDCouplingCartesianAMRMeshGen::getPatches() const +{ + std::size_t sz(_patches.size()); + std::vector< const MEDCouplingCartesianAMRPatch *> ret(sz); + for(std::size_t i=0;i& recurseArrs) const +{ + if(recurseArrs.empty()) + throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseWithoutOverlapWithoutGhost : array is empty ! Should never happen !"); + // + std::vector bs(_mesh->getNumberOfCells(),false); + std::vector cgs(_mesh->getCellGridStructure()); + std::vector< MEDCouplingAutoRefCountObjectPtr > msSafe(_patches.size()+1); + std::size_t ii(0); + for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++) + { + MEDCouplingStructuredMesh::SwitchOnIdsFrom(cgs,(*it)->getBLTRRange(),bs); + std::vector tmpArrs(extractSubTreeFromGlobalFlatten((*it)->getMesh(),recurseArrs)); + msSafe[ii+1]=(*it)->getMesh()->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,tmpArrs); + } + MEDCouplingAutoRefCountObjectPtr eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs)); + // + MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingFieldDouble::New(ON_CELLS)); + MEDCouplingAutoRefCountObjectPtr arr2(extractGhostFrom(ghostSz,recurseArrs[0])); + arr2=arr2->selectByTupleIdSafe(eltsOff->begin(),eltsOff->end()); + ret->setArray(arr2); + ret->setName(arr2->getName()); + MEDCouplingAutoRefCountObjectPtr part(_mesh->buildUnstructured()); + MEDCouplingAutoRefCountObjectPtr mesh(part->buildPartOfMySelf(eltsOff->begin(),eltsOff->end(),false)); + ret->setMesh(mesh); + msSafe[0]=ret; + // + std::vector< const MEDCouplingFieldDouble * > ms(msSafe.size()); + for(std::size_t i=0;ibuildWithGhost(ghostSz). + */ +DataArrayDouble *MEDCouplingCartesianAMRMeshGen::extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const +{ + std::vector st(_mesh->getCellGridStructure()); + std::vector< std::pair > p(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(st)); + std::transform(st.begin(),st.end(),st.begin(),std::bind2nd(std::plus(),2*ghostSz)); + ApplyGhostOnCompactFrmt(p,ghostSz); + MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,arr,p)); + return ret.retn(); +} + MEDCouplingCartesianAMRMeshGen::MEDCouplingCartesianAMRMeshGen(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop, const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop):_father(0) { @@ -1101,7 +1164,7 @@ void MEDCouplingCartesianAMRMeshGen::ApplyGhostOnCompactFrmt(std::vector< std::p } /*! - * This method is different than ApplyGhostOnCompactFrmt + * This method is different than ApplyGhostOnCompactFrmt. The \a partBeforeFact parameter is enlarger contrary to ApplyGhostOnCompactFrmt. * * \param [in,out] partBeforeFact - the part of a image mesh in compact format that will be put in ghost reference. * \param [in] ghostSize - the ghost size of zone for all axis. @@ -1118,6 +1181,38 @@ void MEDCouplingCartesianAMRMeshGen::ApplyAllGhostOnCompactFrmt(std::vector< std } } +/*! + * This method returns a sub set of \a all. The subset is defined by the \a head in the tree defined by \a this. + * Elements in \a all are expected to be sorted from god father to most refined structure. + */ +std::vector MEDCouplingCartesianAMRMeshGen::extractSubTreeFromGlobalFlatten(const MEDCouplingCartesianAMRMeshGen *head, const std::vector& all) const +{ + int maxLev(getMaxNumberOfLevelsRelativeToThis()); + std::vector ret; + std::vector meshes(1,this); + std::size_t kk(0); + for(int i=0;i meshesTmp; + for(std::vector::const_iterator it=meshes.begin();it!=meshes.end();it++) + { + if((*it)==head || head->isObjectInTheProgeny(*it)) + ret.push_back(all[kk]); + kk++; + std::vector< const MEDCouplingCartesianAMRPatch *> ps((*it)->getPatches()); + for(std::vector< const MEDCouplingCartesianAMRPatch *>::const_iterator it0=ps.begin();it0!=ps.end();it0++) + { + const MEDCouplingCartesianAMRMeshGen *mesh((*it0)->getMesh()); + meshesTmp.push_back(mesh); + } + } + meshes=meshesTmp; + } + if(kk!=all.size()) + throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::extractSubTreeFromGlobalFlatten : the size of input vector is not compatible with number of leaves in this !"); + return ret; +} + std::size_t MEDCouplingCartesianAMRMeshGen::getHeapMemorySizeWithoutChildren() const { return sizeof(MEDCouplingCartesianAMRMeshGen); diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx index 6fbb657ba..7905f6880 100644 --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx @@ -37,6 +37,7 @@ namespace ParaMEDMEM class DataArrayByte; class DataArrayDouble; class MEDCoupling1SGTUMesh; + class MEDCouplingFieldDouble; class MEDCouplingCartesianAMRMesh; class MEDCouplingCartesianAMRMeshGen; @@ -145,6 +146,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void removePatch(int patchId); MEDCOUPLING_EXPORT int getNumberOfPatches() const; MEDCOUPLING_EXPORT int getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const; + MEDCOUPLING_EXPORT std::vector< const MEDCouplingCartesianAMRPatch *> getPatches() const; MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRPatch *getPatch(int patchId) const; MEDCOUPLING_EXPORT bool isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const; MEDCOUPLING_EXPORT DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const; @@ -165,6 +167,8 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const; MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const; MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostSz, const std::vector& recurseArrs) const; + MEDCOUPLING_EXPORT DataArrayDouble *extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const; protected: MEDCouplingCartesianAMRMeshGen(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop, const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop); @@ -175,6 +179,7 @@ namespace ParaMEDMEM static void ApplyFactorsOnCompactFrmt(std::vector< std::pair >& partBeforeFact, const std::vector& factors); static void ApplyGhostOnCompactFrmt(std::vector< std::pair >& partBeforeFact, int ghostSize); static void ApplyAllGhostOnCompactFrmt(std::vector< std::pair >& partBeforeFact, int ghostSize); + std::vector extractSubTreeFromGlobalFlatten(const MEDCouplingCartesianAMRMeshGen *head, const std::vector& all) const; protected: MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildren() const; diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 3fa76fadb..3a9582be5 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -340,6 +340,7 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::getMesh; %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::__getitem__; %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildUnstructured; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::extractGhostFrom; %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop; %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly; %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getImageMesh; @@ -353,7 +354,9 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getDataConst; %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getData; %newobject ParaMEDMEM::MEDCouplingAMRAttribute::New; -%newobject ParaMEDMEM::MEDCouplingAMRAttribute::retrieveFieldOn; +%newobject ParaMEDMEM::MEDCouplingAMRAttribute::getFieldOn; +%newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost; +%newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost; %newobject ParaMEDMEM::DenseMatrix::New; %newobject ParaMEDMEM::DenseMatrix::deepCpy; %newobject ParaMEDMEM::DenseMatrix::shallowCpy; @@ -4881,6 +4884,7 @@ namespace ParaMEDMEM int getNumberOfPatches() const throw(INTERP_KERNEL::Exception); int getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception); + DataArrayDouble *extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const throw(INTERP_KERNEL::Exception); MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const throw(INTERP_KERNEL::Exception); MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const throw(INTERP_KERNEL::Exception); void removeAllPatches() throw(INTERP_KERNEL::Exception); @@ -4903,6 +4907,21 @@ namespace ParaMEDMEM self->addPatch(inp,factors); } + PyObject *getPatches() const throw(INTERP_KERNEL::Exception) + { + std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches()); + int sz(ps.size()); + PyObject *ret = PyList_New(sz); + for(int i=0;i(ps[i])); + if(elt) + elt->incrRef(); + PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 )); + } + return ret; + } + PyObject *retrieveGridsAt(int absoluteLev) const throw(INTERP_KERNEL::Exception) { std::vector ps(self->retrieveGridsAt(absoluteLev)); @@ -5043,7 +5062,8 @@ namespace ParaMEDMEM class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel { public: - DataArrayDouble *retrieveFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostLev, MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *buildCellFieldOnWithGhost(int ghostLev, MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception); bool changeGodFather(MEDCouplingCartesianAMRMesh *gf) throw(INTERP_KERNEL::Exception); %extend { @@ -5070,6 +5090,15 @@ namespace ParaMEDMEM return ParaMEDMEM_MEDCouplingAMRAttribute_New(gf,fieldNames); } + DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception) + { + const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName)); + DataArrayDouble *ret2(const_cast(ret)); + if(ret2) + ret2->incrRef(); + return ret2; + } + void spillInfoOnComponents(PyObject *compNames) throw(INTERP_KERNEL::Exception) { std::vector< std::vector > compNamesCpp; -- 2.39.2