diff --git a/src/blockforest/SetupBlockForest.cpp b/src/blockforest/SetupBlockForest.cpp index b57abcccfa8834fa033f593491c69c3a73aaec8f..449e8bea3d7b7b8d110d1b41de3d37a9ff0ff01b 100644 --- a/src/blockforest/SetupBlockForest.cpp +++ b/src/blockforest/SetupBlockForest.cpp @@ -34,6 +34,7 @@ #include "core/debug/CheckFunctions.h" #include "core/logging/Logging.h" #include "core/math/Sample.h" +#include "core/typeToString.h" #include "domain_decomposition/MapPointToPeriodicDomain.h" diff --git a/src/core/DataTypes.h b/src/core/DataTypes.h index f90781461bcff9431501098180f1dbf39ea68d00..5694e7fbccbedbef3e7274be24ae2eecbffd6993 100644 --- a/src/core/DataTypes.h +++ b/src/core/DataTypes.h @@ -290,35 +290,6 @@ inline bool floatIsEqual( float lhs, float rhs, const float epsilon = real_compa return std::fabs( lhs - rhs ) < epsilon; } - - -// data type to string conversion - -template< typename T > inline const char* typeToString(); - -#define TypeToString(X) template<> inline const char* typeToString< X >() { \ - static char string[] = #X; \ - return string; \ -} - -TypeToString(bool) -TypeToString(char) -TypeToString(short) -TypeToString(int) -TypeToString(long) -TypeToString(long long) -TypeToString(unsigned char) -TypeToString(unsigned short) -TypeToString(unsigned int) -TypeToString(unsigned long) -TypeToString(unsigned long long) -TypeToString(float) -TypeToString(double) - -#undef TypeToString - -template< typename T > inline const char* typeToString( T ) { return typeToString<T>(); } - } // namespace walberla #define WALBERLA_UNUSED(x) (void)(x) diff --git a/src/core/typeToString.h b/src/core/typeToString.h new file mode 100644 index 0000000000000000000000000000000000000000..ca49ecefa92ac264fea62ecc6f60c3112c479dd4 --- /dev/null +++ b/src/core/typeToString.h @@ -0,0 +1,52 @@ +//====================================================================================================================== +// +// 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 typeToString.h +//! \author Florian Schornbaum <florian.schornbaum@fau.de> +// +//====================================================================================================================== + +#pragma once + +namespace walberla { + +// data type to string conversion + +template< typename T > inline const char* typeToString(); + +#define TypeToString(X) template<> inline const char* typeToString< X >() { \ + static char string[] = #X; \ + return string; \ +} + +TypeToString(bool) +TypeToString(char) +TypeToString(short) +TypeToString(int) +TypeToString(long) +TypeToString(long long) +TypeToString(unsigned char) +TypeToString(unsigned short) +TypeToString(unsigned int) +TypeToString(unsigned long) +TypeToString(unsigned long long) +TypeToString(float) +TypeToString(double) + +#undef TypeToString + +template< typename T > inline const char* typeToString( T ) { return typeToString<T>(); } + +} // namespace walberla diff --git a/src/geometry/containment_octree/ContainmentOctree.h b/src/geometry/containment_octree/ContainmentOctree.h index f83014c05f2418eaa8e74d059e0e964b61499e2c..96d091c006d8554a4af79a374e1c589ad7097813 100644 --- a/src/geometry/containment_octree/ContainmentOctree.h +++ b/src/geometry/containment_octree/ContainmentOctree.h @@ -30,6 +30,7 @@ #include "core/DataTypes.h" #include "core/math/GenericAABB.h" #include "core/math/KahanSummation.h" +#include "core/typeToString.h" #include <queue> #include <vector> diff --git a/src/mesh_common/distance_octree/DistanceOctree.h b/src/mesh_common/distance_octree/DistanceOctree.h index 2c34b9c6c620e76b84568f710367459f20286809..ce1a21c16cd56f8ba9d78d59e3ae4570aa352968 100644 --- a/src/mesh_common/distance_octree/DistanceOctree.h +++ b/src/mesh_common/distance_octree/DistanceOctree.h @@ -33,6 +33,8 @@ #include "core/math/GenericAABB.h" #include "core/math/Vector3.h" +#include "core/typeToString.h" + #include <vector> #include <queue>