From 7f20b8f033c08a24dfd8ed25976ef4b85894c869 Mon Sep 17 00:00:00 2001
From: Michael Kuron <mkuron@icp.uni-stuttgart.de>
Date: Mon, 25 Mar 2019 09:39:40 +0100
Subject: [PATCH] undef internal macros in header files

---
 src/core/math/MathTrait.h                        |  2 ++
 src/core/math/Uint.h                             |  1 +
 src/core/math/equation_system/EquationParser.cpp | 14 +++++++++++---
 src/core/math/equation_system/EquationParser.h   | 10 ----------
 src/core/singleton/Singleton.h                   |  5 +++++
 src/core/uid/UIDGenerators.h                     |  1 +
 src/cuda/FieldIndexing3D.impl.h                  |  6 +-----
 src/cuda/Kernel.h                                |  2 ++
 src/field/AccuracyEvaluation.h                   |  3 +++
 src/field/AccuracyEvaluationLinePlot.h           |  3 +++
 src/field/MassEvaluation.h                       |  4 ++++
 src/field/StabilityChecker.h                     |  3 +++
 src/field/VolumetricFlowRateEvaluation.h         |  3 +++
 src/gui/MainWindow/GuiUtil.cpp                   |  7 ++-----
 src/lbm/MassEvaluation.h                         |  5 +++++
 src/lbm/refinement/LinearExplosion.h             |  2 ++
 src/pe/ccd/HashGrids.h                           |  4 ++--
 17 files changed, 50 insertions(+), 25 deletions(-)

diff --git a/src/core/math/MathTrait.h b/src/core/math/MathTrait.h
index 1cdd82684..3f3332289 100644
--- a/src/core/math/MathTrait.h
+++ b/src/core/math/MathTrait.h
@@ -688,5 +688,7 @@ WALBERLA_CREATE_MATHTRAIT_SPECIALIZATION( long double   , long double   , long d
 /*! \endcond */
 //*************************************************************************************************
 
+#undef WALBERLA_CREATE_MATHTRAIT_SPECIALIZATION
+
 }
 }
diff --git a/src/core/math/Uint.h b/src/core/math/Uint.h
index ac8802520..fdfc8ca49 100644
--- a/src/core/math/Uint.h
+++ b/src/core/math/Uint.h
@@ -138,6 +138,7 @@ static const uint8_t msbLookupTable[256] =
       0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
       msbLT(5), msbLT(6), msbLT(6), msbLT(7), msbLT(7), msbLT(7), msbLT(7),
       msbLT(8), msbLT(8), msbLT(8), msbLT(8), msbLT(8), msbLT(8), msbLT(8), msbLT(8)
+#undef msbLT
 };
 
 //**********************************************************************************************************************
diff --git a/src/core/math/equation_system/EquationParser.cpp b/src/core/math/equation_system/EquationParser.cpp
index 477bc2e03..a58be4bd7 100644
--- a/src/core/math/equation_system/EquationParser.cpp
+++ b/src/core/math/equation_system/EquationParser.cpp
@@ -23,13 +23,21 @@
 #include "EquationParser.h"
 #include "Operator.h"
 #include "Variable.h"
+#include "core/math/Constants.h"
 
 #include <boost/algorithm/string/trim.hpp>
 #include <boost/lexical_cast.hpp>
 #include <memory>
 
 
