template class MEDCoupling::DataArrayTemplateClassic<int>;
template class MEDCoupling::DataArrayTemplateClassic<double>;
template class MEDCoupling::DataArrayTemplateFP<double>;
+template class MEDCoupling::DataArrayIterator<double>;
template<int SPACEDIM>
void DataArrayDouble::findCommonTuplesAlg(const double *bbox, int nbNodes, int limitNodeId, double prec, DataArrayInt *c, DataArrayInt *cI) const
}
}
-DataArrayDoubleIterator::DataArrayDoubleIterator(DataArrayDouble *da):_da(da),_tuple_id(0),_nb_comp(0),_nb_tuple(0)
+DataArrayDoubleIterator::DataArrayDoubleIterator(DataArrayDouble *da):DataArrayIterator<double>(da)
{
- if(_da)
- {
- _da->incrRef();
- if(_da->isAllocated())
- {
- _nb_comp=da->getNumberOfComponents();
- _nb_tuple=da->getNumberOfTuples();
- _pt=da->getPointer();
- }
- }
-}
-
-DataArrayDoubleIterator::~DataArrayDoubleIterator()
-{
- if(_da)
- _da->decrRef();
-}
-
-DataArrayDoubleTuple *DataArrayDoubleIterator::nextt()
-{
- if(_tuple_id<_nb_tuple)
- {
- _tuple_id++;
- DataArrayDoubleTuple *ret=new DataArrayDoubleTuple(_pt,_nb_comp);
- _pt+=_nb_comp;
- return ret;
- }
- else
- return 0;
}
-DataArrayDoubleTuple::DataArrayDoubleTuple(double *pt, int nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
+DataArrayDoubleTuple::DataArrayDoubleTuple(double *pt, int nbOfComp):DataArrayTuple<double>(pt,nbOfComp)
{
}
}
}
-DataArrayIntIterator::DataArrayIntIterator(DataArrayInt *da):_da(da),_pt(0),_tuple_id(0),_nb_comp(0),_nb_tuple(0)
+DataArrayIntIterator::DataArrayIntIterator(DataArrayInt *da):DataArrayIterator<int>(da)
{
- if(_da)
- {
- _da->incrRef();
- if(_da->isAllocated())
- {
- _nb_comp=da->getNumberOfComponents();
- _nb_tuple=da->getNumberOfTuples();
- _pt=da->getPointer();
- }
- }
-}
-
-DataArrayIntIterator::~DataArrayIntIterator()
-{
- if(_da)
- _da->decrRef();
-}
-
-DataArrayIntTuple *DataArrayIntIterator::nextt()
-{
- if(_tuple_id<_nb_tuple)
- {
- _tuple_id++;
- DataArrayIntTuple *ret=new DataArrayIntTuple(_pt,_nb_comp);
- _pt+=_nb_comp;
- return ret;
- }
- else
- return 0;
}
-DataArrayIntTuple::DataArrayIntTuple(int *pt, int nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
+DataArrayIntTuple::DataArrayIntTuple(int *pt, int nbOfComp):DataArrayTuple<int>(pt,nbOfComp)
{
}
DataArrayDouble() { }
};
- class DataArrayDoubleTuple;
-
- class DataArrayDoubleIterator
- {
- public:
- MEDCOUPLING_EXPORT DataArrayDoubleIterator(DataArrayDouble *da);
- MEDCOUPLING_EXPORT ~DataArrayDoubleIterator();
- MEDCOUPLING_EXPORT DataArrayDoubleTuple *nextt();
- private:
- DataArrayDouble *_da;
- double *_pt;
- int _tuple_id;
- int _nb_comp;
- int _nb_tuple;
- };
-
- class DataArrayDoubleTuple
- {
- public:
- MEDCOUPLING_EXPORT DataArrayDoubleTuple(double *pt, int nbOfComp);
- MEDCOUPLING_EXPORT std::string repr() const;
- MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; }
- MEDCOUPLING_EXPORT const double *getConstPointer() const { return _pt; }
- MEDCOUPLING_EXPORT double *getPointer() { return _pt; }
- MEDCOUPLING_EXPORT double doubleValue() const;
- MEDCOUPLING_EXPORT DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const;
- private:
- double *_pt;
- int _nb_of_compo;
- };
-
class DataArrayIntIterator;
class DataArrayInt : public DataArrayTemplateClassic<int>
return ret;
}
-
- class DataArrayIntTuple;
-
- class DataArrayIntIterator
- {
- public:
- MEDCOUPLING_EXPORT DataArrayIntIterator(DataArrayInt *da);
- MEDCOUPLING_EXPORT ~DataArrayIntIterator();
- MEDCOUPLING_EXPORT DataArrayIntTuple *nextt();
- private:
- DataArrayInt *_da;
- int *_pt;
- int _tuple_id;
- int _nb_comp;
- int _nb_tuple;
- };
-
- class DataArrayIntTuple
- {
- public:
- MEDCOUPLING_EXPORT DataArrayIntTuple(int *pt, int nbOfComp);
- MEDCOUPLING_EXPORT std::string repr() const;
- MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; }
- MEDCOUPLING_EXPORT const int *getConstPointer() const { return _pt; }
- MEDCOUPLING_EXPORT int *getPointer() { return _pt; }
- MEDCOUPLING_EXPORT int intValue() const;
- MEDCOUPLING_EXPORT DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const;
- private:
- int *_pt;
- int _nb_of_compo;
- };
-
class DataArrayChar : public DataArrayTemplate<char>
{
public:
DataArrayByte() { }
};
- class DataArrayByteTuple;
-
- class DataArrayByteIterator
- {
- public:
- MEDCOUPLING_EXPORT DataArrayByteIterator(DataArrayByte *da);
- MEDCOUPLING_EXPORT ~DataArrayByteIterator();
- MEDCOUPLING_EXPORT DataArrayByteTuple *nextt();
- private:
- DataArrayByte *_da;
- char *_pt;
- int _tuple_id;
- int _nb_comp;
- int _nb_tuple;
- };
-
- class DataArrayByteTuple
- {
- public:
- MEDCOUPLING_EXPORT DataArrayByteTuple(char *pt, int nbOfComp);
- MEDCOUPLING_EXPORT std::string repr() const;
- MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; }
- MEDCOUPLING_EXPORT const char *getConstPointer() const { return _pt; }
- MEDCOUPLING_EXPORT char *getPointer() { return _pt; }
- MEDCOUPLING_EXPORT char byteValue() const;
- MEDCOUPLING_EXPORT DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const;
- private:
- char *_pt;
- int _nb_of_compo;
- };
-
class DataArrayAsciiCharIterator;
class DataArrayAsciiChar : public DataArrayChar
DataArrayAsciiChar(const std::vector<std::string>& vst, char defaultChar);
};
+ template<class T>
+ class DataArrayIterator
+ {
+ public:
+ DataArrayIterator(typename Traits<T>::ArrayType *da);
+ ~DataArrayIterator();
+ MEDCOUPLING_EXPORT typename Traits<T>::ArrayTuple *nextt();
+ private:
+ typename Traits<T>::ArrayType *_da;
+ T *_pt;
+ int _tuple_id;
+ int _nb_comp;
+ int _nb_tuple;
+ };
+
+ template<class T>
+ class DataArrayTuple
+ {
+ public:
+ MEDCOUPLING_EXPORT DataArrayTuple(T *pt, int nbOfComp);
+ MEDCOUPLING_EXPORT std::string repr() const;
+ MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; }
+ MEDCOUPLING_EXPORT const T *getConstPointer() const { return _pt; }
+ MEDCOUPLING_EXPORT T *getPointer() { return _pt; }
+ protected:
+ T *_pt;
+ int _nb_of_compo;
+ };
+
+ class DataArrayDoubleTuple;
+
+ class DataArrayDoubleIterator : public DataArrayIterator<double>
+ {
+ public:
+ MEDCOUPLING_EXPORT DataArrayDoubleIterator(DataArrayDouble *da);
+ MEDCOUPLING_EXPORT ~DataArrayDoubleIterator() { }
+ };
+
+ class DataArrayDoubleTuple : public DataArrayTuple<double>
+ {
+ public:
+ MEDCOUPLING_EXPORT DataArrayDoubleTuple(double *pt, int nbOfComp);
+ MEDCOUPLING_EXPORT std::string repr() const;
+ MEDCOUPLING_EXPORT double doubleValue() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const;
+ };
+
+ class DataArrayIntTuple;
+
+ class DataArrayIntIterator : public DataArrayIterator<int>
+ {
+ public:
+ MEDCOUPLING_EXPORT DataArrayIntIterator(DataArrayInt *da);
+ MEDCOUPLING_EXPORT ~DataArrayIntIterator() { }
+ };
+
+ class DataArrayIntTuple : public DataArrayTuple<int>
+ {
+ public:
+ MEDCOUPLING_EXPORT DataArrayIntTuple(int *pt, int nbOfComp);
+ MEDCOUPLING_EXPORT std::string repr() const;
+ MEDCOUPLING_EXPORT int intValue() const;
+ MEDCOUPLING_EXPORT DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const;
+ };
+
class DataArrayAsciiCharTuple;
class DataArrayAsciiCharIterator
char *_pt;
int _nb_of_compo;
};
+
+ class DataArrayByteTuple;
+
+ class DataArrayByteIterator
+ {
+ public:
+ MEDCOUPLING_EXPORT DataArrayByteIterator(DataArrayByte *da);
+ MEDCOUPLING_EXPORT ~DataArrayByteIterator();
+ MEDCOUPLING_EXPORT DataArrayByteTuple *nextt();
+ private:
+ DataArrayByte *_da;
+ char *_pt;
+ int _tuple_id;
+ int _nb_comp;
+ int _nb_tuple;
+ };
+
+ class DataArrayByteTuple
+ {
+ public:
+ MEDCOUPLING_EXPORT DataArrayByteTuple(char *pt, int nbOfComp);
+ MEDCOUPLING_EXPORT std::string repr() const;
+ MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; }
+ MEDCOUPLING_EXPORT const char *getConstPointer() const { return _pt; }
+ MEDCOUPLING_EXPORT char *getPointer() { return _pt; }
+ MEDCOUPLING_EXPORT char byteValue() const;
+ MEDCOUPLING_EXPORT DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const;
+ private:
+ char *_pt;
+ int _nb_of_compo;
+ };
}
namespace MEDCoupling
//////////////////////////////////
+ template<class T>
+ DataArrayIterator<T>::DataArrayIterator(typename Traits<T>::ArrayType *da):_da(da),_tuple_id(0),_nb_comp(0),_nb_tuple(0)
+ {
+ if(_da)
+ {
+ _da->incrRef();
+ if(_da->isAllocated())
+ {
+ _nb_comp=da->getNumberOfComponents();
+ _nb_tuple=da->getNumberOfTuples();
+ _pt=da->getPointer();
+ }
+ }
+ }
+
+ template<class T>
+ DataArrayIterator<T>::~DataArrayIterator()
+ {
+ if(_da)
+ _da->decrRef();
+ }
+
+ template<class T>
+ typename Traits<T>::ArrayTuple *DataArrayIterator<T>::nextt()
+ {
+ if(_tuple_id<_nb_tuple)
+ {
+ _tuple_id++;
+ typename Traits<T>::ArrayTuple *ret=new typename Traits<T>::ArrayTuple(_pt,_nb_comp);
+ _pt+=_nb_comp;
+ return ret;
+ }
+ else
+ return 0;
+ }
+
+ //////////////////////////////////
+
+ template<class T>
+ DataArrayTuple<T>::DataArrayTuple(T *pt, int nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
+ {
+ }
+
+ //////////////////////////////////
+
template<class T>
MCAuto< typename Traits<T>::ArrayTypeCh > DataArrayTemplate<T>::NewFromStdVector(const typename std::vector<T>& v)
{
class MEDCouplingFieldDouble;
class MEDCouplingFieldFloat;
class MEDCouplingFieldInt;
+ class DataArrayIntTuple;
+ class DataArrayDoubleTuple;
template<>
struct MEDCOUPLING_EXPORT Traits<double>
typedef DataArrayDouble ArrayType;
typedef DataArrayDouble ArrayTypeCh;
typedef MEDCouplingFieldDouble FieldType;
+ typedef DataArrayDoubleTuple ArrayTuple;
};
template<>
typedef DataArrayInt ArrayType;
typedef DataArrayInt ArrayTypeCh;
typedef MEDCouplingFieldInt FieldType;
+ typedef DataArrayIntTuple ArrayTuple;
};
template<>
m_1=m[[0,2,4]] ; m_1.zipCoords()
self.assertTrue(f_1.getMesh().isEqual(m_1,1e-12))
pass
+class MEDCouplingBasicsTest5(unittest.TestCase):
+
+ def testFieldFloatIsOnStage1(self):
+ """ My first test with field int."""
+ m=MEDCouplingCMesh()
+ m.setName("mesh")
+ arrX=DataArrayDouble([0,1,2,3])
+ m.setCoords(arrX,arrX)
+ f=MEDCouplingFieldFloat(ON_CELLS)
+ f.setMesh(m)
+ arr=DataArrayFloat(8) ; arr.iota() ;f.setArray(arr)
+ self.assertRaises(InterpKernelException,f.checkConsistencyLight)
+ arr=DataArrayFloat(9) ; arr.iota() ;f.setArray(arr)
+ f.checkConsistencyLight()
+ f.setTimeUnit("ms")
+ self.assertEqual(f.getTimeUnit(),"ms")
+ f.setTime(3.2,5,6)
+ a,b,c=f.getTime()
+ self.assertEqual(b,5)
+ self.assertEqual(c,6)
+ self.assertEqual(a,3.2,12)
+ pass
+
+ def testFieldFloatIsOnStage2(self):
+ """ Very important test to check that isEqual of MEDCouplingFieldFloat is OK !"""
+ m1=MEDCouplingCMesh() ; m1.setCoords(DataArrayDouble([0,1,2,3]),DataArrayDouble([0,1,2,3,4]))
+ m1=m1.buildUnstructured() ; m1.setName("mesh")
+ f1=MEDCouplingFieldFloat(ON_CELLS) ; f1.setMesh(m1)
+ arr1=DataArrayFloat([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr1.setInfoOnComponents(["aa","bbb"])
+ f1.setArray(arr1) ; f1.setName("f1") ; f1.setTime(2.,3,4)
+ #
+ m2=MEDCouplingCMesh() ; m2.setCoords(DataArrayDouble([0,1,2,3]),DataArrayDouble([0,1,2,3,4]))
+ m2=m2.buildUnstructured() ; m2.setName("mesh")
+ f2=MEDCouplingFieldFloat(ON_CELLS) ; f2.setMesh(m2)
+ arr2=DataArrayFloat([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr2.setInfoOnComponents(["aa","bbb"])
+ f2.setArray(arr2) ; f2.setName("f1") ; f2.setTime(2.,3,4)
+ #
+ self.assertTrue(f1.isEqual(f2,1e-12,0.))
+ f1.getArray()[:]*=2
+ self.assertTrue(not f1.isEqual(f2,1e-12,0.))
+ self.assertTrue(not f1.isEqualWithoutConsideringStr(f2,1e-12,0.))
+ f1.getArray()[:]/=2
+ self.assertTrue(f1.isEqual(f2,1e-12,0.))
+ #
+ f1.setName("F1")
+ self.assertTrue(not f1.isEqual(f2,1e-12,0.))
+ f1.setName("f1")
+ self.assertTrue(f1.isEqual(f2,1e-12,0.))
+ #
+ f1.getArray().setInfoOnComponents(["aa","bbbb"])
+ self.assertTrue(not f1.isEqual(f2,1e-12,0.))
+ self.assertTrue(f1.isEqualWithoutConsideringStr(f2,1e-12,0.))
+ f1.getArray().setInfoOnComponents(["aa","bbb"])
+ self.assertTrue(f1.isEqual(f2,1e-12,0.))
+ #
+ f3=f2.deepCopy()
+ self.assertTrue(f1.isEqual(f3,1e-12,0.))
+ #
+ for fd,expected in ((ON_NODES,False),(ON_CELLS,True)):
+ f4=MEDCouplingFieldFloat(fd) ; f4.setMesh(m2) ; f4.setTime(2.,3,4)
+ arr4=DataArrayFloat([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr4.setInfoOnComponents(["aa","bbb"])
+ f4.setArray(arr4) ; f4.setName("f1")
+ self.assertEqual(f1.isEqual(f4,1e-12,0.),expected)
+ pass
+ pass
pass
#include "MEDCouplingField.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldInt.hxx"
+#include "MEDCouplingFieldFloat.hxx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingGaussLocalization.hxx"
#include "MCAuto.hxx"
%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;
{// 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<double>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple;
+ SWIGTITraits<int>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayIntTuple;
}
%}
{
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 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 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:
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 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:
}
}
};
+
+ 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;
+ }
+ }
+ };
class MEDCouplingDefinitionTime
{
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;
{
static const int NPYObjectType=NPY_FLOAT;
static PyTypeObject *NPYFunc;
+ static PyObject *Array_SWIGTYPE;
};
#endif
*
* switch between (int,vector<int>,DataArrayInt)
*/
-static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, MEDCoupling::DataArrayInt *& daIntTyypp, MEDCoupling::DataArrayIntTuple *&daIntTuple) throw(INTERP_KERNEL::Exception)
+static void convertIntStarLikePyObjToCpp(PyObject *value, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, MEDCoupling::DataArrayInt *& daIntTyypp, MEDCoupling::DataArrayIntTuple *&daIntTuple) throw(INTERP_KERNEL::Exception)
{
sw=-1;
if(PyInt_Check(value))
throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple");
}
+/*!
+ * if python int -> cpp int sw=1
+ * if python list[int] -> cpp vector<int> sw=2
+ * if python tuple[int] -> cpp vector<int> sw=2
+ * if python DataArrayInt -> cpp DataArrayInt sw=3
+ * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4
+ *
+ * switch between (int,vector<int>,DataArrayInt)
+ */
+static const int *convertIntStarLikePyObjToCppIntStar(PyObject *value, int& sw, int& sz, int& iTyypp, std::vector<int>& stdvecTyypp) throw(INTERP_KERNEL::Exception)
+{
+ sw=-1;
+ if(PyInt_Check(value))
+ {
+ iTyypp=(int)PyInt_AS_LONG(value);
+ sw=1; sz=1;
+ return &iTyypp;
+ }
+ if(PyTuple_Check(value))
+ {
+ int size=PyTuple_Size(value);
+ stdvecTyypp.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *o=PyTuple_GetItem(value,i);
+ if(PyInt_Check(o))
+ stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+ else
+ {
+ std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ sw=2; sz=size;
+ return &stdvecTyypp[0];
+ }
+ if(PyList_Check(value))
+ {
+ int size=PyList_Size(value);
+ stdvecTyypp.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *o=PyList_GetItem(value,i);
+ if(PyInt_Check(o))
+ stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+ else
+ {
+ std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ sw=2; sz=size;
+ return &stdvecTyypp[0];
+ }
+ void *argp;
+ int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
+ if(SWIG_IsOK(status))
+ {
+ MEDCoupling::DataArrayInt *daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
+ if(daIntTyypp)
+ {
+ sw=3; sz=daIntTyypp->getNbOfElems();
+ return daIntTyypp->begin();
+ }
+ else
+ {
+ sz=0;
+ return 0;
+ }
+ }
+ status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
+ if(SWIG_IsOK(status))
+ {
+ MEDCoupling::DataArrayIntTuple *daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
+ sw=4; sz=daIntTuple->getNumberOfCompo();
+ return daIntTuple->getConstPointer();
+ }
+ throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple");
+}
+
/*!
* if python double -> cpp double sw=1
* if python int -> cpp double sw=1
* switch between (int,vector<int>,DataArrayInt)
*/
template<class T>
-void convertObjToPossibleCpp4(PyObject *value, int& sw, T& iTyypp, std::vector<T>& stdvecTyypp, typename MEDCoupling::Traits<T>::ArrayType *& daIntTyypp, swig_type_info *ti) throw(INTERP_KERNEL::Exception)
+void considerPyObjAsATStarLikeObject(PyObject *value, int& sw, T& iTyypp, std::vector<T>& stdvecTyypp, typename MEDCoupling::Traits<T>::ArrayType *& daIntTyypp, swig_type_info *ti) throw(INTERP_KERNEL::Exception)
{
sw=-1;
if(PyFloat_Check(value))
*
* switch between (int,vector<int>,DataArrayInt)
*/
-static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp, std::vector<double>& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+static void convertDoubleStarLikePyObjToCpp(PyObject *value, int& sw, double& iTyypp, std::vector<double>& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception)
{
sw=-1;
if(PyFloat_Check(value))
sw=3;
}
+/*!
+ * if value int -> cpp val sw=1
+ * if value double -> cpp val sw=1
+ * if value DataArrayDouble -> cpp DataArrayDouble sw=2
+ * if value DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3
+ * if value list[int,double] -> cpp std::vector<double> sw=4
+ * if value tuple[int,double] -> cpp std::vector<double> sw=4
+ */
+static void convertDoubleStarLikePyObjToCpp_2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f)
+{
+ sw=-1;
+ if(PyFloat_Check(value))
+ {
+ val=PyFloat_AS_DOUBLE(value);
+ sw=1;
+ return;
+ }
+ if(PyInt_Check(value))
+ {
+ val=(double)PyInt_AS_LONG(value);
+ sw=1;
+ return;
+ }
+ if(PyTuple_Check(value))
+ {
+ int size=PyTuple_Size(value);
+ f.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *o=PyTuple_GetItem(value,i);
+ if(PyFloat_Check(o))
+ f[i]=PyFloat_AS_DOUBLE(o);
+ else if(PyInt_Check(o))
+ f[i]=(double)PyInt_AS_LONG(o);
+ else
+ {
+ std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not double ! only tuples of doubles accepted or integer !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ sw=4;
+ return;
+ }
+ if(PyList_Check(value))
+ {
+ int size=PyList_Size(value);
+ f.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *o=PyList_GetItem(value,i);
+ if(PyFloat_Check(o))
+ f[i]=PyFloat_AS_DOUBLE(o);
+ else if(PyInt_Check(o))
+ f[i]=(double)PyInt_AS_LONG(o);
+ else
+ {
+ std::ostringstream oss; oss << "List as been detected but element #" << i << " is not double ! only lists of doubles accepted or integer !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ sw=4;
+ return;
+ }
+ void *argp;
+ int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
+ if(SWIG_IsOK(status))
+ {
+ d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp);
+ sw=2;
+ return ;
+ }
+ status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0);
+ if(SWIG_IsOK(status))
+ {
+ e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp);
+ sw=3;
+ return ;
+ }
+ throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple");
+}
+
/*!
* if python int -> cpp int sw=1
* if python list[int] -> cpp vector<int> sw=2
*
* switch between (int,vector<int>,DataArrayInt)
*/
-static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+static void convertIntStarOrSliceLikePyObjToCpp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception)
{
const char *msg="5 types accepted : integer, tuple of integer, list of integer, slice, DataArrayInt, DataArrayIntTuple";
sw=-1;
}
/*!
- * Idem than convertObjToPossibleCpp2
+ * Idem than convertIntStarOrSliceLikePyObjToCpp
*/
-static void convertObjToPossibleCpp2WithNegIntInterp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+static void convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception)
{
- convertObjToPossibleCpp2(value,nbelem,sw,iTyypp,stdvecTyypp,p,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(value,nbelem,sw,iTyypp,stdvecTyypp,p,daIntTyypp);
if(sw==1)
{
iTyypp=InterpreteNegativeInt(iTyypp,nbelem);
{
if(!PyTuple_Check(value))
{
- convertObjToPossibleCpp2WithNegIntInterp(value,nbTuple,sw,it,vt,pt,dt);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(value,nbTuple,sw,it,vt,pt,dt);
return ;
}
else
throw INTERP_KERNEL::Exception("Unexpected nb of slice element : 1 or 2 expected !\n1st is for tuple selection, 2nd for component selection !");
PyObject *ob0=PyTuple_GetItem(value,0);
int sw1,sw2;
- convertObjToPossibleCpp2WithNegIntInterp(ob0,nbTuple,sw1,it,vt,pt,dt);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(ob0,nbTuple,sw1,it,vt,pt,dt);
PyObject *ob1=PyTuple_GetItem(value,1);
- convertObjToPossibleCpp2WithNegIntInterp(ob1,nbCompo,sw2,ic,vc,pc,dc);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(ob1,nbCompo,sw2,ic,vc,pc,dc);
sw=4*sw2+sw1;
}
}
-/*!
- * if value int -> cpp val sw=1
- * if value double -> cpp val sw=1
- * if value DataArrayDouble -> cpp DataArrayDouble sw=2
- * if value DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3
- * if value list[int,double] -> cpp std::vector<double> sw=4
- * if value tuple[int,double] -> cpp std::vector<double> sw=4
- */
-static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f)
-{
- sw=-1;
- if(PyFloat_Check(value))
- {
- val=PyFloat_AS_DOUBLE(value);
- sw=1;
- return;
- }
- if(PyInt_Check(value))
- {
- val=(double)PyInt_AS_LONG(value);
- sw=1;
- return;
- }
- if(PyTuple_Check(value))
- {
- int size=PyTuple_Size(value);
- f.resize(size);
- for(int i=0;i<size;i++)
- {
- PyObject *o=PyTuple_GetItem(value,i);
- if(PyFloat_Check(o))
- f[i]=PyFloat_AS_DOUBLE(o);
- else if(PyInt_Check(o))
- f[i]=(double)PyInt_AS_LONG(o);
- else
- {
- std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not double ! only tuples of doubles accepted or integer !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- sw=4;
- return;
- }
- if(PyList_Check(value))
- {
- int size=PyList_Size(value);
- f.resize(size);
- for(int i=0;i<size;i++)
- {
- PyObject *o=PyList_GetItem(value,i);
- if(PyFloat_Check(o))
- f[i]=PyFloat_AS_DOUBLE(o);
- else if(PyInt_Check(o))
- f[i]=(double)PyInt_AS_LONG(o);
- else
- {
- std::ostringstream oss; oss << "List as been detected but element #" << i << " is not double ! only lists of doubles accepted or integer !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- sw=4;
- return;
- }
- void *argp;
- int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
- if(SWIG_IsOK(status))
- {
- d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp);
- sw=2;
- return ;
- }
- status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0);
- if(SWIG_IsOK(status))
- {
- e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp);
- sw=3;
- return ;
- }
- throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple");
-}
-
/*!
* if value int -> cpp val sw=1
* if value double -> cpp val sw=1
throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple");
}
-/*!
- * if python int -> cpp int sw=1
- * if python list[int] -> cpp vector<int> sw=2
- * if python tuple[int] -> cpp vector<int> sw=2
- * if python DataArrayInt -> cpp DataArrayInt sw=3
- * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4
- *
- * switch between (int,vector<int>,DataArrayInt)
- */
-static const int *convertObjToPossibleCpp1_Safe(PyObject *value, int& sw, int& sz, int& iTyypp, std::vector<int>& stdvecTyypp) throw(INTERP_KERNEL::Exception)
-{
- sw=-1;
- if(PyInt_Check(value))
- {
- iTyypp=(int)PyInt_AS_LONG(value);
- sw=1; sz=1;
- return &iTyypp;
- }
- if(PyTuple_Check(value))
- {
- int size=PyTuple_Size(value);
- stdvecTyypp.resize(size);
- for(int i=0;i<size;i++)
- {
- PyObject *o=PyTuple_GetItem(value,i);
- if(PyInt_Check(o))
- stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
- else
- {
- std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- sw=2; sz=size;
- return &stdvecTyypp[0];
- }
- if(PyList_Check(value))
- {
- int size=PyList_Size(value);
- stdvecTyypp.resize(size);
- for(int i=0;i<size;i++)
- {
- PyObject *o=PyList_GetItem(value,i);
- if(PyInt_Check(o))
- stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
- else
- {
- std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- sw=2; sz=size;
- return &stdvecTyypp[0];
- }
- void *argp;
- int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
- if(SWIG_IsOK(status))
- {
- MEDCoupling::DataArrayInt *daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
- if(daIntTyypp)
- {
- sw=3; sz=daIntTyypp->getNbOfElems();
- return daIntTyypp->begin();
- }
- else
- {
- sz=0;
- return 0;
- }
- }
- status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
- if(SWIG_IsOK(status))
- {
- MEDCoupling::DataArrayIntTuple *daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
- sw=4; sz=daIntTuple->getNumberOfCompo();
- return daIntTuple->getConstPointer();
- }
- throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple");
-}
-
static MEDCoupling::DataArray *CheckAndRetrieveDataArrayInstance(PyObject *obj, const char *msg)
{
void *aBasePtrVS=0;
T i1;
std::vector<T> v1;
typename MEDCoupling::Traits<T>::ArrayType *d1=0;
- convertObjToPossibleCpp4<T>(value,sw1,i1,v1,d1,ti);
+ considerPyObjAsATStarLikeObject<T>(value,sw1,i1,v1,d1,ti);
int it1,ic1;
std::vector<int> vt1,vc1;
std::pair<int, std::pair<int,int> > pt1,pc1;
template<>
struct SWIGTITraits<double>
-{ static swig_type_info *TI; };
+{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
template<>
struct SWIGTITraits<float>
-{ static swig_type_info *TI; };
+{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
+
+template<>
+struct SWIGTITraits<int>
+{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
swig_type_info *SWIGTITraits<double>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe()
swig_type_info *SWIGTITraits<float>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<int>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<double>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<float>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<int>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
PyTypeObject *NPYTraits<double>::NPYFunc=&PyCallBackDataArrayDouble_RefType;
{
int sz=0,sw=-1,val1=-1;
std::vector<int> val2;
- const int *inp=convertObjToPossibleCpp1_Safe(li,sw,sz,val1,val2);
+ const int *inp=convertIntStarLikePyObjToCppIntStar(li,sw,sz,val1,val2);
return self->clonePart(inp,inp+sz);
}
{
std::vector<int> vVal; int iVal=-1;
int sz=-1,sw=0;
- const int *tupleIdsBg=convertObjToPossibleCpp1_Safe(tupleIds,sw,sz,iVal,vVal);
+ const int *tupleIdsBg=convertIntStarLikePyObjToCppIntStar(tupleIds,sw,sz,iVal,vVal);
if(sw==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::computeMeshRestrictionFromTupleIds : none parameter in input !");
DataArrayInt *ret0=0,*ret1=0;
{
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 sw,sz(-1);
int v0; std::vector<int> v1;
- const int *old2NewBg(convertObjToPossibleCpp1_Safe(old2New,sw,sz,v0,v1));
+ const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1));
//
self->renumberArraysForCell(mesh,input1,old2NewBg,check);
}
{
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(mesh,cellIdsBg,cellIdsBg+sz);
}
{
int sw,sz(-1);
int v0; std::vector<int> v1;
- const int *idsBg(convertObjToPossibleCpp1_Safe(ids,sw,sz,v0,v1));
+ const int *idsBg(convertIntStarLikePyObjToCppIntStar(ids,sw,sz,v0,v1));
DataArrayInt *di(0);
MEDCouplingMesh *ret0=self->buildSubMeshData(mesh,idsBg,idsBg+sz,di);
PyObject *ret=PyTuple_New(2);
{
int sw,sz(-1);
int v0; std::vector<int> v1;
- const int *old2NewBg(convertObjToPossibleCpp1_Safe(old2New,sw,sz,v0,v1));
+ const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1));
self->renumberValuesOnNodes(epsOnVals,old2NewBg,newNbOfNodes,arr);
}
{
int sw,sz(-1);
int v0; std::vector<int> v1;
- const int *old2NewBg(convertObjToPossibleCpp1_Safe(old2New,sw,sz,v0,v1));
+ const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1));
self->renumberValuesOnCells(epsOnVals,mesh,old2NewBg,newSz,arr);
}
{
int sw,sz(-1);
int v0; std::vector<int> v1;
- const int *new2oldBg(convertObjToPossibleCpp1_Safe(new2old,sw,sz,v0,v1));
+ const int *new2oldBg(convertIntStarLikePyObjToCppIntStar(new2old,sw,sz,v0,v1));
self->renumberValuesOnCellsR(mesh,new2oldBg,newSz,arr);
}
}
{
int sw,sz,val;
std::vector<int> val2;
- const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
+ const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
return self->accumulatePerChunck(bg,bg+sz);
}
}
#endif
//
- 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:
}
#endif
//
- 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:
}
#endif
//
- 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:
}
#endif
//
- 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:
MEDCoupling::DataArrayInt *daIntTyypp=0;
const double *pt=self->getConstPointer();
int nbc=self->getNumberOfCompo();
- convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
std::vector<double> multiValV;
MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
int nbc=self->getNumberOfCompo();
- convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
+ convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
int singleVal;
std::vector<int> multiVal;
std::pair<int, std::pair<int,int> > slic;
MEDCoupling::DataArrayInt *daIntTyypp=0;
double *pt=self->getPointer();
- convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
switch(sw2)
{
case 1:
{
int sw,sz,val;
std::vector<int> val2;
- const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
+ const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
return self->accumulatePerChunck(bg,bg+sz);
}
{
int sw,sz,val;
std::vector<int> val2;
- const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
+ const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
return self->findIdsEqualTuple(bg,bg+sz);
}
int newNbOfTuples=-1;
int szArr,szArrI,sw,iTypppArr,iTypppArrI;
std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
- const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
- const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
+ const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
MCAuto<DataArrayInt> ret(DataArrayInt::New());
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
+ const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
return ret.retn();
std::vector<int> multiVal;
std::pair<int, std::pair<int,int> > slic;
MEDCoupling::DataArrayInt *daIntTyypp=0;
- convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),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(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
std::vector<int> v1;
DataArrayInt *d1=0;
DataArrayIntTuple *dd1=0;
- convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
+ convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
int it1,ic1;
std::vector<int> vt1,vc1;
std::pair<int, std::pair<int,int> > pt1,pc1;
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
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->pushBackValsSilent(tmp,tmp+szArr);
}
MEDCoupling::DataArrayInt *daIntTyypp=0;
const int *pt=self->getConstPointer();
int nbc=self->getNumberOfCompo();
- convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
std::pair<int, std::pair<int,int> > slic;
MEDCoupling::DataArrayInt *daIntTyypp=0;
int *pt=self->getPointer();
- convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
switch(sw2)
{
case 1:
{
int sz=-1,sw=-1;
int ival=-1; std::vector<int> ivval;
- const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
+ const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
std::vector<char> vals(sz);
std::copy(pt,pt+sz,vals.begin());
return self->presenceOfTuple(vals);
{
int sz=-1,sw=-1;
int ival=-1; std::vector<int> ivval;
- const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
+ const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
std::vector<char> vals2(sz);
std::copy(pt,pt+sz,vals2.begin());
return self->presenceOfValue(vals2);
{
int sz=-1,sw=-1;
int ival=-1; std::vector<int> ivval;
- const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
+ const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
std::vector<char> vals2(sz);
std::copy(pt,pt+sz,vals2.begin());
return self->findIdFirstEqual(vals2);
{
int sz=-1,sw=-1;
int ival=-1; std::vector<int> ivval;
- const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
+ const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
std::vector<char> vals(sz);
std::copy(pt,pt+sz,vals.begin());
return self->findIdFirstEqualTuple(vals);
{
int sz=-1,sw=-1;
int ival=-1; std::vector<int> ivval;
- const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
+ const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
std::vector<char> vals(sz);
std::copy(pt,pt+sz,vals.begin());
return self->findIdSequence(vals);
std::vector<int> v1;
DataArrayInt *d1=0;
DataArrayIntTuple *dd1=0;
- convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
+ convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
int it1,ic1;
std::vector<int> vt1,vc1;
std::pair<int, std::pair<int,int> > pt1,pc1;
std::vector<int> stdvecTyyppArr;
std::pair<int, std::pair<int,int> > sTyyppArr;
MEDCoupling::DataArrayInt *daIntTyypp=0;
- convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
switch(sw)
{
case 1:
MEDCoupling::DataArrayInt *daIntTyypp=0;
int nbOfCompo=self->getNumberOfComponents();
int nbOfTuples=self->getNumberOfTuples();
- convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
int sw2;
char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
MEDCoupling::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:
MEDCoupling::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:
MEDCoupling::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:
MEDCoupling::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:
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
int nbc=mesh->getNumberOfCells();
- convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
if(!self->getArray())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
try
- { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
+ { convertIntStarOrSliceLikePyObjToCpp(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
catch(INTERP_KERNEL::Exception& e)
{ std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
typename MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::FieldType > ret0(fieldT_buildSubPart<T>(self,elt0));
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:
std::vector<int> pos2;
DataArrayInt *pos3=0;
DataArrayIntTuple *pos4=0;
- convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
+ convertIntStarLikePyObjToCpp(ids,sw,pos1,pos2,pos3,pos4);
switch(sw)
{
case 1: