#include "MEDCouplingField.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldInt.hxx"
+#include "MEDCouplingFieldFloat.hxx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingGaussLocalization.hxx"
#include "MCAuto.hxx"
%init %{ import_array(); %}
#endif
+%init %{ initializeMe(); %}
+
%feature("autodoc", "1");
%feature("docstring");
%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::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell;
%newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell;
%newobject MEDCoupling::MEDCouplingSkyLineArray::BuildFromPolyhedronConn;
+%newobject MEDCoupling::MEDCouplingSkyLineArray::getSuperIndexArray;
+%newobject MEDCoupling::MEDCouplingSkyLineArray::getIndexArray;
+%newobject MEDCoupling::MEDCouplingSkyLineArray::getValuesArray;
%feature("unref") MEDCouplingPointSet "$this->decrRef();"
%feature("unref") MEDCouplingMesh "$this->decrRef();"
%include "MEDCouplingRefCountObject.i"
%include "MEDCouplingMemArray.i"
+%{
+ void initializeMe()
+ {// AGY : here initialization of C++ traits in MEDCouplingDataArrayTypemaps.i for code factorization. Awful, I know, but no other solutions.
+ SWIGTITraits<double>::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble;
+ SWIGTITraits<float>::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat;
+ SWIGTITraits<int>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt;
+ SWIGTITraits<double>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple;
+ SWIGTITraits<float>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple;
+ SWIGTITraits<int>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayIntTuple;
+ }
+%}
+
namespace INTERP_KERNEL
{
/*!
{
int sw,sz(-1);
int v0; std::vector<int> v1;
- const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
+ const int *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
self->renumberCells(ids,check);
}
int spaceDim=self->getSpaceDimension();
INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
self->getBoundingBox(tmp);
- PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
+ PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,spaceDim);
return ret;
}
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
if(sw==3)//DataArrayInt
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
DataArrayInt *arr=0;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
if(sw==3)//DataArrayInt
{
int getNumberOf() const;
int getLength() const;
- DataArrayInt* getSuperIndexArray() const;
- DataArrayInt* getIndexArray() const;
- DataArrayInt* getValuesArray() const;
-
void deletePack(const int i, const int j) throw(INTERP_KERNEL::Exception);
%extend
{
return self->simpleRepr();
}
+
+ DataArrayInt *getSuperIndexArray() const
+ {
+ DataArrayInt *ret(self->getSuperIndexArray());
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ DataArrayInt *getIndexArray() const
+ {
+ DataArrayInt *ret(self->getIndexArray());
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ DataArrayInt *getValuesArray() const
+ {
+ DataArrayInt *ret(self->getValuesArray());
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
PyObject *getSimplePackSafe(int absolutePackId) const throw(INTERP_KERNEL::Exception)
{
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
if(sw==3)//DataArrayInt
{
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
if(sw==3)//DataArrayInt
{
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
if(sw==3)//DataArrayInt
{
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
if(sw==3)//DataArrayInt
{
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->renumberNodes(tmp,newNbOfNodes);
}
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->renumberNodesCenter(tmp,newNbOfNodes);
}
std::vector<int> multiVal;
std::pair<int, std::pair<int,int> > slic;
MEDCoupling::DataArrayInt *daIntTyypp=0;
- convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
//
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
return ret;
}
std::pair<int, std::pair<int,int> > slic;
MEDCoupling::DataArrayInt *daIntTyypp=0;
int nbc=self->getNumberOfCells();
- convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
std::pair<int, std::pair<int,int> > slic;
MEDCoupling::DataArrayInt *daIntTyypp=0;
int nbc=self->getNumberOfCells();
- convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
std::pair<int, std::pair<int,int> > slic;
MEDCoupling::DataArrayInt *daIntTyypp=0;
int nbc=self->getNumberOfCells();
- convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
if(size>szArr)
{
std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->insertNextCell(type,szArr,tmp);
}
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
int nbOfDepthPeelingPerformed=0;
DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
PyObject *res=PyTuple_New(2);
std::vector<int> multiVal;
std::pair<int, std::pair<int,int> > slic;
MEDCoupling::DataArrayInt *daIntTyypp=0;
- convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
std::vector<int> multiVal;
std::pair<int, std::pair<int,int> > slic;
MEDCoupling::DataArrayInt *daIntTyypp=0;
- convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
MEDCoupling::DataArrayInt *daIntTyypp=0;
if(!arrIndx)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
- convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
MEDCoupling::DataArrayInt *daIntTyypp=0;
if(!arrIndxIn)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
- convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
MEDCoupling::DataArrayInt *daIntTyypp=0;
if(!arrIndxIn)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
- convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
MEDCoupling::DataArrayInt *daIntTyypp=0;
if(!arrIndxIn)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
- convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
double vals[6];
std::copy(vec,vec+3,vals);
std::copy(pos,pos+3,vals+3);
- return convertDblArrToPyListOfTuple(vals,3,2);
+ return convertDblArrToPyListOfTuple<double>(vals,3,2);
}
static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
std::vector<int> pos2;
DataArrayInt *pos3=0;
DataArrayIntTuple *pos4=0;
- convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
+ convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
switch(sw)
{
case 1:
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->insertNextCell(tmp,tmp+szArr);
}
//
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
std::vector<int> tmp5(tmp4,tmp4+szArr);
//
return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
}
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
+ const int *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
}
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
int szArr2,sw2,iTypppArr2;
std::vector<int> stdvecTyyppArr2;
- const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
+ const int *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
std::vector<int> tmp3(tmp2,tmp2+szArr2);
std::vector< std::pair<int,int> > partCompactFormat;
bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
self->setNodeGridStructure(tmp,tmp+szArr);
}
}
const double *originPtr(0),*dxyzPtr(0);
int sw,sz,val0;
std::vector<int> bb0;
- nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
+ nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
//
double val,val2;
std::vector<double> bb,bb2;
{
int sw,sz,val0;
std::vector<int> bb0;
- const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
+ const int *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
}
{
int sw,sz(-1);
int v0; std::vector<int> v1;
- const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
+ const int *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
}
{
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);
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);
int sz=self->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<double> res=new double[sz];
self->getValueOn(spaceLoc,res);
- return convertDblArrToPyList(res,sz);
+ 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(res,sz);
+ return convertDblArrToPyList<double>(res,sz);
}
DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
int sz=self->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<double> res=new double[sz];
self->getValueOn(spaceLoc,time,res);
- return convertDblArrToPyList(res,sz);
+ return convertDblArrToPyList<double>(res,sz);
}
void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
int sz=self->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->accumulate(tmp);
- return convertDblArrToPyList(tmp,sz);
+ 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(tmp,sz);
+ 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(tmp,sz);
+ 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(tmp,sz);
+ 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(tmp,sz);
+ 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=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->renumberCells(tmp,check);
}
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->renumberCellsWithoutMesh(tmp,check);
}
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->renumberNodes(tmp,eps);
}
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
}
DataArrayDoubleTuple *aa;
std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
DataArrayDoubleTuple *aa;
std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
DataArrayDoubleTuple *aa;
std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
DataArrayDoubleTuple *aa;
std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
DataArrayDoubleTuple *aa;
std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
DataArrayDoubleTuple *aa;
std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
DataArrayDoubleTuple *aa;
std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
DataArrayDoubleTuple *aa;
std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
PyObject *getTinySerializationInformation() const throw(INTERP_KERNEL::Exception)
{
- std::vector<double> a0;
- std::vector<int> a1;
- std::vector<std::string> a2;
- self->getTinySerializationDbleInformation(a0);
- self->getTinySerializationIntInformation(a1);
- self->getTinySerializationStrInformation(a2);
- //
- PyObject *ret(PyTuple_New(3));
- PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
- PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
- int sz(a2.size());
- PyObject *ret2(PyList_New(sz));
- {
- for(int i=0;i<sz;i++)
- PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
- }
- PyTuple_SetItem(ret,2,ret2);
- return ret;
+ return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
}
PyObject *serialize() const throw(INTERP_KERNEL::Exception)
{
- DataArrayInt *ret0(0);
- std::vector<DataArrayDouble *> ret1;
- self->serialize(ret0,ret1);
- if(ret0)
- ret0->incrRef();
- std::size_t sz(ret1.size());
- PyObject *ret(PyTuple_New(2));
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyObject *ret1Py(PyList_New(sz));
- for(std::size_t i=0;i<sz;i++)
- {
- if(ret1[i])
- ret1[i]->incrRef();
- PyList_SetItem(ret1Py,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret1[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
- }
- PyTuple_SetItem(ret,1,ret1Py);
- return ret;
+ return field_serialize<double>(self);
}
static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
{
- static const char MSG[]="MEDCouplingFieldDouble.__new__ : the args in input is expected to be a tuple !";
- if(!PyTuple_Check(args))
- throw INTERP_KERNEL::Exception(MSG);
- PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
- PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
- PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
- //
- PyObject *tmp0(PyTuple_New(1));
- PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
- PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
- Py_DECREF(tmp0);
- Py_DECREF(selfMeth);
- if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
- {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
- PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
- ////
- PyObject *a(PyInt_FromLong(0));
- PyObject *uniqueElt(PyDict_GetItem(PyTuple_GetItem(args,1),a));
- Py_DECREF(a);
- if(!uniqueElt)
- throw INTERP_KERNEL::Exception(MSG);
- if(!PyTuple_Check(uniqueElt) || PyTuple_Size(uniqueElt)!=2)
- throw INTERP_KERNEL::Exception(MSG);
- PyObject *tmp2(PyObject_CallObject(initMeth,uniqueElt));
- Py_XDECREF(tmp2);
- ////
- Py_DECREF(initMeth);
- }
- return instance;
+ 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__...
- self->checkConsistencyLight();
- PyObject *ret(PyTuple_New(1));
- PyObject *ret0(PyDict_New());
- {
- PyObject *a(PyInt_FromLong(0)),*b(PyInt_FromLong(self->getTypeOfField())),*c(PyInt_FromLong(self->getTimeDiscretization()));
- PyObject *d(PyTuple_New(2)); PyTuple_SetItem(d,0,b); PyTuple_SetItem(d,1,c);
- PyDict_SetItem(ret0,a,d);
- Py_DECREF(a); Py_DECREF(d);
- }
- PyTuple_SetItem(ret,0,ret0);
- return ret;
+ return field__getnewargs__<MEDCouplingFieldDouble>(self);
}
PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
{
- self->checkConsistencyLight();
- PyObject *ret0(MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation(self));
- PyObject *ret1(MEDCoupling_MEDCouplingFieldDouble_serialize(self));
- const MEDCouplingMesh *mesh(self->getMesh());
- if(mesh)
- mesh->incrRef();
- PyObject *ret(PyTuple_New(3));
- PyTuple_SetItem(ret,0,ret0);
- PyTuple_SetItem(ret,1,ret1);
- PyTuple_SetItem(ret,2,convertMesh(const_cast<MEDCouplingMesh *>(mesh),SWIG_POINTER_OWN | 0 ));
- return ret;
+ return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
}
void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
{
- static const char MSG[]="MEDCouplingFieldDouble.__setstate__ : expected input is a tuple of size 3 !";
- if(!PyTuple_Check(inp))
- throw INTERP_KERNEL::Exception(MSG);
- int sz(PyTuple_Size(inp));
- if(sz!=3)
- throw INTERP_KERNEL::Exception(MSG);
- // mesh
- PyObject *elt2(PyTuple_GetItem(inp,2));
- void *argp=0;
- int status(SWIG_ConvertPtr(elt2,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingMesh,0|0));
- if(!SWIG_IsOK(status))
- throw INTERP_KERNEL::Exception(MSG);
- self->setMesh(reinterpret_cast< const MEDCouplingUMesh * >(argp));
- //
- PyObject *elt0(PyTuple_GetItem(inp,0));
- PyObject *elt1(PyTuple_GetItem(inp,1));
- std::vector<double> a0;
- std::vector<int> a1;
- std::vector<std::string> a2;
- DataArrayInt *b0(0);
- std::vector<DataArrayDouble *>b1;
- {
- if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
- throw INTERP_KERNEL::Exception(MSG);
- PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
- int tmp(-1);
- fillArrayWithPyListDbl3(a0py,tmp,a0);
- convertPyToNewIntArr3(a1py,a1);
- fillStringVector(a2py,a2);
- }
- {
- if(!PyTuple_Check(elt1) && PyTuple_Size(elt1)!=2)
- throw INTERP_KERNEL::Exception(MSG);
- PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
- void *argp(0);
- int status(SWIG_ConvertPtr(b0py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0));
- if(!SWIG_IsOK(status))
- throw INTERP_KERNEL::Exception(MSG);
- b0=reinterpret_cast<DataArrayInt *>(argp);
- convertFromPyObjVectorOfObj<MEDCoupling::DataArrayDouble *>(b1py,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",b1);
- }
- self->checkForUnserialization(a1,b0,b1);
- // useless here to call resizeForUnserialization because arrays are well resized.
- self->finishUnserialization(a1,a0,a2);
+ field__setstate__<double>(self,inp);
}
}
};
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);
+ 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);
+ }
+
+ 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);
+ }
}
};
const double *originPtr(0),*dxyzPtr(0);
int sw,sz,val0;
std::vector<int> bb0;
- nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
+ nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
//
double val,val2;
std::vector<double> bb,bb2;