-#define E_VAL 2.71828182845904523536
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// PARSE UTIL
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+#define THROW(msg, str, index) {\
+   std::stringstream ss;\
+   ss << (msg) << " -> [" << (str) << "] at [" << (index) << "]";\
+   throw std::runtime_error( ss.str() );\
+}
 
 namespace walberla {
 namespace math {
@@ -179,12 +187,12 @@ NodePtr EquationParser::parseFunction( const std::string& str, size_t& index ) c
    {
    case OP_FUNC_EXP:
       funcPtr = std::make_shared<Node>( OP_PROD );
-      funcPtr->left()  = std::make_shared<Node>( E_VAL  );
+      funcPtr->left()  = std::make_shared<Node>( M_E  );
       funcPtr->right() = nodePtr;
       return funcPtr;
    case OP_FUNC_LN:
       funcPtr = std::make_shared<Node>( OP_LOG );
-      funcPtr->right() = std::make_shared<Node>( E_VAL  );
+      funcPtr->right() = std::make_shared<Node>( M_E  );
       funcPtr->left()  = nodePtr;
       return funcPtr;
    case OP_FUNC_SQRT:
diff --git a/src/core/math/equation_system/EquationParser.h b/src/core/math/equation_system/EquationParser.h
index 97f937eec..e32287be8 100644
--- a/src/core/math/equation_system/EquationParser.h
+++ b/src/core/math/equation_system/EquationParser.h
@@ -26,16 +26,6 @@
 
 #include <sstream>
 
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// PARSE UTIL
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#define THROW(msg, str, index) {\
-   std::stringstream ss;\
-   ss << msg << " -> [" << str << "] at [" << index << "]";\
-   throw std::runtime_error( ss.str() );\
-}
-
 namespace walberla {
 namespace math {
 
diff --git a/src/core/singleton/Singleton.h b/src/core/singleton/Singleton.h
index 441a730c7..3522210b0 100644
--- a/src/core/singleton/Singleton.h
+++ b/src/core/singleton/Singleton.h
@@ -1088,6 +1088,11 @@ private:
 //**********************************************************************************************************************
 
 
+#undef WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY
+#undef WALBERLA_JOIN
+#undef WALBERLA_DO_JOIN
+#undef WALBERLA_DO_JOIN2
+
 
 //======================================================================================================================
 //
diff --git a/src/core/uid/UIDGenerators.h b/src/core/uid/UIDGenerators.h
index d9c254d93..7c762b9a1 100644
--- a/src/core/uid/UIDGenerators.h
+++ b/src/core/uid/UIDGenerators.h
@@ -159,6 +159,7 @@ static const boost::uint8_t logBase2LookupTable[256] =
       0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
       logBase2LT(4), logBase2LT(5), logBase2LT(5), logBase2LT(6), logBase2LT(6), logBase2LT(6), logBase2LT(6),
       logBase2LT(7), logBase2LT(7), logBase2LT(7), logBase2LT(7), logBase2LT(7), logBase2LT(7), logBase2LT(7), logBase2LT(7)
+#undef logBase2LT
 };
 
 template< typename UINT > size_t logBase2( UINT value ); // 1000 -> 3, 0010 -> 1, 0001 -> 0, etc.
diff --git a/src/cuda/FieldIndexing3D.impl.h b/src/cuda/FieldIndexing3D.impl.h
index 147396ac4..bfb7b0edd 100644
--- a/src/cuda/FieldIndexing3D.impl.h
+++ b/src/cuda/FieldIndexing3D.impl.h
@@ -32,10 +32,6 @@
 #include <limits>
 #include <cmath>
 
-#define BLOCK_SIZE_X       uint_t( 32 )
-#define BLOCK_SIZE_Y       uint_t( 2 )
-#define BLOCK_SIZE_Z       uint_t( 2 )
-
 namespace walberla {
 namespace cuda {
 
@@ -43,7 +39,7 @@ namespace cuda {
 inline unsigned int iDivUp( unsigned int a, unsigned int b ) { return ( a + b - 1 ) / b; }
 
 
-dim3 FieldIndexing3DBase::preferredBlockDim_( BLOCK_SIZE_X, BLOCK_SIZE_Y, BLOCK_SIZE_Z );
+dim3 FieldIndexing3DBase::preferredBlockDim_( 32, 2, 2 );
 
 
 template< typename T>
diff --git a/src/cuda/Kernel.h b/src/cuda/Kernel.h
index 987e8e54e..44c8d9ab0 100644
--- a/src/cuda/Kernel.h
+++ b/src/cuda/Kernel.h
@@ -146,6 +146,8 @@ namespace cuda {
       CHECK_PARAMETER_FUNC(7)
       CHECK_PARAMETER_FUNC(8)
 
+      #undef CHECK_PARAMETER_FUNC
+
       template<typename T> bool checkParameter( uint_t n );
       //@}
       //****************************************************************************************************************
diff --git a/src/field/AccuracyEvaluation.h b/src/field/AccuracyEvaluation.h
index 4f6e40176..5c47ede73 100644
--- a/src/field/AccuracyEvaluation.h
+++ b/src/field/AccuracyEvaluation.h
@@ -459,5 +459,8 @@ makeAccuracyEvaluation( const Config_T & config,
 
 
 
+#undef WALBERLA_FIELD_MAKE_ACCURACY_EVALUATION_CONFIG_PARSER
+#undef WALBERLA_FIELD_MAKE_ACCURACY_EVALUATION_SET_AND_RETURN
+
 } // namespace field
 } // namespace walberla
diff --git a/src/field/AccuracyEvaluationLinePlot.h b/src/field/AccuracyEvaluationLinePlot.h
index d2c1fcbe6..949f76c35 100644
--- a/src/field/AccuracyEvaluationLinePlot.h
+++ b/src/field/AccuracyEvaluationLinePlot.h
@@ -692,5 +692,8 @@ makeAccuracyEvaluationLinePlotter( const Config_T & config,
 
 
 
+#undef WALBERLA_FIELD_MAKE_ACCURACY_EVALUATION_LINE_PLOT_CONFIG_PARSER
+#undef WALBERLA_FIELD_MAKE_ACCURACY_EVALUATION_LINE_PLOT_SET_AND_RETURN
+
 } // namespace field
 } // namespace walberla
diff --git a/src/field/MassEvaluation.h b/src/field/MassEvaluation.h
index 3d8228751..5337443ef 100644
--- a/src/field/MassEvaluation.h
+++ b/src/field/MassEvaluation.h
@@ -422,6 +422,10 @@ shared_ptr< MassEvaluation< DensityField_T, Filter_T > > makeMassEvaluation( con
 }
 
 
+#ifndef KEEP_WALBERLA_FIELD_MAKE_MASS_EVALUATION
+#undef WALBERLA_FIELD_MAKE_MASS_EVALUATION_CONFIG_PARSER
+#undef WALBERLA_FIELD_MAKE_MASS_EVALUATION_SET_AND_RETURN
+#endif
 
 } // namespace field
 } // namespace walberla
diff --git a/src/field/StabilityChecker.h b/src/field/StabilityChecker.h
index 74b4470ed..db69a7fb6 100644
--- a/src/field/StabilityChecker.h
+++ b/src/field/StabilityChecker.h
@@ -656,5 +656,8 @@ makeStabilityChecker( const Config_T & config,
 
 
 
+#undef WALBERLA_FIELD_MAKE_STABILITY_CHECKER_CONFIG_PARSER
+#undef WALBERLA_FIELD_MAKE_STABILITY_CHECKER_SET_AND_RETURN
+
 } // namespace field
 } // namespace walberla
diff --git a/src/field/VolumetricFlowRateEvaluation.h b/src/field/VolumetricFlowRateEvaluation.h
index 1763ea0eb..72880e7a5 100644
--- a/src/field/VolumetricFlowRateEvaluation.h
+++ b/src/field/VolumetricFlowRateEvaluation.h
@@ -639,5 +639,8 @@ makeVolumetricFlowRateEvaluation( const Config_T & config,
 
 
 
+#undef WALBERLA_FIELD_MAKE_VOLUMETRIC_FLOW_RATE_EVALUATION_CONFIG_PARSER
+#undef WALBERLA_FIELD_MAKE_VOLUMETRIC_FLOW_RATE_EVALUATION_SET_AND_RETURN
+
 } // namespace field
 } // namespace walberla
diff --git a/src/gui/MainWindow/GuiUtil.cpp b/src/gui/MainWindow/GuiUtil.cpp
index 5a0324b26..9d1306798 100644
--- a/src/gui/MainWindow/GuiUtil.cpp
+++ b/src/gui/MainWindow/GuiUtil.cpp
@@ -32,9 +32,6 @@
 #include <cassert>
 
 
-#define _unused(x) ((void)x)
-
-
 namespace walberla {
 namespace gui {
 
@@ -56,7 +53,7 @@ QMimeData * createMimeDataFromPointer(void * p, const QString & role)
 
     int bytesWritten = s.writeRawData( ( const char * ) & p, int_c( sizeof( void * ) ) );
     WALBERLA_ASSERT_EQUAL( bytesWritten, sizeof( void*) );
-    _unused(bytesWritten);
+    WALBERLA_UNUSED(bytesWritten);
 
     data->setData( role, d );
 
@@ -76,7 +73,7 @@ void * getPointerFromMimeData(const QMimeData *data, const QString& type)
 
     int bytesRead = s.readRawData( (char*)&ptr, int_c( sizeof( void * ) ) );
     WALBERLA_ASSERT_EQUAL( bytesRead, sizeof(void*) );
-    _unused(bytesRead);
+    WALBERLA_UNUSED(bytesRead);
 
     return ptr;
 }
diff --git a/src/lbm/MassEvaluation.h b/src/lbm/MassEvaluation.h
index 737ebdd85..5a12f9c13 100644
--- a/src/lbm/MassEvaluation.h
+++ b/src/lbm/MassEvaluation.h
@@ -21,6 +21,7 @@
 
 #pragma once
 
+#define KEEP_WALBERLA_FIELD_MAKE_MASS_EVALUATION
 #include "field/MassEvaluation.h"
 
 
@@ -286,5 +287,9 @@ makeMassEvaluation( const Config_T & config,
 
 
 
+#undef WALBERLA_FIELD_MAKE_MASS_EVALUATION_CONFIG_PARSER
+#undef WALBERLA_FIELD_MAKE_MASS_EVALUATION_SET_AND_RETURN
+#undef KEEP_WALBERLA_FIELD_MAKE_MASS_EVALUATION
+
 } // namespace lbm
 } // namespace walberla
diff --git a/src/lbm/refinement/LinearExplosion.h b/src/lbm/refinement/LinearExplosion.h
index 97bc1c59f..c70b7befe 100644
--- a/src/lbm/refinement/LinearExplosion.h
+++ b/src/lbm/refinement/LinearExplosion.h
@@ -443,6 +443,7 @@ void linearInterpolation( const cell_idx_t y, const cell_idx_t z, const CellInte
                   grad[i] = v - tmpField->get( min[i], f );
                }
 #endif
+#undef WALBERLA_LBM_REFINEMENT_EXPLOSION_EXCLUDE_EXTRAPOLATION
             }
 
 #define WALBERLA_LBM_REFINEMENT_EXPLOSION_CHEN_CORRECTION
