#include "MEDCouplingIMesh.hxx"
#include "MEDCouplingCurveLinearMesh.hxx"
#include "MEDCoupling1GTUMesh.hxx"
-#include "MEDCouplingField.hxx"
-#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingFieldInt.hxx"
-#include "MEDCouplingFieldFloat.hxx"
-#include "MEDCouplingFieldTemplate.hxx"
-#include "MEDCouplingGaussLocalization.hxx"
#include "MCAuto.hxx"
#include "MEDCouplingMultiFields.hxx"
#include "MEDCouplingFieldOverTime.hxx"
#include "MEDCouplingDefinitionTime.hxx"
-#include "MEDCouplingFieldDiscretization.hxx"
#include "MEDCouplingCartesianAMRMesh.hxx"
#include "MEDCouplingAMRAttribute.hxx"
#include "MEDCouplingMatrix.hxx"
}
//$$$$$$$$$$$$$$$$$$
-////////////////////
-%typemap(out) MEDCoupling::MEDCouplingFieldDiscretization*
-{
- $result=convertFieldDiscretization($1,$owner);
-}
-
-%typemap(out) MEDCouplingFieldDiscretization*
-{
- $result=convertFieldDiscretization($1,$owner);
-}
-//$$$$$$$$$$$$$$$$$$
-
////////////////////
%typemap(out) MEDCoupling::MEDCouplingMultiFields*
{
%feature("autodoc", "1");
%feature("docstring");
-%newobject MEDCoupling::MEDCouplingField::buildMeasureField;
-%newobject MEDCoupling::MEDCouplingField::getLocalizationOfDiscr;
-%newobject MEDCoupling::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
-%newobject MEDCoupling::MEDCouplingFieldDouble::New;
-%newobject MEDCoupling::MEDCouplingFieldDouble::getArray;
-%newobject MEDCoupling::MEDCouplingFieldDouble::getEndArray;
-%newobject MEDCoupling::MEDCouplingFieldDouble::MergeFields;
-%newobject MEDCoupling::MEDCouplingFieldDouble::MeldFields;
-%newobject MEDCoupling::MEDCouplingFieldDouble::convertToIntField;
-%newobject MEDCoupling::MEDCouplingFieldDouble::convertToFloatField;
-%newobject MEDCoupling::MEDCouplingFieldDouble::doublyContractedProduct;
-%newobject MEDCoupling::MEDCouplingFieldDouble::determinant;
-%newobject MEDCoupling::MEDCouplingFieldDouble::eigenValues;
-%newobject MEDCoupling::MEDCouplingFieldDouble::eigenVectors;
-%newobject MEDCoupling::MEDCouplingFieldDouble::inverse;
-%newobject MEDCoupling::MEDCouplingFieldDouble::trace;
-%newobject MEDCoupling::MEDCouplingFieldDouble::deviator;
-%newobject MEDCoupling::MEDCouplingFieldDouble::magnitude;
-%newobject MEDCoupling::MEDCouplingFieldDouble::maxPerTuple;
-%newobject MEDCoupling::MEDCouplingFieldDouble::keepSelectedComponents;
-%newobject MEDCoupling::MEDCouplingFieldDouble::extractSlice3D;
-%newobject MEDCoupling::MEDCouplingFieldDouble::DotFields;
-%newobject MEDCoupling::MEDCouplingFieldDouble::dot;
-%newobject MEDCoupling::MEDCouplingFieldDouble::CrossProductFields;
-%newobject MEDCoupling::MEDCouplingFieldDouble::crossProduct;
-%newobject MEDCoupling::MEDCouplingFieldDouble::MaxFields;
-%newobject MEDCoupling::MEDCouplingFieldDouble::max;
-%newobject MEDCoupling::MEDCouplingFieldDouble::MinFields;
-%newobject MEDCoupling::MEDCouplingFieldDouble::AddFields;
-%newobject MEDCoupling::MEDCouplingFieldDouble::SubstractFields;
-%newobject MEDCoupling::MEDCouplingFieldDouble::MultiplyFields;
-%newobject MEDCoupling::MEDCouplingFieldDouble::DivideFields;
-%newobject MEDCoupling::MEDCouplingFieldDouble::min;
-%newobject MEDCoupling::MEDCouplingFieldDouble::negate;
-%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__;
-%newobject MEDCoupling::MEDCouplingFieldDouble::__sub__;
-%newobject MEDCoupling::MEDCouplingFieldDouble::__mul__;
-%newobject MEDCoupling::MEDCouplingFieldDouble::__div__;
-%newobject MEDCoupling::MEDCouplingFieldDouble::__pow__;
-%newobject MEDCoupling::MEDCouplingFieldDouble::__radd__;
-%newobject MEDCoupling::MEDCouplingFieldDouble::__rsub__;
-%newobject MEDCoupling::MEDCouplingFieldDouble::__rmul__;
-%newobject MEDCoupling::MEDCouplingFieldDouble::__rdiv__;
-%newobject MEDCoupling::MEDCouplingFieldDouble::clone;
-%newobject MEDCoupling::MEDCouplingFieldDouble::cloneWithMesh;
-%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::MEDCouplingFieldInt::buildSubPart;
-%newobject MEDCoupling::MEDCouplingFieldInt::buildSubPartRange;
-%newobject MEDCoupling::MEDCouplingFieldInt::__getitem__;
-%newobject MEDCoupling::MEDCouplingFieldFloat::New;
-%newobject MEDCoupling::MEDCouplingFieldFloat::convertToDblField;
-%newobject MEDCoupling::MEDCouplingFieldFloat::getArray;
-%newobject MEDCoupling::MEDCouplingFieldFloat::deepCopy;
-%newobject MEDCoupling::MEDCouplingFieldFloat::clone;
-%newobject MEDCoupling::MEDCouplingFieldFloat::cloneWithMesh;
-%newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPart;
-%newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPartRange;
-%newobject MEDCoupling::MEDCouplingFieldFloat::__getitem__;
-%newobject MEDCoupling::MEDCouplingFieldTemplate::New;
%newobject MEDCoupling::MEDCouplingMesh::deepCopy;
%newobject MEDCoupling::MEDCouplingMesh::clone;
%newobject MEDCoupling::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
%newobject MEDCoupling::DenseMatrix::__add__;
%newobject MEDCoupling::DenseMatrix::__sub__;
%newobject MEDCoupling::DenseMatrix::__mul__;
-%newobject MEDCoupling::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell;
-%newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell;
%newobject MEDCoupling::MEDCouplingSkyLineArray::BuildFromPolyhedronConn;
%newobject MEDCoupling::MEDCouplingSkyLineArray::getSuperIndexArray;
%newobject MEDCoupling::MEDCouplingSkyLineArray::getIndexArray;
%feature("unref") MEDCouplingCMesh "$this->decrRef();"
%feature("unref") MEDCouplingIMesh "$this->decrRef();"
%feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
-%feature("unref") MEDCouplingField "$this->decrRef();"
-%feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
-%feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
-%feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
-%feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
-%feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
-%feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
%feature("unref") MEDCouplingMultiFields "$this->decrRef();"
%feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
%feature("unref") MEDCouplingMultiFields "$this->decrRef();"
%rename (InterpKernelException) INTERP_KERNEL::Exception;
+
+namespace MEDCoupling
+{
+ 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;
+
+ typedef enum
+ {
+ UNSTRUCTURED = 5,
+ CARTESIAN = 7,
+ EXTRUDED = 8,
+ CURVE_LINEAR = 9,
+ SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
+ SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
+ IMAGE_GRID = 12
+ } MEDCouplingMeshType;
+}
+
+%include "MEDCouplingNatureOfFieldEnum"
%include "MEDCouplingRefCountObject.i"
%include "MEDCouplingMemArray.i"
+%include "MEDCouplingField.i"
%{
void initializeMe()
namespace MEDCoupling
{
- 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;
-
- typedef enum
- {
- UNSTRUCTURED = 5,
- CARTESIAN = 7,
- EXTRUDED = 8,
- CURVE_LINEAR = 9,
- SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
- SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
- IMAGE_GRID = 12
- } MEDCouplingMeshType;
-
class DataArrayInt;
class DataArrayDouble;
class MEDCouplingUMesh;
//== MEDCouplingMesh End
%include "NormalizedGeometricTypes"
-%include "MEDCouplingNatureOfFieldEnum"
//
namespace MEDCoupling
{
namespace MEDCoupling
{
- class MEDCouplingGaussLocalization
- {
- public:
- MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
- MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
- INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
- void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
- int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
- int getDimension() const throw(INTERP_KERNEL::Exception);
- int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
- std::string getStringRepr() 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<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
- double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
- const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
- double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
- const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
- double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
- void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
- void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
- void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
- void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
- void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
- void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
- //
- static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
- //
- %extend
- {
- DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const throw(INTERP_KERNEL::Exception)
- {
- MCAuto<DataArrayDouble> ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh));
- return ret.retn();
- }
-
- MEDCouplingUMesh *buildRefCell() const throw(INTERP_KERNEL::Exception)
- {
- MCAuto<MEDCouplingUMesh> ret(self->buildRefCell());
- return ret.retn();
- }
- }
- };
+
class MEDCouplingSkyLineArray
{
};
}
-%include "MEDCouplingFieldDiscretization.i"
-
//== MEDCouplingPointSet
namespace MEDCoupling
}
+
namespace MEDCoupling
{
- class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel
+ class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
{
public:
+ int getNumberOfFields() 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 checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
- virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
- virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
- void setMesh(const MEDCoupling::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
- void setName(const char *name) throw(INTERP_KERNEL::Exception);
- std::string getDescription() const throw(INTERP_KERNEL::Exception);
- void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
- std::string getName() const throw(INTERP_KERNEL::Exception);
- TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
- NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
- virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
- DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
- int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
- int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
- void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
- void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
- MEDCouplingGaussLocalization& getGaussLocalization(int locId) 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)
- {
- MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
- if(ret1)
- ret1->incrRef();
- return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
- }
-
- PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
- {
- MEDCouplingFieldDiscretization *ret=self->getDiscretization();
- if(ret)
- ret->incrRef();
- 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 *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *ret1=0;
- MEDCouplingMesh *ret0=0;
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
- }
- PyObject *res = PyList_New(2);
- PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
- return res;
- }
-
- PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *ret1=0;
- int bb,ee,ss;
- MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
- PyObject *res=PyTuple_New(2);
- PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
- if(ret1)
- PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
- else
- {
- PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
- PyTuple_SetItem(res,1,res1);
- }
- return res;
- }
-
- DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
- {
- int sw,sz(-1);
- int v0; std::vector<int> v1;
- const int *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
- return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
- }
-
- void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
- }
- }
-
- PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> tmp;
- self->getCellIdsHavingGaussLocalization(locId,tmp);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)tmp.size(),1);
- std::copy(tmp.begin(),tmp.end(),ret->getPointer());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
-
- int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> inp0;
- convertPyToNewIntArr4(code,1,3,inp0);
- std::vector<const DataArrayInt *> inp1;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(idsPerType,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",inp1);
- return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
- }
- }
- };
-
- class MEDCouplingFieldTemplate : public MEDCoupling::MEDCouplingField
- {
- public:
- static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
- static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& 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);
- bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const throw(INTERP_KERNEL::Exception);
- bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const throw(INTERP_KERNEL::Exception);
%extend
{
- MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
- return MEDCouplingFieldTemplate::New(f);
+ return self->simpleRepr();
}
-
- MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f) throw(INTERP_KERNEL::Exception)
+ static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
{
- return MEDCouplingFieldTemplate::New(f);
+ std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
+ convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
+ int sz=tmp.size();
+ std::vector<MEDCouplingFieldDouble *> fs(sz);
+ for(int i=0;i<sz;i++)
+ fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
+ return MEDCouplingMultiFields::New(fs);
}
-
- MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f) throw(INTERP_KERNEL::Exception)
+ MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
{
- return MEDCouplingFieldTemplate::New(f);
+ std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
+ convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
+ int sz=tmp.size();
+ std::vector<MEDCouplingFieldDouble *> fs(sz);
+ for(int i=0;i<sz;i++)
+ fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
+ return MEDCouplingMultiFields::New(fs);
}
-
- MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
+ PyObject *getFields() const
{
- return MEDCouplingFieldTemplate::New(type);
+ std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
+ int sz=fields.size();
+ PyObject *res = PyList_New(sz);
+ for(int i=0;i<sz;i++)
+ {
+ if(fields[i])
+ {
+ fields[i]->incrRef();
+ PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+ }
+ else
+ {
+ PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 ));
+ }
+ }
+ return res;
}
-
- std::string __str__() const throw(INTERP_KERNEL::Exception)
+ PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
{
- return self->simpleRepr();
+ const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
+ if(ret)
+ {
+ ret->incrRef();
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
+ }
+ else
+ return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 );
}
-
- std::string __repr__() const throw(INTERP_KERNEL::Exception)
+ PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
{
- std::ostringstream oss;
- self->reprQuickOverview(oss);
- return oss.str();
+ std::vector<MEDCouplingMesh *> ms=self->getMeshes();
+ int sz=ms.size();
+ PyObject *res = PyList_New(sz);
+ for(int i=0;i<sz;i++)
+ {
+ if(ms[i])
+ {
+ ms[i]->incrRef();
+ PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
+ }
+ else
+ {
+ PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
+ }
+ }
+ return res;
}
-
- PyObject *isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec) const throw(INTERP_KERNEL::Exception)
+ PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
{
- std::string ret1;
- bool ret0=self->isEqualIfNotWhy(other,meshPrec,ret1);
+ std::vector<int> refs;
+ std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
+ int sz=ms.size();
+ PyObject *res = PyList_New(sz);
+ for(int i=0;i<sz;i++)
+ {
+ if(ms[i])
+ {
+ ms[i]->incrRef();
+ PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
+ }
+ else
+ {
+ PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
+ }
+ }
+ //
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;
- }
- }
- };
-
- class MEDCouplingFieldInt;
- class MEDCouplingFieldFloat;
-
- class MEDCouplingFieldDouble : public MEDCoupling::MEDCouplingField
- {
- public:
- static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
- static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
- bool isEqual(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
- bool isEqualWithoutConsideringStr(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
- void setTimeUnit(const std::string& unit);
- std::string getTimeUnit() const;
- void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
- void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
- 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);
- std::string writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldInt *convertToIntField() const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldFloat *convertToFloatField() const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
- MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
- 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);
- 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);
- void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
- void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
- void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
- void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
- int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
- int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
- int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
- void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
- double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
- void setIteration(int it) throw(INTERP_KERNEL::Exception);
- void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
- void setOrder(int order) throw(INTERP_KERNEL::Exception);
- void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
- void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
- void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
- 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 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);
- MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
- void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
- 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 fillFromAnalyticCompo(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
- void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
- void applyFunc(int nbOfComp, 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<std::string>& 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);
- void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
- double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
- double getMaxValue() const throw(INTERP_KERNEL::Exception);
- double getMinValue() const throw(INTERP_KERNEL::Exception);
- double getAverageValue() const throw(INTERP_KERNEL::Exception);
- double norm2() const throw(INTERP_KERNEL::Exception);
- double normMax() const throw(INTERP_KERNEL::Exception);
- //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
- double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
- 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 *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);
- static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
- static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
- static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
- static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
- static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
- static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
- static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
- static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
- %extend {
- MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
- {
- return MEDCouplingFieldDouble::New(type,td);
- }
-
- MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
- {
- return MEDCouplingFieldDouble::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();
- }
-
- PyObject *isEqualIfNotWhy(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
- {
- std::string ret1;
- bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,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;
- }
-
- MEDCouplingFieldDouble *voronoize(double eps) const throw(INTERP_KERNEL::Exception)
- {
- MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
- return ret.retn();
- }
-
- MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const throw(INTERP_KERNEL::Exception)
- {
- MCAuto<MEDCouplingFieldDouble> 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<double> 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)
- {
- DataArrayDouble *ret=self->getArray();
- if(ret)
- ret->incrRef();
- return ret;
- }
-
- PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
- {
- std::vector<DataArrayDouble *> arrs=self->getArrays();
- for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
- if(*it)
- (*it)->incrRef();
- int sz=arrs.size();
- PyObject *ret=PyTuple_New(sz);
- for(int i=0;i<sz;i++)
- {
- if(arrs[i])
- PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
- else
- PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ));
- }
- return ret;
- }
-
- void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayDouble *> tmp;
- convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
- int sz=tmp.size();
- std::vector<DataArrayDouble *> arrs(sz);
- for(int i=0;i<sz;i++)
- arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
- self->setArrays(arrs);
- }
-
- DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
- {
- DataArrayDouble *ret=self->getEndArray();
- if(ret)
- ret->incrRef();
- return ret;
- }
-
- PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
- {
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- const MEDCouplingMesh *mesh=self->getMesh();
- if(!mesh)
- throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
- int spaceDim=mesh->getSpaceDimension();
- const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
- const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
- //
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> res=new double[sz];
- self->getValueOn(spaceLoc,res);
- return convertDblArrToPyList<double>(res,sz);
- }
-
- PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
- {
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> res=new double[sz];
- self->getValueOnPos(i,j,k,res);
- return convertDblArrToPyList<double>(res,sz);
- }
-
- DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
- {
- const MEDCouplingMesh *mesh(self->getMesh());
- if(!mesh)
- throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
- //
- int sw,nbPts;
- double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
- const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
- mesh->getSpaceDimension(),true,nbPts);
- return self->getValueOnMulti(inp,nbPts);
- }
-
- PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
- {
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- const MEDCouplingMesh *mesh=self->getMesh();
- if(!mesh)
- throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
- int spaceDim=mesh->getSpaceDimension();
- const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
- const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
- //
- //
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> res=new double[sz];
- self->getValueOn(spaceLoc,time,res);
- return convertDblArrToPyList<double>(res,sz);
- }
-
- void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
- {
- if(self->getArray()!=0)
- MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
- else
- {
- MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
- MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
- self->setArray(arr);
- }
- }
-
- 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;
- }
-
- PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
- {
- int tmp1,tmp2;
- double tmp0=self->getStartTime(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;
- }
-
- PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
- {
- int tmp1,tmp2;
- double tmp0=self->getEndTime(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;
- }
- PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
- {
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
- self->accumulate(tmp);
- return convertDblArrToPyList<double>(tmp,sz);
- }
- PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
- {
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
- self->integral(isWAbs,tmp);
- return convertDblArrToPyList<double>(tmp,sz);
- }
- PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
- {
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
- self->getWeightedAverageValue(tmp,isWAbs);
- return convertDblArrToPyList<double>(tmp,sz);
- }
- PyObject *normL1() const throw(INTERP_KERNEL::Exception)
- {
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
- self->normL1(tmp);
- return convertDblArrToPyList<double>(tmp,sz);
- }
- PyObject *normL2() const throw(INTERP_KERNEL::Exception)
- {
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
- self->normL2(tmp);
- return convertDblArrToPyList<double>(tmp,sz);
- }
- void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
- {
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
- self->renumberCells(tmp,check);
- }
-
- void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
- {
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
- self->renumberCellsWithoutMesh(tmp,check);
- }
-
- void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
- {
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
- self->renumberNodes(tmp,eps);
- }
-
- void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
- {
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
- self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
- }
-
- MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- return fieldT_buildSubPart(self,li);
- }
-
- MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- return fieldT__getitem__(self,li);
- }
-
- PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *tmp;
- double r1=self->getMaxValue2(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *tmp;
- double r1=self->getMinValue2(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> tmp;
- convertPyToNewIntArr3(li,tmp);
- return self->keepSelectedComponents(tmp);
- }
-
- void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> tmp;
- convertPyToNewIntArr3(li,tmp);
- self->setSelectedComponents(f,tmp);
- }
-
- MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
- {
- double val,val2;
- DataArrayDouble *a,*a2;
- DataArrayDoubleTuple *aa,*aa2;
- std::vector<double> bb,bb2;
- int sw;
- int spaceDim=3;
- const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
- const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
- const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
- const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
- //
- return self->extractSlice3D(orig,vect,eps);
- }
-
- MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- return MEDCoupling_MEDCouplingFieldDouble___add__Impl(self,obj);
- }
-
- MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- return MEDCoupling_MEDCouplingFieldDouble___radd__Impl(self,obj);
- }
-
- MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__sub__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
- const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
- void *argp;
- //
- if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
- {
- MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
- if(other)
- return (*self)-(*other);
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- //
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
- ret->applyLin(1.,-val);
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(ret);
- return ret2.retn();
- }
- case 2:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(ret);
- return ret2.retn();
- }
- case 3:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(ret);
- return ret2.retn();
- }
- case 4:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(ret);
- return ret2.retn();
- }
- default:
- { throw INTERP_KERNEL::Exception(msg); }
- }
- }
-
- MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- return MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(self,obj);
- }
-
- MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- return MEDCoupling_MEDCouplingFieldDouble___mul__Impl(self,obj);
- }
-
- MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- return MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(self,obj);
- }
-
- MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__div__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
- const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
- void *argp;
- //
- if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
- {
- MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
- if(other)
- return (*self)/(*other);
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- //
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- if(val==0.)
- throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
- ret->applyLin(1./val,0);
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(ret);
- return ret2.retn();
- }
- case 2:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(ret);
- return ret2.retn();
- }
- case 3:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(ret);
- return ret2.retn();
- }
- case 4:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(ret);
- return ret2.retn();
- }
- default:
- { throw INTERP_KERNEL::Exception(msg); }
- }
- }
-
- MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- return MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
- }
-
- MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__pow__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
- const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
- void *argp;
- //
- if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
- {
- MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
- if(other)
- return (*self)^(*other);
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- //
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
- ret->applyPow(val);
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(ret);
- return ret2.retn();
- }
- case 2:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(ret);
- return ret2.retn();
- }
- case 3:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(ret);
- return ret2.retn();
- }
- case 4:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(ret);
- return ret2.retn();
- }
- default:
- { throw INTERP_KERNEL::Exception(msg); }
- }
- }
-
- MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
- {
- return self->negate();
- }
-
- PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__iadd__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
- const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
- void *argp;
- //
- if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
- {
- MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
- if(other)
- {
- *self+=*other;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- //
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- self->getArray()->applyLin(1.,val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(a);
- *self+=*ret2;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(aaa);
- *self+=*ret2;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- self->getArray()->addEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- { throw INTERP_KERNEL::Exception(msg); }
- }
- }
-
- PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__isub__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
- const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
- void *argp;
- //
- if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
- {
- MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
- if(other)
- {
- *self-=*other;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- //
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- self->getArray()->applyLin(1.,-val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(a);
- *self-=*ret2;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(aaa);
- *self-=*ret2;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- self->getArray()->substractEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- { throw INTERP_KERNEL::Exception(msg); }
- }
- }
-
- PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__imul__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
- const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
- void *argp;
- //
- if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
- {
- MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
- if(other)
- {
- *self*=*other;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- //
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- self->getArray()->applyLin(val,0);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(a);
- *self*=*ret2;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(aaa);
- *self*=*ret2;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- self->getArray()->multiplyEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- { throw INTERP_KERNEL::Exception(msg); }
- }
- }
-
- PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__idiv__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
- const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
- void *argp;
- //
- if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
- {
- MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
- if(other)
- {
- *self/=*other;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- //
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- if(val==0.)
- throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- self->getArray()->applyLin(1./val,0);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(a);
- *self/=*ret2;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(aaa);
- *self/=*ret2;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- self->getArray()->divideEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- { throw INTERP_KERNEL::Exception(msg); }
- }
- }
-
- PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__ipow__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
- const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
- void *argp;
- //
- if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
- {
- MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
- if(other)
- {
- *self^=*other;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- //
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- self->getArray()->applyPow(val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(a);
- *self^=*ret2;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
- ret2->setArray(aaa);
- *self^=*ret2;
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- if(!self->getArray())
- throw INTERP_KERNEL::Exception(msg2);
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- self->getArray()->powEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- { throw INTERP_KERNEL::Exception(msg); }
- }
- }
-
- static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const MEDCouplingFieldDouble *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
- return MEDCouplingFieldDouble::MergeFields(tmp);
- }
-
- static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const MEDCouplingFieldDouble *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
- return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
- }
-
- PyObject *getTinySerializationInformation() const throw(INTERP_KERNEL::Exception)
- {
- return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
- }
-
- PyObject *serialize() const throw(INTERP_KERNEL::Exception)
- {
- return field_serialize<double>(self);
- }
-
- static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
- {
- return NewMethWrapCallInitOnlyIfDictWithSingleEltInInputGeneral<SinglePyObjExpectToBeAListOfSz2>(cls,args,"MEDCouplingFieldDouble");
- }
-
- PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
- {// put an empty dict in input to say to __new__ to call __init__...
- return field__getnewargs__<MEDCouplingFieldDouble>(self);
- }
-
- PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
- {
- return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
- }
-
- void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
- {
- field__setstate__<double>(self,inp);
- }
- }
- };
-
- class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
- {
- public:
- int getNumberOfFields() 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 checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
- %extend
- {
- std::string __str__() const throw(INTERP_KERNEL::Exception)
- {
- return self->simpleRepr();
- }
- static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
- int sz=tmp.size();
- std::vector<MEDCouplingFieldDouble *> fs(sz);
- for(int i=0;i<sz;i++)
- fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
- return MEDCouplingMultiFields::New(fs);
- }
- MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
- int sz=tmp.size();
- std::vector<MEDCouplingFieldDouble *> fs(sz);
- for(int i=0;i<sz;i++)
- fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
- return MEDCouplingMultiFields::New(fs);
- }
- PyObject *getFields() const
- {
- std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
- int sz=fields.size();
- PyObject *res = PyList_New(sz);
- for(int i=0;i<sz;i++)
- {
- if(fields[i])
- {
- fields[i]->incrRef();
- PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
- }
- else
- {
- PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 ));
- }
- }
- return res;
- }
- PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
- {
- const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
- if(ret)
- {
- ret->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
- }
- else
- return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, 0 );
- }
- PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
- {
- std::vector<MEDCouplingMesh *> ms=self->getMeshes();
- int sz=ms.size();
- PyObject *res = PyList_New(sz);
- for(int i=0;i<sz;i++)
- {
- if(ms[i])
- {
- ms[i]->incrRef();
- PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
- }
- else
- {
- PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
- }
- }
- return res;
- }
- PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> refs;
- std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
- int sz=ms.size();
- PyObject *res = PyList_New(sz);
- for(int i=0;i<sz;i++)
- {
- if(ms[i])
- {
- ms[i]->incrRef();
- PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
- }
- else
- {
- PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, 0 ));
- }
- }
- //
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,res);
- PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
+ PyTuple_SetItem(ret,0,res);
+ PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
return ret;
}
PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
}
}
};
-
- class MEDCouplingFieldInt : public MEDCouplingField
- {
- public:
- static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
- static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
- bool isEqual(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const throw(INTERP_KERNEL::Exception);
- bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const throw(INTERP_KERNEL::Exception);
- 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);
- MEDCouplingFieldInt *buildSubPartRange(int begin, int end, int step) 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);
- }
-
- PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const throw(INTERP_KERNEL::Exception)
- {
- std::string ret1;
- bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,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;
- }
-
- 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();
- }
-
- MEDCouplingFieldInt *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- return fieldT_buildSubPart(self,li);
- }
-
- MEDCouplingFieldInt *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- return fieldT__getitem__(self,li);
- }
-
- 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;
- }
-
- PyObject *getTinySerializationInformation() const throw(INTERP_KERNEL::Exception)
- {
- return field_getTinySerializationInformation<MEDCouplingFieldInt>(self);
- }
-
- PyObject *serialize() const throw(INTERP_KERNEL::Exception)
- {
- return field_serialize<int>(self);
- }
-
- static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
- {
- return NewMethWrapCallInitOnlyIfDictWithSingleEltInInputGeneral<SinglePyObjExpectToBeAListOfSz2>(cls,args,"MEDCouplingFieldInt");
- }
-
- PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
- {// put an empty dict in input to say to __new__ to call __init__...
- return field__getnewargs__<MEDCouplingFieldInt>(self);
- }
-
- PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
- {
- return field__getstate__<MEDCouplingFieldInt>(self,MEDCoupling_MEDCouplingFieldInt_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt_serialize);
- }
-
- void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
- {
- field__setstate__<int>(self,inp);
- }
- }
- };
-
- class MEDCouplingFieldFloat : public MEDCouplingField
- {
- public:
- static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
- static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
- bool isEqual(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const throw(INTERP_KERNEL::Exception);
- bool isEqualWithoutConsideringStr(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const throw(INTERP_KERNEL::Exception);
- 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(DataArrayFloat *array) throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldFloat *deepCopy() const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldFloat *clone(bool recDeepCpy) const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *convertToDblField() const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
- %extend {
- MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
- {
- return MEDCouplingFieldFloat::New(type,td);
- }
-
- MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
- {
- return MEDCouplingFieldFloat::New(ft,td);
- }
-
- PyObject *isEqualIfNotWhy(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const throw(INTERP_KERNEL::Exception)
- {
- std::string ret1;
- bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,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;
- }
-
- 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();
- }
-
- MEDCouplingFieldFloat *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- return fieldT_buildSubPart(self,li);
- }
-
- MEDCouplingFieldFloat *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- return fieldT__getitem__(self,li);
- }
-
- DataArrayFloat *getArray() throw(INTERP_KERNEL::Exception)
- {
- DataArrayFloat *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;
- }
-
- PyObject *getTinySerializationInformation() const throw(INTERP_KERNEL::Exception)
- {
- return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
- }
-
- PyObject *serialize() const throw(INTERP_KERNEL::Exception)
- {
- return field_serialize<float>(self);
- }
-
- static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
- {
- return NewMethWrapCallInitOnlyIfDictWithSingleEltInInputGeneral<SinglePyObjExpectToBeAListOfSz2>(cls,args,"MEDCouplingFieldFloat");
- }
-
- PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
- {// put an empty dict in input to say to __new__ to call __init__...
- return field__getnewargs__<MEDCouplingFieldFloat>(self);
- }
-
- PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
- {
- return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
- }
-
- void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
- {
- field__setstate__<float>(self,inp);
- }
- }
- };
class MEDCouplingDefinitionTime
{
--- /dev/null
+// Copyright (C) 2017 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (EDF R&D)
+
+%{
+#include "MEDCouplingField.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingFieldInt.hxx"
+#include "MEDCouplingFieldFloat.hxx"
+#include "MEDCouplingFieldTemplate.hxx"
+#include "MEDCouplingFieldDiscretization.hxx"
+#include "MEDCouplingGaussLocalization.hxx"
+%}
+
+%include "MEDCouplingFieldDiscretization.i"
+
+////////////////////
+%typemap(out) MEDCoupling::MEDCouplingFieldDiscretization*
+{
+ $result=convertFieldDiscretization($1,$owner);
+}
+
+%typemap(out) MEDCouplingFieldDiscretization*
+{
+ $result=convertFieldDiscretization($1,$owner);
+}
+//$$$$$$$$$$$$$$$$$$
+
+%newobject MEDCoupling::MEDCouplingField::buildMeasureField;
+%newobject MEDCoupling::MEDCouplingField::getLocalizationOfDiscr;
+%newobject MEDCoupling::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
+%newobject MEDCoupling::MEDCouplingFieldDouble::New;
+%newobject MEDCoupling::MEDCouplingFieldDouble::getArray;
+%newobject MEDCoupling::MEDCouplingFieldDouble::getEndArray;
+%newobject MEDCoupling::MEDCouplingFieldDouble::MergeFields;
+%newobject MEDCoupling::MEDCouplingFieldDouble::MeldFields;
+%newobject MEDCoupling::MEDCouplingFieldDouble::convertToIntField;
+%newobject MEDCoupling::MEDCouplingFieldDouble::convertToFloatField;
+%newobject MEDCoupling::MEDCouplingFieldDouble::doublyContractedProduct;
+%newobject MEDCoupling::MEDCouplingFieldDouble::determinant;
+%newobject MEDCoupling::MEDCouplingFieldDouble::eigenValues;
+%newobject MEDCoupling::MEDCouplingFieldDouble::eigenVectors;
+%newobject MEDCoupling::MEDCouplingFieldDouble::inverse;
+%newobject MEDCoupling::MEDCouplingFieldDouble::trace;
+%newobject MEDCoupling::MEDCouplingFieldDouble::deviator;
+%newobject MEDCoupling::MEDCouplingFieldDouble::magnitude;
+%newobject MEDCoupling::MEDCouplingFieldDouble::maxPerTuple;
+%newobject MEDCoupling::MEDCouplingFieldDouble::keepSelectedComponents;
+%newobject MEDCoupling::MEDCouplingFieldDouble::extractSlice3D;
+%newobject MEDCoupling::MEDCouplingFieldDouble::DotFields;
+%newobject MEDCoupling::MEDCouplingFieldDouble::dot;
+%newobject MEDCoupling::MEDCouplingFieldDouble::CrossProductFields;
+%newobject MEDCoupling::MEDCouplingFieldDouble::crossProduct;
+%newobject MEDCoupling::MEDCouplingFieldDouble::MaxFields;
+%newobject MEDCoupling::MEDCouplingFieldDouble::max;
+%newobject MEDCoupling::MEDCouplingFieldDouble::MinFields;
+%newobject MEDCoupling::MEDCouplingFieldDouble::AddFields;
+%newobject MEDCoupling::MEDCouplingFieldDouble::SubstractFields;
+%newobject MEDCoupling::MEDCouplingFieldDouble::MultiplyFields;
+%newobject MEDCoupling::MEDCouplingFieldDouble::DivideFields;
+%newobject MEDCoupling::MEDCouplingFieldDouble::min;
+%newobject MEDCoupling::MEDCouplingFieldDouble::negate;
+%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__;
+%newobject MEDCoupling::MEDCouplingFieldDouble::__sub__;
+%newobject MEDCoupling::MEDCouplingFieldDouble::__mul__;
+%newobject MEDCoupling::MEDCouplingFieldDouble::__div__;
+%newobject MEDCoupling::MEDCouplingFieldDouble::__pow__;
+%newobject MEDCoupling::MEDCouplingFieldDouble::__radd__;
+%newobject MEDCoupling::MEDCouplingFieldDouble::__rsub__;
+%newobject MEDCoupling::MEDCouplingFieldDouble::__rmul__;
+%newobject MEDCoupling::MEDCouplingFieldDouble::__rdiv__;
+%newobject MEDCoupling::MEDCouplingFieldDouble::clone;
+%newobject MEDCoupling::MEDCouplingFieldDouble::cloneWithMesh;
+%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::MEDCouplingFieldInt::buildSubPart;
+%newobject MEDCoupling::MEDCouplingFieldInt::buildSubPartRange;
+%newobject MEDCoupling::MEDCouplingFieldInt::__getitem__;
+%newobject MEDCoupling::MEDCouplingFieldFloat::New;
+%newobject MEDCoupling::MEDCouplingFieldFloat::convertToDblField;
+%newobject MEDCoupling::MEDCouplingFieldFloat::getArray;
+%newobject MEDCoupling::MEDCouplingFieldFloat::deepCopy;
+%newobject MEDCoupling::MEDCouplingFieldFloat::clone;
+%newobject MEDCoupling::MEDCouplingFieldFloat::cloneWithMesh;
+%newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPart;
+%newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPartRange;
+%newobject MEDCoupling::MEDCouplingFieldFloat::__getitem__;
+%newobject MEDCoupling::MEDCouplingFieldTemplate::New;
+%newobject MEDCoupling::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell;
+%newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell;
+
+%feature("unref") MEDCouplingField "$this->decrRef();"
+%feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
+%feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
+%feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
+%feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
+%feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
+%feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
+%feature("unref") MEDCouplingFieldInt "$this->decrRef();"
+%feature("unref") MEDCouplingFieldFloat "$this->decrRef();"
+
+namespace MEDCoupling
+{
+ class MEDCouplingMesh;
+
+ class MEDCouplingGaussLocalization
+ {
+ public:
+ MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
+ const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
+ MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
+ INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
+ void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
+ int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
+ int getDimension() const throw(INTERP_KERNEL::Exception);
+ int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
+ std::string getStringRepr() 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<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
+ double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
+ const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
+ double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
+ const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
+ double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
+ void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
+ void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
+ void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
+ void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
+ void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
+ void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
+ //
+ static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
+ //
+ %extend
+ {
+ DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<DataArrayDouble> ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh));
+ return ret.retn();
+ }
+
+ MEDCouplingUMesh *buildRefCell() const throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<MEDCouplingUMesh> ret(self->buildRefCell());
+ return ret.retn();
+ }
+ }
+ };
+
+ class MEDCouplingFieldDouble;
+
+ class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel
+ {
+ public:
+ virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
+ virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
+ virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
+ void setMesh(const MEDCoupling::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
+ void setName(const char *name) throw(INTERP_KERNEL::Exception);
+ std::string getDescription() const throw(INTERP_KERNEL::Exception);
+ void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
+ std::string getName() const throw(INTERP_KERNEL::Exception);
+ TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
+ NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
+ virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
+ int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
+ int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
+ void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
+ const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
+ void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
+ MEDCouplingGaussLocalization& getGaussLocalization(int locId) 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)
+ {
+ MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
+ if(ret1)
+ ret1->incrRef();
+ return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
+ }
+
+ PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
+ {
+ MEDCouplingFieldDiscretization *ret=self->getDiscretization();
+ if(ret)
+ ret->incrRef();
+ 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 *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ MEDCouplingMesh *ret0=0;
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
+ }
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
+ }
+ PyObject *res = PyList_New(2);
+ PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
+ return res;
+ }
+
+ PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ int bb,ee,ss;
+ MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
+ PyObject *res=PyTuple_New(2);
+ PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
+ if(ret1)
+ PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
+ else
+ {
+ PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
+ PyTuple_SetItem(res,1,res1);
+ }
+ return res;
+ }
+
+ DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
+ {
+ int sw,sz(-1);
+ int v0; std::vector<int> v1;
+ const int *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
+ return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
+ }
+
+ void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
+ const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
+ }
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
+ }
+ }
+
+ PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> tmp;
+ self->getCellIdsHavingGaussLocalization(locId,tmp);
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc((int)tmp.size(),1);
+ std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ }
+
+ int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> inp0;
+ convertPyToNewIntArr4(code,1,3,inp0);
+ std::vector<const DataArrayInt *> inp1;
+ convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(idsPerType,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",inp1);
+ return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
+ }
+ }
+ };
+
+ class MEDCouplingFieldTemplate : public MEDCoupling::MEDCouplingField
+ {
+ public:
+ static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
+ static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& 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);
+ bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const throw(INTERP_KERNEL::Exception);
+ bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDCouplingFieldTemplate::New(f);
+ }
+
+ MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDCouplingFieldTemplate::New(f);
+ }
+
+ MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDCouplingFieldTemplate::New(f);
+ }
+
+ MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDCouplingFieldTemplate::New(type);
+ }
+
+ 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();
+ }
+
+ PyObject *isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec) const throw(INTERP_KERNEL::Exception)
+ {
+ std::string ret1;
+ bool ret0=self->isEqualIfNotWhy(other,meshPrec,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;
+ }
+ }
+ };
+
+ class MEDCouplingFieldInt;
+ class MEDCouplingFieldFloat;
+
+ class MEDCouplingFieldDouble : public MEDCoupling::MEDCouplingField
+ {
+ public:
+ static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
+ static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
+ bool isEqual(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
+ bool isEqualWithoutConsideringStr(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
+ void setTimeUnit(const std::string& unit);
+ std::string getTimeUnit() const;
+ void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
+ void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
+ 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);
+ std::string writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldInt *convertToIntField() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *convertToFloatField() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
+ MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
+ 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);
+ 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);
+ void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
+ void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
+ void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
+ void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
+ int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
+ int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
+ int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
+ void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
+ double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
+ void setIteration(int it) throw(INTERP_KERNEL::Exception);
+ void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
+ void setOrder(int order) throw(INTERP_KERNEL::Exception);
+ void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
+ void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
+ void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
+ 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 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);
+ MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
+ void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
+ 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 fillFromAnalyticCompo(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
+ void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
+ void applyFunc(int nbOfComp, 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<std::string>& 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);
+ void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
+ double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
+ double getMaxValue() const throw(INTERP_KERNEL::Exception);
+ double getMinValue() const throw(INTERP_KERNEL::Exception);
+ double getAverageValue() const throw(INTERP_KERNEL::Exception);
+ double norm2() const throw(INTERP_KERNEL::Exception);
+ double normMax() const throw(INTERP_KERNEL::Exception);
+ //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
+ double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
+ 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 *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);
+ static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
+ static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
+ static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
+ static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
+ static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
+ static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
+ static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
+ static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
+ %extend {
+ MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
+ {
+ return MEDCouplingFieldDouble::New(type,td);
+ }
+
+ MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
+ {
+ return MEDCouplingFieldDouble::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();
+ }
+
+ PyObject *isEqualIfNotWhy(const MEDCouplingFieldDouble *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
+ {
+ std::string ret1;
+ bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,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;
+ }
+
+ MEDCouplingFieldDouble *voronoize(double eps) const throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
+ return ret.retn();
+ }
+
+ MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<MEDCouplingFieldDouble> 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<double> 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)
+ {
+ DataArrayDouble *ret=self->getArray();
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<DataArrayDouble *> arrs=self->getArrays();
+ for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
+ if(*it)
+ (*it)->incrRef();
+ int sz=arrs.size();
+ PyObject *ret=PyTuple_New(sz);
+ for(int i=0;i<sz;i++)
+ {
+ if(arrs[i])
+ PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
+ else
+ PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ));
+ }
+ return ret;
+ }
+
+ void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<const DataArrayDouble *> tmp;
+ convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
+ int sz=tmp.size();
+ std::vector<DataArrayDouble *> arrs(sz);
+ for(int i=0;i<sz;i++)
+ arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
+ self->setArrays(arrs);
+ }
+
+ DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayDouble *ret=self->getEndArray();
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
+ {
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ const MEDCouplingMesh *mesh=self->getMesh();
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
+ int spaceDim=mesh->getSpaceDimension();
+ const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
+ const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
+ //
+ int sz=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<double> res=new double[sz];
+ self->getValueOn(spaceLoc,res);
+ return convertDblArrToPyList<double>(res,sz);
+ }
+
+ PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
+ {
+ int sz=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<double> res=new double[sz];
+ self->getValueOnPos(i,j,k,res);
+ return convertDblArrToPyList<double>(res,sz);
+ }
+
+ DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
+ {
+ const MEDCouplingMesh *mesh(self->getMesh());
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
+ //
+ int sw,nbPts;
+ double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
+ const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
+ mesh->getSpaceDimension(),true,nbPts);
+ return self->getValueOnMulti(inp,nbPts);
+ }
+
+ PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
+ {
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ const MEDCouplingMesh *mesh=self->getMesh();
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
+ int spaceDim=mesh->getSpaceDimension();
+ const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
+ const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
+ //
+ //
+ int sz=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<double> res=new double[sz];
+ self->getValueOn(spaceLoc,time,res);
+ return convertDblArrToPyList<double>(res,sz);
+ }
+
+ void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
+ {
+ if(self->getArray()!=0)
+ MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
+ else
+ {
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
+ MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
+ self->setArray(arr);
+ }
+ }
+
+ 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;
+ }
+
+ PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
+ {
+ int tmp1,tmp2;
+ double tmp0=self->getStartTime(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;
+ }
+
+ PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
+ {
+ int tmp1,tmp2;
+ double tmp0=self->getEndTime(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;
+ }
+ PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
+ {
+ int sz=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
+ self->accumulate(tmp);
+ return convertDblArrToPyList<double>(tmp,sz);
+ }
+ PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
+ {
+ int sz=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
+ self->integral(isWAbs,tmp);
+ return convertDblArrToPyList<double>(tmp,sz);
+ }
+ PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
+ {
+ int sz=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
+ self->getWeightedAverageValue(tmp,isWAbs);
+ return convertDblArrToPyList<double>(tmp,sz);
+ }
+ PyObject *normL1() const throw(INTERP_KERNEL::Exception)
+ {
+ int sz=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
+ self->normL1(tmp);
+ return convertDblArrToPyList<double>(tmp,sz);
+ }
+ PyObject *normL2() const throw(INTERP_KERNEL::Exception)
+ {
+ int sz=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
+ self->normL2(tmp);
+ return convertDblArrToPyList<double>(tmp,sz);
+ }
+ void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
+ {
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ self->renumberCells(tmp,check);
+ }
+
+ void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
+ {
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ self->renumberCellsWithoutMesh(tmp,check);
+ }
+
+ void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
+ {
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ self->renumberNodes(tmp,eps);
+ }
+
+ void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
+ {
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
+ }
+
+ MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ return fieldT_buildSubPart(self,li);
+ }
+
+ MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ return fieldT__getitem__(self,li);
+ }
+
+ PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *tmp;
+ double r1=self->getMaxValue2(tmp);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *tmp;
+ double r1=self->getMinValue2(tmp);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> tmp;
+ convertPyToNewIntArr3(li,tmp);
+ return self->keepSelectedComponents(tmp);
+ }
+
+ void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> tmp;
+ convertPyToNewIntArr3(li,tmp);
+ self->setSelectedComponents(f,tmp);
+ }
+
+ MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
+ {
+ double val,val2;
+ DataArrayDouble *a,*a2;
+ DataArrayDoubleTuple *aa,*aa2;
+ std::vector<double> bb,bb2;
+ int sw;
+ int spaceDim=3;
+ const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
+ const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
+ const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
+ const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
+ //
+ return self->extractSlice3D(orig,vect,eps);
+ }
+
+ MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDCoupling_MEDCouplingFieldDouble___add__Impl(self,obj);
+ }
+
+ MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDCoupling_MEDCouplingFieldDouble___radd__Impl(self,obj);
+ }
+
+ MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__sub__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
+ const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
+ void *argp;
+ //
+ if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
+ {
+ MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
+ if(other)
+ return (*self)-(*other);
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ //
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
+ switch(sw)
+ {
+ case 1:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
+ ret->applyLin(1.,-val);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(ret);
+ return ret2.retn();
+ }
+ case 2:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(ret);
+ return ret2.retn();
+ }
+ case 3:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(ret);
+ return ret2.retn();
+ }
+ case 4:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(ret);
+ return ret2.retn();
+ }
+ default:
+ { throw INTERP_KERNEL::Exception(msg); }
+ }
+ }
+
+ MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(self,obj);
+ }
+
+ MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDCoupling_MEDCouplingFieldDouble___mul__Impl(self,obj);
+ }
+
+ MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(self,obj);
+ }
+
+ MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__div__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
+ const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
+ void *argp;
+ //
+ if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
+ {
+ MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
+ if(other)
+ return (*self)/(*other);
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ //
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
+ switch(sw)
+ {
+ case 1:
+ {
+ if(val==0.)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
+ ret->applyLin(1./val,0);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(ret);
+ return ret2.retn();
+ }
+ case 2:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(ret);
+ return ret2.retn();
+ }
+ case 3:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(ret);
+ return ret2.retn();
+ }
+ case 4:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(ret);
+ return ret2.retn();
+ }
+ default:
+ { throw INTERP_KERNEL::Exception(msg); }
+ }
+ }
+
+ MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
+ }
+
+ MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__pow__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
+ const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
+ void *argp;
+ //
+ if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
+ {
+ MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
+ if(other)
+ return (*self)^(*other);
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ //
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
+ switch(sw)
+ {
+ case 1:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
+ ret->applyPow(val);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(ret);
+ return ret2.retn();
+ }
+ case 2:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(ret);
+ return ret2.retn();
+ }
+ case 3:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(ret);
+ return ret2.retn();
+ }
+ case 4:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(ret);
+ return ret2.retn();
+ }
+ default:
+ { throw INTERP_KERNEL::Exception(msg); }
+ }
+ }
+
+ MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->negate();
+ }
+
+ PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__iadd__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
+ const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
+ void *argp;
+ //
+ if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
+ {
+ MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
+ if(other)
+ {
+ *self+=*other;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ //
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
+ switch(sw)
+ {
+ case 1:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ self->getArray()->applyLin(1.,val);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 2:
+ {
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(a);
+ *self+=*ret2;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 3:
+ {
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(aaa);
+ *self+=*ret2;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 4:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ self->getArray()->addEqual(aaa);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ default:
+ { throw INTERP_KERNEL::Exception(msg); }
+ }
+ }
+
+ PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__isub__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
+ const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
+ void *argp;
+ //
+ if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
+ {
+ MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
+ if(other)
+ {
+ *self-=*other;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ //
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
+ switch(sw)
+ {
+ case 1:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ self->getArray()->applyLin(1.,-val);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 2:
+ {
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(a);
+ *self-=*ret2;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 3:
+ {
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(aaa);
+ *self-=*ret2;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 4:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ self->getArray()->substractEqual(aaa);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ default:
+ { throw INTERP_KERNEL::Exception(msg); }
+ }
+ }
+
+ PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__imul__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
+ const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
+ void *argp;
+ //
+ if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
+ {
+ MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
+ if(other)
+ {
+ *self*=*other;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ //
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
+ switch(sw)
+ {
+ case 1:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ self->getArray()->applyLin(val,0);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 2:
+ {
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(a);
+ *self*=*ret2;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 3:
+ {
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(aaa);
+ *self*=*ret2;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 4:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ self->getArray()->multiplyEqual(aaa);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ default:
+ { throw INTERP_KERNEL::Exception(msg); }
+ }
+ }
+
+ PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__idiv__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
+ const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
+ void *argp;
+ //
+ if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
+ {
+ MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
+ if(other)
+ {
+ *self/=*other;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ //
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
+ switch(sw)
+ {
+ case 1:
+ {
+ if(val==0.)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ self->getArray()->applyLin(1./val,0);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 2:
+ {
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(a);
+ *self/=*ret2;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 3:
+ {
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(aaa);
+ *self/=*ret2;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 4:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ self->getArray()->divideEqual(aaa);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ default:
+ { throw INTERP_KERNEL::Exception(msg); }
+ }
+ }
+
+ PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__ipow__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
+ const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
+ void *argp;
+ //
+ if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
+ {
+ MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
+ if(other)
+ {
+ *self^=*other;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ //
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
+ switch(sw)
+ {
+ case 1:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ self->getArray()->applyPow(val);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 2:
+ {
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(a);
+ *self^=*ret2;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 3:
+ {
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
+ ret2->setArray(aaa);
+ *self^=*ret2;
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 4:
+ {
+ if(!self->getArray())
+ throw INTERP_KERNEL::Exception(msg2);
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ self->getArray()->powEqual(aaa);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ default:
+ { throw INTERP_KERNEL::Exception(msg); }
+ }
+ }
+
+ static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<const MEDCouplingFieldDouble *> tmp;
+ convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
+ return MEDCouplingFieldDouble::MergeFields(tmp);
+ }
+
+ static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<const MEDCouplingFieldDouble *> tmp;
+ convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
+ return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
+ }
+
+ PyObject *getTinySerializationInformation() const throw(INTERP_KERNEL::Exception)
+ {
+ return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
+ }
+
+ PyObject *serialize() const throw(INTERP_KERNEL::Exception)
+ {
+ return field_serialize<double>(self);
+ }
+
+ static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
+ {
+ return NewMethWrapCallInitOnlyIfDictWithSingleEltInInputGeneral<SinglePyObjExpectToBeAListOfSz2>(cls,args,"MEDCouplingFieldDouble");
+ }
+
+ PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
+ {// put an empty dict in input to say to __new__ to call __init__...
+ return field__getnewargs__<MEDCouplingFieldDouble>(self);
+ }
+
+ PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
+ {
+ return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
+ }
+
+ void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
+ {
+ field__setstate__<double>(self,inp);
+ }
+ }
+ };
+
+ class MEDCouplingFieldInt : public MEDCouplingField
+ {
+ public:
+ static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
+ static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
+ bool isEqual(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const throw(INTERP_KERNEL::Exception);
+ bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const throw(INTERP_KERNEL::Exception);
+ 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);
+ MEDCouplingFieldInt *buildSubPartRange(int begin, int end, int step) 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);
+ }
+
+ PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const throw(INTERP_KERNEL::Exception)
+ {
+ std::string ret1;
+ bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,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;
+ }
+
+ 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();
+ }
+
+ MEDCouplingFieldInt *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ return fieldT_buildSubPart(self,li);
+ }
+
+ MEDCouplingFieldInt *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ return fieldT__getitem__(self,li);
+ }
+
+ 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;
+ }
+
+ PyObject *getTinySerializationInformation() const throw(INTERP_KERNEL::Exception)
+ {
+ return field_getTinySerializationInformation<MEDCouplingFieldInt>(self);
+ }
+
+ PyObject *serialize() const throw(INTERP_KERNEL::Exception)
+ {
+ return field_serialize<int>(self);
+ }
+
+ static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
+ {
+ return NewMethWrapCallInitOnlyIfDictWithSingleEltInInputGeneral<SinglePyObjExpectToBeAListOfSz2>(cls,args,"MEDCouplingFieldInt");
+ }
+
+ PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
+ {// put an empty dict in input to say to __new__ to call __init__...
+ return field__getnewargs__<MEDCouplingFieldInt>(self);
+ }
+
+ PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
+ {
+ return field__getstate__<MEDCouplingFieldInt>(self,MEDCoupling_MEDCouplingFieldInt_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt_serialize);
+ }
+
+ void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
+ {
+ field__setstate__<int>(self,inp);
+ }
+ }
+ };
+
+ class MEDCouplingFieldFloat : public MEDCouplingField
+ {
+ public:
+ static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
+ static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
+ bool isEqual(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const throw(INTERP_KERNEL::Exception);
+ bool isEqualWithoutConsideringStr(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const throw(INTERP_KERNEL::Exception);
+ 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(DataArrayFloat *array) throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *deepCopy() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *clone(bool recDeepCpy) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *convertToDblField() const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
+ %extend {
+ MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
+ {
+ return MEDCouplingFieldFloat::New(type,td);
+ }
+
+ MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
+ {
+ return MEDCouplingFieldFloat::New(ft,td);
+ }
+
+ PyObject *isEqualIfNotWhy(const MEDCouplingFieldFloat *other, double meshPrec, float valsPrec) const throw(INTERP_KERNEL::Exception)
+ {
+ std::string ret1;
+ bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,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;
+ }
+
+ 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();
+ }
+
+ MEDCouplingFieldFloat *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ return fieldT_buildSubPart(self,li);
+ }
+
+ MEDCouplingFieldFloat *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ return fieldT__getitem__(self,li);
+ }
+
+ DataArrayFloat *getArray() throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayFloat *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;
+ }
+
+ PyObject *getTinySerializationInformation() const throw(INTERP_KERNEL::Exception)
+ {
+ return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
+ }
+
+ PyObject *serialize() const throw(INTERP_KERNEL::Exception)
+ {
+ return field_serialize<float>(self);
+ }
+
+ static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
+ {
+ return NewMethWrapCallInitOnlyIfDictWithSingleEltInInputGeneral<SinglePyObjExpectToBeAListOfSz2>(cls,args,"MEDCouplingFieldFloat");
+ }
+
+ PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
+ {// put an empty dict in input to say to __new__ to call __init__...
+ return field__getnewargs__<MEDCouplingFieldFloat>(self);
+ }
+
+ PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
+ {
+ return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
+ }
+
+ void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
+ {
+ field__setstate__<float>(self,inp);
+ }
+ }
+ };
+}