From 63f8c96a7c352f2ddc7f38c11e4833803e94acdd Mon Sep 17 00:00:00 2001 From: geay Date: Wed, 28 May 2014 14:54:31 +0200 Subject: [PATCH] On the road of fields on AMR meshes --- src/MEDCoupling/CMakeLists.txt | 1 + src/MEDCoupling/MEDCouplingAMRAttribute.cxx | 142 ++++++++++++++++++ src/MEDCoupling/MEDCouplingAMRAttribute.hxx | 74 +++++++++ .../MEDCouplingCartesianAMRMesh.cxx | 77 +++++++++- .../MEDCouplingCartesianAMRMesh.hxx | 28 +++- src/MEDCoupling/MEDCouplingTimeLabel.cxx | 53 +++++++ src/MEDCoupling/MEDCouplingTimeLabel.hxx | 12 ++ src/MEDCoupling_Swig/MEDCouplingCommon.i | 12 ++ 8 files changed, 396 insertions(+), 3 deletions(-) create mode 100644 src/MEDCoupling/MEDCouplingAMRAttribute.cxx create mode 100644 src/MEDCoupling/MEDCouplingAMRAttribute.hxx diff --git a/src/MEDCoupling/CMakeLists.txt b/src/MEDCoupling/CMakeLists.txt index 5a3aef6b7..5c462b1e4 100644 --- a/src/MEDCoupling/CMakeLists.txt +++ b/src/MEDCoupling/CMakeLists.txt @@ -56,6 +56,7 @@ SET(medcoupling_SOURCES MEDCouplingDefinitionTime.cxx MEDCouplingFieldOverTime.cxx MEDCouplingCartesianAMRMesh.cxx + MEDCouplingAMRAttribute.cxx MEDCouplingMatrix.cxx ) diff --git a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx new file mode 100644 index 000000000..875281b0c --- /dev/null +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx @@ -0,0 +1,142 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay + +#include "MEDCouplingAMRAttribute.hxx" +#include "MEDCouplingMemArray.hxx" + +using namespace ParaMEDMEM; + +DataArrayDoubleCollection *DataArrayDoubleCollection::New(const std::vector< std::pair >& fieldNames) +{ + return new DataArrayDoubleCollection(fieldNames); +} + +void DataArrayDoubleCollection::allocTuples(int nbOfTuples) +{ + std::size_t sz(_arrs.size()); + for(std::size_t i=0;ireAlloc(nbOfTuples); +} + +void DataArrayDoubleCollection::dellocTuples() +{ + std::size_t sz(_arrs.size()); + for(std::size_t i=0;ireAlloc(0); +} + +DataArrayDoubleCollection::DataArrayDoubleCollection(const std::vector< std::pair >& fieldNames):_arrs(fieldNames.size()) +{ + std::size_t sz(fieldNames.size()); + std::vector names(sz); + for(std::size_t i=0;i& info(fieldNames[i]); + _arrs[i]=DataArrayDouble::New(); + _arrs[i]->alloc(0,info.second); + _arrs[i]->setName(info.first); + names[i]=info.second; + } + CheckDiscriminantNames(names); +} + +std::size_t DataArrayDoubleCollection::getHeapMemorySizeWithoutChildren() const +{ + std::size_t ret(sizeof(DataArrayDoubleCollection)); + ret+=_arrs.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); + return ret; +} + +std::vector DataArrayDoubleCollection::getDirectChildren() const +{ + std::vector ret; + for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_arrs.begin();it!=_arrs.end();it++) + { + const DataArrayDouble *pt(*it); + if(pt) + ret.push_back(pt); + } + return ret; +} + +void DataArrayDoubleCollection::CheckDiscriminantNames(const std::vector& names) +{ + std::set s(names.begin(),names.end()); + if(s.size()!=names.size()) + throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::CheckDiscriminantNames : The names of fields must be different each other ! It is not the case !"); +} + +std::size_t MEDCouplingGridCollection::getHeapMemorySizeWithoutChildren() const +{ + std::size_t ret(sizeof(MEDCouplingGridCollection)); + ret+=_map_of_dadc.capacity()*sizeof(std::pair >); + return ret; +} + +std::vector MEDCouplingGridCollection::getDirectChildren() const +{ + std::vector ret; + for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) + { + const DataArrayDoubleCollection *col((*it).second); + if(col) + ret.push_back(col); + } + return ret; +} + +MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames) +{ + return new MEDCouplingAMRAttribute(gf,fieldNames); +} + +void MEDCouplingAMRAttribute::alloc() +{ + _tlc.resetState(); +} + +void MEDCouplingAMRAttribute::dealloc() +{//tony +} + +bool MEDCouplingAMRAttribute::changeGodFather(MEDCouplingCartesianAMRMesh *gf) +{ + bool ret(MEDCouplingDataForGodFather::changeGodFather(gf)); + return ret; +} + +std::size_t MEDCouplingAMRAttribute::getHeapMemorySizeWithoutChildren() const +{ + std::size_t ret(sizeof(MEDCouplingAMRAttribute)); + return ret; +} + +std::vector MEDCouplingAMRAttribute::getDirectChildren() const +{//tony + return std::vector(); +} + +void MEDCouplingAMRAttribute::updateTime() const +{//tony +} + +MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames):MEDCouplingDataForGodFather(gf) +{ +} diff --git a/src/MEDCoupling/MEDCouplingAMRAttribute.hxx b/src/MEDCoupling/MEDCouplingAMRAttribute.hxx new file mode 100644 index 000000000..2120a5bac --- /dev/null +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.hxx @@ -0,0 +1,74 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay + +#ifndef __MEDCOUPLINGAMRATTRIBUTE_HXX__ +#define __MEDCOUPLINGAMRATTRIBUTE_HXX__ + +#include "MEDCoupling.hxx" +#include "MEDCouplingCartesianAMRMesh.hxx" + +namespace ParaMEDMEM +{ + /// @cond INTERNAL + class DataArrayDoubleCollection : public RefCountObject + { + public: + static DataArrayDoubleCollection *New(const std::vector< std::pair >& fieldNames); + void allocTuples(int nbOfTuples); + void dellocTuples(); + private: + DataArrayDoubleCollection(const std::vector< std::pair >& fieldNames); + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildren() const; + static void CheckDiscriminantNames(const std::vector& names); + private: + std::vector< MEDCouplingAutoRefCountObjectPtr > _arrs; + }; + + class MEDCouplingGridCollection : public RefCountObject + { + private: + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildren() const; + private: + std::vector< std::pair > > _map_of_dadc; + }; + /// @endcond + + class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel + { + public: + MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames); + // + MEDCOUPLING_EXPORT void alloc(); + MEDCOUPLING_EXPORT void dealloc(); + MEDCOUPLING_EXPORT bool changeGodFather(MEDCouplingCartesianAMRMesh *gf); + // + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT void updateTime() const; + private: + MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames); + private: + std::vector< MEDCouplingAutoRefCountObjectPtr > _levs; + }; +} + +#endif diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx index 8aa50804e..c4d9a38af 100644 --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx @@ -156,6 +156,28 @@ std::size_t MEDCouplingCartesianAMRPatchGF::getHeapMemorySizeWithoutChildren() c return sizeof(MEDCouplingCartesianAMRPatchGF); } +MEDCouplingDataForGodFather::MEDCouplingDataForGodFather(MEDCouplingCartesianAMRMesh *gf):_gf(gf),_tlc(gf) +{ + if(!_gf) + throw INTERP_KERNEL::Exception("MEDCouplingDataForGodFather constructor : A data has to be attached to a AMR Mesh instance !"); + _gf->setData(this); +} + +void MEDCouplingDataForGodFather::checkGodFatherFrozen() const +{ + _tlc.checkConst(); +} + +bool MEDCouplingDataForGodFather::changeGodFather(MEDCouplingCartesianAMRMesh *gf) +{ + bool ret(_tlc.keepTrackOfNewTL(gf)); + if(ret) + { + _gf=gf; + } + return ret; +} + /// @endcond int MEDCouplingCartesianAMRMeshGen::getSpaceDimension() const @@ -177,6 +199,7 @@ void MEDCouplingCartesianAMRMeshGen::setFactors(const std::vector& newFacto if(!_patches.empty()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::setFactors : modification of factors is not allowed when presence of patches !"); _factors=newFactors; + declareAsNew(); } int MEDCouplingCartesianAMRMeshGen::getMaxNumberOfLevelsRelativeToThis() const @@ -262,6 +285,7 @@ std::vector MEDCouplingCartesianAMRMeshGen::r void MEDCouplingCartesianAMRMeshGen::detachFromFather() { _father=0; + declareAsNew(); } /*! @@ -277,6 +301,7 @@ void MEDCouplingCartesianAMRMeshGen::addPatch(const std::vector< std::pair zeMesh(new MEDCouplingCartesianAMRMeshSub(this,mesh)); MEDCouplingAutoRefCountObjectPtr elt(new MEDCouplingCartesianAMRPatch(zeMesh,bottomLeftTopRight)); _patches.push_back(elt); + declareAsNew(); } /// @cond INTERNAL @@ -591,6 +616,7 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER } for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=listOfPatchesOK.begin();it!=listOfPatchesOK.end();it++) addPatch((*it)->getConstPart(),factors); + declareAsNew(); } /*! @@ -602,6 +628,7 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createPatchesFromCriterion : the criterion DataArrayByte instance must be allocated and not NULL !"); std::vector crit(criterion->toVectorOfBool());//check that criterion has one component. createPatchesFromCriterion(bso,crit,factors); + declareAsNew(); } void MEDCouplingCartesianAMRMeshGen::removeAllPatches() @@ -728,10 +755,12 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhost(int patchId, cons * \param [in,out] cellFieldOnPatch - The array of the cell field on the requested patch to be filled. * \param [in] ghostLev - The size of the ghost zone (must be >=0 !) * \param [in] arrsOnPatches - \b WARNING arrsOnPatches[patchId] is \b NOT \b const. All others are const. + * + * \sa fillCellFieldOnPatchOnlyGhostAdv */ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, const std::vector& arrsOnPatches) const { - int nbp(getNumberOfPatches()),dim(getSpaceDimension()); + int nbp(getNumberOfPatches()); if(nbp!=(int)arrsOnPatches.size()) { std::ostringstream oss; oss << "MEDCouplingCartesianAMRMesh::fillCellFieldOnPatchGhostAdv : there are " << nbp << " patches in this and " << arrsOnPatches.size() << " arrays in the last parameter !"; @@ -740,7 +769,18 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhostAdv(int patchId, c DataArrayDouble *theFieldToFill(const_cast(arrsOnPatches[patchId])); // first, do as usual fillCellFieldOnPatchGhost(patchId,cellFieldOnThis,theFieldToFill,ghostLev); - // all reference patch stuff + fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches); +} + +void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, const std::vector& arrsOnPatches) const +{ + int nbp(getNumberOfPatches()),dim(getSpaceDimension()); + if(nbp!=(int)arrsOnPatches.size()) + { + std::ostringstream oss; oss << "MEDCouplingCartesianAMRMesh::fillCellFieldOnPatchOnlyGhostAdv : there are " << nbp << " patches in this and " << arrsOnPatches.size() << " arrays in the last parameter !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + DataArrayDouble *theFieldToFill(const_cast(arrsOnPatches[patchId])); const MEDCouplingCartesianAMRPatch *refP(getPatch(patchId)); const std::vector< std::pair >& refBLTR(refP->getBLTRRange());//[(1,4),(2,4)] std::vector dimsCoarse(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(refBLTR));//[3,2] @@ -1062,7 +1102,26 @@ MEDCouplingCartesianAMRMesh *MEDCouplingCartesianAMRMesh::New(const std::string& void MEDCouplingCartesianAMRMesh::setData(MEDCouplingDataForGodFather *data) { + MEDCouplingDataForGodFather *myData(_data); + if(myData==data) + return ; + if(myData) + myData->changeGodFather(0); _data=data; + if(data) + data->incrRef(); +} + +void MEDCouplingCartesianAMRMesh::allocData() const +{ + checkData(); + _data->alloc(); +} + +void MEDCouplingCartesianAMRMesh::deallocData() const +{ + checkData(); + _data->dealloc(); } MEDCouplingCartesianAMRMesh::MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop, @@ -1078,3 +1137,17 @@ std::vector MEDCouplingCartesianAMRMesh::getDirectChild ret.push_back(pt); return ret; } + +void MEDCouplingCartesianAMRMesh::checkData() const +{ + const MEDCouplingDataForGodFather *data(_data); + if(!data) + throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::checkData : no data set !"); +} + +MEDCouplingCartesianAMRMesh::~MEDCouplingCartesianAMRMesh() +{ + MEDCouplingDataForGodFather *data(_data); + if(!data) + data->changeGodFather(0); +} diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx index bd38f61d2..6d6191c30 100644 --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx @@ -42,6 +42,9 @@ namespace ParaMEDMEM /// @cond INTERNAL + /*! + * This class does not inherit from TimeLabel so only const method should exist. + */ class MEDCouplingCartesianAMRPatchGen : public RefCountObject { public: @@ -59,6 +62,9 @@ namespace ParaMEDMEM MEDCouplingAutoRefCountObjectPtr _mesh; }; + /*! + * This class does not inherit from TimeLabel so only const method should exist. + */ class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen { public: @@ -77,6 +83,9 @@ namespace ParaMEDMEM std::vector< std::pair > _bl_tr; }; + /*! + * This class does not inherit from TimeLabel so only const method should exist. + */ class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen { public: @@ -87,6 +96,18 @@ namespace ParaMEDMEM class MEDCouplingDataForGodFather : public RefCountObject { + friend class MEDCouplingCartesianAMRMesh; + public: + MEDCOUPLING_EXPORT virtual void alloc() = 0; + MEDCOUPLING_EXPORT virtual void dealloc() = 0; + protected: + MEDCouplingDataForGodFather(MEDCouplingCartesianAMRMesh *gf); + void checkGodFatherFrozen() const; + protected: + virtual bool changeGodFather(MEDCouplingCartesianAMRMesh *gf); + protected: + MEDCouplingCartesianAMRMesh *_gf; + TimeLabelConstOverseer _tlc; }; /// @endcond @@ -124,6 +145,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch) const; MEDCOUPLING_EXPORT void fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const; MEDCOUPLING_EXPORT void fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, const std::vector& arrsOnPatches) const; + MEDCOUPLING_EXPORT void fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, const std::vector& arrsOnPatches) const; MEDCOUPLING_EXPORT void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis) const; MEDCOUPLING_EXPORT void fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev) const; MEDCOUPLING_EXPORT DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const; @@ -166,12 +188,16 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT const MEDCouplingDataForGodFather *getDataConst() const { return _data; } MEDCOUPLING_EXPORT MEDCouplingDataForGodFather *getData() { return _data; } MEDCOUPLING_EXPORT void setData(MEDCouplingDataForGodFather *data); + MEDCOUPLING_EXPORT void allocData() const; + MEDCOUPLING_EXPORT void deallocData() const; private: MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop, const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop); MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + void checkData() const; + ~MEDCouplingCartesianAMRMesh(); private: - MEDCouplingAutoRefCountObjectPtr _data; + mutable MEDCouplingAutoRefCountObjectPtr _data; }; } diff --git a/src/MEDCoupling/MEDCouplingTimeLabel.cxx b/src/MEDCoupling/MEDCouplingTimeLabel.cxx index a82758531..66b495b8c 100644 --- a/src/MEDCoupling/MEDCouplingTimeLabel.cxx +++ b/src/MEDCoupling/MEDCouplingTimeLabel.cxx @@ -20,6 +20,10 @@ #include "MEDCouplingTimeLabel.hxx" +#include "InterpKernelException.hxx" + +#include + using namespace ParaMEDMEM; std::size_t TimeLabel::GLOBAL_TIME=0; @@ -57,3 +61,52 @@ void TimeLabel::forceTimeOfThis(const TimeLabel& other) const { _time=other._time; } + +TimeLabelConstOverseer::TimeLabelConstOverseer(const TimeLabel *tl):_tl(tl),_ref_time(std::numeric_limits::max()) +{ + if(!_tl) + throw INTERP_KERNEL::Exception("TimeLabelConstOverseer constructor : input instance must be not NULL !"); + _tl->updateTime(); + _ref_time=tl->getTimeOfThis(); +} + +/*! + * This method checks that the tracked instance is not NULL and if not NULL that its internal state has not changed. + */ +void TimeLabelConstOverseer::checkConst() const +{ + if(!_tl) + throw INTERP_KERNEL::Exception("TimeLabelConstOverseer::checkConst : NULL tracked instance !"); + _tl->updateTime(); + if(_ref_time!=_tl->getTimeOfThis()) + throw INTERP_KERNEL::Exception("TimeLabelConstOverseer::checkConst : the state of the controlled instance of TimeLable has changed !"); +} + +bool TimeLabelConstOverseer::resetState() +{ + if(_tl) + { + _tl->updateTime(); + _ref_time=_tl->getTimeOfThis(); + return true; + } + else + return false; +} + +bool TimeLabelConstOverseer::keepTrackOfNewTL(const TimeLabel *tl) +{ + if(_tl==tl) + return false; + _tl=tl; + if(_tl) + { + _tl->updateTime(); + _ref_time=_tl->getTimeOfThis(); + } + else + { + _ref_time=std::numeric_limits::max(); + } + return true; +} diff --git a/src/MEDCoupling/MEDCouplingTimeLabel.hxx b/src/MEDCoupling/MEDCouplingTimeLabel.hxx index cd5f13969..799ade98b 100644 --- a/src/MEDCoupling/MEDCouplingTimeLabel.hxx +++ b/src/MEDCoupling/MEDCouplingTimeLabel.hxx @@ -49,6 +49,18 @@ namespace ParaMEDMEM static std::size_t GLOBAL_TIME; mutable std::size_t _time; }; + + class TimeLabelConstOverseer + { + public: + MEDCOUPLING_EXPORT TimeLabelConstOverseer(const TimeLabel *tl); + MEDCOUPLING_EXPORT void checkConst() const; + MEDCOUPLING_EXPORT bool resetState(); + MEDCOUPLING_EXPORT bool keepTrackOfNewTL(const TimeLabel *tl); + private: + const TimeLabel *_tl; + std::size_t _ref_time; + }; } #endif diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 24a60c9c4..ff8136716 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -4837,6 +4837,9 @@ namespace ParaMEDMEM class MEDCouplingDataForGodFather : public RefCountObject { + public: + virtual void alloc() throw(INTERP_KERNEL::Exception); + virtual void dealloc() throw(INTERP_KERNEL::Exception); }; class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel @@ -4939,6 +4942,13 @@ namespace ParaMEDMEM self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2); } + void fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, PyObject *arrsOnPatches) const + { + std::vector arrsOnPatches2; + convertFromPyObjVectorOfObj(arrsOnPatches,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",arrsOnPatches2); + self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2); + } + void __delitem__(int patchId) throw(INTERP_KERNEL::Exception) { self->removePatch(patchId); @@ -4959,6 +4969,8 @@ namespace ParaMEDMEM { public: void setData(MEDCouplingDataForGodFather *data) throw(INTERP_KERNEL::Exception); + void allocData() const throw(INTERP_KERNEL::Exception); + void deallocData() const throw(INTERP_KERNEL::Exception); %extend { static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception) -- 2.39.2