def ParaMEDMEMDataArrayIntImod(self,*args):
import _MEDCoupling
return _MEDCoupling.DataArrayInt____imod___(self, self, *args)
+def ParaMEDMEMDataArrayIntIpow(self,*args):
+ import _MEDCoupling
+ return _MEDCoupling.DataArrayInt____ipow___(self, self, *args)
def ParaMEDMEMDataArrayDoubleTupleIadd(self,*args):
import _MEDCoupling
return _MEDCoupling.DataArrayDoubleTuple____iadd___(self, self, *args)
dbl2.alloc(7,2);
self.assertRaises(InterpKernelException, dbl2.isUniform, 10., 1e-15);
self.assertRaises(InterpKernelException, dbl2.sort);
- self.assertRaises(InterpKernelException, dbl2.reverse);
self.assertRaises(InterpKernelException, dbl2.iota, 10.);
dbl=DataArrayDouble.New();
self.assertRaises(InterpKernelException, dbl.iota, 10.);
self.assertRaises(InterpKernelException, dbl.isUniform, 10., 1e-15);
self.assertRaises(InterpKernelException, dbl.sort);
- self.assertRaises(InterpKernelException, dbl.reverse);
self.assertRaises(InterpKernelException, dbl.fromNoInterlace);
self.assertRaises(InterpKernelException, dbl.toNoInterlace);
pass
pass
+ def testSwig2DAReverseMultiCompo1(self):
+ d=DataArrayDouble(6,2)
+ d[:,0]=range(6)
+ d[:,1]=range(10,16)
+ d.reverse()
+ self.assertTrue(d.isEqual(DataArrayDouble([5.,15.,4.,14.,3.,13.,2.,12.,1.,11.,0.,10.],6,2),1e-14))
+ d=DataArrayDouble(7,2)
+ d[:,0]=range(7)
+ d[:,1]=range(10,17)
+ d.reverse()
+ self.assertTrue(d.isEqual(DataArrayDouble([6.,16.,5.,15.,4.,14.,3.,13.,2.,12.,1.,11.,0.,10.],7,2),1e-14))
+ #
+ d=DataArrayInt(6,2)
+ d[:,0]=range(6)
+ d[:,1]=range(10,16)
+ d.reverse()
+ self.assertTrue(d.isEqual(DataArrayInt([5,15,4,14,3,13,2,12,1,11,0,10],6,2)))
+ d=DataArrayInt(7,2)
+ d[:,0]=range(7)
+ d[:,1]=range(10,17)
+ d.reverse()
+ self.assertTrue(d.isEqual(DataArrayInt([6,16,5,15,4,14,3,13,2,12,1,11,0,10],7,2)))
+ pass
+
def setUp(self):
pass
pass
%newobject ParaMEDMEM::DataArrayInt::Substract;
%newobject ParaMEDMEM::DataArrayInt::Multiply;
%newobject ParaMEDMEM::DataArrayInt::Divide;
+%newobject ParaMEDMEM::DataArrayInt::Pow;
%newobject ParaMEDMEM::DataArrayInt::BuildUnion;
%newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
%newobject ParaMEDMEM::DataArrayInt::Range;
%newobject ParaMEDMEM::DataArrayInt::__rdiv__;
%newobject ParaMEDMEM::DataArrayInt::__mod__;
%newobject ParaMEDMEM::DataArrayInt::__rmod__;
+%newobject ParaMEDMEM::DataArrayInt::__pow__;
+%newobject ParaMEDMEM::DataArrayInt::__rpow__;
%newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
%newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
%newobject ParaMEDMEM::DataArrayChar::renumber;
throw INTERP_KERNEL::Exception(msg);
}
}
+
+ DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ const char msg[]="Unexpected situation in __pow__ !";
+ int val;
+ DataArrayInt *a;
+ std::vector<int> aa;
+ DataArrayIntTuple *aaa;
+ int sw;
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
+ ret->applyPow(val);
+ return ret.retn();
+ }
+ case 2:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ return DataArrayInt::Pow(self,aaa);
+ }
+ case 3:
+ {
+ return DataArrayInt::Pow(self,a);
+ }
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return DataArrayInt::Pow(self,aaaa);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ const char msg[]="Unexpected situation in __rpow__ !";
+ int val;
+ DataArrayInt *a;
+ std::vector<int> aa;
+ DataArrayIntTuple *aaa;
+ int sw;
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
+ ret->applyRPow(val);
+ return ret.retn();
+ }
+ case 2:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ return DataArrayInt::Pow(aaa,self);
+ }
+ case 3:
+ {
+ return DataArrayInt::Pow(a,self);
+ }
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return DataArrayInt::Pow(aaaa,self);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+
+ PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ const char msg[]="Unexpected situation in __ipow__ !";
+ int val;
+ DataArrayInt *a;
+ std::vector<int> aa;
+ DataArrayIntTuple *aaa;
+ int sw;
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ switch(sw)
+ {
+ case 1:
+ {
+ self->applyPow(val);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 3:
+ {
+ self->powEqual(a);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ self->powEqual(aaaa);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }
+ default:
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
};
namespace ParaMEDMEM
DataArrayInt.__imul__=ParaMEDMEMDataArrayIntImul
DataArrayInt.__idiv__=ParaMEDMEMDataArrayIntIdiv
DataArrayInt.__imod__=ParaMEDMEMDataArrayIntImod
+DataArrayInt.__ipow__=ParaMEDMEMDataArrayIntIpow
MEDCouplingFieldDouble.__iadd__=ParaMEDMEMMEDCouplingFieldDoubleIadd
MEDCouplingFieldDouble.__isub__=ParaMEDMEMMEDCouplingFieldDoubleIsub