X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling_Swig%2FMEDCouplingCommon.i;h=a1a557ecc487f7d8059e1240bd00d53a7d244b70;hb=8be544a31d08ec0537eef57b60edd48bc70c22db;hp=82e8d898f5e2f2e0299c28b8196f63e7675ed179;hpb=fb6ad3f990cf8c26e23ff4f6ed571d85dc738aac;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 82e8d898f..a1a557ecc 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D +// Copyright (C) 2007-2016 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 @@ -30,16 +30,17 @@ %{ #include "MEDCouplingMemArray.hxx" #include "MEDCouplingUMesh.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingCMesh.hxx" #include "MEDCouplingIMesh.hxx" #include "MEDCouplingCurveLinearMesh.hxx" #include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingField.hxx" #include "MEDCouplingFieldDouble.hxx" +#include "MEDCouplingFieldInt.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingGaussLocalization.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDCouplingMultiFields.hxx" #include "MEDCouplingFieldOverTime.hxx" #include "MEDCouplingDefinitionTime.hxx" @@ -183,6 +184,7 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingFieldDouble::getEndArray; %newobject MEDCoupling::MEDCouplingFieldDouble::MergeFields; %newobject MEDCoupling::MEDCouplingFieldDouble::MeldFields; +%newobject MEDCoupling::MEDCouplingFieldDouble::convertToIntField; %newobject MEDCoupling::MEDCouplingFieldDouble::doublyContractedProduct; %newobject MEDCoupling::MEDCouplingFieldDouble::determinant; %newobject MEDCoupling::MEDCouplingFieldDouble::eigenValues; @@ -207,9 +209,11 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingFieldDouble::DivideFields; %newobject MEDCoupling::MEDCouplingFieldDouble::min; %newobject MEDCoupling::MEDCouplingFieldDouble::negate; -%newobject MEDCoupling::MEDCouplingFieldDouble::getIdsInRange; +%newobject MEDCoupling::MEDCouplingFieldDouble::findIdsInRange; %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPart; %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPartRange; +%newobject MEDCoupling::MEDCouplingFieldDouble::voronoize; +%newobject MEDCoupling::MEDCouplingFieldDouble::convertQuadraticCellsToLinear; %newobject MEDCoupling::MEDCouplingFieldDouble::__getitem__; %newobject MEDCoupling::MEDCouplingFieldDouble::__neg__; %newobject MEDCoupling::MEDCouplingFieldDouble::__add__; @@ -223,13 +227,20 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingFieldDouble::__rdiv__; %newobject MEDCoupling::MEDCouplingFieldDouble::clone; %newobject MEDCoupling::MEDCouplingFieldDouble::cloneWithMesh; -%newobject MEDCoupling::MEDCouplingFieldDouble::deepCpy; +%newobject MEDCoupling::MEDCouplingFieldDouble::deepCopy; %newobject MEDCoupling::MEDCouplingFieldDouble::buildNewTimeReprFromThis; %newobject MEDCoupling::MEDCouplingFieldDouble::nodeToCellDiscretization; %newobject MEDCoupling::MEDCouplingFieldDouble::cellToNodeDiscretization; %newobject MEDCoupling::MEDCouplingFieldDouble::getValueOnMulti; +%newobject MEDCoupling::MEDCouplingFieldDouble::computeVectorFieldCyl; +%newobject MEDCoupling::MEDCouplingFieldInt::New; +%newobject MEDCoupling::MEDCouplingFieldInt::convertToDblField; +%newobject MEDCoupling::MEDCouplingFieldInt::getArray; +%newobject MEDCoupling::MEDCouplingFieldInt::deepCopy; +%newobject MEDCoupling::MEDCouplingFieldInt::clone; +%newobject MEDCoupling::MEDCouplingFieldInt::cloneWithMesh; %newobject MEDCoupling::MEDCouplingFieldTemplate::New; -%newobject MEDCoupling::MEDCouplingMesh::deepCpy; +%newobject MEDCoupling::MEDCouplingMesh::deepCopy; %newobject MEDCoupling::MEDCouplingMesh::clone; %newobject MEDCoupling::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith; %newobject MEDCoupling::MEDCouplingMesh::checkTypeConsistencyAndContig; @@ -239,30 +250,31 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingMesh::buildPartRange; %newobject MEDCoupling::MEDCouplingMesh::giveCellsWithType; %newobject MEDCoupling::MEDCouplingMesh::getCoordinatesAndOwner; -%newobject MEDCoupling::MEDCouplingMesh::getBarycenterAndOwner; +%newobject MEDCoupling::MEDCouplingMesh::computeCellCenterOfMass; %newobject MEDCoupling::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell; %newobject MEDCoupling::MEDCouplingMesh::buildOrthogonalField; %newobject MEDCoupling::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds; %newobject MEDCoupling::MEDCouplingMesh::mergeMyselfWith; %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalytic; -%newobject MEDCoupling::MEDCouplingMesh::fillFromAnalytic2; -%newobject MEDCoupling::MEDCouplingMesh::fillFromAnalytic3; +%newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticCompo; +%newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticNamedCompo; %newobject MEDCoupling::MEDCouplingMesh::getMeasureField; %newobject MEDCoupling::MEDCouplingMesh::simplexize; %newobject MEDCoupling::MEDCouplingMesh::buildUnstructured; %newobject MEDCoupling::MEDCouplingMesh::MergeMeshes; +%newobject MEDCoupling::MEDCouplingMesh::getDirectAccessOfCoordsArrIfInStructure; %newobject MEDCoupling::MEDCouplingPointSet::zipCoordsTraducer; %newobject MEDCoupling::MEDCouplingPointSet::getCellsInBoundingBox; %newobject MEDCoupling::MEDCouplingPointSet::findBoundaryNodes; %newobject MEDCoupling::MEDCouplingPointSet::buildBoundaryMesh; %newobject MEDCoupling::MEDCouplingPointSet::MergeNodesArray; -%newobject MEDCoupling::MEDCouplingPointSet::buildPartOfMySelf2; +%newobject MEDCoupling::MEDCouplingPointSet::buildPartOfMySelfSlice; %newobject MEDCoupling::MEDCouplingPointSet::BuildInstanceFromMeshType; %newobject MEDCoupling::MEDCouplingPointSet::zipConnectivityTraducer; %newobject MEDCoupling::MEDCouplingPointSet::mergeMyselfWithOnSameCoords; %newobject MEDCoupling::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds; %newobject MEDCoupling::MEDCouplingPointSet::getCellIdsLyingOnNodes; -%newobject MEDCoupling::MEDCouplingPointSet::deepCpyConnectivityOnly; +%newobject MEDCoupling::MEDCouplingPointSet::deepCopyConnectivityOnly; %newobject MEDCoupling::MEDCouplingPointSet::getBoundingBoxForBBTree; %newobject MEDCoupling::MEDCouplingPointSet::computeFetchedNodeIds; %newobject MEDCoupling::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells; @@ -276,6 +288,7 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity; %newobject MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity2; %newobject MEDCoupling::MEDCouplingUMesh::explode3DMeshTo1D; +%newobject MEDCoupling::MEDCouplingUMesh::explodeMeshIntoMicroEdges; %newobject MEDCoupling::MEDCouplingUMesh::buildExtrudedMesh; %newobject MEDCoupling::MEDCouplingUMesh::buildSpreadZonesWithPoly; %newobject MEDCoupling::MEDCouplingUMesh::MergeUMeshes; @@ -284,6 +297,7 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed; %newobject MEDCoupling::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt; %newobject MEDCoupling::MEDCouplingUMesh::conformize2D; +%newobject MEDCoupling::MEDCouplingUMesh::conformize3D; %newobject MEDCoupling::MEDCouplingUMesh::colinearize2D; %newobject MEDCoupling::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes; %newobject MEDCoupling::MEDCouplingUMesh::sortCellsInMEDFileFrmt; @@ -302,6 +316,7 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingUMesh::buildPartOrthogonalField; %newobject MEDCoupling::MEDCouplingUMesh::keepCellIdsByType; %newobject MEDCoupling::MEDCouplingUMesh::Build0DMeshFromCoords; +%newobject MEDCoupling::MEDCouplingUMesh::Build1DMeshFromCoords; %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells; %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DCells; %newobject MEDCoupling::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh; @@ -316,6 +331,7 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf3DMesh; %newobject MEDCoupling::MEDCouplingUMesh::generateGraph; %newobject MEDCoupling::MEDCouplingUMesh::orderConsecutiveCells1D; +%newobject MEDCoupling::MEDCouplingUMesh::clipSingle3DCellByPlane; %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTreeFast; %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic; %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic; @@ -336,8 +352,8 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCoupling1DGTUMesh::buildSetInstanceFromThis; %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshes; %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords; -%newobject MEDCoupling::MEDCouplingExtrudedMesh::New; -%newobject MEDCoupling::MEDCouplingExtrudedMesh::build3DUnstructuredMesh; +%newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::New; +%newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh; %newobject MEDCoupling::MEDCouplingStructuredMesh::buildStructuredSubPart; %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTUnstructured; %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTSubLevelMesh; @@ -356,11 +372,11 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingCurveLinearMesh::New; %newobject MEDCoupling::MEDCouplingCurveLinearMesh::getCoords; %newobject MEDCoupling::MEDCouplingMultiFields::New; -%newobject MEDCoupling::MEDCouplingMultiFields::deepCpy; +%newobject MEDCoupling::MEDCouplingMultiFields::deepCopy; %newobject MEDCoupling::MEDCouplingFieldOverTime::New; %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::getMesh; %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::__getitem__; -%newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::deepCpy; +%newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::deepCopy; %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildUnstructured; %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::extractGhostFrom; %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop; @@ -377,7 +393,7 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingCartesianAMRMesh::New; %newobject MEDCoupling::MEDCouplingDataForGodFather::getMyGodFather; %newobject MEDCoupling::MEDCouplingAMRAttribute::New; -%newobject MEDCoupling::MEDCouplingAMRAttribute::deepCpy; +%newobject MEDCoupling::MEDCouplingAMRAttribute::deepCopy; %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCpyWithoutGodFather; %newobject MEDCoupling::MEDCouplingAMRAttribute::getFieldOn; %newobject MEDCoupling::MEDCouplingAMRAttribute::projectTo; @@ -385,7 +401,7 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost; %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost; %newobject MEDCoupling::DenseMatrix::New; -%newobject MEDCoupling::DenseMatrix::deepCpy; +%newobject MEDCoupling::DenseMatrix::deepCopy; %newobject MEDCoupling::DenseMatrix::shallowCpy; %newobject MEDCoupling::DenseMatrix::getData; %newobject MEDCoupling::DenseMatrix::matVecMult; @@ -393,13 +409,9 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::DenseMatrix::__add__; %newobject MEDCoupling::DenseMatrix::__sub__; %newobject MEDCoupling::DenseMatrix::__mul__; -%newobject MEDCoupling::PartDefinition::New; -%newobject MEDCoupling::PartDefinition::toDAI; -%newobject MEDCoupling::PartDefinition::__add__; -%newobject MEDCoupling::PartDefinition::composeWith; -%newobject MEDCoupling::PartDefinition::tryToSimplify; -%newobject MEDCoupling::DataArrayPartDefinition::New; -%newobject MEDCoupling::SlicePartDefinition::New; +%newobject MEDCoupling::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell; +%newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell; +%newobject MEDCoupling::MEDCouplingSkyLineArray::BuildFromPolyhedronConn; %feature("unref") MEDCouplingPointSet "$this->decrRef();" %feature("unref") MEDCouplingMesh "$this->decrRef();" @@ -407,7 +419,7 @@ using namespace INTERP_KERNEL; %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();" %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();" %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();" -%feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();" +%feature("unref") MEDCouplingMappedExtrudedMesh "$this->decrRef();" %feature("unref") MEDCouplingCMesh "$this->decrRef();" %feature("unref") MEDCouplingIMesh "$this->decrRef();" %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();" @@ -430,9 +442,7 @@ 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();" +%feature("unref") MEDCouplingSkyLineArray "$this->decrRef();" %rename(assign) *::operator=; %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationIntInfo; @@ -513,6 +523,7 @@ namespace MEDCoupling class DataArrayInt; class DataArrayDouble; class MEDCouplingUMesh; + class MEDCouplingCMesh; class MEDCouplingFieldDouble; %extend RefCountObject @@ -553,21 +564,21 @@ namespace MEDCoupling std::string getTimeUnit() const; virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception); bool isStructured() const throw(INTERP_KERNEL::Exception); - virtual MEDCouplingMesh *deepCpy() const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingMesh *deepCopy() const throw(INTERP_KERNEL::Exception); virtual MEDCouplingMesh *clone(bool recDeepCpy) const throw(INTERP_KERNEL::Exception); virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception); virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception); virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception); virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception); virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception); - virtual void checkCoherency() const throw(INTERP_KERNEL::Exception); - virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception); + virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception); + virtual void checkConsistency(double eps=1e-12) const throw(INTERP_KERNEL::Exception); virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception); virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception); virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception); virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception); virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception); - virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception); + virtual DataArrayDouble *computeCellCenterOfMass() const throw(INTERP_KERNEL::Exception); virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception); virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception); virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception); @@ -585,8 +596,8 @@ namespace MEDCoupling virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception); virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception); virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception); - virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception); - virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingFieldDouble *fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception); virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception); virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception); virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception); @@ -617,6 +628,15 @@ namespace MEDCoupling PyList_SetItem(res,2,SWIG_From_int(tmp2)); return res; } + + DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const throw(INTERP_KERNEL::Exception) + { + const DataArrayDouble *ret(self->getDirectAccessOfCoordsArrIfInStructure()); + DataArrayDouble *ret2(const_cast(ret)); + if(ret2) + ret2->incrRef(); + return ret2; + } int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception) { @@ -641,7 +661,7 @@ namespace MEDCoupling int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : "; const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true); - MEDCouplingAutoRefCountObjectPtr elts,eltsIndex; + MCAuto elts,eltsIndex; self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); @@ -651,7 +671,7 @@ namespace MEDCoupling PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr elts,eltsIndex; + MCAuto elts,eltsIndex; int spaceDim=self->getSpaceDimension(); void *da=0; int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ); @@ -706,8 +726,8 @@ namespace MEDCoupling virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr d0=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d1=DataArrayInt::New(); + MCAuto d0=DataArrayInt::New(); + MCAuto d1=DataArrayInt::New(); self->getReverseNodalConnectivity(d0,d1); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); @@ -1123,7 +1143,7 @@ namespace MEDCoupling int getDimension() const throw(INTERP_KERNEL::Exception); int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception); std::string getStringRepr() const throw(INTERP_KERNEL::Exception); - void checkCoherency() const throw(INTERP_KERNEL::Exception); + void checkConsistencyLight() const throw(INTERP_KERNEL::Exception); bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception); // const std::vector& getRefCoords() const throw(INTERP_KERNEL::Exception); @@ -1140,28 +1160,118 @@ namespace MEDCoupling void setWeights(const std::vector& w) throw(INTERP_KERNEL::Exception); // static bool AreAlmostEqual(const std::vector& v1, const std::vector& v2, double eps); + // + %extend + { + DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const throw(INTERP_KERNEL::Exception) + { + MCAuto ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh)); + return ret.retn(); + } + + MEDCouplingUMesh *buildRefCell() const throw(INTERP_KERNEL::Exception) + { + MCAuto ret(self->buildRefCell()); + return ret.retn(); + } + } }; class MEDCouplingSkyLineArray { - public: - MEDCouplingSkyLineArray(); - MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray &myArray ); - MEDCouplingSkyLineArray( DataArrayInt* index, DataArrayInt* value ); - MEDCouplingSkyLineArray( const std::vector& index, const std::vector& value ); + public: + static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayInt* c, const DataArrayInt* cI ) throw(INTERP_KERNEL::Exception); void set( DataArrayInt* index, DataArrayInt* value ); + void set3( DataArrayInt* superIndex, DataArrayInt* index, DataArrayInt* value ); + + int getSuperNumberOf() const; int getNumberOf() const; int getLength() const; + + DataArrayInt* getSuperIndexArray() const; DataArrayInt* getIndexArray() const; - DataArrayInt* getValueArray() const; - %extend + DataArrayInt* getValuesArray() const; + + void deletePack(const int i, const int j) throw(INTERP_KERNEL::Exception); + + %extend + { + MEDCouplingSkyLineArray() throw(INTERP_KERNEL::Exception) + { + return MEDCouplingSkyLineArray::New(); + } + + MEDCouplingSkyLineArray( const std::vector& index, const std::vector& value) throw(INTERP_KERNEL::Exception) + { + return MEDCouplingSkyLineArray::New(index, value); + } + + MEDCouplingSkyLineArray( DataArrayInt* index, DataArrayInt* value ) throw(INTERP_KERNEL::Exception) + { + return MEDCouplingSkyLineArray::New(index, value); + } + + MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray & other ) throw(INTERP_KERNEL::Exception) + { + return MEDCouplingSkyLineArray::New(other); + } + + std::string __str__() const throw(INTERP_KERNEL::Exception) + { + return self->simpleRepr(); + } + + PyObject *getSimplePackSafe(int absolutePackId) const throw(INTERP_KERNEL::Exception) + { + std::vector ret; + self->getSimplePackSafe(absolutePackId,ret); + return convertIntArrToPyList2(ret); + } + + PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const throw(INTERP_KERNEL::Exception) + { + std::vector vpack, vspIdx, out; + + convertPyToNewIntArr3(superPackIndices,vspIdx); + convertPyToNewIntArr3(pack,vpack); + + self->findPackIds(vspIdx, vpack.data(), vpack.data()+vpack.size(), out); + return convertIntArrToPyList2(out); + } + + void pushBackPack(const int i, PyObject *pack) throw(INTERP_KERNEL::Exception) + { + std::vector vpack; + convertPyToNewIntArr3(pack,vpack); + self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size()); + } + + void replaceSimplePack(const int idx, PyObject *pack) throw(INTERP_KERNEL::Exception) + { + std::vector vpack; + convertPyToNewIntArr3(pack,vpack); + self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size()); + } + + void replacePack(const int superIdx, const int idx, PyObject *pack) throw(INTERP_KERNEL::Exception) + { + std::vector vpack; + convertPyToNewIntArr3(pack,vpack); + self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size()); + } + + PyObject *convertToPolyhedronConn() const throw(INTERP_KERNEL::Exception) { - std::string __str__() const throw(INTERP_KERNEL::Exception) - { - return self->simpleRepr(); - } - } + MCAuto d0=DataArrayInt::New(); + MCAuto d1=DataArrayInt::New(); + self->convertToPolyhedronConn(d0,d1); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + return ret; + } + } }; } @@ -1183,7 +1293,7 @@ namespace MEDCoupling void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception); void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception); virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception); - virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step) const throw(INTERP_KERNEL::Exception); virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception); static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception); static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception); @@ -1198,7 +1308,7 @@ namespace MEDCoupling virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception); virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception); virtual bool isEmptyMesh(const std::vector& tinyInfo) const throw(INTERP_KERNEL::Exception); - virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingPointSet *deepCopyConnectivityOnly() 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); virtual bool areAllNodesFetched() const throw(INTERP_KERNEL::Exception); @@ -1289,9 +1399,9 @@ namespace MEDCoupling return convertMesh(ret, SWIG_POINTER_OWN | 0 ); } - virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception) + virtual PyObject *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const throw(INTERP_KERNEL::Exception) { - MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step); + MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step); return convertMesh(ret, SWIG_POINTER_OWN | 0 ); } @@ -1320,12 +1430,12 @@ namespace MEDCoupling self->renumberNodes(tmp,newNbOfNodes); } - void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception) + void renumberNodesCenter(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception) { int szArr,sw,iTypppArr; std::vector stdvecTyyppArr; const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr); - self->renumberNodes2(tmp,newNbOfNodes); + self->renumberNodesCenter(tmp,newNbOfNodes); } PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception) @@ -1519,11 +1629,11 @@ namespace MEDCoupling return res; } - virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception) + virtual PyObject *mergeNodesCenter(double precision) throw(INTERP_KERNEL::Exception) { bool ret1; int ret2; - DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2); + DataArrayInt *ret0=self->mergeNodesCenter(precision,ret1,ret2); PyObject *res = PyList_New(3); PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); PyList_SetItem(res,1,SWIG_From_bool(ret1)); @@ -1593,7 +1703,7 @@ namespace MEDCoupling } case 3: { - return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true); + return self->buildPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,true); } case 4: { @@ -1612,7 +1722,7 @@ namespace MEDCoupling int sz; INTERP_KERNEL::AutoCPtr c=convertPyToNewDblArr2(center,&sz); INTERP_KERNEL::AutoCPtr coo=convertPyToNewDblArr2(coords,&sz); - MEDCoupling::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo); + MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo); for(int i=0;i(coo)); + MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast(coo)); } static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception) @@ -1637,7 +1747,7 @@ namespace MEDCoupling INTERP_KERNEL::AutoCPtr c=convertPyToNewDblArr2(center,&sz); INTERP_KERNEL::AutoCPtr coo=convertPyToNewDblArr2(coords,&sz); INTERP_KERNEL::AutoCPtr v=convertPyToNewDblArr2(vect,&sz2); - MEDCoupling::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo); + MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo); for(int i=0;i v=convertPyToNewDblArr2(vect,&sz2); - MEDCoupling::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast(coo)); + MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,const_cast(coo)); } } }; @@ -1757,20 +1867,21 @@ namespace MEDCoupling public: static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception); static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception); - void checkCoherency() const throw(INTERP_KERNEL::Exception); + void checkConsistencyLight() const throw(INTERP_KERNEL::Exception); void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception); void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception); void finishInsertingCells() throw(INTERP_KERNEL::Exception); MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception); void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception); INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception); - void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception); - int getMeshLength() const throw(INTERP_KERNEL::Exception); + void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception); + int getNodalConnectivityArrayLen() const throw(INTERP_KERNEL::Exception); void computeTypes() throw(INTERP_KERNEL::Exception); std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception); //tools DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception); + DataArrayInt *conformize3D(double eps) throw(INTERP_KERNEL::Exception); DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception); void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception); std::vector getQuadraticStatus() const throw(INTERP_KERNEL::Exception); @@ -1785,6 +1896,7 @@ namespace MEDCoupling 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); + MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception); void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception); bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception); bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception); @@ -1805,10 +1917,10 @@ namespace MEDCoupling DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception); DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception); MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception); + MEDCouplingSkyLineArray *generateGraph() const throw(INTERP_KERNEL::Exception); DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception); DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception); DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception); - MEDCouplingSkyLineArray *generateGraph() const throw(INTERP_KERNEL::Exception); DataArrayInt *orderConsecutiveCells1D() const throw(INTERP_KERNEL::Exception); DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception); DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception); @@ -1854,6 +1966,12 @@ namespace MEDCoupling return self->cellIterator(); } + static MEDCouplingUMesh *Build1DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception) + { + MCAuto ret(MEDCouplingUMesh::Build1DMeshFromCoords(da)); + return ret.retn(); + } + PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception) { std::vector result=self->getAllGeoTypesSorted(); @@ -1969,7 +2087,7 @@ namespace MEDCoupling } case 3: { - self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis); + self->setPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis); break; } case 4: @@ -2114,6 +2232,16 @@ namespace MEDCoupling return ret; } + static PyObject *PartitionBySpreadZone(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception) + { + std::vector retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn)); + int sz=retCpp.size(); + PyObject *ret=PyList_New(sz); + for(int i=0;i(slic); if(!arrIndxIn) - throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !"); + throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : last array is null !"); arrIndxIn->checkAllocated(); if(arrIndxIn->getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !"); - GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !"); + throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : number of components of last argument must be equal to one !"); + GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArraysSlice (wrap) : Invalid slice regarding nb of elements !"); DataArrayInt *arrOut=0,*arrIndexOut=0; - MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut); + MEDCouplingUMesh::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); @@ -2509,10 +2637,10 @@ namespace MEDCoupling return ret; } - PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception) + PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception) { DataArrayInt *ret1; - bool ret0=self->areCellsIncludedIn2(other,ret1); + bool ret0=self->areCellsIncludedInPolicy7(other,ret1); PyObject *ret=PyTuple_New(2); PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py); @@ -2523,10 +2651,10 @@ namespace MEDCoupling PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr d0=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d1=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d2=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d3=DataArrayInt::New(); + MCAuto d0=DataArrayInt::New(); + MCAuto d1=DataArrayInt::New(); + MCAuto d2=DataArrayInt::New(); + MCAuto d3=DataArrayInt::New(); MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); @@ -2537,12 +2665,28 @@ namespace MEDCoupling return ret; } + PyObject *explodeMeshIntoMicroEdges() const throw(INTERP_KERNEL::Exception) + { + MCAuto d0=DataArrayInt::New(); + MCAuto d1=DataArrayInt::New(); + MCAuto d2=DataArrayInt::New(); + MCAuto d3=DataArrayInt::New(); + MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3); + PyObject *ret=PyTuple_New(5); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + return ret; + } + PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr d0=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d1=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d2=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d3=DataArrayInt::New(); + MCAuto d0=DataArrayInt::New(); + MCAuto d1=DataArrayInt::New(); + MCAuto d2=DataArrayInt::New(); + MCAuto d3=DataArrayInt::New(); MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); @@ -2555,10 +2699,10 @@ namespace MEDCoupling PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr d0=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d1=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d2=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d3=DataArrayInt::New(); + MCAuto d0=DataArrayInt::New(); + MCAuto d1=DataArrayInt::New(); + MCAuto d2=DataArrayInt::New(); + MCAuto d3=DataArrayInt::New(); MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); @@ -2588,7 +2732,17 @@ namespace MEDCoupling PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); return ret; } - + + PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayInt *nodeNeigh, const DataArrayInt *nodeNeighI) const throw(INTERP_KERNEL::Exception) + { + MCAuto cellNeigh,cellNeighIndex; + self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + return ret; + } + static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception) { DataArrayInt *neighbors=0,*neighborsIdx=0; @@ -2601,8 +2755,8 @@ namespace MEDCoupling PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh) { - MEDCouplingAutoRefCountObjectPtr d0=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d1=DataArrayInt::New(); + MCAuto d0=DataArrayInt::New(); + MCAuto d1=DataArrayInt::New(); DataArrayInt *d2,*d3,*d4,*dd5; MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5); PyObject *ret=PyTuple_New(7); @@ -2733,6 +2887,21 @@ namespace MEDCoupling return ret; } + MEDCouplingUMesh *clipSingle3DCellByPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception) + { + double val,val2; + DataArrayDouble *a,*a2; + DataArrayDoubleTuple *aa,*aa2; + std::vector bb,bb2; + int sw; + const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st paramater for origin."; + const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd paramater for vector."; + const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true); + const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true); + MCAuto ret(self->clipSingle3DCellByPlane(orig,vect,eps)); + return ret.retn(); + } + DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception) { int spaceDim=self->getSpaceDimension(); @@ -2780,7 +2949,7 @@ namespace MEDCoupling default: throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !"); } - } + } } void convertAllToPoly(); void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception); @@ -2792,27 +2961,34 @@ namespace MEDCoupling //== MEDCouplingUMesh End - //== MEDCouplingExtrudedMesh + //== MEDCouplingMappedExtrudedMesh - class MEDCouplingExtrudedMesh : public MEDCoupling::MEDCouplingMesh + class MEDCouplingMappedExtrudedMesh : public MEDCoupling::MEDCouplingMesh { public: - static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception); + static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception); + static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D) throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception); + int get2DCellIdForExtrusion() const; %extend { - MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception) + MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception) { - return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId); + return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId); } - MEDCouplingExtrudedMesh() + MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D) throw(INTERP_KERNEL::Exception) { - return MEDCouplingExtrudedMesh::New(); + return MEDCouplingMappedExtrudedMesh::New(mesh3D); + } + + MEDCouplingMappedExtrudedMesh() + { + return MEDCouplingMappedExtrudedMesh::New(); } static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception) { - return NewMethWrapCallInitOnlyIfEmptyDictInInput(cls,args,"MEDCouplingExtrudedMesh"); + return NewMethWrapCallInitOnlyIfEmptyDictInInput(cls,args,"MEDCouplingMappedExtrudedMesh"); } std::string __str__() const throw(INTERP_KERNEL::Exception) @@ -2851,7 +3027,7 @@ namespace MEDCoupling } }; - //== MEDCouplingExtrudedMesh End + //== MEDCouplingMappedExtrudedMesh End class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet { @@ -2861,7 +3037,7 @@ namespace MEDCoupling INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception); int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception); virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception); - virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception); + virtual void checkConsistencyOfConnectivity() const throw(INTERP_KERNEL::Exception); %extend { virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception) @@ -3559,7 +3735,7 @@ namespace MEDCoupling class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel { public: - virtual void checkCoherency() const throw(INTERP_KERNEL::Exception); + virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception); virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception); virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception); virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception); @@ -3717,6 +3893,7 @@ namespace MEDCoupling { public: static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception); + static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f) throw(INTERP_KERNEL::Exception); static MEDCouplingFieldTemplate *New(TypeOfField type); std::string simpleRepr() const throw(INTERP_KERNEL::Exception); std::string advancedRepr() const throw(INTERP_KERNEL::Exception); @@ -3726,6 +3903,11 @@ namespace MEDCoupling { return MEDCouplingFieldTemplate::New(f); } + + MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f) throw(INTERP_KERNEL::Exception) + { + return MEDCouplingFieldTemplate::New(f); + } MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception) { @@ -3746,6 +3928,8 @@ namespace MEDCoupling } }; + class MEDCouplingFieldInt; + class MEDCouplingFieldDouble : public MEDCoupling::MEDCouplingField { public: @@ -3759,10 +3943,11 @@ namespace MEDCoupling std::string simpleRepr() const throw(INTERP_KERNEL::Exception); std::string advancedRepr() const throw(INTERP_KERNEL::Exception); std::string writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldInt *convertToIntField() const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *clone(bool recDeepCpy) const; MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const; - MEDCouplingFieldDouble *deepCpy() const; - MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *deepCopy() const; + MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception); TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception); @@ -3790,7 +3975,7 @@ namespace MEDCoupling void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception); void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception); bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception); - bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception); + bool mergeNodesCenter(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception); bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception); bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception); bool simplexize(int policy) throw(INTERP_KERNEL::Exception); @@ -3807,11 +3992,11 @@ namespace MEDCoupling void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception); void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); - void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); - void fillFromAnalytic3(int nbOfComp, const std::vector& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception); + void fillFromAnalyticCompo(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); + void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception); void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); - void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); - void applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception); + void applyFuncCompo(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); + void applyFuncNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception); void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception); void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception); void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception); @@ -3827,7 +4012,7 @@ namespace MEDCoupling double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception); double normL1(int compId) const throw(INTERP_KERNEL::Exception); double normL2(int compId) const throw(INTERP_KERNEL::Exception); - DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception); + DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception); static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception); static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception); @@ -3866,6 +4051,31 @@ namespace MEDCoupling self->reprQuickOverview(oss); return oss.str(); } + + MEDCouplingFieldDouble *voronoize(double eps) const throw(INTERP_KERNEL::Exception) + { + MCAuto ret(self->voronoize(eps)); + return ret.retn(); + } + + MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const throw(INTERP_KERNEL::Exception) + { + MCAuto ret(self->convertQuadraticCellsToLinear()); + return ret.retn(); + } + + MEDCouplingFieldDouble *computeVectorFieldCyl(PyObject *center, PyObject *vector) const + { + const char msg[]="Python wrap of MEDCouplingFieldDouble::computeVectorFieldCyl : "; + double val,val2; + DataArrayDouble *a,*a2; + DataArrayDoubleTuple *aa,*aa2; + std::vector bb,bb2; + int sw; + const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true); + const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true); + return self->computeVectorFieldCyl(centerPtr,vectorPtr); + } DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception) { @@ -3980,7 +4190,7 @@ namespace MEDCoupling MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp); else { - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::New(); + MCAuto arr=DataArrayDouble::New(); MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp); self->setArray(arr); } @@ -4164,7 +4374,7 @@ namespace MEDCoupling { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); } catch(INTERP_KERNEL::Exception& e) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDCouplingAutoRefCountObjectPtr ret0=MEDCoupling_MEDCouplingFieldDouble_buildSubPart(self,elt0); + MCAuto ret0=MEDCoupling_MEDCouplingFieldDouble_buildSubPart(self,elt0); DataArrayDouble *ret0Arr=ret0->getArray(); if(!ret0Arr) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !"); @@ -4173,13 +4383,13 @@ namespace MEDCoupling case 1: { std::vector v2(1,singleVal); - MEDCouplingAutoRefCountObjectPtr aarr(ret0Arr->keepSelectedComponents(v2)); + MCAuto aarr(ret0Arr->keepSelectedComponents(v2)); ret0->setArray(aarr); return ret0.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aarr(ret0Arr->keepSelectedComponents(multiVal)); + MCAuto aarr(ret0Arr->keepSelectedComponents(multiVal)); ret0->setArray(aarr); return ret0.retn(); } @@ -4189,7 +4399,7 @@ namespace MEDCoupling std::vector v2(nbOfComp); for(int i=0;i aarr(ret0Arr->keepSelectedComponents(v2)); + MCAuto aarr(ret0Arr->keepSelectedComponents(v2)); ret0->setArray(aarr); return ret0.retn(); } @@ -4289,9 +4499,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr ret=self->getArray()->deepCpy(); + MCAuto ret=self->getArray()->deepCopy(); ret->applyLin(1.,-val); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4299,8 +4509,8 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Substract(self->getArray(),a); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret=DataArrayDouble::Substract(self->getArray(),a); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4308,9 +4518,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Substract(self->getArray(),aaa); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret=DataArrayDouble::Substract(self->getArray(),aaa); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4318,9 +4528,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Substract(self->getArray(),aaa); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto ret=DataArrayDouble::Substract(self->getArray(),aaa); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4373,9 +4583,9 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !"); if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr ret=self->getArray()->deepCpy(); + MCAuto ret=self->getArray()->deepCopy(); ret->applyLin(1./val,0); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4383,8 +4593,8 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Divide(self->getArray(),a); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret=DataArrayDouble::Divide(self->getArray(),a); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4392,9 +4602,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Divide(self->getArray(),aaa); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret=DataArrayDouble::Divide(self->getArray(),aaa); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4402,9 +4612,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Divide(self->getArray(),aaa); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto ret=DataArrayDouble::Divide(self->getArray(),aaa); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4445,9 +4655,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr ret=self->getArray()->deepCpy(); + MCAuto ret=self->getArray()->deepCopy(); ret->applyPow(val); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4455,8 +4665,8 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Pow(self->getArray(),a); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret=DataArrayDouble::Pow(self->getArray(),a); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4464,9 +4674,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Pow(self->getArray(),aaa); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret=DataArrayDouble::Pow(self->getArray(),aaa); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4474,9 +4684,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Pow(self->getArray(),aaa); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto ret=DataArrayDouble::Pow(self->getArray(),aaa); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4527,7 +4737,7 @@ namespace MEDCoupling } case 2: { - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(a); *self+=*ret2; Py_XINCREF(trueSelf); @@ -4535,8 +4745,8 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret2=self->clone(false); ret2->setArray(aaa); *self+=*ret2; Py_XINCREF(trueSelf); @@ -4546,7 +4756,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->getArray()->addEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4593,7 +4803,7 @@ namespace MEDCoupling } case 2: { - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(a); *self-=*ret2; Py_XINCREF(trueSelf); @@ -4601,8 +4811,8 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret2=self->clone(false); ret2->setArray(aaa); *self-=*ret2; Py_XINCREF(trueSelf); @@ -4612,7 +4822,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->getArray()->substractEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4659,7 +4869,7 @@ namespace MEDCoupling } case 2: { - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(a); *self*=*ret2; Py_XINCREF(trueSelf); @@ -4667,8 +4877,8 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret2=self->clone(false); ret2->setArray(aaa); *self*=*ret2; Py_XINCREF(trueSelf); @@ -4678,7 +4888,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->getArray()->multiplyEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4727,7 +4937,7 @@ namespace MEDCoupling } case 2: { - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(a); *self/=*ret2; Py_XINCREF(trueSelf); @@ -4735,8 +4945,8 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret2=self->clone(false); ret2->setArray(aaa); *self/=*ret2; Py_XINCREF(trueSelf); @@ -4746,7 +4956,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->getArray()->divideEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4793,7 +5003,7 @@ namespace MEDCoupling } case 2: { - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(a); *self^=*ret2; Py_XINCREF(trueSelf); @@ -4801,8 +5011,8 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret2=self->clone(false); ret2->setArray(aaa); *self^=*ret2; Py_XINCREF(trueSelf); @@ -4812,7 +5022,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->getArray()->powEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4914,7 +5124,7 @@ namespace MEDCoupling PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception) {// put an empty dict in input to say to __new__ to call __init__... - self->checkCoherency(); + self->checkConsistencyLight(); PyObject *ret(PyTuple_New(1)); PyObject *ret0(PyDict_New()); { @@ -4929,7 +5139,7 @@ namespace MEDCoupling PyObject *__getstate__() const throw(INTERP_KERNEL::Exception) { - self->checkCoherency(); + self->checkConsistencyLight(); PyObject *ret0(MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation(self)); PyObject *ret1(MEDCoupling_MEDCouplingFieldDouble_serialize(self)); const MEDCouplingMesh *mesh(self->getMesh()); @@ -4996,12 +5206,12 @@ namespace MEDCoupling { public: int getNumberOfFields() const; - MEDCouplingMultiFields *deepCpy() const; + MEDCouplingMultiFields *deepCopy() const; virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception); virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception); virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const; virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const; - virtual void checkCoherency() const throw(INTERP_KERNEL::Exception); + virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception); %extend { std::string __str__() const throw(INTERP_KERNEL::Exception) @@ -5148,6 +5358,63 @@ namespace MEDCoupling } } }; + + class MEDCouplingFieldInt : public MEDCouplingField + { + public: + static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); + static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); + void setTimeUnit(const std::string& unit) throw(INTERP_KERNEL::Exception); + std::string getTimeUnit() const throw(INTERP_KERNEL::Exception); + void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception); + void setArray(DataArrayInt *array) throw(INTERP_KERNEL::Exception); + MEDCouplingFieldInt *deepCopy() const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldInt *clone(bool recDeepCpy) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *convertToDblField() const throw(INTERP_KERNEL::Exception); + %extend { + MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME) + { + return MEDCouplingFieldInt::New(type,td); + } + + MEDCouplingFieldInt(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME) + { + return MEDCouplingFieldInt::New(ft,td); + } + + std::string __str__() const throw(INTERP_KERNEL::Exception) + { + return self->simpleRepr(); + } + + std::string __repr__() const throw(INTERP_KERNEL::Exception) + { + std::ostringstream oss; + self->reprQuickOverview(oss); + return oss.str(); + } + + DataArrayInt *getArray() throw(INTERP_KERNEL::Exception) + { + DataArrayInt *ret=self->getArray(); + if(ret) + ret->incrRef(); + return ret; + } + + PyObject *getTime() throw(INTERP_KERNEL::Exception) + { + int tmp1,tmp2; + double tmp0=self->getTime(tmp1,tmp2); + PyObject *res = PyList_New(3); + PyList_SetItem(res,0,SWIG_From_double(tmp0)); + PyList_SetItem(res,1,SWIG_From_int(tmp1)); + PyList_SetItem(res,2,SWIG_From_int(tmp2)); + return res; + } + } + }; class MEDCouplingDefinitionTime { @@ -5376,9 +5643,9 @@ namespace MEDCoupling } // agy : don't know why typemap fails here ??? let it in the extend section - PyObject *deepCpy(MEDCouplingCartesianAMRMeshGen *father) const throw(INTERP_KERNEL::Exception) + PyObject *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const throw(INTERP_KERNEL::Exception) { - return convertCartesianAMRMesh(self->deepCpy(father), SWIG_POINTER_OWN | 0 ); + return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 ); } MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector& pos) const throw(INTERP_KERNEL::Exception) @@ -5578,7 +5845,7 @@ namespace MEDCoupling { public: int getNumberOfLevels() const throw(INTERP_KERNEL::Exception); - MEDCouplingAMRAttribute *deepCpy() const throw(INTERP_KERNEL::Exception); + MEDCouplingAMRAttribute *deepCopy() 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); @@ -5656,7 +5923,7 @@ namespace MEDCoupling public: static DenseMatrix *New(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception); static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception); - DenseMatrix *deepCpy() const throw(INTERP_KERNEL::Exception); + DenseMatrix *deepCopy() const throw(INTERP_KERNEL::Exception); DenseMatrix *shallowCpy() const throw(INTERP_KERNEL::Exception); // int getNumberOfRows() const throw(INTERP_KERNEL::Exception); @@ -5743,107 +6010,6 @@ namespace MEDCoupling #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; - } - - virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception) - { - std::string ret1; - bool ret0(self->isEqual(other,ret1)); - PyObject *ret=PyTuple_New(2); - PyObject *ret0Py=ret0?Py_True:Py_False; - Py_XINCREF(ret0Py); - PyTuple_SetItem(ret,0,ret0Py); - PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str())); - return ret; - } - - virtual PyObject *deepCpy() const throw(INTERP_KERNEL::Exception) - { - return convertPartDefinition(self->deepCpy(),SWIG_POINTER_OWN | 0); - } - } - 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 %{