From 9fe77429be899311217aa4efff169b0ae156d250 Mon Sep 17 00:00:00 2001 From: Soeren Peters <peters@irmb.tu-bs.de> Date: Wed, 7 Oct 2020 09:37:07 +0200 Subject: [PATCH] Switch typedefs to using. --- src/basics/Core/DataTypes.h | 4 +- src/basics/basics/container/CbArray2D.h | 16 +-- src/basics/basics/container/CbArray3D.h | 24 ++-- src/basics/basics/container/CbArray4D.h | 22 ++-- src/basics/basics/container/CbVector.h | 12 +- src/basics/basics/utilities/UbComparators.h | 14 +-- src/basics/basics/utilities/UbEqual.h | 80 ++++++------ src/basics/basics/utilities/UbException.h | 2 +- src/basics/basics/utilities/UbLogger.h | 2 +- src/basics/basics/utilities/UbMath.h | 10 +- src/basics/basics/utilities/UbScheduler.h | 2 +- src/basics/basics/utilities/UbSystem.h | 12 +- src/basics/basics/utilities/UbTuple.h | 118 +++++++++--------- src/basics/geometry3d/GbCuboid3D.h | 2 +- .../BoundaryConditions/BCAlgorithm.h | 6 +- .../WriteMacroscopicQuantitiesCoProcessor.h | 2 +- src/cpu/VirtualFluidsCore/Data/DataSet3D.h | 6 +- src/cpu/VirtualFluidsCore/Grid/Grid3D.h | 12 +- .../Interactors/D3Q27Interactor.h | 2 +- src/cpu/VirtualFluidsCore/LBM/LBMSystem.h | 4 +- .../Visitors/InitDistributionsBlockVisitor.h | 2 +- 21 files changed, 177 insertions(+), 177 deletions(-) diff --git a/src/basics/Core/DataTypes.h b/src/basics/Core/DataTypes.h index 67a17fa76..b4fa3a0d9 100644 --- a/src/basics/Core/DataTypes.h +++ b/src/basics/Core/DataTypes.h @@ -7,10 +7,10 @@ #ifdef VF_DOUBLE_ACCURACY typedef double real; #else -typedef float real; +using real = float; #endif -typedef unsigned int uint; +using uint = unsigned int; #define INVALID_INDEX 4294967295 //max uint #endif diff --git a/src/basics/basics/container/CbArray2D.h b/src/basics/basics/container/CbArray2D.h index c4c115c29..78329d476 100644 --- a/src/basics/basics/container/CbArray2D.h +++ b/src/basics/basics/container/CbArray2D.h @@ -74,7 +74,7 @@ public: class IndexerX1X2 { public: - typedef int size_type; + using size_type = int; public: inline std::size_t getIndex(const size_type& x1, const size_type& x2, const size_type& nx1,const size_type& nx2) const { @@ -104,13 +104,13 @@ template<typename T, typename IndexClass = IndexerX2X1> class CbArray2D { public: - typedef T value_type; - typedef IndexClass indexer_type; - typedef typename IndexClass::size_type size_type; - typedef typename std::vector< value_type >::reference reference; - typedef typename std::vector< value_type >::const_reference const_reference; - typedef typename std::vector< value_type >::pointer pointer; - typedef typename std::vector< value_type >::const_pointer const_pointer; + using value_type = T; + using indexer_type = IndexClass; + using size_type = typename IndexClass::size_type; + using reference = typename std::vector<value_type>::reference; + using const_reference = typename std::vector<value_type>::const_reference; + using pointer = typename std::vector<value_type>::pointer; + using const_pointer = typename std::vector<value_type>::const_pointer; private: template< typename value_type2, typename IndexClass2 > friend class CbArray2D; diff --git a/src/basics/basics/container/CbArray3D.h b/src/basics/basics/container/CbArray3D.h index f8ad3e8c9..5dd0ecfc8 100644 --- a/src/basics/basics/container/CbArray3D.h +++ b/src/basics/basics/container/CbArray3D.h @@ -56,7 +56,7 @@ class IndexerX3X2X1// FunctorX1SortedForX1X2Plane { public: - typedef size_t size_type; + using size_type = size_t; public: inline std::size_t getIndex( const size_type& x1 , const size_type& x2 , const size_type& x3 , const size_type& nx1, const size_type& nx2, const size_type& nx3 ) const @@ -80,7 +80,7 @@ public: class IndexerX1X2X3 //FunctorX3SortedForX3X2Plane { public: - typedef size_t size_type; + using size_type = size_t; public: inline std::size_t getIndex( const size_type& x1 , const size_type& x2 , const size_type& x3 , const size_type& nx1, const size_type& nx2, const size_type& nx3 ) const @@ -104,7 +104,7 @@ public: class IndexerX2X1X3 { public: - typedef size_t size_type; + using size_type = size_t; public: inline std::size_t getIndex( const size_type& x1 , const size_type& x2 , const size_type& x3 , const size_type& nx1, const size_type& nx2, const size_type& nx3 ) const @@ -136,15 +136,15 @@ template<typename T, typename IndexClass = IndexerX3X2X1> class CbArray3D { public: - typedef SPtr< CbArray3D <T,IndexClass> > CbArray3DPtr; - - typedef T value_type; - typedef IndexClass indexer_type; - typedef typename IndexClass::size_type size_type; - typedef typename std::vector< value_type >::reference reference; - typedef typename std::vector< value_type >::const_reference const_reference; - typedef typename std::vector< value_type >::pointer pointer; - typedef typename std::vector< value_type >::const_pointer const_pointer; + using CbArray3DPtr = SPtr<CbArray3D<T, IndexClass> >; + + using value_type = T; + using indexer_type = IndexClass; + using size_type = typename IndexClass::size_type; + using reference = typename std::vector<value_type>::reference; + using const_reference = typename std::vector<value_type>::const_reference; + using pointer = typename std::vector<value_type>::pointer; + using const_pointer = typename std::vector<value_type>::const_pointer; private: template< typename value_type2, typename IndexClass2 > friend class CbArray3D; diff --git a/src/basics/basics/container/CbArray4D.h b/src/basics/basics/container/CbArray4D.h index 21579b0da..967a65baf 100644 --- a/src/basics/basics/container/CbArray4D.h +++ b/src/basics/basics/container/CbArray4D.h @@ -56,7 +56,7 @@ class IndexerX1X2X3X4 { public: - typedef int size_type; + using size_type = int; public: inline std::size_t getIndex( const size_type& x1 , const size_type& x2 , const size_type& x3 , const size_type& x4 , const size_type& nx1, const size_type& nx2, const size_type& nx3, const size_type& nx4 ) const @@ -82,7 +82,7 @@ public: class IndexerX4X3X2X1 { public: - typedef size_t size_type; + using size_type = size_t; public: inline std::size_t getIndex( const size_type& x1 , const size_type& x2 , const size_type& x3 , const size_type& x4 , const size_type& nx1, const size_type& nx2, const size_type& nx3, const size_type& nx4 ) const @@ -110,15 +110,15 @@ template<typename T, typename IndexClass = IndexerX4X3X2X1> class CbArray4D { public: - typedef SPtr< CbArray4D <T,IndexClass> > CbArray4DPtr; - - typedef T value_type; - typedef IndexClass indexer_type; - typedef typename IndexClass::size_type size_type; - typedef typename std::vector< value_type >::reference reference; - typedef typename std::vector< value_type >::const_reference const_reference; - typedef typename std::vector< value_type >::pointer pointer; - typedef typename std::vector< value_type >::const_pointer const_pointer; + using CbArray4DPtr = SPtr<CbArray4D<T, IndexClass> >; + + using value_type = T; + using indexer_type = IndexClass; + using size_type = typename IndexClass::size_type; + using reference = typename std::vector<value_type>::reference; + using const_reference = typename std::vector<value_type>::const_reference; + using pointer = typename std::vector<value_type>::pointer; + using const_pointer = typename std::vector<value_type>::const_pointer; private: template< typename value_type2, typename IndexClass2 > friend class CbArray4D; diff --git a/src/basics/basics/container/CbVector.h b/src/basics/basics/container/CbVector.h index d0fc6144d..cf4b9296b 100644 --- a/src/basics/basics/container/CbVector.h +++ b/src/basics/basics/container/CbVector.h @@ -64,8 +64,8 @@ class CbVector { public: typedef T value_type; - typedef value_type* pointer; - typedef std::size_t size_type; + using pointer = value_type *; + using size_type = std::size_t; friend class CbVectorAllocator<value_type>; //um auf ptrData und dataSize zugreifen zu koennen! @@ -218,8 +218,8 @@ template< typename T > class CbVectorAllocator { public: - typedef typename CbVector<T>::value_type value_type; - typedef typename CbVector<value_type>::size_type size_type; + using value_type = typename CbVector<T>::value_type; + using size_type = typename CbVector<value_type>::size_type; public: CbVectorAllocator() {} @@ -254,8 +254,8 @@ class CbVectorAllocatorStd : public CbVectorAllocator<T> { public: //typedefs wiederholen, da Basisklasse = template -> "Dependent-Base"-Problem - typedef typename CbVector<T>::value_type value_type; - typedef typename CbVector<value_type>::size_type size_type; + using value_type = typename CbVector<T>::value_type; + using size_type = typename CbVector<value_type>::size_type; public: CbVectorAllocatorStd() : CbVectorAllocator<value_type>() diff --git a/src/basics/basics/utilities/UbComparators.h b/src/basics/basics/utilities/UbComparators.h index abde77000..0e7d2cbed 100644 --- a/src/basics/basics/utilities/UbComparators.h +++ b/src/basics/basics/utilities/UbComparators.h @@ -45,8 +45,8 @@ namespace UbComparators template <typename T, typename C> struct MemberInfo<T C::*> { - typedef T type; - typedef C class_type; + using type = T; + using class_type = C; static T& apply( C& c, T C::* ptr ) { return c.*ptr; } static const T& apply( const C& c, T C::* ptr ) { return c.*ptr; } @@ -56,8 +56,8 @@ namespace UbComparators template <typename T, typename C> struct MemberInfo<T (C::*)()> { - typedef T type; - typedef C class_type; + using type = T; + using class_type = C; static T apply( C& c, T (C::*ptr)() ) { return (c.*ptr)(); } }; @@ -66,8 +66,8 @@ namespace UbComparators template <typename T, typename C> struct MemberInfo<T (C::*)() const> { - typedef T type; - typedef C class_type; + using type = T; + using class_type = C; static T apply( const C& c, T (C::*ptr)() const ) { return (c.*ptr)(); } }; @@ -77,7 +77,7 @@ namespace UbComparators class MemComp : private Comp // -> usage of Empty Base Class Optimization (EBCO) { - typedef typename MemberInfo<Ptr>::class_type C; + using C = typename MemberInfo<Ptr>::class_type; public: MemComp( Ptr ptr, Comp c = Comp() ) diff --git a/src/basics/basics/utilities/UbEqual.h b/src/basics/basics/utilities/UbEqual.h index e748bec34..c605c36ef 100644 --- a/src/basics/basics/utilities/UbEqual.h +++ b/src/basics/basics/utilities/UbEqual.h @@ -56,54 +56,54 @@ template < typename T1, typename T2 > struct UbEqualTrait { - typedef T1 High; - typedef T1 Low; + using High = T1; + using Low = T1; }; //std-trait, fuer gleiche T template < typename T > struct UbEqualTrait< T, T > { - typedef T High; - typedef T Low; + using High = T; + using Low = T; }; //spezialisierung fuer diverse Typen-Tuples -template<> struct UbEqualTrait< short, int > { typedef int High; typedef short Low; }; -template<> struct UbEqualTrait< short, long > { typedef long High; typedef short Low; }; -template<> struct UbEqualTrait< short, float > { typedef float High; typedef short Low; }; -template<> struct UbEqualTrait< short, double > { typedef double High; typedef short Low; }; -template<> struct UbEqualTrait< short, long double > { typedef long double High; typedef short Low; }; - -template<> struct UbEqualTrait< int, short > { typedef int High; typedef short Low; }; -template<> struct UbEqualTrait< int, long > { typedef long High; typedef int Low; }; -template<> struct UbEqualTrait< int, float > { typedef float High; typedef int Low; }; -template<> struct UbEqualTrait< int, double > { typedef double High; typedef int Low; }; -template<> struct UbEqualTrait< int, long double > { typedef long double High; typedef int Low; }; - -template<> struct UbEqualTrait< long, short > { typedef long High; typedef short Low; }; -template<> struct UbEqualTrait< long, int > { typedef long High; typedef int Low; }; -template<> struct UbEqualTrait< long, float > { typedef float High; typedef long Low; }; -template<> struct UbEqualTrait< long, double > { typedef double High; typedef long Low; }; -template<> struct UbEqualTrait< long, long double > { typedef long double High; typedef long Low; }; - -template<> struct UbEqualTrait< float, short > { typedef float High; typedef short Low; }; -template<> struct UbEqualTrait< float, int > { typedef float High; typedef int Low; }; -template<> struct UbEqualTrait< float, long > { typedef float High; typedef long Low; }; -template<> struct UbEqualTrait< float, double > { typedef double High; typedef float Low; }; -template<> struct UbEqualTrait< float, long double > { typedef long double High; typedef float Low; }; - -template<> struct UbEqualTrait< double, short > { typedef double High; typedef short Low; }; -template<> struct UbEqualTrait< double, int > { typedef double High; typedef int Low; }; -template<> struct UbEqualTrait< double, long > { typedef double High; typedef long Low; }; -template<> struct UbEqualTrait< double, float > { typedef double High; typedef float Low; }; -template<> struct UbEqualTrait< double, long double > { typedef long double High; typedef double Low; }; - -template<> struct UbEqualTrait< long double, short > { typedef long double High; typedef short Low; }; -template<> struct UbEqualTrait< long double, int > { typedef long double High; typedef int Low; }; -template<> struct UbEqualTrait< long double, long > { typedef long double High; typedef long Low; }; -template<> struct UbEqualTrait< long double, float > { typedef long double High; typedef float Low; }; -template<> struct UbEqualTrait< long double, double > { typedef long double High; typedef double Low; }; +template<> struct UbEqualTrait< short, int > { using High = int; using Low = short; }; +template<> struct UbEqualTrait< short, long > { using High = long; using Low = short; }; +template<> struct UbEqualTrait< short, float > { using High = float; using Low = short; }; +template<> struct UbEqualTrait< short, double > { using High = double; using Low = short; }; +template<> struct UbEqualTrait< short, long double > { using High = long double; using Low = short; }; + +template<> struct UbEqualTrait< int, short > { using High = int; using Low = short; }; +template<> struct UbEqualTrait< int, long > { using High = long; using Low = int; }; +template<> struct UbEqualTrait< int, float > { using High = float; using Low = int; }; +template<> struct UbEqualTrait< int, double > { using High = double; using Low = int; }; +template<> struct UbEqualTrait< int, long double > { using High = long double; using Low = int; }; + +template<> struct UbEqualTrait< long, short > { using High = long; using Low = short; }; +template<> struct UbEqualTrait< long, int > { using High = long; using Low = int; }; +template<> struct UbEqualTrait< long, float > { using High = float; using Low = long; }; +template<> struct UbEqualTrait< long, double > { using High = double; using Low = long; }; +template<> struct UbEqualTrait< long, long double > { using High = long double; using Low = long; }; + +template<> struct UbEqualTrait< float, short > { using High = float; using Low = short; }; +template<> struct UbEqualTrait< float, int > { using High = float; using Low = int; }; +template<> struct UbEqualTrait< float, long > { using High = float; using Low = long; }; +template<> struct UbEqualTrait< float, double > { using High = double; using Low = float; }; +template<> struct UbEqualTrait< float, long double > { using High = long double; using Low = float; }; + +template<> struct UbEqualTrait< double, short > { using High = double; using Low = short; }; +template<> struct UbEqualTrait< double, int > { using High = double; using Low = int; }; +template<> struct UbEqualTrait< double, long > { using High = double; using Low = long; }; +template<> struct UbEqualTrait< double, float > { using High = double; using Low = float; }; +template<> struct UbEqualTrait< double, long double > { using High = long double; using Low = double; }; + +template<> struct UbEqualTrait< long double, short > { using High = long double; using Low = short; }; +template<> struct UbEqualTrait< long double, int > { using High = long double; using Low = int; }; +template<> struct UbEqualTrait< long double, long > { using High = long double; using Low = long; }; +template<> struct UbEqualTrait< long double, float > { using High = long double; using Low = float; }; +template<> struct UbEqualTrait< long double, double > { using High = long double; using Low = double; }; ////////////////////////////////////////////////////////////////////////// //fuer Allgmeine-Typen ( operator== ): @@ -127,7 +127,7 @@ inline bool specific_equal< long double, long double >(const long double& a, con template< typename T1, typename T2 > inline bool isUbEqual(const T1& a, const T2& b) { - typedef typename UbEqualTrait<T1,T2>::Low Low; + using Low = typename UbEqualTrait<T1, T2>::Low; return specific_equal< Low, Low >(static_cast< Low >( a ),static_cast< Low >( b )); }; diff --git a/src/basics/basics/utilities/UbException.h b/src/basics/basics/utilities/UbException.h index 6c318cecd..3ac995112 100644 --- a/src/basics/basics/utilities/UbException.h +++ b/src/basics/basics/utilities/UbException.h @@ -80,7 +80,7 @@ class UbException : public std::runtime_error { public: - typedef UbTuple< std::string, int, std::string, std::string > ExceptionData; + using ExceptionData = UbTuple<std::string, int, std::string, std::string>; public: ////////////////////////////////////////////////////////////////////////// //constructors diff --git a/src/basics/basics/utilities/UbLogger.h b/src/basics/basics/utilities/UbLogger.h index a7bb006c2..40ea42a48 100644 --- a/src/basics/basics/utilities/UbLogger.h +++ b/src/basics/basics/utilities/UbLogger.h @@ -110,7 +110,7 @@ template <typename OutputPolicy> class UbLogger { public: - typedef OutputPolicy output_policy; + using output_policy = OutputPolicy; public: UbLogger(); virtual ~UbLogger(); diff --git a/src/basics/basics/utilities/UbMath.h b/src/basics/basics/utilities/UbMath.h index 659b66cc5..195dda399 100644 --- a/src/basics/basics/utilities/UbMath.h +++ b/src/basics/basics/utilities/UbMath.h @@ -176,7 +176,7 @@ namespace UbMath template<typename T1, typename T2> inline bool equal(const T1& value, const T2& reference) { - typedef typename UbEqualTrait<T1,T2>::High High; + using High = typename UbEqualTrait<T1, T2>::High; return std::fabs(value-reference) < Epsilon<High>::val(); } /*=======================================================*/ @@ -189,28 +189,28 @@ namespace UbMath template<typename T1, typename T2> inline bool less(const T1& value, const T2& reference) { - typedef typename UbEqualTrait<T1,T2>::High High; + using High = typename UbEqualTrait<T1, T2>::High; return value < reference - Epsilon<High>::val(); } /*=======================================================*/ template<typename T1, typename T2> inline bool lessEqual(const T1& value, const T2& reference) { - typedef typename UbEqualTrait<T1,T2>::High High; + using High = typename UbEqualTrait<T1, T2>::High; return value <= reference + Epsilon<High>::val(); } /*=======================================================*/ template<typename T1, typename T2> inline bool greater(const T1& value, const T2& reference) { - typedef typename UbEqualTrait<T1,T2>::High High; + using High = typename UbEqualTrait<T1, T2>::High; return value > reference + Epsilon<High>::val(); } /*=======================================================*/ template<typename T1, typename T2> inline bool greaterEqual(const T1& value, const T2& reference) { - typedef typename UbEqualTrait<T1,T2>::High High; + using High = typename UbEqualTrait<T1, T2>::High; return value >= reference - Epsilon<High>::val(); } /*=======================================================*/ diff --git a/src/basics/basics/utilities/UbScheduler.h b/src/basics/basics/utilities/UbScheduler.h index c927e45b4..cc4f6a50f 100644 --- a/src/basics/basics/utilities/UbScheduler.h +++ b/src/basics/basics/utilities/UbScheduler.h @@ -318,7 +318,7 @@ protected: std::vector<UbSchedule> schedules; }; -typedef UbScheduler::UbSchedule UbSchedule; +using UbSchedule = UbScheduler::UbSchedule; #endif //UBSCHEDULER_H diff --git a/src/basics/basics/utilities/UbSystem.h b/src/basics/basics/utilities/UbSystem.h index 8efe16cca..87b2cfd89 100644 --- a/src/basics/basics/utilities/UbSystem.h +++ b/src/basics/basics/utilities/UbSystem.h @@ -500,7 +500,7 @@ namespace UbSystem template<typename Ta, typename Tb> class IfThenElse<false, Ta, Tb> { public: - typedef Tb ResultT; + using ResultT = Tb; }; ////////////////////////////////////////////////////////////////////////// // generic IfThenElse - end @@ -512,7 +512,7 @@ namespace UbSystem template< typename T> struct type2type { - typedef T type; + using type = T; }; @@ -522,8 +522,8 @@ namespace UbSystem template <typename Pair> struct select1st { - typedef Pair argument_type ; - typedef typename Pair::first_type result_type ; + using argument_type = Pair ; + using result_type = typename Pair::first_type ; const result_type& operator()(const argument_type &p) const { @@ -534,8 +534,8 @@ namespace UbSystem template <typename Pair> struct select2nd { - typedef Pair argument_type ; - typedef typename Pair::second_type result_type ; + using argument_type = Pair ; + using result_type = typename Pair::second_type ; const result_type& operator()(const argument_type &p) const { diff --git a/src/basics/basics/utilities/UbTuple.h b/src/basics/basics/utilities/UbTuple.h index 6b9b8b52a..a75581ade 100644 --- a/src/basics/basics/utilities/UbTuple.h +++ b/src/basics/basics/utilities/UbTuple.h @@ -78,12 +78,12 @@ template <typename T> class UbTypeOp // primary template { public: - typedef T ArgT; - typedef T BareT; - typedef T const ConstT; - typedef T & RefT; - typedef T & RefBareT; - typedef T const & RefConstT; + using ArgT = T; + using BareT = T; + using ConstT = const T; + using RefT = T &; + using RefBareT = T &; + using RefConstT = const T &; }; /**** end of typeop1.hpp ****/ @@ -95,12 +95,12 @@ template <typename T> class UbTypeOp <T const> // partial specialization for const types { public: - typedef T const ArgT; - typedef T BareT; - typedef T const ConstT; - typedef T const & RefT; - typedef T & RefBareT; - typedef T const & RefConstT; + using ArgT = const T; + using BareT = T; + using ConstT = const T; + using RefT = const T &; + using RefBareT = T &; + using RefConstT = const T &; }; /**** end of typeop2.hpp ****/ @@ -112,12 +112,12 @@ template <typename T> class UbTypeOp <T&> // partial specialization for references { public: - typedef T & ArgT; - typedef typename UbTypeOp<T>::BareT BareT; - typedef T const ConstT; - typedef T & RefT; - typedef typename UbTypeOp<T>::BareT & RefBareT; - typedef T const & RefConstT; + using ArgT = T &; + using BareT = typename UbTypeOp<T>::BareT; + using ConstT = const T; + using RefT = T &; + using RefBareT = typename UbTypeOp<T>::BareT &; + using RefConstT = const T &; }; /**** end of typeop3.hpp ****/ @@ -129,12 +129,12 @@ template<> class UbTypeOp <void> // full specialization for void { public: - typedef void ArgT; - typedef void BareT; - typedef void const ConstT; - typedef void RefT; - typedef void RefBareT; - typedef void RefConstT; + using ArgT = void; + using BareT = void; + using ConstT = const void; + using RefT = void; + using RefBareT = void; + using RefConstT = void; }; /**** end of typeop4.hpp ****/ @@ -149,8 +149,8 @@ template <typename T1, typename T2> class UbDuo { public: - typedef T1 Type1; // type of first field - typedef T2 Type2; // type of second field + using Type1 = T1; // type of first field + using Type2 = T2; // type of second field enum { N = 2 }; // number of fields public: @@ -224,8 +224,8 @@ template <typename A, typename B, typename C> class UbDuo<A, UbDuo<B,C> > { public: - typedef A T1; // type of first field - typedef UbDuo<B,C> T2; // type of second field + using T1 = A; // type of first field + using T2 = UbDuo<B, C>; // type of second field enum { N = UbDuo<B,C>::N + 1 }; // number of fields public: @@ -264,7 +264,7 @@ template <int N, typename T> class UbDuoT { public: - typedef void ResultT; // in general, the result type is void + using ResultT = void; // in general, the result type is void }; // specialization for 1st field of a plain duo @@ -272,7 +272,7 @@ template <typename A, typename B> class UbDuoT<1, UbDuo<A,B> > { public: - typedef A ResultT; + using ResultT = A; }; // specialization for 2nd field of a plain duo @@ -280,7 +280,7 @@ template <typename A, typename B> class UbDuoT<2, UbDuo<A,B> > { public: - typedef B ResultT; + using ResultT = B; }; // specialization for Nth field of a recursive duo @@ -288,7 +288,7 @@ template <int N, typename A, typename B, typename C> class UbDuoT<N, UbDuo<A, UbDuo<B,C> > > { public: - typedef typename UbDuoT<N-1, UbDuo<B,C> >::ResultT ResultT; + using ResultT = typename UbDuoT<N - 1, UbDuo<B, C> >::ResultT; }; // specialization for 1st field of a recursive duo @@ -296,7 +296,7 @@ template <typename A, typename B, typename C> class UbDuoT<1, UbDuo<A, UbDuo<B,C> > > { public: - typedef A ResultT; + using ResultT = A; }; // specialization for 2nd field of a recursive duo @@ -304,7 +304,7 @@ template <typename A, typename B, typename C> class UbDuoT<2, UbDuo<A, UbDuo<B,C> > > { public: - typedef B ResultT; + using ResultT = B; }; //duo4.hpp @@ -388,8 +388,8 @@ template <typename A> struct UbDuo<A,void> { public: - typedef A T1; // type of first field - typedef void T2; // type of second field + using T1 = A; // type of first field + using T2 = void; // type of second field enum { N = 1 }; // number of fields private: @@ -464,7 +464,7 @@ template <typename P1, class UbTuple : public UbDuo<P1, typename UbTuple<P2,P3,P4,P5,P6,P7,P8,UbNullT>::BaseT> { public: - typedef UbDuo<P1, typename UbTuple<P2,P3,P4,P5,P6,P7,P8,UbNullT>::BaseT> BaseT; + using BaseT = UbDuo<P1, typename UbTuple<P2, P3, P4, P5, P6, P7, P8, UbNullT>::BaseT>; // constructor: UbTuple() {} @@ -494,7 +494,7 @@ public: template <typename P1, typename P2> class UbTuple<P1,P2,UbNullT,UbNullT,UbNullT,UbNullT,UbNullT,UbNullT> : public UbDuo<P1,P2> { public: - typedef UbDuo<P1,P2> BaseT; + using BaseT = UbDuo<P1, P2>; // constructor: UbTuple() {} @@ -525,7 +525,7 @@ template <typename P1> class UbTuple<P1,UbNullT,UbNullT,UbNullT,UbNullT,UbNullT,UbNullT,UbNullT> : public UbDuo<P1,void> { public: - typedef UbDuo<P1,void> BaseT; + using BaseT = UbDuo<P1, void>; // constructor: UbTuple() {} @@ -608,26 +608,26 @@ inline UbTuple<T1,T2,T3,T4,T5,T6,T7,T8> makeUbTuple(T1 const &a1, T2 const &a2,T } //some typedefs -typedef UbTuple<float,float> UbTupleFloat2; -typedef UbTuple<float,float,float> UbTupleFloat3; -typedef UbTuple<int,int> UbTupleInt2; -typedef UbTuple<int,int,int> UbTupleInt3; -typedef UbTuple<int,int,int,int> UbTupleInt4; -typedef UbTuple<int,int,int,int,int> UbTupleInt5; -typedef UbTuple<int,int,int,int,int,int> UbTupleInt6; -typedef UbTuple<int,int,int,int,int,int,int,int> UbTupleInt8; -typedef UbTuple<unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int> UbTupleUInt8; -typedef UbTuple<double,double> UbTupleDouble2; -typedef UbTuple<double,double,double> UbTupleDouble3; -typedef UbTuple<double,double,double,double> UbTupleDouble4; -typedef UbTuple<double,double,double,double,double,double> UbTupleDouble6; -typedef UbTuple<std::string,double,double> UbTupleStringDouble2; -typedef UbTuple<std::string,double,double,double> UbTupleStringDouble3; -typedef UbTuple<std::string,int,int,int> UbTupleStringInt3; -typedef UbTuple<short,short,short,short> UbTupleShort4; -typedef UbTuple<bool,bool,bool> UbTupleBool3; -typedef UbTuple<int,double,double> UbTupleIntDouble2; -typedef UbTuple<int, bool> UbTupleIntBool; +using UbTupleFloat2 = UbTuple<float, float>; +using UbTupleFloat3 = UbTuple<float, float, float>; +using UbTupleInt2 = UbTuple<int, int>; +using UbTupleInt3 = UbTuple<int, int, int>; +using UbTupleInt4 = UbTuple<int, int, int, int>; +using UbTupleInt5 = UbTuple<int, int, int, int, int>; +using UbTupleInt6 = UbTuple<int, int, int, int, int, int>; +using UbTupleInt8 = UbTuple<int, int, int, int, int, int, int, int>; +using UbTupleUInt8 = UbTuple<unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>; +using UbTupleDouble2 = UbTuple<double, double>; +using UbTupleDouble3 = UbTuple<double, double, double>; +using UbTupleDouble4 = UbTuple<double, double, double, double>; +using UbTupleDouble6 = UbTuple<double, double, double, double, double, double>; +using UbTupleStringDouble2 = UbTuple<std::string, double, double>; +using UbTupleStringDouble3 = UbTuple<std::string, double, double, double>; +using UbTupleStringInt3 = UbTuple<std::string, int, int, int>; +using UbTupleShort4 = UbTuple<short, short, short, short>; +using UbTupleBool3 = UbTuple<bool, bool, bool>; +using UbTupleIntDouble2 = UbTuple<int, double, double>; +using UbTupleIntBool = UbTuple<int, bool>; #endif //UBTUPLE_H diff --git a/src/basics/geometry3d/GbCuboid3D.h b/src/basics/geometry3d/GbCuboid3D.h index 1124077ea..9a099737b 100644 --- a/src/basics/geometry3d/GbCuboid3D.h +++ b/src/basics/geometry3d/GbCuboid3D.h @@ -45,7 +45,7 @@ class GbObject3DCreator; #include <PointerDefinitions.h> class GbCuboid3D; -typedef SPtr<GbCuboid3D> GbCuboid3DPtr; +using GbCuboid3DPtr = SPtr<GbCuboid3D>; //! \brief This Class provides basic 3D box objects. class GbCuboid3D : public GbObject3D, public UbObserver diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h index 45a06b56b..6addd98e4 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h @@ -87,9 +87,9 @@ protected: LBMReal compressibleFactor; - typedef void(*CalcMacrosFct)(const LBMReal* const& /*f[27]*/, LBMReal& /*rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); - typedef LBMReal(*CalcFeqForDirFct)(const int& /*direction*/, const LBMReal& /*(d)rho*/, const LBMReal& /*vx1*/, const LBMReal& /*vx2*/, const LBMReal& /*vx3*/); - typedef void(*CalcFeqFct)(LBMReal* const& /*feq[27]*/, const LBMReal& /*rho*/, const LBMReal& /*vx1*/, const LBMReal& /*vx2*/, const LBMReal& /*vx3*/); + using CalcMacrosFct = void (*)(const LBMReal *const &, LBMReal &, LBMReal &, LBMReal &, LBMReal &); + using CalcFeqForDirFct = LBMReal (*)(const int &, const LBMReal &, const LBMReal &, const LBMReal &, const LBMReal &); + using CalcFeqFct = void (*)(LBMReal *const &, const LBMReal &, const LBMReal &, const LBMReal &, const LBMReal &); CalcFeqForDirFct calcFeqsForDirFct ; CalcMacrosFct calcMacrosFct; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h index cacb97b4c..9ce47ba63 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h @@ -94,7 +94,7 @@ private: int gridRank; SPtr<Communicator> comm; - typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); + using CalcMacrosFct = void (*)(const LBMReal *const &, LBMReal &, LBMReal &, LBMReal &, LBMReal &); CalcMacrosFct calcMacros; }; diff --git a/src/cpu/VirtualFluidsCore/Data/DataSet3D.h b/src/cpu/VirtualFluidsCore/Data/DataSet3D.h index 095708b4a..66fefb15a 100644 --- a/src/cpu/VirtualFluidsCore/Data/DataSet3D.h +++ b/src/cpu/VirtualFluidsCore/Data/DataSet3D.h @@ -40,9 +40,9 @@ #include "basics/container/CbArray3D.h" #include "DistributionArray3D.h" -typedef CbArray4D<LBMReal,IndexerX4X3X2X1> AverageValuesArray3D; -typedef CbArray4D<LBMReal,IndexerX4X3X2X1> ShearStressValuesArray3D; -typedef CbArray3D<LBMReal, IndexerX3X2X1> RelaxationFactorArray3D; +using AverageValuesArray3D = CbArray4D<LBMReal, IndexerX4X3X2X1>; +using ShearStressValuesArray3D = CbArray4D<LBMReal, IndexerX4X3X2X1>; +using RelaxationFactorArray3D = CbArray3D<LBMReal, IndexerX3X2X1>; //! A class provides an interface for data structures in the kernel. class DataSet3D diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3D.h b/src/cpu/VirtualFluidsCore/Grid/Grid3D.h index c684d7c8e..16e64d43b 100644 --- a/src/cpu/VirtualFluidsCore/Grid/Grid3D.h +++ b/src/cpu/VirtualFluidsCore/Grid/Grid3D.h @@ -59,17 +59,17 @@ class Interactor3D; class Grid3D : public enableSharedFromThis<Grid3D> { public: - typedef UbKeys::Key3<int> Block3DKey; - typedef std::map< Block3DKey, SPtr<Block3D> > Block3DMap; - typedef std::map< int, SPtr<Block3D> > BlockIDMap; - typedef std::vector<Block3DMap> LevelSet; - typedef std::vector<SPtr<Interactor3D> > Interactor3DSet; + using Block3DKey = UbKeys::Key3<int>; + using Block3DMap = std::map<Block3DKey, SPtr<Block3D> >; + using BlockIDMap = std::map<int, SPtr<Block3D> >; + using LevelSet = std::vector<Block3DMap>; + using Interactor3DSet = std::vector<SPtr<Interactor3D> >; public: Grid3D(); Grid3D(SPtr<Communicator> comm); Grid3D(SPtr<Communicator> comm, int blockNx1, int blockNx2, int blockNx3, int gridNx1, int gridNx2, int gridNx3); - virtual ~Grid3D(){} + virtual ~Grid3D() = default; ////////////////////////////////////////////////////////////////////////// //blocks control void addBlock(SPtr<Block3D> block); diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h index a3e4468d2..9bd4725bb 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h +++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h @@ -54,7 +54,7 @@ class Grid3D; class GbObject3D; typedef std::map<SPtr<Block3D>, std::set< std::vector<int> > > BcNodeIndicesMap; -typedef std::map<SPtr<Block3D>, std::set< UbTupleInt3 > > SolidNodeIndicesMap; +using SolidNodeIndicesMap = std::map<SPtr<Block3D>, std::set<UbTupleInt3> >; //! \brief A specialized class for grid generation. //! \details Support standard geometric primitives. diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMSystem.h b/src/cpu/VirtualFluidsCore/LBM/LBMSystem.h index 49a82b393..7b016a3b7 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMSystem.h +++ b/src/cpu/VirtualFluidsCore/LBM/LBMSystem.h @@ -49,7 +49,7 @@ namespace LBMSystem typedef float real; #define REAL_CAST(x) ( (LBMSystem::real)(x) ) #else - typedef double real; + using real = double; #define REAL_CAST(x) ( x ) #endif @@ -89,7 +89,7 @@ namespace LBMSystem } //some typedefs for global namespace -typedef LBMSystem::real LBMReal; +using LBMReal = LBMSystem::real; #endif diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.h index 1e7425796..bddda7901 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.h +++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.h @@ -63,7 +63,7 @@ class Block3D; class InitDistributionsBlockVisitor : public Block3DVisitor { public: - typedef std::numeric_limits<LBMReal> D3Q27RealLim; + using D3Q27RealLim = std::numeric_limits<LBMReal>; public: InitDistributionsBlockVisitor(); -- GitLab