return new MEDCouplingGridCollection(ms,fieldNames);
}
-MEDCouplingGridCollection *MEDCouplingGridCollection::deepCpy() const
+MEDCouplingGridCollection *MEDCouplingGridCollection::deepCpy(const MEDCouplingCartesianAMRMeshGen *newGf, const MEDCouplingCartesianAMRMeshGen *oldGf) const
{
- return new MEDCouplingGridCollection(*this);
+ return new MEDCouplingGridCollection(*this,newGf,oldGf);
}
void MEDCouplingGridCollection::alloc(int ghostLev)
}
}
-MEDCouplingGridCollection::MEDCouplingGridCollection(const MEDCouplingGridCollection& other):RefCountObject(other),_map_of_dadc(other._map_of_dadc.size())
+MEDCouplingGridCollection::MEDCouplingGridCollection(const MEDCouplingGridCollection& other, const MEDCouplingCartesianAMRMeshGen *newGf, const MEDCouplingCartesianAMRMeshGen *oldGf):RefCountObject(other),_map_of_dadc(other._map_of_dadc.size())
{
std::size_t sz(other._map_of_dadc.size());
for(std::size_t i=0;i<sz;i++)
{
- _map_of_dadc[i].first=other._map_of_dadc[i].first;
+ std::vector<int> pos(other._map_of_dadc[i].first->getPositionRelativeTo(oldGf));
+ _map_of_dadc[i].first=newGf->getMeshAtPosition(pos);
const DataArrayDoubleCollection *dac(other._map_of_dadc[i].second);
if(dac)
_map_of_dadc[i].second=dac->deepCpy();
}
}
-MEDCouplingCartesianAMRPatchGF::MEDCouplingCartesianAMRPatchGF(MEDCouplingCartesianAMRMesh *mesh):MEDCouplingCartesianAMRPatchGen(mesh)
+MEDCouplingCartesianAMRMeshGen *MEDCouplingDataForGodFather::getMyGodFather()
{
-}
-
-std::size_t MEDCouplingCartesianAMRPatchGF::getHeapMemorySizeWithoutChildren() const
-{
- return sizeof(MEDCouplingCartesianAMRPatchGF);
+ return _gf;
}
MEDCouplingDataForGodFather::MEDCouplingDataForGodFather(MEDCouplingCartesianAMRMeshGen *gf):_gf(gf),_tlc(gf)
return ret;
}
-MEDCouplingDataForGodFather::MEDCouplingDataForGodFather(const MEDCouplingDataForGodFather& other):RefCountObject(other),_gf(other._gf),_tlc(other._gf)
+MEDCouplingDataForGodFather::MEDCouplingDataForGodFather(const MEDCouplingDataForGodFather& other, bool deepCpyGF):RefCountObject(other),_gf(other._gf),_tlc(other._gf)
{
other._tlc.checkConst();
+ if(deepCpyGF)
+ {
+ const MEDCouplingCartesianAMRMeshGen *gf(other._gf);
+ if(gf)
+ _gf=gf->deepCpy();
+ _tlc.keepTrackOfNewTL(_gf);
+ }
}
/*!
MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::deepCpy() const
{
- return new MEDCouplingAMRAttribute(*this);
+ return new MEDCouplingAMRAttribute(*this,true);
+}
+
+MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::deepCpyWithoutGodFather() const
+{
+ return new MEDCouplingAMRAttribute(*this,false);
}
/*!
*/
void MEDCouplingAMRAttribute::synchronizeAllGhostZones()
{
- if(_levs.empty())
+ int sz(getNumberOfLevels());
+ if(sz==0)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineEachOther : not any levels in this !");
// 1st - synchronize from coarse to the finest all the patches (excepted the god father one)
- std::size_t sz(_levs.size());
- for(std::size_t i=1;i<sz;i++)
+ for(int i=1;i<sz;i++)
{
const MEDCouplingGridCollection *fine(_levs[i]),*coarse(_levs[i-1]);
MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone(_ghost_lev,coarse,fine);
}
// 2nd - classical direct sublevel inside common patch
- for(std::size_t i=1;i<sz;i++)
+ for(int i=1;i<sz;i++)
{
const MEDCouplingGridCollection *fine(_levs[i]);
if(!fine)
DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(_ghost_lev,(*it).first,firstDAC,(*it).second,secondDAC);
}
// 4th - same level but with far ancestor.
- for(std::size_t i=1;i<sz;i++)
+ for(int i=1;i<sz;i++)
{
const MEDCouplingGridCollection *fine(_levs[i]);
fine->synchronizeFineEachOtherExt(_ghost_lev,_cross_lev_neighbors[i]);
}
}
+/*!
+ * This method
+ */
+void MEDCouplingAMRAttribute::synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh)
+{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeAllGhostZonesOfDirectChidrenOf : input mesh is NULL !");
+ int level(mesh->getAbsoluteLevelRelativeTo(_gf)),sz(getNumberOfLevels());
+ if(level<0 || level>=sz-1)
+ throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeAllGhostZonesOfDirectChidrenOf : the specified level does not exist ! Must be in [0,nbOfLevelsOfThis-1) !");
+ const DataArrayDoubleCollection& colCoarse(findCollectionAttachedTo(mesh));
+ std::vector< const MEDCouplingCartesianAMRPatch *> directChildren(mesh->getPatches());
+ std::size_t nbOfDirChildren(directChildren.size());
+ for(std::size_t patchId=0;patchId<nbOfDirChildren;patchId++)
+ {
+ const DataArrayDoubleCollection& colFine(findCollectionAttachedTo(directChildren[patchId]->getMesh()));
+ DataArrayDoubleCollection *colFine2(const_cast<DataArrayDoubleCollection *>(&colFine));
+ DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone(_ghost_lev,mesh,(int)patchId,&colCoarse,colFine2);
+ }
+}
+
/*!
* This method allocates all DataArrayDouble instances stored recursively in \a this.
*
}
}
-MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& other):MEDCouplingDataForGodFather(other),_ghost_lev(other._ghost_lev),_levs(other._levs.size()),_neighbors(other._neighbors),_mixed_lev_neighbors(other._mixed_lev_neighbors),_cross_lev_neighbors(other._cross_lev_neighbors)
+MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& other, bool deepCpyGF):MEDCouplingDataForGodFather(other,deepCpyGF),_ghost_lev(other._ghost_lev),_levs(other._levs.size()),_neighbors(other._neighbors),_mixed_lev_neighbors(other._mixed_lev_neighbors),_cross_lev_neighbors(other._cross_lev_neighbors)
{
std::size_t sz(other._levs.size());
for(std::size_t i=0;i<sz;i++)
const MEDCouplingGridCollection *elt(other._levs[i]);
if(elt)
{
- _levs[i]=other._levs[i]->deepCpy();
+ _levs[i]=other._levs[i]->deepCpy(_gf,other._gf);
}
}
}
{
public:
static MEDCouplingGridCollection *New(const std::vector<const MEDCouplingCartesianAMRMeshGen *>& ms, const std::vector< std::pair<std::string,int> >& fieldNames);
- MEDCouplingGridCollection *deepCpy() const;
+ MEDCouplingGridCollection *deepCpy(const MEDCouplingCartesianAMRMeshGen *newGf, const MEDCouplingCartesianAMRMeshGen *oldGf) const;
void alloc(int ghostLev);
void dealloc();
void spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames);
void fillIfInTheProgenyOf(const std::string& fieldName, const MEDCouplingCartesianAMRMeshGen *head, std::vector<const DataArrayDouble *>& recurseArrs) const;
private:
MEDCouplingGridCollection(const std::vector<const MEDCouplingCartesianAMRMeshGen *>& ms, const std::vector< std::pair<std::string,int> >& fieldNames);
- MEDCouplingGridCollection(const MEDCouplingGridCollection& other);
+ MEDCouplingGridCollection(const MEDCouplingGridCollection& other, const MEDCouplingCartesianAMRMeshGen *newGf, const MEDCouplingCartesianAMRMeshGen *oldGf);
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildren() const;
void updateTime() const;
{
friend class MEDCouplingCartesianAMRMesh;
public:
+ MEDCOUPLING_EXPORT MEDCouplingCartesianAMRMeshGen *getMyGodFather();
MEDCOUPLING_EXPORT virtual void synchronizeFineToCoarse() = 0;
MEDCOUPLING_EXPORT virtual void synchronizeFineToCoarseBetween(int fromLev, int toLev) = 0;
MEDCOUPLING_EXPORT virtual void synchronizeCoarseToFine() = 0;
MEDCOUPLING_EXPORT virtual void synchronizeCoarseToFineBetween(int fromLev, int toLev) = 0;
MEDCOUPLING_EXPORT virtual void synchronizeAllGhostZones() = 0;
+ MEDCOUPLING_EXPORT virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh) = 0;
MEDCOUPLING_EXPORT virtual void alloc() = 0;
MEDCOUPLING_EXPORT virtual void dealloc() = 0;
protected:
void checkGodFatherFrozen() const;
protected:
virtual bool changeGodFather(MEDCouplingCartesianAMRMeshGen *gf);
- MEDCouplingDataForGodFather(const MEDCouplingDataForGodFather& other);
+ MEDCouplingDataForGodFather(const MEDCouplingDataForGodFather& other, bool deepCpyGF);
protected:
MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRMeshGen> _gf;
TimeLabelConstOverseer _tlc;
MEDCOUPLING_EXPORT void spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames);
MEDCOUPLING_EXPORT void spillNatures(const std::vector<NatureOfField>& nfs);
MEDCOUPLING_EXPORT MEDCouplingAMRAttribute *deepCpy() const;
+ MEDCOUPLING_EXPORT MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const;
MEDCOUPLING_EXPORT int getNumberOfLevels() const;
MEDCOUPLING_EXPORT std::vector<DataArrayDouble *> retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const;
MEDCOUPLING_EXPORT const DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
MEDCOUPLING_EXPORT void synchronizeCoarseToFine();
MEDCOUPLING_EXPORT void synchronizeCoarseToFineBetween(int fromLev, int toLev);
MEDCOUPLING_EXPORT void synchronizeAllGhostZones();
+ MEDCOUPLING_EXPORT void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
MEDCOUPLING_EXPORT void alloc();
MEDCOUPLING_EXPORT void dealloc();
MEDCOUPLING_EXPORT bool changeGodFather(MEDCouplingCartesianAMRMeshGen *gf);
MEDCOUPLING_EXPORT void updateTime() const;
private:
MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMeshGen *gf, const std::vector< std::pair<std::string,int> >& fieldNames, int ghostLev);
- MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& other);
+ MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& other, bool deepCpyGF);
const DataArrayDoubleCollection& findCollectionAttachedTo(const MEDCouplingCartesianAMRMeshGen *m) const;
void synchronizeFineToCoarseByOneLevel(int level);
void synchronizeCoarseToFineByOneLevel(int level);
_mesh=mesh; _mesh->incrRef();
}
+MEDCouplingCartesianAMRPatchGen::MEDCouplingCartesianAMRPatchGen(const MEDCouplingCartesianAMRPatchGen& other):RefCountObject(other),_mesh(other._mesh)
+{
+ const MEDCouplingCartesianAMRMeshGen *mesh(other._mesh);
+ if(mesh)
+ _mesh=mesh->deepCpy();
+}
+
const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRPatchGen::getMeshSafe() const
{
const MEDCouplingCartesianAMRMeshGen *mesh(_mesh);
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch constructor : space dimension of father and input bottomLeft/topRight size mismatches !");
}
+MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRPatch::deepCpy() const
+{
+ return new MEDCouplingCartesianAMRPatch(*this);
+}
+
void MEDCouplingCartesianAMRPatch::addPatch(const std::vector< std::pair<int,int> >& bottomLeftTopRight, const std::vector<int>& factors)
{
return getMeshSafe()->addPatch(bottomLeftTopRight,factors);
MEDCouplingIMesh::CondenseFineToCoarse(dimsCoarse,ghostVals,interstRange,fakeFactors,dataOnP1);
}
+MEDCouplingCartesianAMRPatch::MEDCouplingCartesianAMRPatch(const MEDCouplingCartesianAMRPatch& other):MEDCouplingCartesianAMRPatchGen(other),_bl_tr(other._bl_tr)
+{
+}
+
/*!
* \param [in,out] partBeforeFact - the part of a image mesh in compact format that will be put in refined reference.
* \param [in] factors - the factors per axis.
}
}
+MEDCouplingCartesianAMRPatchGF::MEDCouplingCartesianAMRPatchGF(MEDCouplingCartesianAMRMesh *mesh):MEDCouplingCartesianAMRPatchGen(mesh)
+{
+}
+
+MEDCouplingCartesianAMRPatchGF *MEDCouplingCartesianAMRPatchGF::deepCpy() const
+{
+ return new MEDCouplingCartesianAMRPatchGF(*this);
+}
+
+std::size_t MEDCouplingCartesianAMRPatchGF::getHeapMemorySizeWithoutChildren() const
+{
+ return sizeof(MEDCouplingCartesianAMRPatchGF);
+}
+
+MEDCouplingCartesianAMRPatchGF::MEDCouplingCartesianAMRPatchGF(const MEDCouplingCartesianAMRPatchGF& other):MEDCouplingCartesianAMRPatchGen(other)
+{
+}
+
/// @endcond
int MEDCouplingCartesianAMRMeshGen::getSpaceDimension() const
}
/*!
- * This method returns the level of \a this. 0 for god father. -1 for children of god father ...
+ * This method returns the level of \a this. 0 for god father. 1 for children of god father ...
*/
int MEDCouplingCartesianAMRMeshGen::getAbsoluteLevel() const
{
if(_father==0)
return 0;
else
- return _father->getAbsoluteLevel()-1;
+ return _father->getAbsoluteLevel()+1;
+}
+
+int MEDCouplingCartesianAMRMeshGen::getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const
+{
+ if(this==ref)
+ return 0;
+ if(_father==0)
+ {
+ if(ref==0)
+ return 0;
+ else
+ throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getAbsoluteLevelRelativeTo : ref is not in the progeny of this !");
+ }
+ else
+ return _father->getAbsoluteLevelRelativeTo(ref)+1;
+}
+
+/*!
+ * This method returns a vector of size equal to getAbsoluteLevelRelativeTo. It allows to find position an absolute position of \a this
+ * relative to \a ref (that is typically the god father).
+ *
+ * \sa getPatchAtPosition
+ */
+std::vector<int> MEDCouplingCartesianAMRMeshGen::getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const
+{
+ if(!ref)
+ throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPositionRelativeTo : input pointer is NULL !");
+ std::vector<int> ret;
+ getPositionRelativeToInternal(ref,ret);
+ std::reverse(ret.begin(),ret.end());
+ return ret;
+}
+
+/*!
+ * \sa getPositionRelativeTo, getMeshAtPosition
+ */
+const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatchAtPosition(const std::vector<int>& pos) const
+{
+ std::size_t sz(pos.size());
+ if(sz==0)
+ throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : empty input -> no patch by definition !");
+ int patchId(pos[0]);
+ const MEDCouplingCartesianAMRPatch *elt(getPatch(patchId));
+ if(sz==1)
+ return elt;
+ if(!elt || !elt->getMesh())
+ throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : NULL element found during walk !");
+ std::vector<int> pos2(pos.begin()+1,pos.end());
+ return elt->getMesh()->getPatchAtPosition(pos2);
+}
+
+const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshGen::getMeshAtPosition(const std::vector<int>& pos) const
+{
+ std::size_t sz(pos.size());
+ if(sz==0)
+ return this;
+ int patchId(pos[0]);
+ const MEDCouplingCartesianAMRPatch *elt(getPatch(patchId));
+ if(sz==1)
+ {
+ if(!elt)
+ throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getMeshAtPosition : NULL patch !");
+ return elt->getMesh();
+ }
+ if(!elt || !elt->getMesh())
+ throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : NULL element found during walk !");
+ std::vector<int> pos2(pos.begin()+1,pos.end());
+ return elt->getMesh()->getMeshAtPosition(pos2);
}
/*!
/*!
* This method creates a multi level patches split at once.
* This method calls as times as size of \a bso createPatchesFromCriterion. Size of \a bso and size of \a factors must be the same !
+ * \b WARNING, after the call the number of levels in \a this is equal to bso.size() + 1 !
*
* \param [in] bso
* \param [in] criterion
return oss.str();
}
+MEDCouplingCartesianAMRMeshGen::MEDCouplingCartesianAMRMeshGen(const MEDCouplingCartesianAMRMeshGen& other, MEDCouplingCartesianAMRMeshGen *father):_father(father),_mesh(other._mesh),_patches(other._patches),_factors(other._factors)
+{
+ const MEDCouplingIMesh *mesh(other._mesh);
+ if(mesh)
+ _mesh=static_cast<MEDCouplingIMesh *>(mesh->deepCpy());
+ std::size_t sz(other._patches.size());
+ for(std::size_t i=0;i<sz;i++)
+ {
+ const MEDCouplingCartesianAMRPatch *patch(other._patches[i]);
+ if(patch)
+ _patches[i]=patch->deepCpy();
+ }
+}
+
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)
{
}
}
+/*!
+ * \sa getPositionRelativeTo
+ */
+void MEDCouplingCartesianAMRMeshGen::getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<int>& ret) const
+{
+ if(this==ref)
+ return ;
+ if(!_father)
+ throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPositionRelativeToInternal : ref is not in the progeny of this !");
+ int myId(_father->getPatchIdFromChildMesh(this));
+ ret.push_back(myId);
+ _father->getPositionRelativeToInternal(ref,ret);
+}
+
std::size_t MEDCouplingCartesianAMRMeshGen::getHeapMemorySizeWithoutChildren() const
{
return sizeof(MEDCouplingCartesianAMRMeshGen);
{
}
+MEDCouplingCartesianAMRMeshSub::MEDCouplingCartesianAMRMeshSub(const MEDCouplingCartesianAMRMeshSub& other, MEDCouplingCartesianAMRMeshGen *father):MEDCouplingCartesianAMRMeshGen(other,father)
+{
+}
+
+MEDCouplingCartesianAMRMeshSub *MEDCouplingCartesianAMRMeshSub::deepCpy() const
+{
+ return new MEDCouplingCartesianAMRMeshSub(*this,_father);
+}
+
MEDCouplingCartesianAMRMesh *MEDCouplingCartesianAMRMesh::New(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop,
const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop)
{
return new MEDCouplingCartesianAMRMesh(meshName,spaceDim,nodeStrctStart,nodeStrctStop,originStart,originStop,dxyzStart,dxyzStop);
}
+MEDCouplingCartesianAMRMesh *MEDCouplingCartesianAMRMesh::deepCpy() const
+{
+ return new MEDCouplingCartesianAMRMesh(*this);
+}
+
+MEDCouplingCartesianAMRMesh::MEDCouplingCartesianAMRMesh(const MEDCouplingCartesianAMRMesh& other):MEDCouplingCartesianAMRMeshGen(other,0)
+{
+}
+
MEDCouplingCartesianAMRMesh::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):MEDCouplingCartesianAMRMeshGen(meshName,spaceDim,nodeStrctStart,nodeStrctStop,originStart,originStop,dxyzStart,dxyzStop)
{
class MEDCouplingCartesianAMRPatchGen : public RefCountObject
{
public:
+ MEDCOUPLING_EXPORT virtual MEDCouplingCartesianAMRPatchGen *deepCpy() const = 0;
MEDCOUPLING_EXPORT int getNumberOfCellsRecursiveWithOverlap() const;
MEDCOUPLING_EXPORT int getNumberOfCellsRecursiveWithoutOverlap() const;
MEDCOUPLING_EXPORT int getMaxNumberOfLevelsRelativeToThis() const;
MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getMesh() const { return _mesh; }
protected:
+ MEDCouplingCartesianAMRPatchGen(const MEDCouplingCartesianAMRPatchGen& other);
MEDCouplingCartesianAMRPatchGen(MEDCouplingCartesianAMRMeshGen *mesh);
const MEDCouplingCartesianAMRMeshGen *getMeshSafe() const;
MEDCouplingCartesianAMRMeshGen *getMeshSafe();
{
public:
MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair<int,int> >& bottomLeftTopRight);
+ MEDCouplingCartesianAMRPatch *deepCpy() const;
// direct forward to _mesh
MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair<int,int> >& bottomLeftTopRight, const std::vector<int>& factors);
// end of direct forward to _mesh
public:
static void ApplyFactorsOnCompactFrmt(std::vector< std::pair<int,int> >& partBeforeFact, const std::vector<int>& factors);
static void ApplyAllGhostOnCompactFrmt(std::vector< std::pair<int,int> >& partBeforeFact, int ghostSize);
+ private:
+ MEDCouplingCartesianAMRPatch(const MEDCouplingCartesianAMRPatch& other);
private:
//! bottom left/top right cell range relative to \a _father
std::vector< std::pair<int,int> > _bl_tr;
{
public:
MEDCouplingCartesianAMRPatchGF(MEDCouplingCartesianAMRMesh *mesh);
+ MEDCouplingCartesianAMRPatchGF *deepCpy() const;
private:
std::size_t getHeapMemorySizeWithoutChildren() const;
+ private:
+ MEDCouplingCartesianAMRPatchGF(const MEDCouplingCartesianAMRPatchGF& other);
};
/// @endcond
class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
{
public:
+ MEDCOUPLING_EXPORT virtual MEDCouplingCartesianAMRMeshGen *deepCpy() const = 0;
MEDCOUPLING_EXPORT int getSpaceDimension() const;
MEDCOUPLING_EXPORT const std::vector<int>& getFactors() const { return _factors; }
MEDCOUPLING_EXPORT void setFactors(const std::vector<int>& newFactors);
MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getFather() const;
MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getGodFather() const;
MEDCOUPLING_EXPORT int getAbsoluteLevel() const;
+ MEDCOUPLING_EXPORT int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
+ MEDCOUPLING_EXPORT std::vector<int> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
+ MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<int>& pos) const;
+ MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<int>& pos) const;
MEDCOUPLING_EXPORT std::vector<MEDCouplingCartesianAMRPatchGen *> retrieveGridsAt(int absoluteLev) const;
MEDCOUPLING_EXPORT void detachFromFather();
MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair<int,int> >& bottomLeftTopRight, const std::vector<int>& factors);
MEDCOUPLING_EXPORT std::vector<int> getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const;
MEDCOUPLING_EXPORT std::string buildPythonDumpOfThis() const;
protected:
+ MEDCouplingCartesianAMRMeshGen(const MEDCouplingCartesianAMRMeshGen& other, MEDCouplingCartesianAMRMeshGen *father);
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);
MEDCouplingCartesianAMRMeshGen(MEDCouplingCartesianAMRMeshGen *father, MEDCouplingIMesh *mesh);
static int GetGhostLevelInFineRef(int ghostLev, const std::vector<int>& factors);
std::vector<const DataArrayDouble *> extractSubTreeFromGlobalFlatten(const MEDCouplingCartesianAMRMeshGen *head, const std::vector<const DataArrayDouble *>& all) const;
void dumpPatchesOf(const std::string& varName, std::ostream& oss) const;
+ void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<int>& ret) const;
protected:
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
MEDCOUPLING_EXPORT void updateTime() const;
- private:
+ protected:
MEDCouplingCartesianAMRMeshGen *_father;
+ private:
MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> _mesh;
std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> > _patches;
std::vector<int> _factors;
{
public:
MEDCouplingCartesianAMRMeshSub(MEDCouplingCartesianAMRMeshGen *father, MEDCouplingIMesh *mesh);
+ private:
+ MEDCouplingCartesianAMRMeshSub(const MEDCouplingCartesianAMRMeshSub& other, MEDCouplingCartesianAMRMeshGen *father);
+ MEDCouplingCartesianAMRMeshSub *deepCpy() const;
};
class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
MEDCOUPLING_EXPORT static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop,
const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop);
private:
+ MEDCouplingCartesianAMRMesh *deepCpy() const;
+ MEDCouplingCartesianAMRMesh(const MEDCouplingCartesianAMRMesh& other);
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<const BigMemoryObject *> getDirectChildren() const;
{
int nxwg(coarseSt[0]+2*ghostSize);
int kk(fineLocInCoarse[0].first+ghostSize+nxwg*(fineLocInCoarse[1].first+ghostSize)),fact1(facts[1]),fact0(facts[0]);
- inPtr+=(dims[0]*fact0+2*ghostSize)*nbCompo;
+ inPtr+=(dims[0]*fact0+2*ghostSize)*ghostSize*nbCompo;
for(int j=0;j<dims[1];j++)
{
for(int jfact=0;jfact<fact1;jfact++)
%newobject ParaMEDMEM::MEDCouplingMultiFields::New;
%newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
%newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
+%newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::deepCpy;
%newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::getMesh;
%newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::__getitem__;
+%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::deepCpy;
%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildUnstructured;
%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::extractGhostFrom;
%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop;
%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getPatch;
%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch;
%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf;
+%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getPatchAtPosition;
+%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getMeshAtPosition;
%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::__getitem__;
%newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::New;
+%newobject ParaMEDMEM::MEDCouplingDataForGodFather::getMyGodFather;
%newobject ParaMEDMEM::MEDCouplingAMRAttribute::New;
%newobject ParaMEDMEM::MEDCouplingAMRAttribute::deepCpy;
+%newobject ParaMEDMEM::MEDCouplingAMRAttribute::deepCpyWithoutGodFather;
%newobject ParaMEDMEM::MEDCouplingAMRAttribute::getFieldOn;
%newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost;
%newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost;
class MEDCouplingCartesianAMRPatchGen : public RefCountObject
{
public:
+ virtual MEDCouplingCartesianAMRPatchGen *deepCpy() const throw(INTERP_KERNEL::Exception);
int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
{
};
-
- class MEDCouplingDataForGodFather : public RefCountObject
- {
- public:
- virtual void synchronizeFineToCoarse() throw(INTERP_KERNEL::Exception);
- virtual void synchronizeFineToCoarseBetween(int fromLev, int toLev) throw(INTERP_KERNEL::Exception);
- virtual void synchronizeCoarseToFine() throw(INTERP_KERNEL::Exception);
- virtual void synchronizeCoarseToFineBetween(int fromLev, int toLev) throw(INTERP_KERNEL::Exception);
- virtual void synchronizeAllGhostZones() throw(INTERP_KERNEL::Exception);
- virtual void alloc() throw(INTERP_KERNEL::Exception);
- virtual void dealloc() throw(INTERP_KERNEL::Exception);
- };
class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
{
public:
+ virtual MEDCouplingCartesianAMRMeshGen *deepCpy() const throw(INTERP_KERNEL::Exception);
int getAbsoluteLevel() const throw(INTERP_KERNEL::Exception);
+ int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const throw(INTERP_KERNEL::Exception);
+ std::vector<int> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const throw(INTERP_KERNEL::Exception);
int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
const std::vector<int>& getFactors() const throw(INTERP_KERNEL::Exception);
void setFactors(const std::vector<int>& newFactors) throw(INTERP_KERNEL::Exception);
return ret;
}
+ MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<int>& pos) const throw(INTERP_KERNEL::Exception)
+ {
+ const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
+ MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
+ if(ret2)
+ ret2->incrRef();
+ return ret2;
+ }
+
+ MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<int>& pos) const throw(INTERP_KERNEL::Exception)
+ {
+ const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
+ MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
+ if(ret2)
+ ret2->incrRef();
+ return ret2;
+ }
+
void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps) throw(INTERP_KERNEL::Exception)
{
std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
}
}
};
+
+ class MEDCouplingDataForGodFather : public RefCountObject
+ {
+ public:
+ virtual void synchronizeFineToCoarse() throw(INTERP_KERNEL::Exception);
+ virtual void synchronizeFineToCoarseBetween(int fromLev, int toLev) throw(INTERP_KERNEL::Exception);
+ virtual void synchronizeCoarseToFine() throw(INTERP_KERNEL::Exception);
+ virtual void synchronizeCoarseToFineBetween(int fromLev, int toLev) throw(INTERP_KERNEL::Exception);
+ virtual void synchronizeAllGhostZones() throw(INTERP_KERNEL::Exception);
+ virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh) throw(INTERP_KERNEL::Exception);
+ virtual void alloc() throw(INTERP_KERNEL::Exception);
+ virtual void dealloc() throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDCouplingCartesianAMRMeshGen *getMyGodFather() throw(INTERP_KERNEL::Exception)
+ {
+ MEDCouplingCartesianAMRMeshGen *ret(self->getMyGodFather());
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ }
+ };
class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
{
public:
int getNumberOfLevels() const throw(INTERP_KERNEL::Exception);
MEDCouplingAMRAttribute *deepCpy() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);