Bounds *Bounds::nearlyAmIIntersectingWith(const Bounds& other) const
{
- if( (other._x_min > _x_max+QUADRATIC_PLANAR::_precision) || (other._x_max < _x_min-QUADRATIC_PLANAR::_precision) || (other._y_min > _y_max+QUADRATIC_PLANAR::_precision)
- || (other._y_max < _y_min-QUADRATIC_PLANAR::_precision) )
+ double eps = QuadraticPlanarPrecision::getPrecision();
+ if( (other._x_min > _x_max+eps) || (other._x_max < _x_min-eps) || (other._y_min > _y_max+eps)
+ || (other._y_max < _y_min-eps) )
return 0;
if( (other._x_min >= _x_max ) || (other._x_max <= _x_min) || (other._y_min >= _y_max) || (other._y_max <= _y_min) )
{
- return new Bounds(std::max(_x_min-QUADRATIC_PLANAR::_precision,other._x_min),
- std::min(_x_max+QUADRATIC_PLANAR::_precision,other._x_max),
- std::max(_y_min-QUADRATIC_PLANAR::_precision,other._y_min),
- std::min(_y_max+QUADRATIC_PLANAR::_precision,other._y_max));//In approx cases.
+ return new Bounds(std::max(_x_min-eps,other._x_min),
+ std::min(_x_max+eps,other._x_max),
+ std::max(_y_min-eps,other._y_min),
+ std::min(_y_max+eps,other._y_max));//In approx cases.
}
else
return new Bounds(std::max(_x_min,other._x_min),std::min(_x_max,other._x_max),std::max(_y_min,other._y_min),std::min(_y_max,other._y_max));
bool thinY=Node::areDoubleEquals(_y_min,_y_max);
if(!thinX)
{
- if((Node::areDoubleEquals(x,_x_min) || Node::areDoubleEquals(x,_x_max)) && ((y<_y_max+QUADRATIC_PLANAR::_precision) && (y>_y_min-QUADRATIC_PLANAR::_precision)))
+ if((Node::areDoubleEquals(x,_x_min) || Node::areDoubleEquals(x,_x_max)) && ((y<_y_max+QuadraticPlanarPrecision::getPrecision()) && (y>_y_min-QuadraticPlanarPrecision::getPrecision())))
return ON_BOUNDARY_POS;
}
else
return OUT;
if(!thinY)
{
- if((Node::areDoubleEquals(y,_y_min) || Node::areDoubleEquals(y,_y_max)) && ((x<_x_max+QUADRATIC_PLANAR::_precision) && (x>_x_min-QUADRATIC_PLANAR::_precision)))
+ if((Node::areDoubleEquals(y,_y_min) || Node::areDoubleEquals(y,_y_max)) && ((x<_x_max+QuadraticPlanarPrecision::getPrecision()) && (x>_x_min-QuadraticPlanarPrecision::getPrecision())))
return ON_BOUNDARY_POS;
}
else
for(std::set< IntersectElement >::iterator iter4=inOutSwitch.begin();iter4!=inOutSwitch.end();iter4++)
{
double val((*iter4).getVal1());
- if(fabs(val-ref)>=QUADRATIC_PLANAR::_precision)
+ if(fabs(val-ref)>=QuadraticPlanarPrecision::getPrecision())
{
if(val<ref)
{
inline bool eqpair(const std::pair<double,Node *>& p1, const std::pair<double,Node *>& p2)
{
- return fabs(p1.first-p2.first)<QUADRATIC_PLANAR::_precision;
+ return fabs(p1.first-p2.first)<QuadraticPlanarPrecision::getPrecision();
}
/**
for(std::vector< std::pair<double,Node *> >::const_iterator it=an2.begin();it!=itend;it++)
{
int idd=(*mapp2.find((*it).second)).second;
- if((*it).first<QUADRATIC_PLANAR::_precision)
+ if((*it).first<QuadraticPlanarPrecision::getPrecision())
{
startId=idd;
continue;
}
- if((*it).first>1-QUADRATIC_PLANAR::_precision)
+ if((*it).first>1-QuadraticPlanarPrecision::getPrecision())
{
endId=idd;
continue;
{
_dist=Node::distanceBtw2Pt(getE1().getCenter(),getE2().getCenter());
double radius1=getE1().getRadius(); double radius2=getE2().getRadius();
- if(_dist>radius1+radius2+QUADRATIC_PLANAR::_precision || _dist+std::min(radius1,radius2)+QUADRATIC_PLANAR::_precision<std::max(radius1,radius2))
+ if(_dist>radius1+radius2+QuadraticPlanarPrecision::getPrecision() || _dist+std::min(radius1,radius2)+QuadraticPlanarPrecision::getPrecision()<std::max(radius1,radius2))
{
obviousNoIntersection=true;
areOverlapped=false;
((*(_e2.getStartNode()))[0]-center[0])*((*(_e2.getEndNode()))[1]-center[1])-
((*(_e2.getStartNode()))[1]-center[1])*((*(_e2.getEndNode()))[0]-center[0]);
_determinant=getE1().getRadius()*getE1().getRadius()/_drSq-_cross*_cross/(_drSq*_drSq);
- if(_determinant>-2*QUADRATIC_PLANAR::_precision)//QUADRATIC_PLANAR::_precision*QUADRATIC_PLANAR::_precision*_drSq*_drSq/(2.*_dx*_dx))
+ if(_determinant>-2*QuadraticPlanarPrecision::getPrecision())//QuadraticPlanarPrecision::getPrecision()*QuadraticPlanarPrecision::getPrecision()*_drSq*_drSq/(2.*_dx*_dx))
obviousNoIntersection=false;
else
obviousNoIntersection=true;
{
std::list< IntersectElement > ret;
const double *center=getE1().getCenter();
- if(!(fabs(_determinant)<(2.*QUADRATIC_PLANAR::_precision)))//QUADRATIC_PLANAR::_precision*QUADRATIC_PLANAR::_precision*_drSq*_drSq/(2.*_dx*_dx))
+ if(!(fabs(_determinant)<(2.*QuadraticPlanarPrecision::getPrecision())))//QuadraticPlanarPrecision::getPrecision()*QuadraticPlanarPrecision::getPrecision()*_drSq*_drSq/(2.*_dx*_dx))
{
double determinant=EdgeArcCircle::SafeSqrt(_determinant);
double x1=(_cross*_dy/_drSq+Node::sign(_dy)*_dx*determinant)+center[0];
//
double myDelta1(angle1-_angle0),myDelta2(angle2-_angle0);
if(_angle>0.)
- { myDelta1=myDelta1>-QUADRATIC_PLANAR::_precision?myDelta1:myDelta1+2.*M_PI; myDelta2=myDelta2>-QUADRATIC_PLANAR::_precision?myDelta2:myDelta2+2.*M_PI; }
+ { myDelta1=myDelta1>-QuadraticPlanarPrecision::getPrecision()?myDelta1:myDelta1+2.*M_PI; myDelta2=myDelta2>-QuadraticPlanarPrecision::getPrecision()?myDelta2:myDelta2+2.*M_PI; }
else
- { myDelta1=myDelta1<QUADRATIC_PLANAR::_precision?myDelta1:myDelta1-2.*M_PI; myDelta2=myDelta2<QUADRATIC_PLANAR::_precision?myDelta2:myDelta2-2.*M_PI; }
+ { myDelta1=myDelta1<QuadraticPlanarPrecision::getPrecision()?myDelta1:myDelta1-2.*M_PI; myDelta2=myDelta2<QuadraticPlanarPrecision::getPrecision()?myDelta2:myDelta2-2.*M_PI; }
////
mid[0]=_center[0]+_radius*cos(_angle0+(myDelta1+myDelta2)/2.);
mid[1]=_center[1]+_radius*sin(_angle0+(myDelta1+myDelta2)/2.);
double myDelta2=val2-_angle0;
if(_angle>0.)
{
- myDelta1=myDelta1>-(_radius*QUADRATIC_PLANAR::_precision)?myDelta1:myDelta1+2.*M_PI;//in some cases val1 or val2 are so close to angle0 that myDelta is close to 0. but negative.
- myDelta2=myDelta2>-(_radius*QUADRATIC_PLANAR::_precision)?myDelta2:myDelta2+2.*M_PI;
+ myDelta1=myDelta1>-(_radius*QuadraticPlanarPrecision::getPrecision())?myDelta1:myDelta1+2.*M_PI;//in some cases val1 or val2 are so close to angle0 that myDelta is close to 0. but negative.
+ myDelta2=myDelta2>-(_radius*QuadraticPlanarPrecision::getPrecision())?myDelta2:myDelta2+2.*M_PI;
return myDelta1<myDelta2;
}
else
{
- myDelta1=myDelta1<(_radius*QUADRATIC_PLANAR::_precision)?myDelta1:myDelta1-2.*M_PI;
- myDelta2=myDelta2<(_radius*QUADRATIC_PLANAR::_precision)?myDelta2:myDelta2-2.*M_PI;
+ myDelta1=myDelta1<(_radius*QuadraticPlanarPrecision::getPrecision())?myDelta1:myDelta1-2.*M_PI;
+ myDelta2=myDelta2<(_radius*QuadraticPlanarPrecision::getPrecision())?myDelta2:myDelta2-2.*M_PI;
return myDelta2<myDelta1;
}
}
bool SegSegIntersector::areColinears() const
{
double determinant=_matrix[0]*_matrix[3]-_matrix[1]*_matrix[2];
- return fabs(determinant)<QUADRATIC_PLANAR::_arc_detection_precision;
+ return fabs(determinant)<QuadraticPlanarArcDetectionPrecision::getArcDetectionPrecision();
}
/*!
* Should be called \b once ! non const method.
* \param whereToFind specifies the box where final seek should be done. Essentially it is used for caracteristic reason.
- * \param colinearity returns if regarding QUADRATIC_PLANAR::_precision ; e1 and e2 are colinears
+ * \param colinearity returns if regarding QuadraticPlanarPrecision::getPrecision() ; e1 and e2 are colinears
* If true 'this' is modified ! So this method be called once above all if true is returned for this parameter.
* \param areOverlapped if colinearity if true, this parameter looks if e1 and e2 are overlapped.
*/
void SegSegIntersector::areOverlappedOrOnlyColinears(const Bounds *whereToFind, bool& colinearity, bool& areOverlapped)
{
double determinant=_matrix[0]*_matrix[3]-_matrix[1]*_matrix[2];
- if(fabs(determinant)>2.*QUADRATIC_PLANAR::_precision)//2*_precision due to max of offset on _start and _end
+ if(fabs(determinant)>2.*QuadraticPlanarPrecision::getPrecision())//2*_precision due to max of offset on _start and _end
{
colinearity=false; areOverlapped=false;
_matrix[0]/=determinant; _matrix[1]/=determinant; _matrix[2]/=determinant; _matrix[3]/=determinant;
double deno=sqrt(_matrix[0]*_matrix[0]+_matrix[1]*_matrix[1]);
double x=(*(_e1.getStartNode()))[0]-(*(_e2.getStartNode()))[0];
double y=(*(_e1.getStartNode()))[1]-(*(_e2.getStartNode()))[1];
- areOverlapped=fabs((_matrix[1]*y+_matrix[0]*x)/deno)<QUADRATIC_PLANAR::_precision;
+ areOverlapped=fabs((_matrix[1]*y+_matrix[0]*x)/deno)<QuadraticPlanarPrecision::getPrecision();
}
}
static double dot(const double *vect1, const double *vect2) { return vect1[0]*vect2[0]+vect1[1]*vect2[1]; }
static double sign(double val) { if(val>=0) return 1.; else return -1.; }
static double norm(const double *vect) { return sqrt(vect[0]*vect[0]+vect[1]*vect[1]); }
- static bool areDoubleEquals(double a, double b) { return fabs(a-b) < QUADRATIC_PLANAR::_precision; }
+ static bool areDoubleEquals(double a, double b) { return fabs(a-b) < QuadraticPlanarPrecision::getPrecision(); }
//! idem areDoubleEquals except that precision of comparison is modified.
- static bool areDoubleEqualsWP(double a, double b, double k) { return fabs(a-b) < k*QUADRATIC_PLANAR::_precision; }
+ static bool areDoubleEqualsWP(double a, double b, double k) { return fabs(a-b) < k*QuadraticPlanarPrecision::getPrecision(); }
static double distanceBtw2Pt(const double *a, const double *b) { return sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])); }
static double distanceBtw2PtSq(const double *a, const double *b) { return (a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]); }
//
#include "InterpKernelGeo2DPrecision.hxx"
-double INTERP_KERNEL::QUADRATIC_PLANAR::_precision=1e-14;
+double INTERP_KERNEL::QuadraticPlanarPrecision::_precision=1e-14;
+double INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::_arc_detection_precision=1e-14;
+
+INTERP_KERNEL::QuadraticPlanarPrecision::QuadraticPlanarPrecision(double precision):
+ _initial_precision(_precision)
+{
+ _precision=precision;
+}
+
+INTERP_KERNEL::QuadraticPlanarPrecision::~QuadraticPlanarPrecision()
+{
+ _precision = _initial_precision;
+}
+
+INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::QuadraticPlanarArcDetectionPrecision(double precision):
+ _initial_arc_detection_precision(_arc_detection_precision)
+{
+ _arc_detection_precision=precision;
+}
+
+INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::~QuadraticPlanarArcDetectionPrecision()
+{
+ _arc_detection_precision = _initial_arc_detection_precision;
+}
-double INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=1e-14;
-void INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(double precision)
+void INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(double precision)
{
- INTERP_KERNEL::QUADRATIC_PLANAR::_precision=precision;
+ _precision=precision;
}
-void INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(double precision)
+void INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(double precision)
{
- INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=precision;
+ _arc_detection_precision=precision;
}
namespace INTERP_KERNEL
{
- class INTERPKERNEL_EXPORT QUADRATIC_PLANAR
+ /* !!TODO: a more global review of the code should be done, so that eps is always a parameter of all methods
+ instead of being stored as a static attribute.
+ */
+
+ /** Class storing the precision for the detection of colinear segments, coincident points, etc ...
+ * in Geometric2D computations.
+ *
+ * RAII pattern allowing to temporarily override Geometric2D precision.
+ * When the instance is destroyed, the previous precision is set back.
+ *
+ */
+ class QuadraticPlanarPrecision
{
public:
- static double _precision;
- static double _arc_detection_precision;
+ QuadraticPlanarPrecision(double prec);
+ virtual ~QuadraticPlanarPrecision();
+
static void setPrecision(double precision);
+ inline static double getPrecision() { return _precision; }
+ private:
+ static double _precision;
+ double _initial_precision;
+ };
+
+ /** Class storing the precision for the detection of degenerated arc of circles
+ * in Geometric2D computations.
+ *
+ * RAII pattern allowing to temporarily override Geometric2D precision.
+ * When the instance is destroyed, the previous precision is set back.
+ */
+ class QuadraticPlanarArcDetectionPrecision
+ {
+ public:
+ QuadraticPlanarArcDetectionPrecision(double prec);
+ virtual ~QuadraticPlanarArcDetectionPrecision();
+
static void setArcDetectionPrecision(double precision);
+ inline static double getArcDetectionPrecision() { return _arc_detection_precision; }
+ private:
+ static double _arc_detection_precision;
+ double _initial_arc_detection_precision;
+
};
}
#endif
+
QuadraticPolygon *buildPolygonOfOneEdgeFrom(const std::vector<double>& coords, NormalizedCellType type);
QuadraticPolygon *buildPolygonAFrom(ConnType cell, int nbOfPoints, NormalizedCellType type);
QuadraticPolygon *buildPolygonBFrom(ConnType cell, int nbOfPoints, NormalizedCellType type);
+
+ QuadraticPlanarPrecision _precision;
};
}
GEO2D_INTERSECTOR::Geometric2DIntersector(const MyMeshType& meshT, const MyMeshType& meshS,
double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane,
double precision, int orientation):
- InterpType<MyMeshType,MyMatrix,GEO2D_INTERSECTOR >(meshT,meshS,dimCaracteristic, precision, md3DSurf, minDot3DSurf, medianPlane, true, orientation, 0)
+ InterpType<MyMeshType,MyMatrix,GEO2D_INTERSECTOR >(meshT,meshS,dimCaracteristic, precision, md3DSurf, minDot3DSurf, medianPlane, true, orientation, 0),
+ _precision(precision)
{
- QUADRATIC_PLANAR::_precision=precision;
}
INTERSECTOR_TEMPLATE
double INTERP_KERNEL::InterpolationOptions::getArcDetectionPrecision() const
{
- return INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision;
+ return INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::getArcDetectionPrecision();
}
void INTERP_KERNEL::InterpolationOptions::setArcDetectionPrecision(double p)
{
- INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=p;
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(p);
}
std::string INTERP_KERNEL::InterpolationOptions::getIntersectionTypeRepr() const
delete intersector; e2->decrRef(); e1->decrRef();
}
// Tangent intersection
- QUADRATIC_PLANAR::setPrecision(1e-5);
+ QuadraticPlanarPrecision::setPrecision(1e-5);
for(unsigned k=0;k<8;k++)
{
double center2[2]; center[0]=0.; center[1]=0.;
v4.clear(); v4.clear();
delete intersector; e2->decrRef(); e1->decrRef();
}
- QUADRATIC_PLANAR::setPrecision(1e-14);
+ QuadraticPlanarPrecision::setPrecision(1e-14);
// Extremities # 1
for(unsigned k=0;k<8;k++)
{
*/
void QuadraticPlanarInterpTest::checkHighLevelFunctionTest1()
{
- QUADRATIC_PLANAR::setPrecision(1e-12);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9);
+ QuadraticPlanarPrecision::setPrecision(1e-12);
+ QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-9);
double coords[]={
8.8334591186000004, 5.0999999999999996,
7.1014083111000001, 6.0999999999999996,
pol=QuadraticPolygon::BuildArcCirclePolygon(nodes);
pol->getBarycenter(tmp,tmp2);
delete pol;
- QUADRATIC_PLANAR::setPrecision(1e-14);
+ QuadraticPlanarPrecision::setPrecision(1e-14);
}
void QuadraticPlanarInterpTest::check1DInterpLin()
{
- QUADRATIC_PLANAR::setPrecision(1e-7);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9);
+ QuadraticPlanarPrecision::setPrecision(1e-7);
+ QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-9);
const int NB_OF_CELL_AXIAL_1=30;
static const double Z_VALS_1[NB_OF_CELL_AXIAL_1+1]=
{ -0.1550 , -0.1356, -0.1162, -0.0969, -0.0775 ,-0.0581, -0.0387, -0.0194, 0.0000 , 0.0500,
CPPUNIT_ASSERT_EQUAL(1,(int)m[i+2].size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,m[i+2][i+9],1e-12);
}
- QUADRATIC_PLANAR::setPrecision(1e-14);
+ QuadraticPlanarPrecision::setPrecision(1e-14);
}
/*!
*/
void QuadraticPlanarInterpTest::checkEpsilonCoherency1()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-12);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-12);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-5);
const double pol1[]={
-2.1083388455000001, 1.2172499999999999,
void QuadraticPlanarInterpTest::checkNonRegression2()
{
- QUADRATIC_PLANAR::setPrecision(1e-12);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9);
+ QuadraticPlanarPrecision::setPrecision(1e-12);
+ QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-9);
double coords1[]=
{
15.141499999899999, -26.226033271399999,
void QuadraticPlanarInterpTest::checkNonRegression4()
{
- QUADRATIC_PLANAR::setPrecision(1e-12);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9);
+ QuadraticPlanarPrecision::setPrecision(1e-12);
+ QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-9);
double coords1[]=
{
10.962340811000001, -22.417749999000002,
void QuadraticPlanarInterpTest::checkNonRegression5()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-12);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-12);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-5);
double coords1[]=
{
-1.7320508075000001, 1,
void QuadraticPlanarInterpTest::checkNonRegression6()
{
- QUADRATIC_PLANAR::setPrecision(1e-12);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5);
+ QuadraticPlanarPrecision::setPrecision(1e-12);
+ QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-5);
double coords1[]=
{
10.962340811000001, -22.417749999000002,
void QuadraticPlanarInterpTest::checkNonRegression7()
{
- QUADRATIC_PLANAR::setPrecision(1e-5);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5);
+ QuadraticPlanarPrecision::setPrecision(1e-5);
+ QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-5);
double coords1[]=
{
-2., 0,
void QuadraticPlanarInterpTest::checkNonRegression8()
{
- QUADRATIC_PLANAR::setPrecision(1e-3);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5);
+ QuadraticPlanarPrecision::setPrecision(1e-3);
+ QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-5);
double coords1[]=
{
-13.933240959000001, -28.559499999,
void QuadraticPlanarInterpTest::checkNonRegression9()
{
- QUADRATIC_PLANAR::setPrecision(1e-7);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-8);
+ QuadraticPlanarPrecision::setPrecision(1e-7);
+ QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-8);
double coords1[]=
{
-0.04476229252902969, -0.085118027765365603,
void QuadraticPlanarInterpTest::checkNonRegression10()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords1[]=
{ -0.002269581957210453, -0.09851030343724453,
-0.004268022334182935, -0.1059685844580936,
void QuadraticPlanarInterpTest::checkNonRegression11()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords1[]=
{ -0.002269581957210453, -0.09851030343724453,
-0.004268022334182935, -0.1059685844580936,
void QuadraticPlanarInterpTest::checkNonRegression12()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-6);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-6);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords1[]=
{ -0.5032251558760915, -0.8716087994449138,
-0.4695268343089433, -0.8806382374805872,
void QuadraticPlanarInterpTest::checkNonRegression13()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-6);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-6);
double coords_1[194]={
0, 0, 0.304375, -7.454791178893722e-17, 0.2152256265236553, -0.2152256265236555, -5.591093384170291e-17, -0.304375,
*/
void QuadraticPlanarInterpTest::checkNonRegression14()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-6);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-6);
double coords[72]={
1.,0.,1.3,0.,-1.3,0.,-1.,0.,1.15,0.,0.,1.3,-1.15,0.,0.,1.,
*/
void QuadraticPlanarInterpTest::checkNonRegression15()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-6);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-6);
double coords[72]={
1.,0.,1.3,0.,-1.3,0.,-1.,0.,1.15,0.,0.,1.3,-1.15,0.,0.,1.,
*/
void QuadraticPlanarInterpTest::checkNonRegression16()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords1[194]={
0, 0, 0.304375, 0, 0.2152256265236554, 0.2152256265236554, 1.86369779472343e-17, 0.304375,
-0.2152256265236554, 0.2152256265236554, -0.304375, 3.727395589446861e-17, -0.2152256265236555, -0.2152256265236554, -5.591093384170291e-17, -0.304375,
*/
void QuadraticPlanarInterpTest::checkNonRegression17()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-1., 0., 1., 0. , 1.5, 0., -1.5, 0.,
0. , 1., 1.25, 0., 0., 1.5, -1.25, 0.};
void QuadraticPlanarInterpTest::checkNormalize()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-14);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-14);
Node *n1=new Node(0.,0.); Node *n4=new Node(0.,-3.);
Node *n2=new Node(10.,0.); Node *n5=new Node(10.,-3.);
Node *n3=new Node(5.,10.); Node *n6=new Node(5.,7.);
void QuadraticPlanarInterpTest::checkMakePartitionAbs1()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-14);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-14);
Node *n0=new Node(0.,0.); Node *n4=new Node(0.5,0.25);
Node *n1=new Node(0.,0.5); Node *n5=new Node(0.3,1.2);
Node *n2=new Node(1.,0.5); Node *n6=new Node(1.1,1.3);
void QuadraticPlanarInterpTest::checkNonRegressionOmar0000()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.383022221559489, 0.3213938048432697, -0.5745333323392334, 0.4820907072649046, 0.5745333323392335, 0.4820907072649044, 0.383022221559489, 0.3213938048432696,
-0.4787777769493612, 0.4017422560540872, 4.592273826833915e-17, 0.75, 0.4787777769493612, 0.401742256054087, 3.061515884555943e-17, 0.5 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0001()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.383022221559489, 0.3213938048432697, -0.5745333323392334, 0.4820907072649046, 0.5745333323392335, 0.4820907072649044, 0.383022221559489, 0.3213938048432696,
-0.4787777769493612, 0.4017422560540872, 4.592273826833915e-17, 0.75, 0.4787777769493612, 0.401742256054087, 3.061515884555943e-17, 0.5 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0002()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.383022221559489, 0.3213938048432697, -0.5745333323392334, 0.4820907072649046, 0.5745333323392335, 0.4820907072649044, 0.383022221559489, 0.3213938048432696,
-0.4787777769493612, 0.4017422560540872, 4.592273826833915e-17, 0.75, 0.4787777769493612, 0.401742256054087, 3.061515884555943e-17, 0.5 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0003()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.3535533905932737, 0.3535533905932738, -0.5303300858899106, 0.5303300858899107, 0.5303300858899107, 0.5303300858899106, 0.3535533905932738, 0.3535533905932737,
-0.4419417382415922, 0.4419417382415922, 4.592273826833915e-17, 0.75, 0.4419417382415922, 0.4419417382415922, 3.061515884555943e-17, 0.5 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0004()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.4596194077712559, 0.4596194077712559, -0.5303300858899106, 0.5303300858899107, 0.5303300858899107, 0.5303300858899106, 0.4596194077712559, 0.4596194077712559,
-0.4949747468305832, 0.4949747468305833, 4.592273826833915e-17, 0.75, 0.4949747468305833, 0.4949747468305832, 3.979970649922726e-17, 0.65 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0005()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.383022221559489, 0.3213938048432697, -0.6128355544951823, 0.5142300877492316, 0.6128355544951825, 0.5142300877492314, 0.383022221559489, 0.3213938048432696,
-0.4979288880273356, 0.4178119462962507, 4.898425415289509e-17, 0.8, 0.4979288880273357, 0.4178119462962505, 3.061515884555943e-17, 0.5 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0006()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.383022221559489, 0.3213938048432697, -0.5362311101832845, 0.4499513267805776, 0.5362311101832846, 0.4499513267805774, 0.383022221559489, 0.3213938048432696,
-0.4596266658713867, 0.3856725658119237, 4.28612223837832e-17, 0.7, 0.4596266658713868, 0.3856725658119236, 3.061515884555943e-17, 0.5 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0007()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.383022221559489, 0.3213938048432697, -0.5362311101832845, 0.4499513267805776, 0.5362311101832846, 0.4499513267805774, 0.383022221559489, 0.3213938048432696,
-0.4596266658713867, 0.3856725658119237, 4.28612223837832e-17, 0.7, 0.4596266658713868, 0.3856725658119236, 3.061515884555943e-17, 0.5 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0008()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.383022221559489, 0.3213938048432697, -0.5362311101832845, 0.4499513267805776, 0.5362311101832846, 0.4499513267805774, 0.383022221559489, 0.3213938048432696,
-0.4596266658713867, 0.3856725658119237, 4.28612223837832e-17, 0.7, 0.4596266658713868, 0.3856725658119236, 3.061515884555943e-17, 0.5 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0009()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.3863703305156274, -0.1035276180410081, -0.4829629131445342, -0.1294095225512602, 0.4829629131445342, -0.1294095225512604, 0.3863703305156274, -0.1035276180410083,
-0.4346666218300808, -0.1164685702961342, 1.416374613080751e-16, 0.5, 0.4346666218300808, -0.1164685702961343, 1.133099690464601e-16, 0.4 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0010()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.3863703305156274, -0.1035276180410081, -0.4829629131445342, -0.1294095225512602, 0.4829629131445342, -0.1294095225512604, 0.3863703305156274, -0.1035276180410083,
-0.4346666218300808, -0.1164685702961342, 1.416374613080751e-16, 0.5, 0.4346666218300808, -0.1164685702961343, 1.133099690464601e-16, 0.4 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0011()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.3863703305156274, -0.1035276180410081, -0.4829629131445342, -0.1294095225512602, 0.4829629131445342, -0.1294095225512604, 0.3863703305156274, -0.1035276180410083,
-0.4346666218300808, -0.1164685702961342, 1.416374613080751e-16, 0.5, 0.4346666218300808, -0.1164685702961343, 1.133099690464601e-16, 0.4 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar2511()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.3863703305156274, -0.1035276180410081, -0.4829629131445342, -0.1294095225512602, 0.4829629131445342, -0.1294095225512604, 0.3863703305156274, -0.1035276180410083,
-0.4346666218300808, -0.1164685702961342, 1.416374613080751e-16, 0.5, 0.4346666218300808, -0.1164685702961343, 1.133099690464601e-16, 0.4, };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0012()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1,
-1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0013()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1,
-1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0014()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1,
-1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0015()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1,
-1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0016()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1,
-1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0017()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1,
-1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0018()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1,
-1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0019()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
-0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0020()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
-0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0021()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
-0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 };
}
void QuadraticPlanarInterpTest::checkNonRegressionOmar0022()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
-0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0023()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
-0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5, };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0024()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
-0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar2524()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
-0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0025()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
-0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0026()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0,
-0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0027()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0,
-0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0028()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0,
-0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0029()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0,
-0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 };
void QuadraticPlanarInterpTest::checkNonRegressionOmar0030()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
double coords[16]={
-0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0,
-0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 };
INTERP_KERNEL::Node *tmp=new INTERP_KERNEL::Node(res[2*i],res[2*i+1]);
nodes[i]=tmp;
}
- INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps;
- INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps;
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(eps);
INTERP_KERNEL::QuadraticPolygon *pol=0;
if(isQuad)
pol=INTERP_KERNEL::QuadraticPolygon::BuildArcCirclePolygon(nodes);
void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints,
double eps, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& elts, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& eltsIndex) const
{
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(eps);
elts=DataArrayInt::New(); eltsIndex=DataArrayInt::New(); eltsIndex->alloc(nbOfPoints+1,1); eltsIndex->setIJ(0,0,0); elts->alloc(0,1);
int *eltsIndexPtr(eltsIndex->getPointer());
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bboxArr(getBoundingBoxForBBTree(eps));
{
if(SPACEDIM!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getCellsContainingPointsAlg : not implemented yet for POLYGON and QPOLYGON in spaceDim 3 !");
- INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps;
- INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps;
std::vector<INTERP_KERNEL::Node *> nodes(sz);
INTERP_KERNEL::QuadraticPolygon *pol(0);
for(int j=0;j<sz;j++)
double epsa=fabs(eps);
if(epsa<std::numeric_limits<double>::min())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DCurveInternal : epsilon is null ! Please specify a higher epsilon. If too tiny it can lead to a huge amount of nodes and memory !");
- INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=1.e-10;
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(1.e-10);
int nbCells=getNumberOfCells();
int nbNodes=getNumberOfNodes();
const int *conn=_nodal_connec->getConstPointer();
int spaceDim(getSpaceDimension()),mDim(getMeshDimension()),nbOfCells(getNumberOfCells());
if(spaceDim!=2 || mDim!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic : This method should be applied on mesh with mesh dimension equal to 2 and space dimension also equal to 2!");
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(arcDetEps);
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
const double *coords(_coords->getConstPointer());
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[*connI]));
int sz(connI[1]-connI[0]-1);
- INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=arcDetEps;
std::vector<INTERP_KERNEL::Node *> nodes(sz);
INTERP_KERNEL::QuadraticPolygon *pol(0);
for(int j=0;j<sz;j++)
int spaceDim(getSpaceDimension()),mDim(getMeshDimension()),nbOfCells(getNumberOfCells());
if(spaceDim!=2 || mDim!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic : This method should be applied on mesh with mesh dimension equal to 1 and space dimension also equal to 2!");
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision prec(arcDetEps);
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
const double *coords(_coords->getConstPointer());
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[*connI]));
int sz(connI[1]-connI[0]-1);
- INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=arcDetEps;
std::vector<INTERP_KERNEL::Node *> nodes(sz);
INTERP_KERNEL::Edge *edge(0);
for(int j=0;j<sz;j++)
m2->checkFullyDefined();
if(m1->getMeshDimension()!=2 || m1->getSpaceDimension()!=2 || m2->getMeshDimension()!=2 || m2->getSpaceDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshes works on umeshes m1 AND m2 with meshdim equal to 2 and spaceDim equal to 2 too!");
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(eps);
// Step 1: compute all edge intersections (new nodes)
std::vector< std::vector<int> > intersectEdge1, colinear2, subDiv2;
// Step 1: compute all edge intersections (new nodes)
std::vector< std::vector<int> > intersectEdge1, colinear2, subDiv2;
std::vector<double> addCoo,addCoordsQuadratic; // coordinates of newly created nodes
- INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps;
- INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps;
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(eps);
//
// Build desc connectivity
DataArrayInt *desc1(DataArrayInt::New()),*descIndx1(DataArrayInt::New()),*revDesc1(DataArrayInt::New()),*revDescIndx1(DataArrayInt::New());
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> baryRet1(ret1NonCol->getBarycenterAndOwner());
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
mesh2D->getCellsContainingPoints(baryRet1->begin(),baryRet1->getNumberOfTuples(),eps,elts,eltsIndex);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> eltsIndex2(eltsIndex->deltaShiftIndex());
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> eltsIndex2(DataArrayInt::New()); eltsIndex2->alloc(0,1);
+ if (eltsIndex->getNumberOfTuples() > 1)
+ eltsIndex2 = eltsIndex->deltaShiftIndex();
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> eltsIndex3(eltsIndex2->getIdsEqual(1));
if(eltsIndex2->count(0)+eltsIndex3->getNumberOfTuples()!=ret1NonCol->getNumberOfCells())
throw INTERP_KERNEL::Exception("Intersect2DMeshWith1DLine : internal error 1 !");
const int *conn2(m2->getNodalConnectivity()->getConstPointer()),*connI2(m2->getNodalConnectivityIndex()->getConstPointer());
int offset2(offset1+m2->getNumberOfNodes());
int offset3(offset2+((int)addCoords.size())/2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bbox1Arr(m1->getBoundingBoxForBBTree()),bbox2Arr(m2->getBoundingBoxForBBTree());
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bbox1Arr(m1->getBoundingBoxForBBTree(eps)),bbox2Arr(m2->getBoundingBoxForBBTree(eps));
const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin());
// Here a BBTree on 2D-cells, not on segments:
BBTree<SPACEDIM,int> myTree(bbox2,0,0,m2->getNumberOfCells(),eps);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New());
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mDesc(buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1));
const int *c(mDesc->getNodalConnectivity()->getConstPointer()),*ci(mDesc->getNodalConnectivityIndex()->getConstPointer()),*rd(revDesc1->getConstPointer()),*rdi(revDescIndx1->getConstPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bboxArr(mDesc->getBoundingBoxForBBTree());
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bboxArr(mDesc->getBoundingBoxForBBTree(eps));
const double *bbox(bboxArr->begin()),*coords(getCoords()->begin());
int nCell(getNumberOfCells()),nDescCell(mDesc->getNumberOfCells());
std::vector< std::vector<int> > intersectEdge(nDescCell),overlapEdge(nDescCell);
std::vector<double> addCoo;
BBTree<SPACEDIM,int> myTree(bbox,0,0,nDescCell,-eps);
- INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps;
- INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps;
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(eps);
for(int i=0;i<nDescCell;i++)
{
std::vector<int> candidates;
checkCoherency();
if(getSpaceDimension()!=2 || getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::colinearize2D : This method only works for meshes with spaceDim=2 and meshDim=2 !");
- INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps;
- INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps;
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(eps);
int nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
const int *cptr(_nodal_connec->begin()),*ciptr(_nodal_connec_index->begin());
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newc(DataArrayInt::New()),newci(DataArrayInt::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0);
std::vector< std::vector<int> >& intersectEdge1, std::vector< std::vector<int> >& colinear2, std::vector< std::vector<int> >& subDiv2, std::vector<double>& addCoo, std::map<int,int>& mergedNodes)
{
static const int SPACEDIM=2;
- INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps;
- INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps;
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
+ INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(eps);
const int *c1(m1Desc->getNodalConnectivity()->getConstPointer()),*ci1(m1Desc->getNodalConnectivityIndex()->getConstPointer());
// Build BB tree of all edges in the tool mesh (second mesh)
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bbox1Arr(m1Desc->getBoundingBoxForBBTree()),bbox2Arr(m2Desc->getBoundingBoxForBBTree());
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bbox1Arr(m1Desc->getBoundingBoxForBBTree(eps)),bbox2Arr(m2Desc->getBoundingBoxForBBTree(eps));
const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin());
int nDescCell1(m1Desc->getNumberOfCells()),nDescCell2(m2Desc->getNumberOfCells());
intersectEdge1.resize(nDescCell1);
pass
#
pass
-
+
def testComputeNeighborsOfCells1(self):
m=MEDCouplingDataForTest.build2DTargetMesh_1();
d1,d2=m.computeNeighborsOfCells();
self.assertTrue(subMesh.isEqual(m5,1e-12))
self.assertRaises(InterpKernelException,m.buildPartOfMySelf,[1,5],True);
pass
-
+
def testSwigGetItem3(self):
da=DataArrayInt.New([4,5,6])
self.assertEqual(5,da[1])
d-=2
d%=7
pass
-
+
def testSwigDAIOp5(self):
d=DataArrayInt.New([4,5,6,10,3,-1],2,3)
self.toSeeIfDaIIopsAreOK(d)
dExp=DataArrayInt.New([2,4,6,0,0,6],2,3)
self.assertTrue(d.isEqual(dExp));
pass
-
+
def toSeeIfDaDIopsAreOK(self,d):
d+=5
d*=6
self.assertAlmostEqual(expected4[i],ard2.getIJ(i,0),12)
pass
pass
-
+
def testPartitionBySpreadZone1(self):
m=MEDCouplingDataForTest.build2DTargetMesh_1();
m4=MEDCouplingUMesh.MergeUMeshes([m,m[-3:],m[0:2]]);
self.assertTrue(m2.getCoords().isEqual(DataArrayDouble.New(expected1[pos],4,2),1e-12))
pass
pass
-
+
def testSwigBugNonRegressionZipDA(self):
angles=map(lambda x:pi/3*x,xrange(6))
radius=3
self.assertEqual(expected2,d2.getValues())
pass
+ def testIntersect2DMeshes7(self):
+ """ Quadratic precision values were improperly reset before testing colinearities """
+ eps = 1.0e-08
+ mesh1 = MEDCouplingUMesh('assemblyGrid_Pij', 2)
+ coo = DataArrayDouble([(10.80630000000000,10.80630000000000),(9.48750000000000,10.80630000000000),(10.75250000000000,10.80630000000000),(9.48750000000000,9.48750000000000),(10.75250000000000,9.48750000000000),(10.80630000000000,9.48750000000000),(9.48750000000000,10.75250000000000),(10.75250000000000,10.75250000000000),(10.80630000000000,10.75250000000000)])
+ mesh1.setCoords(coo)
+ c = DataArrayInt([5, 4, 3, 6, 7, 5, 5, 4, 7, 8, 5, 1, 2, 7, 6, 5, 2, 0, 8, 7])
+ cI = DataArrayInt([0, 5, 10, 15, 20])
+ mesh1.setConnectivity(c, cI)
+ mesh2 = MEDCouplingUMesh('merge', 2)
+ coo = DataArrayDouble([(9.48750000000001,9.48750000000001),(10.75249999999975,9.48749999999955),(10.12000000000001,9.48750000000001),(10.80629999999976,9.48749999999955),(8.22250000000029,10.75250000000028),(9.48749999999961,10.75249999999971),(8.85500000000029,10.75250000000028),(9.48750000000001,10.12000000000001),(10.75249999999338,10.75249999999338),(10.41000000000001,10.12000000000001),(10.32506096654411,10.32506096654411),(10.12000000000001,10.41000000000001),(9.91493903345591,10.32506096654411),(9.83000000000001,10.12000000000001),(9.91493903345591,9.91493903345591),(10.12000000000001,9.83000000000001),(10.32506096654411,9.91493903345591),(10.11999999999961,10.75249999999971),(10.75249999999975,10.11999999999958),(10.49000000000001,10.12000000000001),(10.38162950903903,10.38162950903903),(10.12000000000001,10.49000000000001),(9.85837049096099,10.38162950903903),(9.75000000000001,10.12000000000001),(9.85837049096099,9.85837049096099),(10.12000000000001,9.75000000000001),(10.38162950903903,9.85837049096099),(9.88665476220845,10.35334523779157),(9.88665476220845,9.88665476220845),(9.67293524548050,9.67293524548050),(9.67293524548050,10.56706475451952),(10.80629999999339,10.75249999999338),(8.22250000000029,10.80630000000028),(9.48749999999961,10.80629999999971),(10.75249999999338,10.80629999999339),(10.80629999999339,10.80629999999339),(10.77939999999976,9.48749999999955),(10.77939999999339,10.75249999999338),(10.80629999999976,10.11999999999958),(8.22250000000029,10.77940000000028),(8.85500000000029,10.80630000000028),(9.48749999999961,10.77939999999971),(10.11999999999961,10.80629999999971),(10.75249999999338,10.77939999999339),(10.77939999999339,10.80629999999339),(10.80629999999339,10.77939999999339)])
+ mesh2.setCoords(coo)
+ c = DataArrayInt([32, 4, 32, 33, 5, 39, 40, 41, 6, 32, 5, 33, 34, 8, 41, 42, 43, 17, 32, 8, 34, 35, 31, 43, 44, 45, 37, 32, 14, 12, 10, 16, 13, 11, 9, 15, 32, 22, 12, 14, 24, 27, 13, 28, 23, 32, 24, 0, 5, 22, 29, 7, 30, 23, 32, 24, 14, 16, 10, 12, 22, 20, 26, 28, 15, 9, 11, 27, 21, 19, 25, 32, 22, 5, 8, 1, 0, 24, 26, 20, 30, 17, 18, 2, 29, 25, 19, 21, 32, 1, 8, 31, 3, 18, 37, 38, 36])
+ cI = DataArrayInt([0, 9, 18, 27, 36, 45, 54, 71, 88, 97])
+ mesh2.setConnectivity(c, cI)
+ result, mapResToInit, mapResToRef = MEDCouplingUMesh.Intersect2DMeshes(mesh1, mesh2, eps)
+ result.zipCoords()
+ exp_coo = [9.48750000000001, 9.48750000000001, 10.75249999999975, 9.48749999999955, 10.80629999999976, 9.48749999999955, 9.48749999999961, 10.75249999999971, 10.75249999999338, 10.75249999999338, 10.32506096654411, 10.32506096654411, 9.91493903345591, 10.32506096654411, 9.91493903345591, 9.91493903345591, 10.32506096654411, 9.91493903345591, 10.38162950903903, 10.38162950903903, 9.85837049096099, 10.38162950903903, 9.85837049096099, 9.85837049096099, 10.38162950903903, 9.85837049096099, 10.80629999999339, 10.75249999999338, 9.48749999999961, 10.80629999999971, 10.75249999999338, 10.80629999999339, 10.80629999999339, 10.80629999999339, 9.830000000000023, 10.120000000000008, 10.120000000000008, 10.410000000000004, 10.41000000000001, 10.120000000000008, 10.120000000000008, 9.830000000000013, 9.886654762208451, 10.353345237791569, 9.830000000000023, 10.120000000000008, 9.886654762208451, 9.886654762208451, 9.750000000000005, 10.12000000000001, 9.487499999999809, 10.11999999999986, 9.6729352454803, 10.56706475451937, 9.750000000000005, 10.12000000000001, 9.672935245480499, 9.672935245480499, 9.886654762208451, 9.886654762208451, 10.120000000000008, 9.830000000000013, 10.41000000000001, 10.120000000000008, 10.120000000000008, 10.410000000000004, 9.886654762208451, 10.353345237791569, 10.120000000000013, 10.490000000000004, 10.489999999999988, 10.120000000000013, 10.120000000000017, 9.750000000000021, 10.119999999996494, 10.752499999996544, 10.752499999996566, 10.119999999996466, 10.11999999999988, 9.48749999999978, 9.672935245480499, 9.672935245480499, 10.120000000000017, 9.750000000000021, 10.489999999999988, 10.120000000000013, 10.120000000000013, 10.490000000000004, 9.6729352454803, 10.56706475451937]
+ e1 = [0, 0, 0, 0, 0, 1, 2, 3]
+ e2 = [3, 4, 5, 6, 7, 8, 1, 2]
+ valuesExpected=DataArrayDouble(exp_coo, len(exp_coo)/2, 2)
+ self.assertTrue(result.getCoords().isEqual(valuesExpected,1e-12))
+ self.assertEqual(e1, mapResToInit.getValues())
+ self.assertEqual(e2, mapResToRef.getValues())
+
+ def testIntersect2DMeshes8(self):
+ """ Quadratic precision values were improperly reset before testing colinearities
+ This was also impacting the mapping computation. """
+ eps = 1.0e-8
+ mesh1 = MEDCouplingUMesh('assemblyGrid_Pij', 2)
+ coo = DataArrayDouble([(10.80630000000000,-10.80630000000000),(9.48750000000000,-10.80630000000000),(10.75250000000000,-10.80630000000000),(9.48750000000000,-10.75250000000000),(10.75250000000000,-10.75250000000000),(10.80630000000000,-10.75250000000000),(9.48750000000000,-9.48750000000000),(10.75250000000000,-9.48750000000000),(10.80630000000000,-9.48750000000000)])
+ mesh1.setCoords(coo)
+ c = DataArrayInt([5, 2, 1, 3, 4, 5, 0, 2, 4, 5, 5, 4, 3, 6, 7, 5, 5, 4, 7, 8])
+ cI = DataArrayInt([0, 5, 10, 15, 20])
+ mesh1.setConnectivity(c, cI)
+ mesh2 = MEDCouplingUMesh('merge', 2)
+ coo = DataArrayDouble([(9.48749999999998,-10.75249999999999),(9.48750000000018,-10.80629999999998),(10.75250000000047,-10.75250000000063),(10.75249999999318,-10.80629999999318),(10.80630000000048,-10.75250000000063),(10.80629999999318,-10.80629999999318),(9.48750000000001,-9.48750000000001),(9.48749999999998,-10.11999999999999),(10.75249999999975,-9.48750000000004),(10.40999999999999,-10.11999999999999),(10.32506096654408,-9.91493903345589),(10.11999999999999,-9.82999999999999),(9.91493903345589,-9.91493903345589),(9.82999999999998,-10.11999999999999),(9.91493903345589,-10.32506096654409),(10.11999999999999,-10.40999999999999),(10.32506096654408,-10.32506096654409),(10.12000000000001,-9.48750000000001),(10.75250000000047,-10.12000000000058),(10.12000000000018,-10.75249999999998),(9.70121951672794,-10.53878048327204),(9.70121951672794,-9.70121951672794),(10.80629999999976,-9.48750000000004),(9.48750000000018,-10.77939999999998),(10.75249999999318,-10.77939999999318),(10.12000000000018,-10.80629999999998),(10.77940000000048,-10.75250000000063),(10.80629999999318,-10.77939999999318),(10.77939999999318,-10.80629999999318),(10.77939999999976,-9.48750000000004),(10.80630000000048,-10.12000000000058)])
+ mesh2.setCoords(coo)
+ c = DataArrayInt([32, 1, 0, 2, 3, 23, 19, 24, 25, 32, 3, 2, 4, 5, 24, 26, 27, 28, 32, 16, 14, 12, 10, 15, 13, 11, 9, 32, 0, 6, 12, 14, 7, 21, 13, 20, 32, 6, 8, 2, 0, 14, 16, 10, 12, 17, 18, 19, 20, 15, 9, 11, 21, 32, 2, 8, 22, 4, 18, 29, 30, 26])
+ cI = DataArrayInt([0, 9, 18, 27, 36, 53, 62])
+ mesh2.setConnectivity(c, cI)
+ result, mapResToInit, mapResToRef = MEDCouplingUMesh.Intersect2DMeshes(mesh1, mesh2, eps)
+ result.zipCoords()
+ exp_coo = [9.48749999999998, -10.75249999999999, 9.48750000000018, -10.80629999999998, 10.75250000000047, -10.75250000000063, 10.75249999999318, -10.80629999999318, 10.80630000000048, -10.75250000000063, 10.80629999999318, -10.80629999999318, 9.48750000000001, -9.48750000000001, 10.75249999999975, -9.48750000000004, 10.32506096654408, -9.91493903345589, 9.91493903345589, -9.91493903345589, 9.91493903345589, -10.32506096654409, 10.32506096654408, -10.32506096654409, 10.80629999999976, -9.48750000000004, 10.119999999999989, -10.409999999999961, 9.829999999999997, -10.11999999999999, 10.119999999999983, -9.830000000000005, 10.409999999999968, -10.119999999999987, 9.487499999999994, -10.120000000000001, 9.70121951672795, -9.70121951672795, 9.829999999999997, -10.11999999999999, 9.701219516727935, -10.53878048327204, 10.11999999999988, -9.487500000000026, 10.752500000000111, -10.120000000000335, 10.120000000000225, -10.75250000000031, 9.701219516727935, -10.53878048327204, 10.119999999999989, -10.409999999999961, 10.409999999999968, -10.119999999999987, 10.119999999999983, -9.830000000000005, 9.70121951672795, -9.70121951672795]
+ e1 = [0, 1, 2, 2, 2, 3]
+ e2 = [0, 1, 2, 3, 4, 5]
+ valuesExpected=DataArrayDouble(exp_coo, len(exp_coo)/2, 2)
+ self.assertTrue(result.getCoords().isEqual(valuesExpected,1e-10))
+ self.assertEqual(e1, mapResToInit.getValues())
+ self.assertEqual(e2, mapResToRef.getValues())
+
def testSwig2Intersect2DMeshesQuadra1(self):
import cmath
- def createDiagCircle(lX, lY, R, cells=[0,1]):
+ def createDiagCircle(lX, lY, R, cells=[0,1]):
""" A circle in a square box, cut along the diagonal.
- """
+ """
c = []
for i in range(8):
c.append(cmath.rect(R, i*pi/4))
-
+
coords = [0.0,0.0, c[3].real,c[3].imag, -lX/2.0, lY/2.0,
0.0, lY/2.0, lX/2.0,lY/2.0, lX/2.0,0.0,
# 6 7 8
lX/2.0,-lY/2.0, c[7].real,c[7].imag, c[1].real,c[1].imag,
- # 9 10 11
+ # 9 10 11
c[5].real,c[5].imag, -lX/2.0,-lY/2.0, 0.0, -lY/2.0,
# 12 13 14
-lX/2.0,0.0, 0.0,0.0, 0.0, 0.0]
coords[14*2+1] = 0.5*(coords[1*2+1]+coords[2*2+1])
connec = [1,7,8,0] # half circle up right
connec3 = [6,7,1,2,4,13,8,14,3,5]
-
- baseMesh = MEDCouplingUMesh.New("box_circle", 2)
+
+ baseMesh = MEDCouplingUMesh.New("box_circle", 2)
baseMesh.allocateCells(2)
meshCoords = DataArrayDouble.New(coords, len(coords)/2, 2)
meshCoords.setInfoOnComponents(["X [au]", "Y [au]"])
baseMesh.setCoords(meshCoords)
-
+
if 0 in cells:
- baseMesh.insertNextCell(NORM_QPOLYG, connec)
- if 1 in cells:
- baseMesh.insertNextCell(NORM_QPOLYG, connec3)
- baseMesh.finishInsertingCells()
- baseMesh.checkCoherency()
- return baseMesh
-
+ baseMesh.insertNextCell(NORM_QPOLYG, connec)
+ if 1 in cells:
+ baseMesh.insertNextCell(NORM_QPOLYG, connec3)
+ baseMesh.finishInsertingCells()
+ baseMesh.checkCoherency()
+ return baseMesh
+
eps = 1.0e-7
- m1 = createDiagCircle(1.0, 1.0, 0.5*0.90, cells=[0,1])
+ m1 = createDiagCircle(1.0, 1.0, 0.5*0.90, cells=[0,1])
m2 = createDiagCircle(1.0, 1.0, 0.5*0.95, cells=[0])
m3, _, _= MEDCouplingUMesh.Intersect2DMeshes(m1, m2, eps)
m3.mergeNodes(eps)
m3.convertDegeneratedCells()
- m3.zipCoords()
+ m3.zipCoords()
m4 = m3.deepCpy()
m5, _, _ = MEDCouplingUMesh.Intersect2DMeshes(m3, m4, eps)
m5.mergeNodes(eps)
eps = 1.0e-8
coords = [-0.5,-0.5, -0.5, 0.5, 0.5, 0.5, 0.5,-0.5]
connec = range(4)
- m1 = MEDCouplingUMesh.New("box", 2)
+ m1 = MEDCouplingUMesh.New("box", 2)
m1.allocateCells(1)
meshCoords = DataArrayDouble.New(coords, len(coords)/2, 2)
m1.setCoords(meshCoords)
m1.insertNextCell(NORM_POLYGON, connec)
- m1.finishInsertingCells()
-
+ m1.finishInsertingCells()
+
m2 = MEDCouplingDataForTest.buildCircle(0.25, 0.2, 0.4)
# Was looping indefinitly:
m_intersec, resToM1, resToM2 = MEDCouplingUMesh.Intersect2DMeshes(m1, m2, eps)
m_intersec.zipCoords()
- coo_tgt = DataArrayDouble([-0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.03284271247461901, 0.4828427124746191,
- -0.014575131106459124, 0.5000000000000001, 0.5, -0.11224989991991996, 0.24271243444677046, 0.5, 0.5, 0.19387505004004,
- -0.04799910280454185, -0.06682678787499614, -0.023843325638122054, 0.4915644577163915, 0.5, -0.30612494995996, 0.0, -0.5,
+ coo_tgt = DataArrayDouble([-0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.03284271247461901, 0.4828427124746191,
+ -0.014575131106459124, 0.5000000000000001, 0.5, -0.11224989991991996, 0.24271243444677046, 0.5, 0.5, 0.19387505004004,
+ -0.04799910280454185, -0.06682678787499614, -0.023843325638122054, 0.4915644577163915, 0.5, -0.30612494995996, 0.0, -0.5,
-0.5, 0.0, -0.25728756555322957, 0.5, -0.023843325638122026, 0.49156445771639157, -0.04799910280454181, -0.06682678787499613], 17 ,2)
conn_tgt = [32, 5, 2, 6, 4, 7, 8, 9, 10, 32, 6, 3, 0, 1, 5, 4, 11, 12, 13, 14, 15, 16]
connI_tgt = [0, 9, 22]
self.assertEqual(connI_tgt, m_intersec.getNodalConnectivityIndex().getValues())
self.assertEqual(res1_tgt, resToM1.getValues())
self.assertEqual(res2_tgt, resToM2.getValues())
-
+
def testDAIBuildUnique1(self):
d=DataArrayInt([1,2,2,3,3,3,3,4,5,5,7,7,7,19])
e=d.buildUnique()
mT3.allocateCells(1)
mT3.insertNextCell(NORM_TRI3,range(3))
mT3.finishInsertingCells()
-
+
tr=[[0.,0.],[2.,0.], [0.,2.],[2.,2.],[4.,2.],[6.,2.],[8.,2.],[10.,2.],[12.,2.],[0.,4.],[2.,4.],[4.,4.],[6.,4.],[8.,4.],[10.,4.],[12.,4.],[14.,4.],[16.,4.],[18.,4.],[20.,4.],[22.,4.]]
ms=2*[mQ4]+7*[mQ8]+11*[mT3]
ms[:]=(elt.deepCpy() for elt in ms)
#
m0=MEDCouplingUMesh("m",3) ; m0.allocateCells(0); m0.insertNextCell(NORM_TETRA4,[0,1,2,3]); #Well oriented
m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,1,2,3,4]); #Well oriented
- m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,1,2,3,4,5]); #Well oriented
+ m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,1,2,3,4,5]); #Well oriented
m3=MEDCouplingUMesh("m",3) ; m3.allocateCells(0); m3.insertNextCell(NORM_HEXA8,[0,1,2,3,4,5,6,7]); #Well oriented
m4=MEDCouplingUMesh("m",3) ; m4.allocateCells(0)
self.assertRaises(InterpKernelException,m4.insertNextCell,NORM_HEXGP12,[0,1,2,3,4,5,6,7,8,9,10,11,12]);
#
mOK=m.deepCpy()
m0=MEDCouplingUMesh("m",3) ; m0.allocateCells(0); m0.insertNextCell(NORM_TETRA4,[0,2,1,3]); #Not well oriented
- m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,1,2,3,4]); #Well oriented
- m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,1,2,3,4,5]); #Well oriented
+ m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,1,2,3,4]); #Well oriented
+ m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,1,2,3,4,5]); #Well oriented
m3=MEDCouplingUMesh("m",3) ; m3.allocateCells(0); m3.insertNextCell(NORM_HEXA8,[0,3,2,1,4,7,6,5]); #Not well oriented
m4=MEDCouplingUMesh("m",3) ; m4.allocateCells(0); m4.insertNextCell(NORM_HEXGP12,[0,5,4,3,2,1,6,11,10,9,8,7]); #Not well oriented
m0.setCoords(c0) ; m1.setCoords(c1) ; m2.setCoords(c2) ; m3.setCoords(c3) ; m4.setCoords(c4)
pass
#
m0=MEDCouplingUMesh("m",3) ; m0.allocateCells(0); m0.insertNextCell(NORM_TETRA4,[0,1,2,3]); #Well oriented
- m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,3,2,1,4]); #Not well oriented
- m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,2,1,3,5,4]); #Not well oriented
+ m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,3,2,1,4]); #Not well oriented
+ m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,2,1,3,5,4]); #Not well oriented
m3=MEDCouplingUMesh("m",3) ; m3.allocateCells(0); m3.insertNextCell(NORM_HEXA8,[0,1,2,3,4,5,6,7]); #Well oriented
m4=MEDCouplingUMesh("m",3) ; m4.allocateCells(0); m4.insertNextCell(NORM_HEXGP12,range(12)); #Well oriented
m0.setCoords(c0) ; m1.setCoords(c1) ; m2.setCoords(c2) ; m3.setCoords(c3) ; m4.setCoords(c4)
pass
def testSwigSetItem3(self):
- # 1-2
+ # 1-2
d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
d[3]=[1,2]
self.assertTrue(d.isEqual(DataArrayDouble([0,0,0,0,0,0,1,2,0,0,0,0],6,2),1e-14))
d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
d[1::2,:]=[3,9]
self.assertTrue(d.isEqual(DataArrayDouble([0,0,3,9,0,0,3,9,0,0,3,9],6,2),1e-14))
- # 1-2
+ # 1-2
d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
d[3]=[1,2]
self.assertTrue(d.isEqual(DataArrayInt([0,0,0,0,0,0,1,2,0,0,0,0],6,2)))
self.assertTrue(a.isEqual(DataArrayInt([0,2,4])))
self.assertTrue(b.isEqual(DataArrayInt([0,1,2,7,8,15,16,17])))
pass
-
+
def testSwig2BigMem(self):
if MEDCouplingSizeOfVoidStar()==64:
d=DataArrayAsciiChar(223456789,16)
d4**=d3
self.assertTrue(d4.isEqual(DataArrayDouble([1.,sqrt(2.),1.4422495703074083,sqrt(2.)]),1e-14))
pass
-
+
def testSwig2Baryenter3DForCellsWithVolumeZero1(self):
coo=DataArrayDouble([0.,0.,0.,1.,0.,0.,0.,1.,0.],3,3)
m2=MEDCouplingUMesh("mesh",2)
d.alloc(1000,3) ; d.fillWithValue(127)
self.assertTrue(len(d.__repr__())<500)
pass
-
+
def testSwig2MeshComputeIsoBarycenterOfNodesPerCell1(self):
coo=DataArrayDouble([26.17509821414239,5.0374,200.,26.175098214142388,-5.0374,200.,17.450065476094927,20.1496,200.,8.725032738047464,25.187,200.,43.62516369023732,5.0374,200.,34.90013095218986,10.0748,200.,34.900130952189855,-10.0748,200.,43.625163690237315,-5.0374,200.,26.175098214142402,25.187,200.,26.175098214142395,35.2618,200.,17.45006547609493,40.2992,200.,8.725032738047469,35.2618,200.,26.17509821414239,5.0374,200.,26.175098214142388,-5.0374,200.,17.450065476094927,20.1496,200.,8.725032738047464,25.187,200.,43.62516369023732,5.0374,200.,34.90013095218986,10.0748,200.,34.900130952189855,-10.0748,200.,43.625163690237315,-5.0374,200.,26.175098214142402,25.187,200.,26.175098214142395,35.2618,200.,17.45006547609493,40.2992,200.,8.725032738047469,35.2618,200.],24,3)
m=MEDCouplingUMesh.New("toto",3)
self.assertTrue(d.isEqual(DataArrayInt([0,0,0,0,0,0])))
self.assertTrue(e.isEqual(DataArrayInt([0,1,2,3,4,5,6])))
pass
-
+
def testSwigAdvGauss(self):
f=MEDCouplingFieldTemplate(ON_GAUSS_PT)
f.setDiscretization(None)
self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(1,0.25),(1,0.44444444444444442),(1,0.59999999999999998),(1,0.72727272727272729),(1,0.83333333333333337)]),1e-12))
self.assertRaises(InterpKernelException,f.__rdiv__,f2)
pass
-
+
pass
if __name__ == '__main__':
unittest.main()
-
+
pass
#
pass
-
+
# test the when input slice is all the same object is return by MEDCouplingMesh.buildPartRange
def testSwig2MeshPartSlice1(self):
a=DataArrayDouble(4) ; a.iota()
exp=DataArrayDouble([18.5,118.5,17.5,117.5,16.5,116.5,14.5,114.5,13.5,113.5,12.5,112.5],6,2) ; exp.setInfoOnComponents(["aa [km]","bbb [kJ]"])
self.assertTrue(f2.getArray().isEqual(exp,1e-13))
pass
-
+
def testSwig2NonRegressionBugIntersectMeshes1(self):
src=MEDCouplingUMesh("src",2)
src.setCoords(DataArrayDouble([-2.5,-3,-2.5,3,2.5,3],3,2))
self.assertTrue(m.getCellsContainingPoint((-0.4,-0.4),1e-12).isEqual(DataArrayInt([1])))
self.assertTrue(m.getCellsContainingPoint((0.,-0.4),1e-12).isEqual(DataArrayInt([0,1])))
pass
-
+
def testSwig2GetCellsContainingPointsForNonConvexPolygon2(self):
coo=DataArrayDouble([-0.5,-0.5,-0.5,0.5,0.5,0.5,0.5,-0.5,-2.0816681711721685e-17,-2.0816681711721685e-17,-0.17677669529663687,0.1767766952966369,0.,0.5,0.5,0.,0.17677669529663684,-0.17677669529663692,0.17677669529663692,0.17677669529663684,-0.17677669529663692,-0.17677669529663687,0.,-0.5,-0.5,0.,0.33838834764831843,-0.3383883476483185,-0.33838834764831843,0.33838834764831843,-0.21213203435596423,0.21213203435596426,0.2121320343559642,-0.2121320343559643,0.21213203435596426,0.2121320343559642,-0.21213203435596423,-0.21213203435596428,0.3560660171779821,-0.35606601717798214,-0.35606601717798214,0.35606601717798214,0.19445436482630052,-0.19445436482630063,-0.19445436482630055,0.19445436482630057,0.,0.27],24,2)
m=MEDCouplingUMesh("mesh",2) ; m.setCoords(coo) ; m.allocateCells()
def testSwig2Colinearize2D3(self):
""" colinearize was too agressive, potentially producing cells with one edge """
# Flat polygon with 3 edges - nothing should happen (min number of edges for a linear polyg)
- coo = DataArrayDouble([0.0,0.0, 2.0,0.0, 1.5,0.0, 1.0,0.0, 0.5,0.0], 5,2)
+ coo = DataArrayDouble([0.0,0.0, 2.0,0.0, 1.5,0.0, 1.0,0.0, 0.5,0.0], 5,2)
m = MEDCouplingUMesh("m", 2)
c, cI = [DataArrayInt(l) for l in [[NORM_POLYGON, 0,1,2], [0,4]] ]
m.setCoords(coo); m.setConnectivity(c, cI)
m.checkCoherency1()
self.assertEqual(c.getValues(), m.getNodalConnectivity().getValues())
self.assertEqual(cI.getValues(), m.getNodalConnectivityIndex().getValues())
-
- # Flat quad polygon, 2 edges - nothing should happen (min number of edges for a quad polyg)
+
+ # Flat quad polygon, 2 edges - nothing should happen (min number of edges for a quad polyg)
m = MEDCouplingUMesh("m", 2)
c, cI = [DataArrayInt(l) for l in [[NORM_QPOLYG, 0,1, 2,3], [0,5]] ]
m.setCoords(coo); m.setConnectivity(c, cI)
m.checkCoherency1()
self.assertEqual(c.getValues(), m.getNodalConnectivity().getValues())
self.assertEqual(cI.getValues(), m.getNodalConnectivityIndex().getValues())
-
+
# Flat polygon, 4 edges - one reduction should happen
m = MEDCouplingUMesh("m", 2)
c, cI = [DataArrayInt(l) for l in [[NORM_POLYGON, 0,1,2,3], [0,5]] ]
m.checkCoherency1()
self.assertEqual([NORM_POLYGON, 3,1,2], m.getNodalConnectivity().getValues())
self.assertEqual([0,4], m.getNodalConnectivityIndex().getValues())
-
- # Flat quad polygon, 3 edges - one reduction expected
+
+ # Flat quad polygon, 3 edges - one reduction expected
m = MEDCouplingUMesh("m", 2)
c, cI = [DataArrayInt(l) for l in [[NORM_QPOLYG, 0,1,3, 3,2,4], [0,7]] ]
m.setCoords(coo); m.setConnectivity(c, cI)
self.assertEqual([NORM_QPOLYG, 3,1, 5,2], m.getNodalConnectivity().getValues())
self.assertTrue( m.getCoords()[5].isEqual( DataArrayDouble([(1.5,0.0)]), 1.0e-12 ) )
self.assertEqual([0,5], m.getNodalConnectivityIndex().getValues())
-
+
# Now an actual (neutronic) case: circle made of 4 SEG3. Should be reduced to 2 SEG3
m = MEDCouplingDataForTest.buildCircle2(0.0, 0.0, 1.0)
c, cI = [DataArrayInt(l) for l in [[NORM_QPOLYG, 7,5,3,1, 6,4,2,0], [0,9]] ]
self.assertEqual(d.getValuesAsTuple(),[])
d=DataArrayDouble(24) ; d.iota() ; d.rearrange(3)
self.assertEqual(d.getValues(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15.,16.,17.,18.,19.,20.,21.,22.,23.])
- self.assertEqual(d.getValuesAsTuple(),[(0.,1.,2.0),(3.,4.,5.0),(6.,7.,8.0),(9.,10.,11.0),(12.,13.,14.0),(15.,16.,17.0),(18.,19.,20.0),(21.,22.,23.)])
+ self.assertEqual(d.getValuesAsTuple(),[(0.,1.,2.0),(3.,4.,5.0),(6.,7.,8.0),(9.,10.,11.0),(12.,13.,14.0),(15.,16.,17.0),(18.,19.,20.0),(21.,22.,23.)])
d=DataArrayInt()
self.assertEqual(d.getValues(),[])
self.assertEqual(d.getValuesAsTuple(),[])
self.assertTrue(isinstance(g1[i],MEDCouplingCartesianAMRPatch))
pass
pass
-
+
def testSwig2AMR7(self):
"""Idem testSwig2AMR6 except that we are in 1D"""
amr=MEDCouplingCartesianAMRMesh("",1,[6],[0],[1])
exp11=DataArrayDouble([61.03,61.03,62.03,62.03,62.03,63.03,63.03,63.03,64.03,64.03,64.03,65.03,65.03,61.03,61.03,62.03,62.03,62.03,63.03,63.03,63.03,64.03,64.03,64.03,65.03,65.03,75.03,75.03,76.03,76.03,76.03,77.03,77.03,77.03,78.03,78.03,78.03,79.03,79.03,75.03,75.03,76.03,76.03,76.03,77.03,77.03,77.03,78.03,78.03,78.03,79.03,79.03,75.03,75.03,76.03,76.03,76.03,77.03,77.03,77.03,78.03,78.03,78.03,79.03,79.03,89.03,89.03,90.03,90.03,90.03,91.03,91.03,91.03,92.03,92.03,92.03,93.03,93.03,89.03,89.03,90.03,90.03,90.03,91.03,91.03,91.03,92.03,92.03,92.03,93.03,93.03,89.03,89.03,90.03,90.03,90.03,91.03,91.03,91.03,92.03,92.03,92.03,93.03,93.03,103.03,103.03,104.03,104.03,104.03,105.03,105.03,105.03,106.03,106.03,106.03,107.03,107.03,103.03,103.03,104.03,104.03,104.03,105.03,105.03,105.03,106.03,106.03,106.03,107.03,107.03,103.03,103.03,104.03,104.03,104.03,105.03,105.03,105.03,106.03,106.03,106.03,107.03,107.03,117.03,117.03,118.03,118.03,118.03,119.03,119.03,119.03,120.03,120.03,120.03,121.03,121.03,117.03,117.03,118.03,118.03,118.03,119.03,119.03,119.03,120.03,120.03,120.03,121.03,121.03])
self.assertTrue(att3.getFieldOn(att3.getMyGodFather().getMeshAtPosition((1,3)),"YY").isEqualWithoutConsideringStr(exp11,1e-12))
del att3
- ###
+ ###
att4.synchronizeAllGhostZonesAtASpecifiedLevel(2)
for pos in [(),(0,),(1,),(2,)]:
self.assertTrue(att4.getFieldOn(att4.getMyGodFather().getMeshAtPosition(pos),"YY").isEqual(att5.getFieldOn(att5.getMyGodFather().getMeshAtPosition(pos),"YY"),1e-12))
self.assertTrue(att.getFieldOn(amr[1].getMesh(),"YY").isEqualWithoutConsideringStr(exp1,1e-12))
pass
pass
-
+
def testSwig2AMR14(self):
""" non regression linked to VTHB write."""
fact=[2,2] ; fact2=[3,3]
m2.setConnectivity(conn2, connI2)
# End of construction of input meshes m1bis and m2 -> start of specific part of the test
- a,b,c,d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m1, m2, 1e-10)
+ a,b,c,d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m1, m2, 1e-10)
self.assertTrue(a.getNodalConnectivity().isEqual(DataArrayInt([4,2,1,4,5,32,0,3,11,7,10,14,15,16,17,18,32,4,1,10,7,11,19,20,21,22,23])))
self.assertTrue(a.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,16,27])))
self.assertTrue(b.getNodalConnectivity().isEqual(DataArrayInt([1,6,10,1,10,7,2,7,11,12,2,11,8,13])))
self.assertTrue(c.isEqual(DataArrayInt([0,0,0,0])))
self.assertTrue(d.isEqual(DataArrayInt([(-1,-1),(0,3),(-1,-1),(-1,-1),(1,3),(-1,-1),(-1,-1),(2,3),(-1,-1)])))
pass
-
+
def testSwig2Intersect2DMeshWith1DLine8(self):
""" Line pieces ending (or fully located) in the middle of a cell """
m1c = MEDCouplingCMesh()
m_circ = MEDCouplingDataForTest.buildCircle2(0.0, 0.0, 2.0)
coords = [0.0,3.0,0.0,-3.0]
connec = [0,1]
- m_line = MEDCouplingUMesh("seg", 1)
+ m_line = MEDCouplingUMesh("seg", 1)
m_line.allocateCells(1)
meshCoords = DataArrayDouble.New(coords, len(coords)/2, 2)
m_line.setCoords(meshCoords)
m.checkCoherency()
coords2 = [0., 1.3, -1.3, 0., -0.6, 0.6, 0., -1.3, -0.5, -0.5]
connec2, cI2 = [NORM_SEG3, 0, 1, 2, NORM_SEG3, 1, 3, 4], [0,4,8]
- m_line = MEDCouplingUMesh("seg", 1)
+ m_line = MEDCouplingUMesh("seg", 1)
m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2))
m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2))
a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m, m_line, eps)
m.checkCoherency()
coords2 = [-1., 0.25, 1., 0.25]
connec2, cI2 = [NORM_SEG2, 0, 1], [0,3]
- m_line = MEDCouplingUMesh.New("seg", 1)
+ m_line = MEDCouplingUMesh.New("seg", 1)
m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2))
m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2))
m_line2 = m_line.deepCpy()
m = MEDCouplingUMesh("boxcircle", 2)
sq2 = math.sqrt(2.0)
soth = (sq2+1.0)/2.0
- coo = [2., 0., sq2, sq2, 0., 2., -sq2, sq2, -2., 0., -sq2, -sq2, 0., -2., sq2, -sq2, -1., -1., -1., 1., 1.,
+ coo = [2., 0., sq2, sq2, 0., 2., -sq2, sq2, -2., 0., -sq2, -sq2, 0., -2., sq2, -sq2, -1., -1., -1., 1., 1.,
1., 1., -1., -1., 0., 0., 1., 1., 0., 0., -1., -soth, soth, soth,soth]
- coo = DataArrayDouble(coo); coo.rearrange(2)
+ coo = DataArrayDouble(coo); coo.rearrange(2)
m.setCoords(coo)
c = [NORM_QPOLYG, 8, 9, 10, 11, 12, 13, 14, 15, NORM_QPOLYG, 3, 1, 10, 9, 2, 17, 13, 16, NORM_QPOLYG, 1, 7, 5, 3, 9, 8, 11, 10, 0, 6, 4, 16, 12, 15, 14, 17]
cI = [0, 9, 18, 35]
m.checkCoherency()
coords2 = [-2., 1., 2., 1.0]
connec2, cI2 = [NORM_SEG2, 0, 1], [0,3]
- m_line = MEDCouplingUMesh("seg", 1)
+ m_line = MEDCouplingUMesh("seg", 1)
m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2))
m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2))
a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m, m_line, eps)
coo = [2.,0.,1.4142135623730951,1.414213562373095,0.,2.,-1.414213562373095,1.4142135623730951,-2.,0.,-1.4142135623730954,-1.414213562373095,0.,-2.,
1.4142135623730947,-1.4142135623730954,1.,0.,0.7071067811865476,0.7071067811865475,0.,1.,-0.7071067811865475,0.7071067811865476,-1.,0.,-0.7071067811865477,-0.7071067811865475,
0.,-1.,0.7071067811865474,-0.7071067811865477,1.060660171779821,-1.0606601717798214,-1.0606601717798214,-1.0606601717798212]
- coo = DataArrayDouble(coo); coo.rearrange(2)
+ coo = DataArrayDouble(coo); coo.rearrange(2)
m.setCoords(coo)
c = [NORM_QPOLYG, 15, 13, 11, 9, 14, 12, 10, 8, NORM_QPOLYG, 7, 5, 13, 15, 6, 17, 14, 16, NORM_QPOLYG, 5, 3, 1, 7, 15, 9, 11, 13, 4, 2, 0, 16, 8, 10, 12, 17]
- cI = [0, 9, 18, 35]
+ cI = [0, 9, 18, 35]
m.setConnectivity(DataArrayInt(c), DataArrayInt(cI))
m.checkCoherency()
coords2 = [-2., 0., 2., 0.]
connec2, cI2 = [NORM_SEG2, 0, 1], [0,3]
- m_line = MEDCouplingUMesh.New("seg", 1)
+ m_line = MEDCouplingUMesh.New("seg", 1)
m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2))
m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2))
a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m, m_line, eps)
m = MEDCouplingUMesh("boxcircle", 2)
sq2 = math.sqrt(2.0)
soth = (sq2+1.0)/2.0
- coo = [2., 0., sq2, sq2, 0., 2., -sq2, sq2, -2., 0., -sq2, -sq2, 0., -2., sq2, -sq2, -1., -1., -1., 1., 1.,
+ coo = [2., 0., sq2, sq2, 0., 2., -sq2, sq2, -2., 0., -sq2, -sq2, 0., -2., sq2, -sq2, -1., -1., -1., 1., 1.,
1., 1., -1., -1., 0., 0., 1., 1., 0., 0., -1., -soth, soth, soth,soth]
- coo = DataArrayDouble(coo); coo.rearrange(2)
+ coo = DataArrayDouble(coo); coo.rearrange(2)
m.setCoords(coo)
c = [NORM_QPOLYG, 8, 9, 10, 11, 12, 13, 14, 15, NORM_QPOLYG, 3, 1, 10, 9, 2, 17, 13, 16, NORM_QPOLYG, 1, 7, 5, 3, 9, 8, 11, 10, 0, 6, 4, 16, 12, 15, 14, 17]
cI = [0, 9, 18, 35]
m.checkCoherency()
coords2 = [(-2., 1.),(2.,1.),(0.,1)]
connec2, cI2 = [NORM_SEG2, 0, 2, NORM_SEG2, 2, 1], [0,3,6]
- m_line = MEDCouplingUMesh("seg", 1)
+ m_line = MEDCouplingUMesh("seg", 1)
m_line.setCoords(DataArrayDouble(coords2))
m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2))
a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m, m_line, eps)
m = MEDCouplingUMesh("boxcircle", 2)
sq2 = math.sqrt(2.0)
soth = (sq2+1.0)/2.0
- coo = [2., 0., sq2, sq2, 0., 2., -sq2, sq2, -2., 0., -sq2, -sq2, 0., -2., sq2, -sq2, -1., -1., -1., 1., 1.,
+ coo = [2., 0., sq2, sq2, 0., 2., -sq2, sq2, -2., 0., -sq2, -sq2, 0., -2., sq2, -sq2, -1., -1., -1., 1., 1.,
1., 1., -1., -1., 0., 0., 1., 1., 0., 0., -1., -soth, soth, soth,soth]
- coo = DataArrayDouble(coo); coo.rearrange(2)
+ coo = DataArrayDouble(coo); coo.rearrange(2)
m.setCoords(coo)
c = [NORM_QPOLYG, 8, 9, 10, 11, 12, 13, 14, 15, NORM_QPOLYG, 3, 1, 10, 9, 2, 17, 13, 16, NORM_QPOLYG, 1, 7, 5, 3, 9, 8, 11, 10, 0, 6, 4, 16, 12, 15, 14, 17]
cI = [0, 9, 18, 35]
m.checkCoherency()
coords2 = [1., 2., 1., -2.]
connec2, cI2 = [NORM_SEG2, 0, 1], [0,3]
- m_line = MEDCouplingUMesh("seg", 1)
+ m_line = MEDCouplingUMesh("seg", 1)
m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2))
m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2))
a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m, m_line, eps)
self.assertTrue(d.isEqual(DataArrayInt([(-1,-1),(1,2),(3,0),(3,4),(-1,-1)])))
pass
+ def testSwig2Intersect2DMeshWith1DLine17(self):
+ """ Single colinear intersection - a deltaShiftIndex() was improperly tested. """
+ eps = 1.0e-12
+ mesh = MEDCouplingUMesh('dummy_layer', 2)
+ coo = DataArrayDouble([(-0.5,-0.5),(-0.5,0.5),(0.5,0.5),(0.5,-0.5),(-0.25,-0.25),(-0.25,0.25),(0.25,0.25),(0.25,-0.25)])
+ mesh.setCoords(coo)
+ c = DataArrayInt([5, 4, 5, 6, 7, 5, 0, 1, 5, 4, 5, 1, 2, 3, 0, 4, 7, 6, 5])
+ cI = DataArrayInt([0, 5, 10, 19])
+ mesh.setConnectivity(c, cI)
+ m_line = MEDCouplingUMesh('segment', 1)
+ coo = DataArrayDouble([(-0.5,0.5),(-0.25,0.25)])
+ m_line.setCoords(coo)
+ c = DataArrayInt([1, 0, 1])
+ cI = DataArrayInt([0, 3])
+ m_line.setConnectivity(c, cI)
+ a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(mesh, m_line, eps)
+ self.assertEqual(mesh.getNodalConnectivity().getValues(),a.getNodalConnectivity().getValues())
+ self.assertEqual(mesh.getNodalConnectivityIndex().getValues(),a.getNodalConnectivityIndex().getValues())
+ self.assertEqual([1,1,5],b.getNodalConnectivity().getValues())
+ self.assertEqual(m_line.getNodalConnectivityIndex().getValues(),b.getNodalConnectivityIndex().getValues())
+ self.assertTrue([0,1,2], c.getValues())
+ self.assertEqual([2,1], d.getValues())
+
def testOrderConsecutiveCells1D1(self):
"""A line in several unconnected pieces:"""
m2 = MEDCouplingUMesh.New("bla", 1)
m2.setCoords(coords2);
m2.setConnectivity(c, cI);
m2.checkCoherency1(1.0e-8);
-
+
# Shuffle a bit :-)
m2.renumberCells(DataArrayInt([0,3,6,8,1,4,7,5,2]), True);
res = m2.orderConsecutiveCells1D()
expRes = [0,3,6,8,1,4,2,7,5]
self.assertEqual(m2.getNumberOfCells(),res.getNumberOfTuples())
self.assertEqual(expRes, res.getValues())
-
+
# A closed line (should also work)
m3 = MEDCouplingUMesh.New("bla3", 1)
conn3A = DataArrayInt([NORM_SEG2,0,1,NORM_SEG3,1,3,2, NORM_SEG2,3,0])
coord3 = coords2[0:5]
c.reAlloc(10)
cI.reAlloc(4)
-
+
m3.setCoords(coord3)
m3.setConnectivity(conn3A, cI)
m3.checkCoherency1(1.0e-8)
self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp5,12)
m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0)
self.assertAlmostEqual(m2.computeDiameterField().getArray()[0],exp5,12)
- # PYRA5 (1) 5th node is further
+ # PYRA5 (1) 5th node is further
# noise of coo=DataArrayDouble([(0,0,0),(1,0,0),(1,1,0),(0,1,0),(0.5,0.5,2)]) + rotation([0.7,-1.2,0.6],[-4,-1,10],0.3)
coo=DataArrayDouble([(-0.31638393672228626,-0.3157865246451914,-0.12555467233075002),(0.7281379795666488,0.03836511217237115,-0.08431662762197323),(0.4757967840735147,0.8798897996143908,-0.2680890320119049),(-0.5386339871809047,0.5933159894201252,-0.2975311238319419),(0.012042592988768974,0.534282135495012,1.7859521682027926)])
m=MEDCoupling1SGTUMesh("mesh",NORM_PYRA5) ; m.setCoords(coo)
self.assertEqual( 6, sla3.getLength() )
pass
-
+
def testMEDCouplingUMeshgenerateGraph(self):
# cartesian mesh 3x3
arr=DataArrayDouble(4) ; arr.iota()