std::vector<double> bb;
int sw;
int spaceDim=self->getSpaceDimension();
- const char msg[]="Python wrap of MEDCouplingUMesh::getCellContainingPoint : ";
+ const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
return self->getCellContainingPoint(pos,eps);
}
std::vector<double> bb;
int sw;
int spaceDim=self->getSpaceDimension();
- const char msg[]="Python wrap of MEDCouplingUMesh::getCellContainingPoint : ";
+ const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
std::vector<int> elts,eltsIndex;
self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
return ret;
}
+ PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> elts,eltsIndex;
+ int spaceDim=self->getSpaceDimension();
+ void *da=0;
+ int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(p,&size);
+ int nbOfPoints=size/spaceDim;
+ if(size%spaceDim!=0)
+ {
+ throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
+ }
+ self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
+ }
+ else
+ {
+ DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
+ da2->checkAllocated();
+ int size=da2->getNumberOfTuples();
+ int nbOfCompo=da2->getNumberOfComponents();
+ if(nbOfCompo!=spaceDim)
+ {
+ throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
+ }
+ self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
+ }
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
+ d0->alloc(elts.size(),1);
+ d1->alloc(eltsIndex.size(),1);
+ std::copy(elts.begin(),elts.end(),d0->getPointer());
+ std::copy(eltsIndex.begin(),eltsIndex.end(),d1->getPointer());
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ d0->incrRef();
+ d1->incrRef();
+ return ret;
+ }
+
PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
{
- int sz;
- INTERP_KERNEL::AutoPtr<double> pos=convertPyToNewDblArr2(p,&sz);
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ int spaceDim=self->getSpaceDimension();
+ const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
+ const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
std::vector<int> elts;
self->getCellsContainingPoint(pos,eps,elts);
DataArrayInt *ret=DataArrayInt::New();
void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
{
- int sz;
- INTERP_KERNEL::AutoPtr<double> p=convertPyToNewDblArr2(point,&sz);
- self->scale(p,factor);
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ int spaceDim=self->getSpaceDimension();
+ const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
+ const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
+ self->scale(pointPtr,factor);
}
PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
}
PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> nodes;
int spaceDim=self->getSpaceDimension();
- int sz1,sz2;
- INTERP_KERNEL::AutoPtr<double> p=convertPyToNewDblArr2(pt,&sz1);
- INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vec,&sz2);
- if(sz1!=spaceDim || sz2!=spaceDim)
- throw INTERP_KERNEL::Exception("Mismatch of spaceDimension and the length of the input array point and vector !");
+ double val,val2;
+ DataArrayDouble *a,*a2;
+ DataArrayDoubleTuple *aa,*aa2;
+ std::vector<double> bb,bb2;
+ int sw;
+ const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
+ const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
+ const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
+ const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
+ std::vector<int> nodes;
self->findNodesOnLine(p,v,eps,nodes);
DataArrayInt *ret=DataArrayInt::New();
ret->alloc((int)nodes.size(),1);
}
PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
{
+ int spaceDim=self->getSpaceDimension();
+ double val,val2;
+ DataArrayDouble *a,*a2;
+ DataArrayDoubleTuple *aa,*aa2;
+ std::vector<double> bb,bb2;
+ int sw;
+ const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
+ const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
+ const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
+ const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
std::vector<int> nodes;
- int sz;
- INTERP_KERNEL::AutoPtr<double> p=convertPyToNewDblArr2(pt,&sz);
- INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vec,&sz);
self->findNodesOnPlane(p,v,eps,nodes);
DataArrayInt *ret=DataArrayInt::New();
ret->alloc((int)nodes.size(),1);
}
PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
{
- int size;
- INTERP_KERNEL::AutoPtr<double> pos=convertPyToNewDblArr2(pt,&size);
- if(size<self->getSpaceDimension())
- throw INTERP_KERNEL::Exception("getNodeIdsNearPoint : to tiny array ! must be at least of size SpaceDim !");
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ int spaceDim=self->getSpaceDimension();
+ const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
+ const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
std::vector<int> tmp=self->getNodeIdsNearPoint(pos,eps);
DataArrayInt *ret=DataArrayInt::New();
ret->alloc((int)tmp.size(),1);
PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfNodes, double eps) const throw(INTERP_KERNEL::Exception)
{
std::vector<int> c,cI;
- int size;
- INTERP_KERNEL::AutoPtr<double> pos=convertPyToNewDblArr2(pt,&size);
- if(size<self->getSpaceDimension()*nbOfNodes)
- throw INTERP_KERNEL::Exception("getNodeIdsNearPoints : to tiny array ! must be at least of size SpaceDim*nbOfNodes !");
+ //
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ int spaceDim=self->getSpaceDimension();
+ const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
+ const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfNodes,spaceDim,true);
self->getNodeIdsNearPoints(pos,nbOfNodes,eps,c,cI);
PyObject *ret=PyTuple_New(2);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
{
std::vector<int> elems;
- int size;
- INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(bbox,&size);
+ //
+ //
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ int spaceDim=self->getSpaceDimension();
+ const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
+ const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
+ //
self->getCellsInBoundingBox(tmp,eps,elems);
DataArrayInt *ret=DataArrayInt::New();
ret->alloc((int)elems.size(),1);
PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
{
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ int spaceDim=self->getSpaceDimension();
+ const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
+ const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
+ //
std::vector<int> cells;
- int sz;
- INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vec,&sz);
self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
DataArrayInt *ret=DataArrayInt::New();
ret->alloc((int)cells.size(),1);
void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
{
- int sz;
- INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vec,&sz);
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ int spaceDim=self->getSpaceDimension();
+ const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
+ const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
self->orientCorrectly2DCells(v,polyOnly);
}
PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
{
- int sz;
- INTERP_KERNEL::AutoPtr<double> orig=convertPyToNewDblArr2(origin,&sz);
- if(!orig || sz!=3)
- throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D : in parameter 1 expecting origin of type list of float of size 3 !");
- INTERP_KERNEL::AutoPtr<double> vect=convertPyToNewDblArr2(vec,&sz);
- if(!vec || sz!=3)
- throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D : in parameter 2 expecting vector of type list of float of size 3 !");
+ int spaceDim=self->getSpaceDimension();
+ if(spaceDim!=3)
+ throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
+ double val,val2;
+ DataArrayDouble *a,*a2;
+ DataArrayDoubleTuple *aa,*aa2;
+ std::vector<double> bb,bb2;
+ int sw;
+ const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
+ const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
+ const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
+ const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
+ //
DataArrayInt *cellIds=0;
MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
PyObject *ret=PyTuple_New(2);
PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
{
- int sz;
- INTERP_KERNEL::AutoPtr<double> orig=convertPyToNewDblArr2(origin,&sz);
- if(!orig || sz!=3)
- throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3DSurf : in parameter 1 expecting origin of type list of float of size 3 !");
- INTERP_KERNEL::AutoPtr<double> vect=convertPyToNewDblArr2(vec,&sz);
- if(!vec || sz!=3)
- throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3DSurf : in parameter 2 expecting vector of type list of float of size 3 !");
+ int spaceDim=self->getSpaceDimension();
+ if(spaceDim!=3)
+ throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
+ double val,val2;
+ DataArrayDouble *a,*a2;
+ DataArrayDoubleTuple *aa,*aa2;
+ std::vector<double> bb,bb2;
+ int sw;
+ const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
+ const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
+ const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
+ const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
+ //
DataArrayInt *cellIds=0;
MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
PyObject *ret=PyTuple_New(2);
DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
{
- int sz;
- INTERP_KERNEL::AutoPtr<double> orig=convertPyToNewDblArr2(origin,&sz);
- if(!orig || sz!=3)
- throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getCellIdsCrossingPlane : in parameter 1 expecting origin of type list of float of size 3 !");
- INTERP_KERNEL::AutoPtr<double> vect=convertPyToNewDblArr2(vec,&sz);
- if(!vec || sz!=3)
- throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getCellIdsCrossingPlane : in parameter 2 expecting vector of type list of float of size 3 !");
+ int spaceDim=self->getSpaceDimension();
+ if(spaceDim!=3)
+ throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
+ double val,val2;
+ DataArrayDouble *a,*a2;
+ DataArrayDoubleTuple *aa,*aa2;
+ std::vector<double> bb,bb2;
+ int sw;
+ const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
+ const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
+ const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
+ const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
return self->getCellIdsCrossingPlane(orig,vect,eps);
}
PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
{
- int sz;
- INTERP_KERNEL::AutoPtr<double> spaceLoc=convertPyToNewDblArr2(sl,&sz);
- sz=self->getNumberOfComponents();
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ const MEDCouplingMesh *mesh=self->getMesh();
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
+ int spaceDim=mesh->getSpaceDimension();
+ const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
+ const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
+ //
+ int sz=self->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<double> res=new double[sz];
self->getValueOn(spaceLoc,res);
return convertDblArrToPyList(res,sz);
{
int size;
INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(li,&size);
- int spaceDim=self->getMesh()->getSpaceDimension();
+ const MEDCouplingMesh *mesh=self->getMesh();
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
+ int spaceDim=mesh->getSpaceDimension();
int nbOfPoints=size/spaceDim;
if(size%spaceDim!=0)
{
da2->checkAllocated();
int size=da2->getNumberOfTuples();
int nbOfCompo=da2->getNumberOfComponents();
- if(nbOfCompo!=self->getMesh()->getSpaceDimension())
+ const MEDCouplingMesh *mesh=self->getMesh();
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
+ if(nbOfCompo!=mesh->getSpaceDimension())
{
throw INTERP_KERNEL::Exception("Invalid DataArrayDouble nb of components ! Expected same as self.getMesh().getSpaceDimension() !");
}
PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
{
- int sz;
- INTERP_KERNEL::AutoPtr<double> spaceLoc=convertPyToNewDblArr2(sl,&sz);
- sz=self->getNumberOfComponents();
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ const MEDCouplingMesh *mesh=self->getMesh();
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
+ int spaceDim=mesh->getSpaceDimension();
+ const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
+ const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
+ //
+ //
+ int sz=self->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<double> res=new double[sz];
self->getValueOn(spaceLoc,time,res);
return convertDblArrToPyList(res,sz);
targetMesh.rotate(center,0.78539816339744830962);
t1=None
t2=None
- t1,t2=targetMesh.getCellsContainingPoints(pos,6,1e-12);
+ t1,t2=targetMesh.getCellsContainingPoints(pos,1e-12);
+ self.assertEqual(6,t1.getNumberOfTuples());
+ self.assertEqual(7,t2.getNumberOfTuples());
+ self.assertEqual(list(t1.getValues()),expectedValues1);
+ self.assertEqual(list(t2.getValues()),expectedValues2);
+ t1,t2=targetMesh.getCellsContainingPoints(DataArrayDouble.New(pos,6,2),1e-12);
self.assertEqual(6,t1.getNumberOfTuples());
self.assertEqual(7,t2.getNumberOfTuples());
self.assertEqual(list(t1.getValues()),expectedValues1);
self.assertEqual(list(t2.getValues()),expectedValues2);
+ self.assertRaises(InterpKernelException,targetMesh.getCellsContainingPoints,DataArrayDouble.New(pos,4,3),1e-12);
#2D outside
pos1bis=[-0.3303300858899107,-0.11819805153394641]
self.assertEqual(-1,targetMesh.getCellContainingPoint(pos1bis,1e-12));
tmp2=DataArrayDouble.Aggregate(coords,tmp);
mesh.setCoords(tmp2);
pts=[0.2,0.2,0.1,0.3,-0.3,0.7]
- c=mesh.getNodeIdsNearPoint(pts,1e-7);
+ c=mesh.getNodeIdsNearPoint(pts[:2],1e-7);
self.assertEqual([4,9,11],c.getValues());
c,cI=mesh.getNodeIdsNearPoints(pts,3,1e-7);
self.assertEqual([0,3,3,4],cI.getValues());
self.assertRaises(InterpKernelException,m.giveCellsWithType,NORM_HEXA8)
pass
- def testDAOp1(self):
+ def testSwigDAOp1(self):
d=DataArrayDouble.New(5,2)
d.rearrange(1) ; d.iota(2.) ; d.rearrange(2)
d.setInfoOnComponents(["X [m]","Y [m]"])
self.assertEqual(d5.getValues(),[2,3,0,0,2,2,0,4,2,1])
pass
- def testSelectTupleId2DAIBug1(self):
+ def testSwigSelectTupleId2DAIBug1(self):
da=DataArrayInt.New([0,1,2,3,12,13,4,5,6,7,14,15,8,9,10,11,16,17])
self.assertEqual([2,6,10],da[2::6].getValues())
self.assertEqual([0,4,8],da[::6].getValues())
self.assertEqual([5],da[7:-5:6].getValues())
pass
+ def testSwigCpp5Safe1(self):
+ m=MEDCouplingUMesh.New("toto",2)
+ coords=DataArrayDouble.New([0.,0.,1.,0.,1.,1.,0.,1.],4,2)
+ m.setCoords(coords)
+ vecs=DataArrayDouble.New([2.,3.,4.,5.,6.,7.],3,2)
+ expected1=[[2.,3.,3.,3.,3.,4.,2.,4.0],[4.,5.,5.,5.,5.,6.,4.,6.0],[6.,7.,7.,7.,7.,8.,6.,8.0]]
+ for pos,vec in enumerate(vecs):
+ m2=m.deepCpy()
+ m2.translate(vec)
+ self.assertTrue(m2.getCoords().isEqual(DataArrayDouble.New(expected1[pos],4,2),1e-12))
+ pass
+ for pos,vec in enumerate(vecs):
+ m2=m.deepCpy()
+ m2.translate(vec.buildDADouble())
+ self.assertTrue(m2.getCoords().isEqual(DataArrayDouble.New(expected1[pos],4,2),1e-12))
+ pass
+ pass
+
def setUp(self):
pass
pass