From cc7fe50c199d66560502654c463708e2705b6d8e Mon Sep 17 00:00:00 2001 From: ageay Date: Mon, 18 Jun 2012 10:35:46 +0000 Subject: [PATCH] simplification of polyedrons. --- src/MEDCoupling/MEDCouplingMemArray.cxx | 23 +++++++++++++++++++++++ src/MEDCoupling_Swig/MEDCoupling.i | 2 ++ 2 files changed, 25 insertions(+) diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 933d542a0..cce1ae037 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -1538,6 +1538,29 @@ void DataArrayDouble::getMinMaxPerComponent(double *bounds) const throw(INTERP_K } } +/*! + * This method recenter tuples in \b this in order to be centered at the origin to benefit about the advantages of maximal precision to be around the box + * around origin of 'radius' 1. + * + * \param [in] eps absolute epsilon. under that value of delta between max and min no scale is performed. + */ +void DataArrayDouble::recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception) +{ + checkAllocated(); + int dim=getNumberOfComponents(); + std::vector bounds(2*dim); + getMinMaxPerComponent(&bounds[0]); + for(int i=0;ieps) + applyLin(1./delta,-offset/delta,i); + else + applyLin(1.,-offset,i); + } +} + double DataArrayDouble::getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception) { if(getNumberOfComponents()!=1) diff --git a/src/MEDCoupling_Swig/MEDCoupling.i b/src/MEDCoupling_Swig/MEDCoupling.i index 33403f8e9..e85f54a87 100644 --- a/src/MEDCoupling_Swig/MEDCoupling.i +++ b/src/MEDCoupling_Swig/MEDCoupling.i @@ -699,6 +699,7 @@ namespace ParaMEDMEM bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception); void zipCoords() throw(INTERP_KERNEL::Exception); double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception); + void recenterForMaxPrecision(double eps) const throw(INTERP_KERNEL::Exception); void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception); void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception); virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception) = 0; @@ -1970,6 +1971,7 @@ namespace ParaMEDMEM void convertAllToPoly(); void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception); void unPolyze() throw(INTERP_KERNEL::Exception); + void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception); }; -- 2.39.2