@@ -453,6 +454,7 @@ void linearInterpolation( const cell_idx_t y, const cell_idx_t z, const CellInte
 
             grad = grad - cNorm * ( cNorm * grad );
 #endif
+#undef WALBERLA_LBM_REFINEMENT_EXPLOSION_CHEN_CORRECTION
 
             const auto xx = x + cell_idx_t(1);
             const auto yy = y + cell_idx_t(1);
diff --git a/src/pe/ccd/HashGrids.h b/src/pe/ccd/HashGrids.h
index 49c40b5ce..f3998e26b 100644
--- a/src/pe/ccd/HashGrids.h
+++ b/src/pe/ccd/HashGrids.h
@@ -45,8 +45,6 @@
 #include <pe/utility/BodyCast.h>
 #include <pe/raytracing/Intersects.h>
 
-#define BLOCKCELL_NORMAL_INDETERMINATE 3
-
 namespace walberla{
 namespace pe{
 
@@ -189,6 +187,8 @@ private:
       BodyID getRayIntersectingBody(const raytracing::Ray& ray, const AABB& blockAABB, real_t& t, Vec3& n,
                                     std::function<bool (const BodyID body)> isBodyVisibleFunc) const;
       
+      static const int BLOCKCELL_NORMAL_INDETERMINATE = 3;
+
       template<typename BodyTuple>
       BodyID getBodyIntersectionForBlockCell(const Vector3<int32_t>& blockCell,
                                              const int8_t cellNormalAxis, const int8_t cellNormalDir,
-- 
GitLab