From ae3c3d11c1f73429f62b29ec4fb618b7cdd1075c Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 21 Jan 2009 13:14:43 +0000 Subject: [PATCH] reset default tolerance to smaller value --- Post/OctreePost.cpp | 32 ++++++++++++++++---------------- Post/OctreePost.h | 4 ++-- Post/shapeFunctions.cpp | 10 ++++++++-- Post/shapeFunctions.h | 9 ++------- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/Post/OctreePost.cpp b/Post/OctreePost.cpp index 64b7c7d88c..f74eab2fbf 100644 --- a/Post/OctreePost.cpp +++ b/Post/OctreePost.cpp @@ -393,22 +393,8 @@ bool OctreePost::_getValue(void *in, int nbComp, double P[3], int timestep, return true; } -bool OctreePost::searchScalar(double x, double y, double z, double *values, - int step, double *size) -{ - bool a = searchScalar_(x,y,z,values,step,size); - if (!a){ - element::setTolerance(10.); - a = searchScalar_(x,y,z,values,step,size); - element::setTolerance(1.e-3); - } - if (!a)printf("cannot find %g %g %g\n",x,y,z); - return a; -} - - -bool OctreePost::searchScalar_(double x, double y, double z, double *values, - int step, double *size) +bool OctreePost::_searchScalar(double x, double y, double z, double *values, + int step, double *size) { double P[3] = {x, y, z}; @@ -438,6 +424,20 @@ bool OctreePost::searchScalar_(double x, double y, double z, double *values, return false; } +bool OctreePost::searchScalar(double x, double y, double z, double *values, + int step, double *size) +{ + bool a = _searchScalar(x, y, z, values, step, size); + if (!a){ + double oldeps = element::getTolerance(); + element::setTolerance(10.); + a = _searchScalar(x, y, z, values, step, size); + element::setTolerance(oldeps); + } + if (!a) Msg::Debug("No element found containing point (%g,%g,%g)", x, y, z); + return a; +} + bool OctreePost::searchVector(double x, double y, double z, double *values, int step, double *size) { diff --git a/Post/OctreePost.h b/Post/OctreePost.h index 172125d449..bd6770d517 100644 --- a/Post/OctreePost.h +++ b/Post/OctreePost.h @@ -30,8 +30,8 @@ class OctreePost double *elementSize); bool _getValue(void *in, int nbComp, double P[3], int step, double *values, double *elementSize); - bool searchScalar_(double x, double y, double z, double *values, - int step = -1, double *size = 0); + bool _searchScalar(double x, double y, double z, double *values, + int step = -1, double *size = 0); public : OctreePost(PView *); ~OctreePost(); diff --git a/Post/shapeFunctions.cpp b/Post/shapeFunctions.cpp index 47681c4e0f..69c5aee5e8 100644 --- a/Post/shapeFunctions.cpp +++ b/Post/shapeFunctions.cpp @@ -1,3 +1,9 @@ +// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle +// +// See the LICENSE.txt file for license information. Please report all +// bugs and problems to <gmsh@geuz.org>. + #include "shapeFunctions.h" -double element::ONE = 1.+1.e-2; -double element::ZERO = -1.e-2; + +double element::ONE = 1. + 1.e-6; +double element::ZERO = -1.e-6; diff --git a/Post/shapeFunctions.h b/Post/shapeFunctions.h index da06e97770..965347251d 100644 --- a/Post/shapeFunctions.h +++ b/Post/shapeFunctions.h @@ -17,13 +17,8 @@ protected: static double ONE, ZERO; public: element(double *x, double *y, double *z) : _x(x), _y(y), _z(z) {} - static void setTolerance (const double tol){ - ONE = 1.+tol; - ZERO = -tol; - } - static double getTolerance () { - return -ZERO; - } + static void setTolerance (const double tol){ ONE = 1. + tol; ZERO = -tol; } + static double getTolerance () { return -ZERO; } virtual ~element(){} virtual int getDimension() = 0; virtual int getNumNodes() = 0; -- GitLab