X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling_Swig%2FMEDCouplingCommon.i;h=b78056bfb231b87ddf145d4a5f946c0b1dcee346;hb=62a3e1a7f12332a2fd01f5751b9f5ca99b8727e1;hp=7e5a3b181f198534a3f78f2512d790b69fb8df68;hpb=bc460c6b18a13410f9a14ba8cf633e503fd6d147;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 7e5a3b181..b78056bfb 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -43,6 +43,7 @@ #include "MEDCouplingCartesianAMRMesh.hxx" #include "MEDCouplingAMRAttribute.hxx" #include "MEDCouplingMatrix.hxx" +#include "MEDCouplingPartDefinition.hxx" #include "MEDCouplingTypemaps.i" #include "InterpKernelAutoPtr.hxx" @@ -150,6 +151,18 @@ using namespace INTERP_KERNEL; } //$$$$$$$$$$$$$$$$$$ +//////////////////// +%typemap(out) ParaMEDMEM::PartDefinition* +{ + $result=convertPartDefinition($1,$owner); +} + +%typemap(out) PartDefinition* +{ + $result=convertPartDefinition($1,$owner); +} +//$$$$$$$$$$$$$$$$$$ + #ifdef WITH_NUMPY %init %{ import_array(); %} #endif @@ -245,6 +258,7 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes; %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly; %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree; +%newobject ParaMEDMEM::MEDCouplingPointSet::computeFetchedNodeIds; %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells; %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__; %newobject ParaMEDMEM::MEDCouplingUMesh::New; @@ -269,7 +283,6 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt; %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt; %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType; -%newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds; %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec; %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField; %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic; @@ -374,6 +387,13 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::DenseMatrix::__add__; %newobject ParaMEDMEM::DenseMatrix::__sub__; %newobject ParaMEDMEM::DenseMatrix::__mul__; +%newobject ParaMEDMEM::PartDefinition::New; +%newobject ParaMEDMEM::PartDefinition::toDAI; +%newobject ParaMEDMEM::PartDefinition::__add__; +%newobject ParaMEDMEM::PartDefinition::composeWith; +%newobject ParaMEDMEM::PartDefinition::tryToSimplify; +%newobject ParaMEDMEM::DataArrayPartDefinition::New; +%newobject ParaMEDMEM::SlicePartDefinition::New; %feature("unref") MEDCouplingPointSet "$this->decrRef();" %feature("unref") MEDCouplingMesh "$this->decrRef();" @@ -404,6 +424,9 @@ using namespace INTERP_KERNEL; %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();" %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();" %feature("unref") DenseMatrix "$this->decrRef();" +%feature("unref") PartDefinition "$this->decrRef();" +%feature("unref") DataArrayPartDefinition "$this->decrRef();" +%feature("unref") SlicePartDefinition "$this->decrRef();" %rename(assign) *::operator=; %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo; @@ -1040,6 +1063,7 @@ namespace ParaMEDMEM static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception); static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception); static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception); + virtual DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception); virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception); virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception); virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception); @@ -1051,6 +1075,7 @@ namespace ParaMEDMEM virtual bool isEmptyMesh(const std::vector& tinyInfo) const throw(INTERP_KERNEL::Exception); virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception); virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception); + virtual void renumberNodesWithOffsetInConn(int offset) throw(INTERP_KERNEL::Exception); %extend { std::string __str__() const throw(INTERP_KERNEL::Exception) @@ -1631,7 +1656,6 @@ namespace ParaMEDMEM DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception); DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception); DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception); - DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception); @@ -3970,13 +3994,13 @@ namespace ParaMEDMEM case 1: { std::vector v2(1,singleVal); - MEDCouplingAutoRefCountObjectPtr aarr=static_cast(ret0Arr->keepSelectedComponents(v2)); + MEDCouplingAutoRefCountObjectPtr aarr(ret0Arr->keepSelectedComponents(v2)); ret0->setArray(aarr); return ret0.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aarr=static_cast(ret0Arr->keepSelectedComponents(multiVal)); + MEDCouplingAutoRefCountObjectPtr aarr(ret0Arr->keepSelectedComponents(multiVal)); ret0->setArray(aarr); return ret0.retn(); } @@ -3986,7 +4010,7 @@ namespace ParaMEDMEM std::vector v2(nbOfComp); for(int i=0;i aarr=static_cast(ret0Arr->keepSelectedComponents(v2)); + MEDCouplingAutoRefCountObjectPtr aarr(ret0Arr->keepSelectedComponents(v2)); ret0->setArray(aarr); return ret0.retn(); } @@ -4904,6 +4928,12 @@ namespace ParaMEDMEM return convertFromVectorPairInt(ret); } + PyObject *getBLTRRangeRelativeToGF() const throw(INTERP_KERNEL::Exception) + { + std::vector< std::pair > ret(self->getBLTRRangeRelativeToGF()); + return convertFromVectorPairInt(ret); + } + void addPatch(PyObject *bottomLeftTopRight, const std::vector& factors) throw(INTERP_KERNEL::Exception) { std::vector< std::pair > inp; @@ -5143,6 +5173,7 @@ namespace ParaMEDMEM class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen { public: + static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh) throw(INTERP_KERNEL::Exception); %extend { static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception) @@ -5175,7 +5206,12 @@ namespace ParaMEDMEM 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); + return ParaMEDMEM_MEDCouplingCartesianAMRMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz); + } + + MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh) throw(INTERP_KERNEL::Exception) + { + return MEDCouplingCartesianAMRMesh::New(mesh); } } }; @@ -5216,6 +5252,7 @@ namespace ParaMEDMEM MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception); bool changeGodFather(MEDCouplingCartesianAMRMesh *gf) throw(INTERP_KERNEL::Exception); MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const throw(INTERP_KERNEL::Exception); + std::string writeVTHB(const std::string& fileName) const throw(INTERP_KERNEL::Exception); %extend { static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev) throw(INTERP_KERNEL::Exception) @@ -5373,6 +5410,90 @@ namespace ParaMEDMEM #endif } }; + + class PartDefinition : public RefCountObject, public TimeLabel + { + public: + static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception); + static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception); + virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception); + virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception); + virtual std::string getRepr() const throw(INTERP_KERNEL::Exception); + virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception); + virtual void checkCoherency() const throw(INTERP_KERNEL::Exception); + virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception); + %extend + { + virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception) + { + return (*self)+other; + } + } + protected: + virtual ~PartDefinition(); + }; + + class DataArrayPartDefinition : public PartDefinition + { + public: + static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception); + %extend + { + DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception) + { + return DataArrayPartDefinition::New(listOfIds); + } + + std::string __str__() const throw(INTERP_KERNEL::Exception) + { + return self->getRepr(); + } + + std::string __repr__() const throw(INTERP_KERNEL::Exception) + { + std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl; + oss << self->getRepr(); + return oss.str(); + } + } + protected: + virtual ~DataArrayPartDefinition(); + }; + + class SlicePartDefinition : public PartDefinition + { + public: + static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception); + int getEffectiveStop() const throw(INTERP_KERNEL::Exception); + %extend + { + SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception) + { + return SlicePartDefinition::New(start,stop,step); + } + + PyObject *getSlice() const throw(INTERP_KERNEL::Exception) + { + int a,b,c; + self->getSlice(a,b,c); + return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c)); + } + + std::string __str__() const throw(INTERP_KERNEL::Exception) + { + return self->getRepr(); + } + + std::string __repr__() const throw(INTERP_KERNEL::Exception) + { + std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl; + oss << self->getRepr(); + return oss.str(); + } + } + protected: + virtual ~SlicePartDefinition(); + }; } %pythoncode %{