#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingExtrudedMesh.hxx"
#include "MEDCouplingCMesh.hxx"
+#include "MEDCouplingCurveLinearMesh.hxx"
#include "MEDCouplingField.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldTemplate.hxx"
$result=convertMesh($1,$owner);
}
+%typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
+{
+ $result=convertMesh($1,$owner);
+}
+
%typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
{
$result=convertFieldDiscretization($1,$owner);
%feature("docstring");
%newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getOffsetArr;
+%newobject ParaMEDMEM::MEDCouplingFieldDiscretization::clone;
+%newobject ParaMEDMEM::MEDCouplingFieldDiscretization::clonePart;
%newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
%newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
%newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
%newobject ParaMEDMEM::DataArrayInt::renumberAndReduce;
%newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2O;
%newobject ParaMEDMEM::DataArrayInt::invertArrayN2O2O2N;
+%newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2OBis;
%newobject ParaMEDMEM::DataArrayInt::getIdsEqual;
%newobject ParaMEDMEM::DataArrayInt::getIdsNotEqual;
%newobject ParaMEDMEM::DataArrayInt::getIdsEqualList;
%newobject ParaMEDMEM::DataArrayInt::buildComplement;
%newobject ParaMEDMEM::DataArrayInt::buildUnion;
%newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
+%newobject ParaMEDMEM::DataArrayInt::buildSubstractionOptimized;
%newobject ParaMEDMEM::DataArrayInt::buildIntersection;
+%newobject ParaMEDMEM::DataArrayInt::buildUnique;
%newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
%newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
%newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
%newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
%newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
%newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
+%newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
+%newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
%newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
%newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
%newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
%newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
%newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
%newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
+%newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
%newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
%newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
%newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
%newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
%newobject ParaMEDMEM::MEDCouplingUMesh::__getitem__;
%newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
-%newobject ParaMEDMEM::MEDCouplingUMesh::giveCellsWithType;
%newobject ParaMEDMEM::MEDCouplingUMesh::zipConnectivityTraducer;
%newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
%newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
+%newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
%newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
%newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
-%newobject ParaMEDMEM::MEDCouplingUMesh::computeNbOfNodesPerCell;
%newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
%newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
%newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
+%newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
%newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
%newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
%newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
%newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
%newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
%newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
+%newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
%newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
%newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
%newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
%newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
%newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
%newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
+%newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
+%newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
%newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
%newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
%newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsLyingOnNodes;
%newobject ParaMEDMEM::MEDCouplingCMesh::New;
%newobject ParaMEDMEM::MEDCouplingCMesh::clone;
%newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
+%newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
+%newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
+%newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
%newobject ParaMEDMEM::MEDCouplingMultiFields::New;
%newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
%newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
%feature("unref") MEDCouplingMultiFields "$this->decrRef();"
%rename(assign) *::operator=;
+%ignore ParaMEDMEM::MEDCouplingVersionMajMinRel;
%ignore ParaMEDMEM::RefCountObject::decrRef;
%ignore ParaMEDMEM::MemArray::operator=;
%ignore ParaMEDMEM::MemArray::operator[];
}
%include "MEDCouplingTimeLabel.hxx"
-%include "MEDCouplingRefCountObject.hxx"
+
+namespace ParaMEDMEM
+{
+ typedef enum
+ {
+ C_DEALLOC = 2,
+ CPP_DEALLOC = 3
+ } DeallocType;
+
+ typedef enum
+ {
+ ON_CELLS = 0,
+ ON_NODES = 1,
+ ON_GAUSS_PT = 2,
+ ON_GAUSS_NE = 3,
+ ON_NODES_KR = 4
+ } TypeOfField;
+
+ typedef enum
+ {
+ NO_TIME = 4,
+ ONE_TIME = 5,
+ LINEAR_TIME = 6,
+ CONST_ON_TIME_INTERVAL = 7
+ } TypeOfTimeDiscretization;
+
+ const char *MEDCouplingVersionStr();
+ int MEDCouplingVersion();
+ PyObject *MEDCouplingVersionMajMinRel()
+ {
+ int tmp0=0,tmp1=0,tmp2=0;
+ MEDCouplingVersionMajMinRel(tmp0,tmp1,tmp2);
+ PyObject *res = PyList_New(3);
+ PyList_SetItem(res,0,SWIG_From_int(tmp0));
+ PyList_SetItem(res,1,SWIG_From_int(tmp1));
+ PyList_SetItem(res,2,SWIG_From_int(tmp2));
+ return res;
+ }
+
+ class MEDCOUPLING_EXPORT RefCountObject
+ {
+ protected:
+ RefCountObject();
+ RefCountObject(const RefCountObject& other);
+ ~RefCountObject();
+ public:
+ bool decrRef() const;
+ void incrRef() const;
+ virtual std::size_t getHeapMemorySize() const;
+ };
+}
namespace ParaMEDMEM
{
UNSTRUCTURED = 5,
UNSTRUCTURED_DESC = 6,
CARTESIAN = 7,
- EXTRUDED = 8
+ EXTRUDED = 8,
+ CURVE_LINEAR = 9
} MEDCouplingMeshType;
class DataArrayInt;
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 DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
+ virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
- virtual std::string simpleRepr() const;
- virtual std::string advancedRepr() const;
+ virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
+ virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
// tools
virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
+ static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
%extend
{
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->simpleRepr();
}
PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
{
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- MEDCouplingMesh *ret=self->buildPart(tmp,((const int *)tmp)+size);
- return convertMesh(ret, SWIG_POINTER_OWN | 0 );
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- MEDCouplingMesh *ret=self->buildPart(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
- ret->setName(da2->getName().c_str());
- return convertMesh(ret, SWIG_POINTER_OWN | 0 );
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
+ if(sw==3)//DataArrayInt
+ {
+ void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
+ DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
+ std::string name=argpt->getName();
+ if(!name.empty())
+ ret->setName(name.c_str());
}
+ return convertMesh(ret, SWIG_POINTER_OWN | 0 );
}
- PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- void *da=0;
- DataArrayInt *arr=0;
- MEDCouplingMesh *ret=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- ret=self->buildPartAndReduceNodes(tmp,((const int *)tmp)+size,arr);
+ PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ DataArrayInt *arr=0;
+ const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
+ if(sw==3)//DataArrayInt
+ {
+ void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
+ DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
+ std::string name=argpt->getName();
+ if(!name.empty())
+ ret->setName(name.c_str());
}
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- ret=self->buildPartAndReduceNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),arr);
- ret->setName(da2->getName().c_str());
- }
- PyObject *res = PyList_New(2);
- PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
- PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
- PyList_SetItem(res,0,obj0);
- PyList_SetItem(res,1,obj1);
- return res;
- }
+ //
+ PyObject *res = PyList_New(2);
+ PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
+ PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ PyList_SetItem(res,0,obj0);
+ PyList_SetItem(res,1,obj1);
+ return res;
+ }
PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
{
return ret;
}
- void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
- {
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- int spaceDim=self->getSpaceDimension();
- const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
- const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
- self->translate(vectorPtr);
- }
+ void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
+ {
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ int spaceDim=self->getSpaceDimension();
+ const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
+ const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
+ self->translate(vectorPtr);
+ }
void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
{
%extend ParaMEDMEM::DataArrayInt
{
PyObject *getDifferentValues() const throw(INTERP_KERNEL::Exception)
- {
- std::set<int> ret=self->getDifferentValues();
- return convertIntArrToPyList3(ret);
- }
+ {
+ std::set<int> ret=self->getDifferentValues();
+ return convertIntArrToPyList3(ret);
+ }
+
+ PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> ret1;
+ std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
+ std::size_t sz=ret0.size();
+ PyObject *pyRet=PyTuple_New(2);
+ PyObject *pyRet0=PyList_New((int)sz);
+ PyObject *pyRet1=PyList_New((int)sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
+ }
+ PyTuple_SetItem(pyRet,0,pyRet0);
+ PyTuple_SetItem(pyRet,1,pyRet1);
+ return pyRet;
+ }
+}
+
+%extend ParaMEDMEM::MEDCouplingFieldDiscretization
+{
+ MEDCouplingFieldDiscretization *clonePart(PyObject *li)
+ {
+ int sz=0,sw=-1,val1=-1;
+ std::vector<int> val2;
+ const int *inp=convertObjToPossibleCpp1_Safe(li,sw,sz,val1,val2);
+ return self->clonePart(inp,inp+sz);
+ }
+}
+
+%extend ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell
+{
+ PyObject *getArrayOfDiscIds() const
+ {
+ DataArrayInt *ret=const_cast<DataArrayInt *>(self->getArrayOfDiscIds());
+ if(ret)
+ ret->incrRef();
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ }
}
%ignore ParaMEDMEM::DataArray::getInfoOnComponents;
%ignore ParaMEDMEM::DataArrayInt::getDifferentValues;
+%ignore ParaMEDMEM::DataArrayInt::partitionByDifferentValues;
+%ignore ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell::getArrayOfDiscIds;
+%ignore ParaMEDMEM::MEDCouplingFieldDiscretization::clonePart;
%include "MEDCouplingMemArray.hxx"
%include "NormalizedUnstructuredMesh.hxx"
void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const throw(INTERP_KERNEL::Exception);
void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings) throw(INTERP_KERNEL::Exception);
- virtual void getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector<int>& elems) throw(INTERP_KERNEL::Exception);
+ virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
virtual DataArrayInt *findBoundaryNodes() const;
%extend
{
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->simpleRepr();
}
ret1->incrRef();
return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
}
+
PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
{
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,((const int *)tmp)+size,keepCoords);
- return convertMesh(ret, SWIG_POINTER_OWN | 0 );
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- MEDCouplingPointSet *ret=self->buildPartOfMySelf(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),keepCoords);
- ret->setName(da2->getName().c_str());
- return convertMesh(ret, SWIG_POINTER_OWN | 0 );
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
+ if(sw==3)//DataArrayInt
+ {
+ void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
+ DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
+ std::string name=argpt->getName();
+ if(!name.empty())
+ ret->setName(name.c_str());
}
+ return convertMesh(ret, SWIG_POINTER_OWN | 0 );
}
+
PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
{
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,((const int *)tmp)+size,fullyIn);
- return convertMesh(ret, SWIG_POINTER_OWN | 0 );
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
- ret->setName(da2->getName().c_str());
- return convertMesh(ret, SWIG_POINTER_OWN | 0 );
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
+ if(sw==3)//DataArrayInt
+ {
+ void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
+ DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
+ std::string name=argpt->getName();
+ if(!name.empty())
+ ret->setName(name.c_str());
}
+ return convertMesh(ret, SWIG_POINTER_OWN | 0 );
}
+
PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
{
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,((const int *)tmp)+size,fullyIn);
- return convertMesh(ret, SWIG_POINTER_OWN | 0 );
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
- ret->setName(da2->getName().c_str());
- return convertMesh(ret, SWIG_POINTER_OWN | 0 );
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
+ if(sw==3)//DataArrayInt
+ {
+ void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
+ DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
+ std::string name=argpt->getName();
+ if(!name.empty())
+ ret->setName(name.c_str());
}
+ return convertMesh(ret, SWIG_POINTER_OWN | 0 );
}
void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
{
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- self->renumberNodes(tmp,newNbOfNodes);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- self->renumberNodes(da2->getConstPointer(),newNbOfNodes);
- }
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ self->renumberNodes(tmp,newNbOfNodes);
}
+
void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
{
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- self->renumberNodes2(tmp,newNbOfNodes);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- self->renumberNodes2(da2->getConstPointer(),newNbOfNodes);
- }
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ self->renumberNodes2(tmp,newNbOfNodes);
}
+
PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
{
int spaceDim=self->getSpaceDimension();
std::copy(nodes.begin(),nodes.end(),ret->getPointer());
return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
+
PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
{
double val;
int spaceDim=self->getSpaceDimension();
const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
- std::vector<int> tmp=self->getNodeIdsNearPoint(pos,eps);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)tmp.size(),1);
- std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+ DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfNodes, double eps) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> c,cI;
+ DataArrayInt *c=0,*cI=0;
//
double val;
DataArrayDouble *a;
const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfNodes,spaceDim,true);
self->getNodeIdsNearPoints(pos,nbOfNodes,eps,c,cI);
PyObject *ret=PyTuple_New(2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
- d0->alloc(c.size(),1);
- d1->alloc(cI.size(),1);
- std::copy(c.begin(),c.end(),d0->getPointer());
- std::copy(cI.begin(),cI.end(),d1->getPointer());
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- d0->incrRef();
- d1->incrRef();
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> c,cI;
+ DataArrayInt *c=0,*cI=0;
int spaceDim=self->getSpaceDimension();
- void *da=0;
- int res1=SWIG_ConvertPtr(pt,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(pt,&size);
- int nbOfPoints=size/spaceDim;
- if(size%spaceDim!=0)
- {
- throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
- }
- self->getNodeIdsNearPoints(tmp,nbOfPoints,eps,c,cI);
- }
- else
- {
- DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
- da2->checkAllocated();
- int size=da2->getNumberOfTuples();
- int nbOfCompo=da2->getNumberOfComponents();
- if(nbOfCompo!=spaceDim)
- {
- throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
- }
- self->getNodeIdsNearPoints(da2->getConstPointer(),size,eps,c,cI);
- }
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ int nbOfTuples=-1;
+ const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
+ self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
+ //
PyObject *ret=PyTuple_New(2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
- d0->alloc(c.size(),1);
- d1->alloc(cI.size(),1);
- std::copy(c.begin(),c.end(),d0->getPointer());
- std::copy(cI.begin(),cI.end(),d1->getPointer());
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- d0->incrRef();
- d1->incrRef();
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> elems;
- //
- //
double val;
DataArrayDouble *a;
DataArrayDoubleTuple *aa;
const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
//
- self->getCellsInBoundingBox(tmp,eps,elems);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)elems.size(),1);
- std::copy(elems.begin(),elems.end(),ret->getPointer());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
for(int i=0;i<sz;i++)
PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
}
+
+ static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
+ {
+ int sz,sz2;
+ INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
+ int sw,nbNodes=0;
+ double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
+ std::vector<double> val3;
+ const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
+ "Rotate2DAlg",2,true,nbNodes);
+ if(sw!=2 && sw!=3)
+ throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
+ ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
+ }
+
static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
{
int sz,sz2;
INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
INTERP_KERNEL::AutoPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
- double *v=convertPyToNewDblArr2(vect,&sz2);
+ INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
for(int i=0;i<sz;i++)
PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
}
+
+ static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
+ {
+ int sz,sz2;
+ INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
+ int sw,nbNodes=0;
+ double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
+ std::vector<double> val3;
+ const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
+ "Rotate3DAlg",3,true,nbNodes);
+ if(sw!=2 && sw!=3)
+ throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
+ INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
+ ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
+ }
}
};
int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
int getMeshLength() const throw(INTERP_KERNEL::Exception);
void computeTypes() throw(INTERP_KERNEL::Exception);
- DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
//tools
DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
+ bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
- DataArrayInt *zipConnectivityTraducer(int compType) throw(INTERP_KERNEL::Exception);
- DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) 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);
void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
+ DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
+ std::string cppRepr() const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
+ DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
return MEDCouplingUMesh::New(meshName,meshDim);
}
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->simpleRepr();
}
void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
{
- int sz;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&sz);
- if(size>sz)
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ if(size>szArr)
{
- std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << sz << " !";
+ std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
self->insertNextCell(type,size,tmp);
void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
{
- int sz;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&sz);
- self->insertNextCell(type,sz,tmp);
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ self->insertNextCell(type,szArr,tmp);
}
DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
PyList_SetItem(res,i,PyInt_FromLong(*iL));
return res;
}
+
+ static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
+ {
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
+ int nbOfDepthPeelingPerformed=0;
+ DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
+ PyObject *res=PyTuple_New(2);
+ PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
+ return res;
+ }
+
+ PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *v0=0,*v1=0;
+ self->findCommonCells(compType,startCellId,v0,v1);
+ PyObject *res = PyList_New(2);
+ PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return res;
+ }
+
+ static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *v0=0,*v1=0;
+ MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
+ PyObject *res = PyList_New(2);
+ PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return res;
+ }
+
+ PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
+ {
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ int nbOfCompo=self->getSpaceDimension();
+ const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
+ //
+ int cellId=-1,nodeId=-1;
+ double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId,nodeId);
+ PyObject *ret=PyTuple_New(3);
+ PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
+ PyTuple_SetItem(ret,2,PyInt_FromLong(nodeId));
+ return ret;
+ }
+
PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
{
bool ret1;
return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
- PyObject *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> cells;
- self->findAndCorrectBadOriented3DExtrudedCells(cells);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)cells.size(),1);
- std::copy(cells.begin(),cells.end(),ret->getPointer());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
-
PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
{
double vec[3];
return ret;
}
+ PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> 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_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
{
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=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_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- d0->incrRef();
- d1->incrRef();
- d2->incrRef();
- d3->incrRef();
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
return ret;
}
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_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- d0->incrRef();
- d1->incrRef();
- d2->incrRef();
- d3->incrRef();
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
return ret;
}
return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
}
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->simpleRepr();
}
}
};
- class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingMesh
+ class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
+ {
+ public:
+ void updateTime() const throw(INTERP_KERNEL::Exception);
+ int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
+ int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
+ };
+
+ class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
{
public:
static MEDCouplingCMesh *New();
const DataArrayDouble *coordsY=0,
const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
- void updateTime() const throw(INTERP_KERNEL::Exception);
%extend {
MEDCouplingCMesh()
{
{
return MEDCouplingCMesh::New(meshName);
}
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->simpleRepr();
}
}
}
};
+
+ class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
+ {
+ public:
+ static MEDCouplingCurveLinearMesh *New();
+ static MEDCouplingCurveLinearMesh *New(const char *meshName);
+ MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
+ void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
+ std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
+ %extend {
+ MEDCouplingCurveLinearMesh()
+ {
+ return MEDCouplingCurveLinearMesh::New();
+ }
+ MEDCouplingCurveLinearMesh(const char *meshName)
+ {
+ return MEDCouplingCurveLinearMesh::New(meshName);
+ }
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
+ }
+ DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayDouble *ret=self->getCoords();
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
+ {
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
+ self->setNodeGridStructure(tmp,tmp+szArr);
+ }
+ }
+ };
+
}
%extend ParaMEDMEM::MEDCouplingFieldDiscretizationKriging
{
{
return self->buildDADouble(1,self->getNumberOfCompo());
}
+
+ PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
+ ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
+ ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+
+ PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
+ ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+
+ PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
+ ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+
PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
{
int sw;
return DataArrayDouble::New();
}
- static DataArrayDouble *New(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
+ static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
{
const char *msg="ParaMEDMEM::DataArrayDouble::New : Available API are : \n-DataArrayDouble.New()\n--DataArrayDouble.New([1.,3.,4.])\n-DataArrayDouble.New([1.,3.,4.],3)\n-DataArrayDouble.New([1.,3.,4.,5.],2,2)\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2) !";
if(PyList_Check(elt0) || PyTuple_Check(elt0))
{
- if(elt1)
+ if(nbOfTuples)
{
- if(PyInt_Check(elt1))
+ if(PyInt_Check(nbOfTuples))
{
- int nbOfTuples=PyInt_AS_LONG(elt1);
- if(nbOfTuples<0)
+ int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
if(elt2)
{
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
- double *tmp=new double[nbOfTuples*nbOfCompo];
- try { fillArrayWithPyListDbl(elt0,tmp,nbOfTuples*nbOfCompo,0.,true); }
- catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
- ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfCompo);
+ std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
+ ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
ret->incrRef();
return ret;
}
else
{//DataArrayDouble.New([1.,3.,4.],3)
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
- double *tmp=new double[nbOfTuples];
- try { fillArrayWithPyListDbl(elt0,tmp,nbOfTuples,0.,true); }
- catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
- ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,1);
+ int tmpp1=-1;
+ std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
+ ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
ret->incrRef();
return ret;
}
}
else
{// DataArrayDouble.New([1.,3.,4.])
- int szz=-1;
- if(PyList_Check(elt0))
- szz=PyList_Size(elt0);
- else
- szz=PyTuple_Size(elt0);
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
- double *tmp=new double[szz];
- try { fillArrayWithPyListDbl(elt0,tmp,szz,0.,true); }
- catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
- ret->useArray(tmp,true,CPP_DEALLOC,szz,1);
+ int tmpp1=-1,tmpp2=-1;
+ std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
+ ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
ret->incrRef();
return ret;
}
}
else if(PyInt_Check(elt0))
{
- int nbOfTuples=PyInt_AS_LONG(elt0);
- if(nbOfTuples<0)
+ int nbOfTuples1=PyInt_AS_LONG(elt0);
+ if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
- if(elt1)
+ if(nbOfTuples)
{
if(!elt2)
{
- if(PyInt_Check(elt1))
+ if(PyInt_Check(nbOfTuples))
{//DataArrayDouble.New(5,2)
- int nbOfCompo=PyInt_AS_LONG(elt1);
+ int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
- ret->alloc(nbOfTuples,nbOfCompo);
+ ret->alloc(nbOfTuples1,nbOfCompo);
ret->incrRef();
return ret;
}
else
{//DataArrayDouble.New(5)
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
- ret->alloc(nbOfTuples,1);
+ ret->alloc(nbOfTuples1,1);
ret->incrRef();
return ret;
}
throw INTERP_KERNEL::Exception(msg);
}
- DataArrayDouble(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
+ DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
{
- return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,elt1,elt2);
+ return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
}
std::string __str__() const
{
return self->iterator();
}
-
- void setValues(PyObject *li, int nbOfTuples, int nbOfElsPerTuple) throw(INTERP_KERNEL::Exception)
+
+ void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
{
- double *tmp=new double[nbOfTuples*nbOfElsPerTuple];
- try
+ const char *msg="ParaMEDMEM::DataArrayDouble::setValues : Available API are : \n-DataArrayDouble.setValues([1.,3.,4.])\n-DataArrayDouble.setValues([1.,3.,4.],3)\n-DataArrayDouble.setValues([1.,3.,4.,5.],2,2)\n-DataArrayDouble.setValues([(1.,1.7),(3.,3.7),(4.,4.7)])\n !";
+ if(PyList_Check(li) || PyTuple_Check(li))
{
- fillArrayWithPyListDbl(li,tmp,nbOfTuples*nbOfElsPerTuple,0.,false);
- }
- catch(INTERP_KERNEL::Exception& e)
- {
- delete [] tmp;
- throw e;
+ if(nbOfTuples)
+ {
+ if(PyInt_Check(nbOfTuples))
+ {
+ int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ if(nbOfTuples1<0)
+ throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
+ if(nbOfComp)
+ {
+ if(PyInt_Check(nbOfComp))
+ {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
+ int nbOfCompo=PyInt_AS_LONG(nbOfComp);
+ if(nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
+ std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
+ self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {//DataArrayDouble.setValues([1.,3.,4.],3)
+ int tmpp1=-1;
+ std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
+ self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {// DataArrayDouble.setValues([1.,3.,4.])
+ int tmpp1=-1,tmpp2=-1;
+ std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
+ self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
+ }
}
- self->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfElsPerTuple);
+ else
+ throw INTERP_KERNEL::Exception(msg);
}
PyObject *getValues() throw(INTERP_KERNEL::Exception)
return res;
}
+ PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
+ {
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ int tupleId=-1,nbTuples=-1,nbOfCompo=self->getNumberOfComponents();
+ const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
+ //
+ int cellId=-1,nodeId=-1;
+ double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
+ return ret;
+ }
+
void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
{
std::vector<int> tmp;
const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
- std::vector<int> c,cI;
+ DataArrayInt *c=0,*cI=0;
self->computeTupleIdsNearTuples(inpu,eps,c,cI);
- DataArrayInt *ret0=DataArrayInt::New(),*ret1=DataArrayInt::New();
- ret0->alloc((int)c.size(),1); std::copy(c.begin(),c.end(),ret0->getPointer());
- ret1->alloc((int)cI.size(),1); std::copy(cI.begin(),cI.end(),ret1->getPointer());
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
return ret;
}
return self;
case 2:
tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+ tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
return self;
case 3:
return self;
case 2:
tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+ tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
return self;
case 3:
return self;
case 2:
tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+ tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
return self;
case 3:
return self;
case 2:
tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+ tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
return self;
case 3:
}
case 11:
{
- int bb=pt1.first;
- int ee=pt1.second.first;
- int ss=pt1.second.second;
- if(ee<bb || ss<=0)
- throw INTERP_KERNEL::Exception("Invalid slice in tuple selection");
- int nbOfE=(ee-bb)/ss;
- std::vector<int> nv(nbOfE);
- for(int jj=0;jj<nbOfE;jj++)
- nv[jj]=bb+jj*ss;
switch(sw1)
{
case 1:
- self->setPartOfValuesSimple2(i1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
+ self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
return self;
case 2:
tmp=DataArrayDouble::New();
tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size(),false);
+ self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
return self;
case 3:
- self->setPartOfValues2(d1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
+ self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
return self;
default:
throw INTERP_KERNEL::Exception(msg);
return self;
case 2:
tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+ tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
return self;
case 3:
return self;
case 2:
tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+ tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
return self;
case 3:
PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
{
- std::vector<int> c,cI;
+ DataArrayInt *c=0,*cI=0;
//
self->computeTupleIdsNearTuples(other,eps,c,cI);
PyObject *ret=PyTuple_New(2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
- d0->alloc(c.size(),1);
- d1->alloc(cI.size(),1);
- std::copy(c.begin(),c.end(),d0->getPointer());
- std::copy(cI.begin(),cI.end(),d1->getPointer());
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- d0->incrRef();
- d1->incrRef();
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
return ret;
}
};
{
return self->buildDAInt(1,self->getNumberOfCompo());
}
+
+ PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+
+ PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+
+ PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+
+ PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+
+ PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
{
return DataArrayInt::New();
}
- static DataArrayInt *New(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
+ static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
{
const char *msg="ParaMEDMEM::DataArrayInt::New : Available API are : \n-DataArrayInt.New()\n--DataArrayInt.New([1,3,4])\n-DataArrayInt.New([1,3,4],3)\n-DataArrayInt.New([1,3,4,5],2,2)\n-DataArrayInt.New(5)\n-DataArrayInt.New(5,2) !";
if(PyList_Check(elt0) || PyTuple_Check(elt0))
{
- if(elt1)
+ if(nbOfTuples)
{
- if(PyInt_Check(elt1))
+ if(PyInt_Check(nbOfTuples))
{
- int nbOfTuples=PyInt_AS_LONG(elt1);
- if(nbOfTuples<0)
+ int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
- if(elt2)
+ if(nbOfComp)
{
- if(PyInt_Check(elt2))
+ if(PyInt_Check(nbOfComp))
{//DataArrayInt.New([1,3,4,5],2,2)
- int nbOfCompo=PyInt_AS_LONG(elt2);
+ int nbOfCompo=PyInt_AS_LONG(nbOfComp);
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
- int *tmp=new int[nbOfTuples*nbOfCompo];
- try { fillArrayWithPyListInt(elt0,tmp,nbOfTuples*nbOfCompo,0,true); }
- catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
- ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfCompo);
+ std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
+ ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
ret->incrRef();
return ret;
}
else
{//DataArrayInt.New([1,3,4],3)
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
- int *tmp=new int[nbOfTuples];
- try { fillArrayWithPyListInt(elt0,tmp,nbOfTuples,0,true); }
- catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
- ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,1);
+ int tmpp1=-1;
+ std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
+ ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
ret->incrRef();
return ret;
}
}
else
{// DataArrayInt.New([1,3,4])
- int szz=-1;
- if(PyList_Check(elt0))
- szz=PyList_Size(elt0);
- else
- szz=PyTuple_Size(elt0);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
- int *tmp=new int[szz];
- try { fillArrayWithPyListInt(elt0,tmp,szz,0,true); }
- catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
- ret->useArray(tmp,true,CPP_DEALLOC,szz,1);
+ int tmpp1=-1,tmpp2=-1;
+ std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
+ ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
ret->incrRef();
return ret;
}
}
else if(PyInt_Check(elt0))
{
- int nbOfTuples=PyInt_AS_LONG(elt0);
- if(nbOfTuples<0)
+ int nbOfTuples1=PyInt_AS_LONG(elt0);
+ if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
- if(elt1)
+ if(nbOfTuples)
{
- if(!elt2)
+ if(!nbOfComp)
{
- if(PyInt_Check(elt1))
+ if(PyInt_Check(nbOfTuples))
{//DataArrayInt.New(5,2)
- int nbOfCompo=PyInt_AS_LONG(elt1);
+ int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(nbOfTuples,nbOfCompo);
+ ret->alloc(nbOfTuples1,nbOfCompo);
ret->incrRef();
return ret;
}
else
{//DataArrayInt.New(5)
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(nbOfTuples,1);
+ ret->alloc(nbOfTuples1,1);
ret->incrRef();
return ret;
}
throw INTERP_KERNEL::Exception(msg);
}
- DataArrayInt(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
+ DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
{
- return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,elt1,elt2);
+ return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
}
std::string __str__() const
{
return self->iterator();
}
-
- static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, const DataArrayInt *arr, const DataArrayInt *arrI) throw(INTERP_KERNEL::Exception)
+
+ PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
+ {
+ int sz=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
+ self->accumulate(tmp);
+ return convertIntArrToPyList(tmp,sz);
+ }
+
+ static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
{
int newNbOfTuples=-1;
- DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arr,arrI,newNbOfTuples);
+ int szArr,szArrI,sw,iTypppArr,iTypppArrI;
+ std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
+ const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
+ DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
return ret;
}
- void setValues(PyObject *li, int nbOfTuples, int nbOfElsPerTuple) throw(INTERP_KERNEL::Exception)
+ void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
{
- int *tmp=new int[nbOfTuples*nbOfElsPerTuple];
- try
+ const char *msg="ParaMEDMEM::DataArrayInt::setValues : Available API are : \n-DataArrayInt.setValues([1,3,4])\n-DataArrayInt.setValues([1,3,4],3)\n-DataArrayInt.setValues([1,3,4,5],2,2)\n-DataArrayInt.New(5)\n !";
+ if(PyList_Check(li) || PyTuple_Check(li))
{
- fillArrayWithPyListInt(li,tmp,nbOfTuples*nbOfElsPerTuple,0,false);
- }
- catch(INTERP_KERNEL::Exception& e)
- {
- delete [] tmp;
- throw e;
+ if(nbOfTuples)
+ {
+ if(PyInt_Check(nbOfTuples))
+ {
+ int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ if(nbOfTuples<0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
+ if(nbOfComp)
+ {
+ if(PyInt_Check(nbOfComp))
+ {//DataArrayInt.setValues([1,3,4,5],2,2)
+ int nbOfCompo=PyInt_AS_LONG(nbOfComp);
+ if(nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
+ std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
+ self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {//DataArrayInt.setValues([1,3,4],3)
+ int tmpp1=-1;
+ std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
+ self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {// DataArrayInt.setValues([1,3,4])
+ int tmpp1=-1,tmpp2=-1;
+ std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
+ self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
+ }
}
- self->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfElsPerTuple);
+ else
+ throw INTERP_KERNEL::Exception(msg);
}
PyObject *getValues() throw(INTERP_KERNEL::Exception)
return ret;
}
- void transformWithIndArr(PyObject *li)
+ void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
{
void *da=0;
int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
return self;
case 2:
tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+ tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
return self;
case 3:
return self;
case 2:
tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+ tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
return self;
case 3:
return self;
case 2:
tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+ tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
return self;
case 3:
return self;
case 2:
tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+ tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
return self;
case 3:
}
case 11:
{
- int bb=pt1.first;
- int ee=pt1.second.first;
- int ss=pt1.second.second;
- if(ee<bb || ss<=0)
- throw INTERP_KERNEL::Exception("Invalid slice in tuple selection");
- int nbOfE=(ee-bb)/ss;
- std::vector<int> nv(nbOfE);
- for(int jj=0;jj<nbOfE;jj++)
- nv[jj]=bb+jj*ss;
switch(sw1)
{
case 1:
- self->setPartOfValuesSimple2(i1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
+ self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
return self;
case 2:
tmp=DataArrayInt::New();
tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size(),false);
+ self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
return self;
case 3:
- self->setPartOfValues2(d1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
+ self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
return self;
case 4:
tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
+ self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
return self;
default:
throw INTERP_KERNEL::Exception(msg);
return self;
case 2:
tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+ tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
return self;
case 3:
return self;
case 2:
tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+ tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
return self;
case 3:
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);
+ virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
void setName(const char *name) throw(INTERP_KERNEL::Exception);
const char *getDescription() const throw(INTERP_KERNEL::Exception);
int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
+ int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
+ void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
%extend {
PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
{
return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
}
+ PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
+ {
+ std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
+ return convertIntArrToPyList3(ret);
+ }
+
PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
{
std::string ret1;
class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
{
public:
- static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=NO_TIME);
- static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td=NO_TIME);
+ static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
+ static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td=ONE_TIME);
void setTimeUnit(const char *unit);
const char *getTimeUnit() const;
- void copyTinyStringsFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
+ void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
- std::string simpleRepr() const;
- std::string advancedRepr() const;
+ void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
+ std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
+ std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
+ void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
MEDCouplingFieldDouble *deepCpy() const;
TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
+ void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *operator*(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *operator/(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
%extend {
- MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=NO_TIME)
+ MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
{
return MEDCouplingFieldDouble::New(type,td);
}
- MEDCouplingFieldDouble(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td=NO_TIME)
+ MEDCouplingFieldDouble(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td=ONE_TIME)
{
return MEDCouplingFieldDouble::New(ft,td);
}
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->simpleRepr();
}
public:
static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
static MEDCouplingFieldTemplate *New(TypeOfField type);
- std::string simpleRepr() const;
- std::string advancedRepr() const;
+ std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
+ std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
void updateTime() const;
%extend
{
return MEDCouplingFieldTemplate::New(type);
}
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->simpleRepr();
}
public:
int getNumberOfFields() const;
MEDCouplingMultiFields *deepCpy() const;
- virtual std::string simpleRepr() const;
- virtual std::string advancedRepr() 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);
void updateTime() const throw(INTERP_KERNEL::Exception);
%extend
{
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->simpleRepr();
}
fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
return MEDCouplingFieldOverTime::New(fs);
}
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->simpleRepr();
}