From 6ed35d1f6c6fa89e216b99a9f7e5b67c6d086ead Mon Sep 17 00:00:00 2001 From: geay Date: Wed, 28 May 2014 10:21:22 +0200 Subject: [PATCH] Ready to integrate management of fields on AMR mesh. --- .../MEDCouplingCartesianAMRMesh.cxx | 35 ++++ .../MEDCouplingCartesianAMRMesh.hxx | 10 +- src/MEDCoupling_Swig/MEDCouplingBasicsTest.py | 9 + src/MEDCoupling_Swig/MEDCouplingCommon.i | 184 ++++++++++++------ src/MEDCoupling_Swig/MEDCouplingTypemaps.i | 36 ++++ 5 files changed, 217 insertions(+), 57 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx index 096042063..8aa50804e 100644 --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx @@ -53,6 +53,22 @@ MEDCouplingCartesianAMRPatchGen::MEDCouplingCartesianAMRPatchGen(MEDCouplingCart _mesh=mesh; _mesh->incrRef(); } +const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRPatchGen::getMeshSafe() const +{ + const MEDCouplingCartesianAMRMeshGen *mesh(_mesh); + if(!mesh) + throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatchGen::getMeshSafe const : the mesh is NULL !"); + return mesh; +} + +MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRPatchGen::getMeshSafe() +{ + MEDCouplingCartesianAMRMeshGen *mesh(_mesh); + if(!mesh) + throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatchGen::getMeshSafe : the mesh is NULL !"); + return mesh; +} + std::vector MEDCouplingCartesianAMRPatchGen::getDirectChildren() const { std::vector ret; @@ -73,6 +89,11 @@ MEDCouplingCartesianAMRPatch::MEDCouplingCartesianAMRPatch(MEDCouplingCartesianA throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch constructor : space dimension of father and input bottomLeft/topRight size mismatches !"); } +void MEDCouplingCartesianAMRPatch::addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors) +{ + return getMeshSafe()->addPatch(bottomLeftTopRight,factors); +} + int MEDCouplingCartesianAMRPatch::getNumberOfOverlapedCellsForFather() const { return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(_bl_tr); @@ -1039,7 +1060,21 @@ MEDCouplingCartesianAMRMesh *MEDCouplingCartesianAMRMesh::New(const std::string& return new MEDCouplingCartesianAMRMesh(meshName,spaceDim,nodeStrctStart,nodeStrctStop,originStart,originStop,dxyzStart,dxyzStop); } +void MEDCouplingCartesianAMRMesh::setData(MEDCouplingDataForGodFather *data) +{ + _data=data; +} + 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) { } + +std::vector MEDCouplingCartesianAMRMesh::getDirectChildren() const +{ + std::vector ret(MEDCouplingCartesianAMRMeshGen::getDirectChildren()); + const MEDCouplingDataForGodFather *pt(_data); + if(pt) + ret.push_back(pt); + return ret; +} diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx index cf467e235..bd38f61d2 100644 --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx @@ -51,6 +51,8 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getMesh() const { return _mesh; } protected: MEDCouplingCartesianAMRPatchGen(MEDCouplingCartesianAMRMeshGen *mesh); + const MEDCouplingCartesianAMRMeshGen *getMeshSafe() const; + MEDCouplingCartesianAMRMeshGen *getMeshSafe(); private: std::vector getDirectChildren() const; protected: @@ -83,7 +85,7 @@ namespace ParaMEDMEM std::size_t getHeapMemorySizeWithoutChildren() const; }; - class MEDCouplingGodFatherData : public RefCountObject + class MEDCouplingDataForGodFather : public RefCountObject { }; /// @endcond @@ -161,9 +163,15 @@ namespace ParaMEDMEM public: 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); + MEDCOUPLING_EXPORT const MEDCouplingDataForGodFather *getDataConst() const { return _data; } + MEDCOUPLING_EXPORT MEDCouplingDataForGodFather *getData() { return _data; } + MEDCOUPLING_EXPORT void setData(MEDCouplingDataForGodFather *data); 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; + private: + MEDCouplingAutoRefCountObjectPtr _data; }; } diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 3fa6114d6..f36dd9f42 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -15189,6 +15189,15 @@ class MEDCouplingBasicsTest(unittest.TestCase): f4=MEDCouplingFieldDouble(ON_CELLS) ; f4.setMesh(amr[4].getMesh().getImageMesh().buildWithGhost(1)) ; f4.setArray(da4) ; f4.setName("p4") ; f4.checkCoherency() # self.assertTrue(da0.isEqual(DataArrayDouble([28.8,16.9,16.9,16.9,16.9,17.9,17.9,17.9,17.9,18.9,18.9,18.9,18.9,25.7,34.8,23.9,23.9,23.9,23.9,24.9,24.9,24.9,24.9,25.9,25.9,25.9,25.9,31.7,40.8,23.9,23.9,23.9,23.9,24.9,24.9,24.9,24.9,25.9,25.9,25.9,25.9,37.7,46.8,23.9,23.9,23.9,23.9,24.9,24.9,24.9,24.9,25.9,25.9,25.9,25.9,43.7,52.8,23.9,23.9,23.9,23.9,24.9,24.9,24.9,24.9,25.9,25.9,25.9,25.9,49.7,58.8,30.9,30.9,30.9,30.9,31.9,31.9,31.9,31.9,32.9,32.9,32.9,32.9,7.6,64.8,30.9,30.9,30.9,30.9,31.9,31.9,31.9,31.9,32.9,32.9,32.9,32.9,13.6,70.8,30.9,30.9,30.9,30.9,31.9,31.9,31.9,31.9,32.9,32.9,32.9,32.9,19.6,76.8,30.9,30.9,30.9,30.9,31.9,31.9,31.9,31.9,32.9,32.9,32.9,32.9,25.6,36.9,37.9,37.9,37.9,37.9,38.9,38.9,38.9,38.9,39.9,39.9,39.9,39.9,40.9]),1e-12)) + # + g0=amr.retrieveGridsAt(0) + self.assertEqual(1,len(g0)) + self.assertTrue(isinstance(g0[0],MEDCouplingCartesianAMRPatchGF)) + g1=amr.retrieveGridsAt(1) + self.assertEqual(5,len(g1)) + for i in xrange(5): + self.assertTrue(isinstance(g1[i],MEDCouplingCartesianAMRPatch)) + pass pass def setUp(self): diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index b3eae0060..24a60c9c4 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -80,6 +80,19 @@ using namespace INTERP_KERNEL; } //$$$$$$$$$$$$$$$$$$ +//////////////////// +%typemap(out) MEDCouplingCartesianAMRPatchGen* +{ + $result=convertCartesianAMRPatch($1,$owner); +} +//$$$$$$$$$$$$$$$$$$ + +//////////////////// +%typemap(out) MEDCouplingCartesianAMRMeshGen* +{ + $result=convertCartesianAMRMesh($1,$owner); +} +//$$$$$$$$$$$$$$$$$$ //////////////////// %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh* @@ -316,19 +329,21 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingMultiFields::New; %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy; %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New; -%newobject ParaMEDMEM::MEDCouplingCartesianAMRPatch::getMesh; -%newobject ParaMEDMEM::MEDCouplingCartesianAMRPatch::__getitem__; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::getMesh; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::__getitem__; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildUnstructured; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getImageMesh; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getGodFather; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getFather; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getPatch; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::__getitem__; %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::New; -%newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::buildUnstructured; -%newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::buildMeshFromPatchEnvelop; -%newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::buildMeshOfDirectChildrenOnly; -%newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getImageMesh; -%newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getGodFather; -%newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getFather; -%newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getPatch; -%newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::createCellFieldOnPatch; -%newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::findPatchesInTheNeighborhoodOf; -%newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::__getitem__; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getDataConst; +%newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getData; %newobject ParaMEDMEM::DenseMatrix::New; %newobject ParaMEDMEM::DenseMatrix::deepCpy; %newobject ParaMEDMEM::DenseMatrix::shallowCpy; @@ -359,8 +374,13 @@ using namespace INTERP_KERNEL; %feature("unref") MEDCouplingMultiFields "$this->decrRef();" %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();" %feature("unref") MEDCouplingMultiFields "$this->decrRef();" +%feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();" %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();" +%feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();" +%feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();" +%feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();" %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();" +%feature("unref") MEDCouplingDataForGodFather "$this->decrRef();" %feature("unref") DenseMatrix "$this->decrRef();" %rename(assign) *::operator=; @@ -4736,16 +4756,30 @@ namespace ParaMEDMEM }; class MEDCouplingCartesianAMRMesh; - - class MEDCouplingCartesianAMRPatch : public RefCountObject + + class MEDCouplingCartesianAMRPatchGen : public RefCountObject { public: int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception); int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception); int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception); + %extend + { + MEDCouplingCartesianAMRMeshGen *getMesh() const throw(INTERP_KERNEL::Exception) + { + MEDCouplingCartesianAMRMeshGen *ret(const_cast(self->getMesh())); + if(ret) + ret->incrRef(); + return ret; + } + } + }; + + class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen + { + public: int getNumberOfOverlapedCellsForFather() const throw(INTERP_KERNEL::Exception); bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const throw(INTERP_KERNEL::Exception); - bool isGodFatherPatch() const throw(INTERP_KERNEL::Exception); %extend { PyObject *getBLTRRange() const throw(INTERP_KERNEL::Exception) @@ -4754,14 +4788,6 @@ namespace ParaMEDMEM return convertFromVectorPairInt(ret); } - MEDCouplingCartesianAMRMesh *getMesh() const throw(INTERP_KERNEL::Exception) - { - MEDCouplingCartesianAMRMesh *ret(const_cast(self->getMesh())); - if(ret) - ret->incrRef(); - return ret; - } - void addPatch(PyObject *bottomLeftTopRight, const std::vector& factors) throw(INTERP_KERNEL::Exception) { std::vector< std::pair > inp; @@ -4771,9 +4797,9 @@ namespace ParaMEDMEM MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception) { - const MEDCouplingCartesianAMRMesh *mesh(self->getMesh()); + const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh()); if(!mesh) - throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__getitem__ : no underlying mesh !"); + throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !"); if(patchId==mesh->getNumberOfPatches()) { std::ostringstream oss; @@ -4789,7 +4815,7 @@ namespace ParaMEDMEM void __delitem__(int patchId) throw(INTERP_KERNEL::Exception) { - MEDCouplingCartesianAMRMesh *mesh(const_cast(self->getMesh())); + MEDCouplingCartesianAMRMeshGen *mesh(const_cast(self->getMesh())); if(!mesh) throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !"); mesh->removePatch(patchId); @@ -4797,15 +4823,23 @@ namespace ParaMEDMEM int __len__() const throw(INTERP_KERNEL::Exception) { - const MEDCouplingCartesianAMRMesh *mesh(self->getMesh()); + const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh()); if(!mesh) throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !"); return mesh->getNumberOfPatches(); } } }; + + class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen + { + }; + + class MEDCouplingDataForGodFather : public RefCountObject + { + }; - class MEDCouplingCartesianAMRMesh : public RefCountObject, public TimeLabel + class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel { public: int getAbsoluteLevel() const throw(INTERP_KERNEL::Exception); @@ -4834,30 +4868,6 @@ namespace ParaMEDMEM DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) 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) - { - static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !"; - static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !"; - const int *nodeStrctPtr(0); - const double *originPtr(0),*dxyzPtr(0); - int sw,sz,val0; - std::vector bb0; - nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0); - // - double val,val2; - std::vector bb,bb2; - int sz1,sz2; - originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1); - dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2); - // - return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2); - } - - MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception) - { - return ParaMEDMEM_MEDCouplingCartesianAMRMesh_New(meshName,spaceDim,nodeStrct,origin,dxyz); - } - void addPatch(PyObject *bottomLeftTopRight, const std::vector& factors) throw(INTERP_KERNEL::Exception) { std::vector< std::pair > inp; @@ -4865,17 +4875,27 @@ namespace ParaMEDMEM self->addPatch(inp,factors); } - MEDCouplingCartesianAMRMesh *getFather() const throw(INTERP_KERNEL::Exception) + PyObject *retrieveGridsAt(int absoluteLev) const throw(INTERP_KERNEL::Exception) + { + std::vector ps(self->retrieveGridsAt(absoluteLev)); + int sz(ps.size()); + PyObject *ret = PyList_New(sz); + for(int i=0;i(self->getFather())); + MEDCouplingCartesianAMRMeshGen *ret(const_cast(self->getFather())); if(ret) ret->incrRef(); return ret; } - MEDCouplingCartesianAMRMesh *getGodFather() const throw(INTERP_KERNEL::Exception) + MEDCouplingCartesianAMRMeshGen *getGodFather() const throw(INTERP_KERNEL::Exception) { - MEDCouplingCartesianAMRMesh *ret(const_cast(self->getGodFather())); + MEDCouplingCartesianAMRMeshGen *ret(const_cast(self->getGodFather())); if(ret) ret->incrRef(); return ret; @@ -4931,6 +4951,58 @@ namespace ParaMEDMEM } }; + class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen + { + }; + + class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen + { + public: + void setData(MEDCouplingDataForGodFather *data) throw(INTERP_KERNEL::Exception); + %extend + { + static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception) + { + static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !"; + static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !"; + const int *nodeStrctPtr(0); + const double *originPtr(0),*dxyzPtr(0); + int sw,sz,val0; + std::vector bb0; + nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0); + // + double val,val2; + std::vector bb,bb2; + int sz1,sz2; + originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1); + dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2); + // + return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2); + } + + MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception) + { + return ParaMEDMEM_MEDCouplingCartesianAMRMesh_New(meshName,spaceDim,nodeStrct,origin,dxyz); + } + + MEDCouplingDataForGodFather *getDataConst() const throw(INTERP_KERNEL::Exception) + { + const MEDCouplingDataForGodFather *ret(self->getDataConst()); + if(ret) + ret->incrRef(); + return const_cast(ret); + } + + MEDCouplingDataForGodFather *getData() throw(INTERP_KERNEL::Exception) + { + MEDCouplingDataForGodFather *ret(self->getData()); + if(ret) + ret->incrRef(); + return ret; + } + } + }; + class DenseMatrix : public RefCountObject, public TimeLabel { public: diff --git a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i index f0382c2cd..0a50f88f8 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i @@ -85,6 +85,42 @@ static PyObject* convertMultiFields(ParaMEDMEM::MEDCouplingMultiFields *mfs, int return ret; } +static PyObject *convertCartesianAMRMesh(ParaMEDMEM::MEDCouplingCartesianAMRMeshGen *mesh, int owner) throw(INTERP_KERNEL::Exception) +{ + if(!mesh) + { + Py_XINCREF(Py_None); + return Py_None; + } + if(dynamic_cast(mesh)) + { + return SWIG_NewPointerObj(reinterpret_cast(mesh),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCartesianAMRMeshSub,owner); + } + if(dynamic_cast(mesh)) + { + return SWIG_NewPointerObj(reinterpret_cast(mesh),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCartesianAMRMesh,owner); + } + throw INTERP_KERNEL::Exception("convertCartesianAMRMesh wrap : unrecognized type of cartesian AMR mesh !"); +} + +static PyObject *convertCartesianAMRPatch(ParaMEDMEM::MEDCouplingCartesianAMRPatchGen *patch, int owner) throw(INTERP_KERNEL::Exception) +{ + if(!patch) + { + Py_XINCREF(Py_None); + return Py_None; + } + if(dynamic_cast(patch)) + { + return SWIG_NewPointerObj(reinterpret_cast(patch),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCartesianAMRPatchGF,owner); + } + if(dynamic_cast(patch)) + { + return SWIG_NewPointerObj(reinterpret_cast(patch),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCartesianAMRPatch,owner); + } + throw INTERP_KERNEL::Exception("convertCartesianAMRPatch wrap : unrecognized type of cartesian AMR patch !"); +} + static ParaMEDMEM::MEDCouplingFieldDouble *ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(ParaMEDMEM::MEDCouplingFieldDouble *self, PyObject *obj) throw(INTERP_KERNEL::Exception) { const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__add__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double."; -- 2.39.2