Loading src/TNL/Containers/Expressions/BinaryExpressionTemplate.h +32 −6 Original line number Diff line number Diff line Loading @@ -26,12 +26,6 @@ template< typename T1, ExpressionVariableType T2Type = ExpressionVariableTypeGetter< T2 >::value > struct BinaryExpressionTemplate { /*BinaryExpressionTemplate( const T1& a, const T2& b ){}; static T1 evaluate( const T1& a, const T2& b ) { return Operation< T1, T2 >::evaluate( a, b ); }*/ }; template< typename T1, Loading @@ -42,18 +36,22 @@ struct BinaryExpressionTemplate< T1, T2, Operation, VectorVariable, VectorVariab using RealType = typename T1::RealType; using IsExpressionTemplate = bool; __cuda_callable__ BinaryExpressionTemplate( const T1& a, const T2& b ): op1( a ), op2( b ){} __cuda_callable__ static BinaryExpressionTemplate evaluate( const T1& a, const T2& b ) { return BinaryExpressionTemplate( a, b ); } __cuda_callable__ RealType operator[]( const int i ) const { return Operation< typename T1::RealType, typename T2::RealType >::evaluate( op1[ i ], op2[ i ] ); } __cuda_callable__ int getSize() const { return op1.getSize(); Loading @@ -73,18 +71,22 @@ struct BinaryExpressionTemplate< T1, T2, Operation, VectorVariable, ArithmeticVa using RealType = typename T1::RealType; using IsExpressionTemplate = bool; __cuda_callable__ BinaryExpressionTemplate( const T1& a, const T2& b ): op1( a ), op2( b ){} __cuda_callable__ BinaryExpressionTemplate evaluate( const T1& a, const T2& b ) { return BinaryExpressionTemplate( a, b ); } __cuda_callable__ RealType operator[]( const int i ) const { return Operation< typename T1::RealType, T2 >::evaluate( op1[ i ], op2 ); } __cuda_callable__ int getSize() const { return op1.getSize(); Loading @@ -104,18 +106,22 @@ struct BinaryExpressionTemplate< T1, T2, Operation, ArithmeticVariable, VectorVa using RealType = typename T2::RealType; using IsExpressionTemplate = bool; __cuda_callable__ BinaryExpressionTemplate( const T1& a, const T2& b ): op1( a ), op2( b ){} __cuda_callable__ BinaryExpressionTemplate evaluate( const T1& a, const T2& b ) { return BinaryExpressionTemplate( a, b ); } __cuda_callable__ RealType operator[]( const int i ) const { return Operation< T1, typename T2::RealType >::evaluate( op1, op2[ i ] ); } __cuda_callable__ int getSize() const { return op2.getSize(); Loading @@ -134,6 +140,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< L1, L2, LOperation >, Expressions::BinaryExpressionTemplate< R1, R2, ROperation >, Loading @@ -150,6 +157,7 @@ operator + ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< T1, T2, Operation >, typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType, Loading @@ -171,6 +179,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< L1, L2, LOperation >, Expressions::BinaryExpressionTemplate< R1, R2, ROperation >, Loading @@ -187,6 +196,7 @@ operator - ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< T1, T2, Operation >, typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType, Loading @@ -208,6 +218,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< L1, L2, LOperation >, Expressions::BinaryExpressionTemplate< R1, R2, ROperation >, Loading @@ -224,6 +235,7 @@ operator * ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< T1, T2, Operation >, typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType, Loading @@ -245,6 +257,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< L1, L2, LOperation >, Expressions::BinaryExpressionTemplate< R1, R2, ROperation >, Loading @@ -261,6 +274,7 @@ operator / ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< T1, T2, Operation >, typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType, Loading @@ -282,6 +296,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ bool operator == ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& a, const Expressions::BinaryExpressionTemplate< R1, R2, ROperation >& b ) Loading @@ -292,6 +307,7 @@ operator == ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ bool operator == ( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& a, const typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType& b ) Loading @@ -307,6 +323,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ bool operator != ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& a, const Expressions::BinaryExpressionTemplate< R1, R2, ROperation >& b ) Loading @@ -317,6 +334,7 @@ operator != ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ bool operator != ( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& a, const typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType& b ) Loading @@ -332,6 +350,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ bool operator < ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& a, const Expressions::BinaryExpressionTemplate< R1, R2, ROperation >& b ) Loading @@ -342,6 +361,7 @@ operator < ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ bool operator < ( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& a, const typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType& b ) Loading @@ -357,6 +377,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ bool operator <= ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& a, const Expressions::BinaryExpressionTemplate< R1, R2, ROperation >& b ) Loading @@ -367,6 +388,7 @@ operator <= ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ bool operator <= ( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& a, const typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType& b ) Loading @@ -382,6 +404,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ bool operator > ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& a, const Expressions::BinaryExpressionTemplate< R1, R2, ROperation >& b ) Loading @@ -392,6 +415,7 @@ operator > ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ bool operator > ( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& a, const typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType& b ) Loading @@ -407,6 +431,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ bool operator >= ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& a, const Expressions::BinaryExpressionTemplate< R1, R2, ROperation >& b ) Loading @@ -417,6 +442,7 @@ operator >= ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ bool operator >= ( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& a, const typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType& b ) Loading src/TNL/Containers/Expressions/ExpressionTemplatesOperations.h +4 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ namespace TNL { template< typename T1, typename T2 > struct Addition { __cuda_callable__ static auto evaluate( const T1& a, const T2& b ) -> decltype( a + b ) { return a + b; Loading @@ -26,6 +27,7 @@ struct Addition template< typename T1, typename T2 > struct Subtraction { __cuda_callable__ static auto evaluate( const T1& a, const T2& b ) -> decltype( a - b ) { return a - b; Loading @@ -35,6 +37,7 @@ struct Subtraction template< typename T1, typename T2 > struct Multiplication { __cuda_callable__ static auto evaluate( const T1& a, const T2& b ) -> decltype( a * b ) { return a * b; Loading @@ -44,6 +47,7 @@ struct Multiplication template< typename T1, typename T2 > struct Division { __cuda_callable__ static auto evaluate( const T1& a, const T2& b ) -> decltype( a / b ) { return a / b; Loading src/TNL/Containers/Expressions/StaticComparison.h +6 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ namespace TNL { template< typename T1, typename T2 > __cuda_callable__ bool StaticComparisonEQ( const T1& a, const T2& b ) { TNL_ASSERT_EQ( a.getSize(), b.getSize(), "Sizes of expressions to be compared do not fit." ); Loading @@ -29,6 +30,7 @@ bool StaticComparisonEQ( const T1& a, const T2& b ) template< typename T1, typename T2 > __cuda_callable__ bool StaticComparisonNE( const T1& a, const T2& b ) { return ! StaticComparisonEQ( a, b ); Loading @@ -36,6 +38,7 @@ bool StaticComparisonNE( const T1& a, const T2& b ) template< typename T1, typename T2 > __cuda_callable__ bool StaticComparisonGT( const T1& a, const T2& b ) { TNL_ASSERT_EQ( a.getSize(), b.getSize(), "Sizes of expressions to be compared do not fit." ); Loading @@ -47,6 +50,7 @@ bool StaticComparisonGT( const T1& a, const T2& b ) template< typename T1, typename T2 > __cuda_callable__ bool StaticComparisonLE( const T1& a, const T2& b ) { return ! StaticComparisonGT( a, b ); Loading @@ -54,6 +58,7 @@ bool StaticComparisonLE( const T1& a, const T2& b ) template< typename T1, typename T2 > __cuda_callable__ bool StaticComparisonLT( const T1& a, const T2& b ) { TNL_ASSERT_EQ( a.getSize(), b.getSize(), "Sizes of expressions to be compared do not fit." ); Loading @@ -65,6 +70,7 @@ bool StaticComparisonLT( const T1& a, const T2& b ) template< typename T1, typename T2 > __cuda_callable__ bool StaticComparisonGE( const T1& a, const T2& b ) { return ! StaticComparisonLT( a, b ); Loading src/TNL/Containers/StaticVector.h +8 −1 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ class StaticVector : public StaticArray< Size, Real > template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ StaticVector( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& op ); /** Loading Loading @@ -290,6 +291,7 @@ class StaticVector< 1, Real > : public StaticArray< 1, Real > template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ StaticVector( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& op ); bool setup( const Config::ParameterContainer& parameters, Loading Loading @@ -426,6 +428,7 @@ class StaticVector< 2, Real > : public StaticArray< 2, Real > template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ StaticVector( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& op ); bool setup( const Config::ParameterContainer& parameters, Loading Loading @@ -563,9 +566,9 @@ class StaticVector< 3, Real > : public StaticArray< 3, Real > template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ StaticVector( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& op ); bool setup( const Config::ParameterContainer& parameters, const String& prefix = "" ); Loading Loading @@ -680,6 +683,7 @@ namespace Containers { template< int Size, typename Real1, typename Real2 > struct StaticScalarProductGetter { __cuda_callable__ static auto compute( const Real1* u, const Real2* v ) -> decltype( u[ 0 ] * v[ 0 ] ) { return u[ 0 ] * v[ 0 ] + StaticScalarProductGetter< Size - 1, Real1, Real2 >::compute( &u[ 1 ], &v[ 1 ] ); Loading @@ -689,6 +693,7 @@ struct StaticScalarProductGetter template< typename Real1, typename Real2 > struct StaticScalarProductGetter< 1, Real1, Real2 > { __cuda_callable__ static auto compute( const Real1* u, const Real2* v ) -> decltype( u[ 0 ] * v[ 0 ] ) { return u[ 0 ] * v[ 0 ]; Loading @@ -696,6 +701,7 @@ struct StaticScalarProductGetter< 1, Real1, Real2 > }; template< int Size, typename Real1, typename Real2 > __cuda_callable__ auto ScalarProduct( const StaticVector< Size, Real1 >& u, const StaticVector< Size, Real2 >& v ) -> decltype( u[ 0 ] * v[ 0 ] ) { Loading @@ -703,6 +709,7 @@ auto ScalarProduct( const StaticVector< Size, Real1 >& u, } template< int Size, typename Real1, typename Real2 > __cuda_callable__ auto operator,( const StaticVector< Size, Real1 >& u, const StaticVector< Size, Real2 >& v ) -> decltype( u[ 0 ] * v[ 0 ] ) { Loading src/TNL/Containers/StaticVector1D_impl.h +1 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ template< typename Real > template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ StaticVector< 1, Real >::StaticVector( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& op ) { Algorithms::VectorAssignment< StaticVector< 1, Real >, Expressions::BinaryExpressionTemplate< T1, T2, Operation > >::assign( *this, op ); Loading Loading
src/TNL/Containers/Expressions/BinaryExpressionTemplate.h +32 −6 Original line number Diff line number Diff line Loading @@ -26,12 +26,6 @@ template< typename T1, ExpressionVariableType T2Type = ExpressionVariableTypeGetter< T2 >::value > struct BinaryExpressionTemplate { /*BinaryExpressionTemplate( const T1& a, const T2& b ){}; static T1 evaluate( const T1& a, const T2& b ) { return Operation< T1, T2 >::evaluate( a, b ); }*/ }; template< typename T1, Loading @@ -42,18 +36,22 @@ struct BinaryExpressionTemplate< T1, T2, Operation, VectorVariable, VectorVariab using RealType = typename T1::RealType; using IsExpressionTemplate = bool; __cuda_callable__ BinaryExpressionTemplate( const T1& a, const T2& b ): op1( a ), op2( b ){} __cuda_callable__ static BinaryExpressionTemplate evaluate( const T1& a, const T2& b ) { return BinaryExpressionTemplate( a, b ); } __cuda_callable__ RealType operator[]( const int i ) const { return Operation< typename T1::RealType, typename T2::RealType >::evaluate( op1[ i ], op2[ i ] ); } __cuda_callable__ int getSize() const { return op1.getSize(); Loading @@ -73,18 +71,22 @@ struct BinaryExpressionTemplate< T1, T2, Operation, VectorVariable, ArithmeticVa using RealType = typename T1::RealType; using IsExpressionTemplate = bool; __cuda_callable__ BinaryExpressionTemplate( const T1& a, const T2& b ): op1( a ), op2( b ){} __cuda_callable__ BinaryExpressionTemplate evaluate( const T1& a, const T2& b ) { return BinaryExpressionTemplate( a, b ); } __cuda_callable__ RealType operator[]( const int i ) const { return Operation< typename T1::RealType, T2 >::evaluate( op1[ i ], op2 ); } __cuda_callable__ int getSize() const { return op1.getSize(); Loading @@ -104,18 +106,22 @@ struct BinaryExpressionTemplate< T1, T2, Operation, ArithmeticVariable, VectorVa using RealType = typename T2::RealType; using IsExpressionTemplate = bool; __cuda_callable__ BinaryExpressionTemplate( const T1& a, const T2& b ): op1( a ), op2( b ){} __cuda_callable__ BinaryExpressionTemplate evaluate( const T1& a, const T2& b ) { return BinaryExpressionTemplate( a, b ); } __cuda_callable__ RealType operator[]( const int i ) const { return Operation< T1, typename T2::RealType >::evaluate( op1, op2[ i ] ); } __cuda_callable__ int getSize() const { return op2.getSize(); Loading @@ -134,6 +140,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< L1, L2, LOperation >, Expressions::BinaryExpressionTemplate< R1, R2, ROperation >, Loading @@ -150,6 +157,7 @@ operator + ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< T1, T2, Operation >, typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType, Loading @@ -171,6 +179,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< L1, L2, LOperation >, Expressions::BinaryExpressionTemplate< R1, R2, ROperation >, Loading @@ -187,6 +196,7 @@ operator - ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< T1, T2, Operation >, typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType, Loading @@ -208,6 +218,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< L1, L2, LOperation >, Expressions::BinaryExpressionTemplate< R1, R2, ROperation >, Loading @@ -224,6 +235,7 @@ operator * ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< T1, T2, Operation >, typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType, Loading @@ -245,6 +257,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< L1, L2, LOperation >, Expressions::BinaryExpressionTemplate< R1, R2, ROperation >, Loading @@ -261,6 +274,7 @@ operator / ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ const Expressions::BinaryExpressionTemplate< Expressions::BinaryExpressionTemplate< T1, T2, Operation >, typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType, Loading @@ -282,6 +296,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ bool operator == ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& a, const Expressions::BinaryExpressionTemplate< R1, R2, ROperation >& b ) Loading @@ -292,6 +307,7 @@ operator == ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ bool operator == ( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& a, const typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType& b ) Loading @@ -307,6 +323,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ bool operator != ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& a, const Expressions::BinaryExpressionTemplate< R1, R2, ROperation >& b ) Loading @@ -317,6 +334,7 @@ operator != ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ bool operator != ( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& a, const typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType& b ) Loading @@ -332,6 +350,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ bool operator < ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& a, const Expressions::BinaryExpressionTemplate< R1, R2, ROperation >& b ) Loading @@ -342,6 +361,7 @@ operator < ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ bool operator < ( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& a, const typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType& b ) Loading @@ -357,6 +377,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ bool operator <= ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& a, const Expressions::BinaryExpressionTemplate< R1, R2, ROperation >& b ) Loading @@ -367,6 +388,7 @@ operator <= ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ bool operator <= ( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& a, const typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType& b ) Loading @@ -382,6 +404,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ bool operator > ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& a, const Expressions::BinaryExpressionTemplate< R1, R2, ROperation >& b ) Loading @@ -392,6 +415,7 @@ operator > ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ bool operator > ( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& a, const typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType& b ) Loading @@ -407,6 +431,7 @@ template< typename L1, typename R1, typename R2, template< typename, typename > class ROperation > __cuda_callable__ bool operator >= ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& a, const Expressions::BinaryExpressionTemplate< R1, R2, ROperation >& b ) Loading @@ -417,6 +442,7 @@ operator >= ( const Expressions::BinaryExpressionTemplate< L1, L2, LOperation >& template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ bool operator >= ( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& a, const typename Expressions::BinaryExpressionTemplate< T1, T2, Operation >::RealType& b ) Loading
src/TNL/Containers/Expressions/ExpressionTemplatesOperations.h +4 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ namespace TNL { template< typename T1, typename T2 > struct Addition { __cuda_callable__ static auto evaluate( const T1& a, const T2& b ) -> decltype( a + b ) { return a + b; Loading @@ -26,6 +27,7 @@ struct Addition template< typename T1, typename T2 > struct Subtraction { __cuda_callable__ static auto evaluate( const T1& a, const T2& b ) -> decltype( a - b ) { return a - b; Loading @@ -35,6 +37,7 @@ struct Subtraction template< typename T1, typename T2 > struct Multiplication { __cuda_callable__ static auto evaluate( const T1& a, const T2& b ) -> decltype( a * b ) { return a * b; Loading @@ -44,6 +47,7 @@ struct Multiplication template< typename T1, typename T2 > struct Division { __cuda_callable__ static auto evaluate( const T1& a, const T2& b ) -> decltype( a / b ) { return a / b; Loading
src/TNL/Containers/Expressions/StaticComparison.h +6 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ namespace TNL { template< typename T1, typename T2 > __cuda_callable__ bool StaticComparisonEQ( const T1& a, const T2& b ) { TNL_ASSERT_EQ( a.getSize(), b.getSize(), "Sizes of expressions to be compared do not fit." ); Loading @@ -29,6 +30,7 @@ bool StaticComparisonEQ( const T1& a, const T2& b ) template< typename T1, typename T2 > __cuda_callable__ bool StaticComparisonNE( const T1& a, const T2& b ) { return ! StaticComparisonEQ( a, b ); Loading @@ -36,6 +38,7 @@ bool StaticComparisonNE( const T1& a, const T2& b ) template< typename T1, typename T2 > __cuda_callable__ bool StaticComparisonGT( const T1& a, const T2& b ) { TNL_ASSERT_EQ( a.getSize(), b.getSize(), "Sizes of expressions to be compared do not fit." ); Loading @@ -47,6 +50,7 @@ bool StaticComparisonGT( const T1& a, const T2& b ) template< typename T1, typename T2 > __cuda_callable__ bool StaticComparisonLE( const T1& a, const T2& b ) { return ! StaticComparisonGT( a, b ); Loading @@ -54,6 +58,7 @@ bool StaticComparisonLE( const T1& a, const T2& b ) template< typename T1, typename T2 > __cuda_callable__ bool StaticComparisonLT( const T1& a, const T2& b ) { TNL_ASSERT_EQ( a.getSize(), b.getSize(), "Sizes of expressions to be compared do not fit." ); Loading @@ -65,6 +70,7 @@ bool StaticComparisonLT( const T1& a, const T2& b ) template< typename T1, typename T2 > __cuda_callable__ bool StaticComparisonGE( const T1& a, const T2& b ) { return ! StaticComparisonLT( a, b ); Loading
src/TNL/Containers/StaticVector.h +8 −1 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ class StaticVector : public StaticArray< Size, Real > template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ StaticVector( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& op ); /** Loading Loading @@ -290,6 +291,7 @@ class StaticVector< 1, Real > : public StaticArray< 1, Real > template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ StaticVector( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& op ); bool setup( const Config::ParameterContainer& parameters, Loading Loading @@ -426,6 +428,7 @@ class StaticVector< 2, Real > : public StaticArray< 2, Real > template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ StaticVector( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& op ); bool setup( const Config::ParameterContainer& parameters, Loading Loading @@ -563,9 +566,9 @@ class StaticVector< 3, Real > : public StaticArray< 3, Real > template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ StaticVector( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& op ); bool setup( const Config::ParameterContainer& parameters, const String& prefix = "" ); Loading Loading @@ -680,6 +683,7 @@ namespace Containers { template< int Size, typename Real1, typename Real2 > struct StaticScalarProductGetter { __cuda_callable__ static auto compute( const Real1* u, const Real2* v ) -> decltype( u[ 0 ] * v[ 0 ] ) { return u[ 0 ] * v[ 0 ] + StaticScalarProductGetter< Size - 1, Real1, Real2 >::compute( &u[ 1 ], &v[ 1 ] ); Loading @@ -689,6 +693,7 @@ struct StaticScalarProductGetter template< typename Real1, typename Real2 > struct StaticScalarProductGetter< 1, Real1, Real2 > { __cuda_callable__ static auto compute( const Real1* u, const Real2* v ) -> decltype( u[ 0 ] * v[ 0 ] ) { return u[ 0 ] * v[ 0 ]; Loading @@ -696,6 +701,7 @@ struct StaticScalarProductGetter< 1, Real1, Real2 > }; template< int Size, typename Real1, typename Real2 > __cuda_callable__ auto ScalarProduct( const StaticVector< Size, Real1 >& u, const StaticVector< Size, Real2 >& v ) -> decltype( u[ 0 ] * v[ 0 ] ) { Loading @@ -703,6 +709,7 @@ auto ScalarProduct( const StaticVector< Size, Real1 >& u, } template< int Size, typename Real1, typename Real2 > __cuda_callable__ auto operator,( const StaticVector< Size, Real1 >& u, const StaticVector< Size, Real2 >& v ) -> decltype( u[ 0 ] * v[ 0 ] ) { Loading
src/TNL/Containers/StaticVector1D_impl.h +1 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ template< typename Real > template< typename T1, typename T2, template< typename, typename > class Operation > __cuda_callable__ StaticVector< 1, Real >::StaticVector( const Expressions::BinaryExpressionTemplate< T1, T2, Operation >& op ) { Algorithms::VectorAssignment< StaticVector< 1, Real >, Expressions::BinaryExpressionTemplate< T1, T2, Operation > >::assign( *this, op ); Loading