From d32ef78cc004db06a040af7270bbc59ec1678300 Mon Sep 17 00:00:00 2001 From: Sebastian Eibl <sebastian.eibl@fau.de> Date: Wed, 2 Aug 2017 10:32:36 +0200 Subject: [PATCH] made thresholds changeable --- src/pe/Thresholds.cpp | 72 +++++++++++++++++++++++++++++++++++++++++++ src/pe/Thresholds.h | 18 ++++------- 2 files changed, 78 insertions(+), 12 deletions(-) create mode 100644 src/pe/Thresholds.cpp diff --git a/src/pe/Thresholds.cpp b/src/pe/Thresholds.cpp new file mode 100644 index 000000000..b8edf23bd --- /dev/null +++ b/src/pe/Thresholds.cpp @@ -0,0 +1,72 @@ +//====================================================================================================================== +// +// This file is part of waLBerla. waLBerla is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// waLBerla is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file Thresholds.cpp +//! \author Klaus Iglberger +//! \author Sebastian Eibl <sebastian.eibl@fau.de> +//! \brief Numerical thresholds for the physics engine +// +//====================================================================================================================== + +#include "Thresholds.h" + +namespace walberla { +namespace pe { + +//================================================================================================= +// +// GLOBAL THRESHOLD VALUES +// +//================================================================================================= + +//************************************************************************************************* +//! Threshold for the contact classification. +/*! This threshold separates between separating, resting and colliding contacts. */ +real_t collisionThreshold = Thresholds<real_t>::collisionThreshold(); +//************************************************************************************************* + + +//************************************************************************************************* +//! Threshold for the distance between two rigid bodies. +/*! Rigid bodies with a distance smaller than this threshold are in contact. */ +real_t contactThreshold = Thresholds<real_t>::contactThreshold(); +//************************************************************************************************* + + +//************************************************************************************************* +//! Threshold for the restriction of the coefficient of restitution. +/*! In case the relative velocity between two colliding rigid bodies is smaller than this + threshold, a coefficient of restitution of 0 is used to avoid an infinite number of + collisions during a single time step. */ +real_t restitutionThreshold = Thresholds<real_t>::restitutionThreshold(); +//************************************************************************************************* + + +//************************************************************************************************* +//! Threshold for the separation between static and dynamic friction. +/*! This threshold represents the boundary between static and dynamic friction. */ +real_t frictionThreshold = Thresholds<real_t>::frictionThreshold(); +//************************************************************************************************* + + +//************************************************************************************************* +//! Threshold for surface points/checks. +/*! Only points with a distance to the surface smaller than this threshold are considered + surface point. */ +real_t surfaceThreshold = Thresholds<real_t>::surfaceThreshold(); +//************************************************************************************************* + +} // namespace pe +} // namespace walberla diff --git a/src/pe/Thresholds.h b/src/pe/Thresholds.h index f0993be59..bea31db50 100644 --- a/src/pe/Thresholds.h +++ b/src/pe/Thresholds.h @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License along // with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file Types.h +//! \file Thresholds.h //! \author Klaus Iglberger //! \author Sebastian Eibl <sebastian.eibl@fau.de> //! \brief Numerical thresholds for the physics engine @@ -219,23 +219,17 @@ public: // //================================================================================================= -// Disable false warnings in GCC 5 -#if ( defined __GNUC__ ) && ( __GNUC__ >= 5 ) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunused-variable" -#endif - //************************************************************************************************* //! Threshold for the contact classification. /*! This threshold separates between separating, resting and colliding contacts. */ -const real_t collisionThreshold = Thresholds<real_t>::collisionThreshold(); +extern real_t collisionThreshold; //************************************************************************************************* //************************************************************************************************* //! Threshold for the distance between two rigid bodies. /*! Rigid bodies with a distance smaller than this threshold are in contact. */ -const real_t contactThreshold = Thresholds<real_t>::contactThreshold(); +extern real_t contactThreshold; //************************************************************************************************* @@ -244,14 +238,14 @@ const real_t contactThreshold = Thresholds<real_t>::contactThreshold(); /*! In case the relative velocity between two colliding rigid bodies is smaller than this threshold, a coefficient of restitution of 0 is used to avoid an infinite number of collisions during a single time step. */ -const real_t restitutionThreshold = Thresholds<real_t>::restitutionThreshold(); +extern real_t restitutionThreshold; //************************************************************************************************* //************************************************************************************************* //! Threshold for the separation between static and dynamic friction. /*! This threshold represents the boundary between static and dynamic friction. */ -const real_t frictionThreshold = Thresholds<real_t>::frictionThreshold(); +extern real_t frictionThreshold; //************************************************************************************************* @@ -259,7 +253,7 @@ const real_t frictionThreshold = Thresholds<real_t>::frictionThreshold(); //! Threshold for surface points/checks. /*! Only points with a distance to the surface smaller than this threshold are considered surface point. */ -const real_t surfaceThreshold = Thresholds<real_t>::surfaceThreshold(); +extern real_t surfaceThreshold; //************************************************************************************************* -- GitLab