Template Numerical Library  version develop:4b9c6207
Namespaces | Classes | Functions
TNL Namespace Reference

The main TNL namespace. More...

Namespaces

 Algorithms
 Namespace for fundamental TNL algorithms.
 
 Allocators
 Namespace for TNL allocators.
 
 Assert
 Internal namespace for helper classes used in the TNL_ASSERT_* macros.
 
 Communicators
 Namespace for TNL communicators.
 
 Containers
 Namespace for TNL containers.
 
 Devices
 Namespace for TNL execution models.
 
 Exceptions
 Namespace for TNL exceptions.
 
 Images
 Namespace for image processing.
 
 Matrices
 Namespace for matrix formats.
 
 Meshes
 Namespace for numerical meshes and related objects.
 
 Pointers
 Namespace for TNL pointers.
 

Classes

class  Atomic
 
class  Atomic< T, Devices::Cuda >
 
class  Atomic< T, Devices::Host >
 
struct  CacheSizes
 
class  File
 This class serves for binary IO. It allows to do IO even for data allocated on GPU together with on-the-fly data type conversion. More...
 
class  FileName
 Helper class for the construction of file names based on name, index and extension. More...
 
struct  HasConstexprGetSizeMethod
 Type trait for checking if T has a constexpr getSize method. More...
 
class  HasGetArrayDataMethod
 Type trait for checking if T has getArrayData method. More...
 
class  HasGetSizeMethod
 Type trait for checking if T has getSize method. More...
 
class  HasSetSizeMethod
 Type trait for checking if T has setSize method. More...
 
class  HasStaticGetSerializationType
 Type trait for checking if T has a static getSerializationType method. More...
 
class  HasSubscriptOperator
 Type trait for checking if T has operator[] taking one index argument. More...
 
struct  IsArrayType
 Type trait for checking if T is an array type, e.g. Containers::Array or Containers::Vector. More...
 
struct  IsStaticArrayType
 Type trait for checking if T is a static array type. More...
 
struct  IsViewType
 Type trait for checking if T is a view type. More...
 
class  Logger
 Creates calculations log in the form of a table. More...
 
class  Object
 Basic class for majority of TNL objects like matrices, meshes, grids, solvers, etc.. More...
 
class  String
 Class for managing strings. More...
 
class  SystemInfo
 
class  Timer
 Class for real time, CPU time and CPU cycles measuring. More...
 

Functions

template<typename Real , typename Device , typename Index , typename Allocator >
auto abs (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<class T , std::enable_if_t< ! std::is_unsigned< T >::value, bool > = true>
__cuda_callable__ T abs (const T &n)
 This function returns absolute value of given number n. More...
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto acos (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto acos (const T &value) -> decltype(std::acos(value))
 This function returns the arc cosine of the given value.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto acosh (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto acosh (const T &value) -> decltype(std::acosh(value))
 This function returns the inverse hyperbolic cosine of the given value.
 
template<typename Vector , typename T1 , typename T2 , template< typename, typename > class Operation, typename Reduction , typename Result >
Result addAndReduce (Vector &lhs, const Containers::Expressions::BinaryExpressionTemplate< T1, T2, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , typename T2 , template< typename, typename > class Operation, typename Reduction , typename Result >
Result addAndReduce (Vector &lhs, const Containers::Expressions::DistributedBinaryExpressionTemplate< T1, T2, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , template< typename > class Operation, typename Reduction , typename Result >
Result addAndReduce (Vector &lhs, const Containers::Expressions::DistributedUnaryExpressionTemplate< T1, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , typename T2 , template< typename, typename > class Operation, typename Reduction , typename Result >
__cuda_callable__ Result addAndReduce (Vector &lhs, const Containers::Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , template< typename > class Operation, typename Reduction , typename Result >
__cuda_callable__ Result addAndReduce (Vector &lhs, const Containers::Expressions::StaticUnaryExpressionTemplate< T1, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , template< typename > class Operation, typename Reduction , typename Result >
Result addAndReduce (Vector &lhs, const Containers::Expressions::UnaryExpressionTemplate< T1, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , typename T2 , template< typename, typename > class Operation, typename Reduction , typename Result >
Result addAndReduceAbs (Vector &lhs, const Containers::Expressions::BinaryExpressionTemplate< T1, T2, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , typename T2 , template< typename, typename > class Operation, typename Reduction , typename Result >
Result addAndReduceAbs (Vector &lhs, const Containers::Expressions::DistributedBinaryExpressionTemplate< T1, T2, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , template< typename > class Operation, typename Reduction , typename Result >
Result addAndReduceAbs (Vector &lhs, const Containers::Expressions::DistributedUnaryExpressionTemplate< T1, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , typename T2 , template< typename, typename > class Operation, typename Reduction , typename Result >
__cuda_callable__ Result addAndReduceAbs (Vector &lhs, const Containers::Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , template< typename > class Operation, typename Reduction , typename Result >
__cuda_callable__ Result addAndReduceAbs (Vector &lhs, const Containers::Expressions::StaticUnaryExpressionTemplate< T1, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , template< typename > class Operation, typename Reduction , typename Result >
Result addAndReduceAbs (Vector &lhs, const Containers::Expressions::UnaryExpressionTemplate< T1, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename T1 , typename T2 , typename ResultType = typename std::common_type< T1, T2 >::type>
__cuda_callable__ ResultType argAbsMax (const T1 &a, const T2 &b)
 
template<typename T1 , typename T2 , typename ResultType = typename std::common_type< T1, T2 >::type>
__cuda_callable__ ResultType argAbsMin (const T1 &a, const T2 &b)
 
template<typename Real , typename Device , typename Index , typename Allocator >
std::pair< Index, std::decay_t< Real > > argMax (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T1 , typename T2 , typename ResultType = typename std::common_type< T1, T2 >::type>
__cuda_callable__ ResultType argMax (const T1 &a, const T2 &b)
 
template<typename Real , typename Device , typename Index , typename Allocator >
std::pair< Index, std::decay_t< Real > > argMin (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T1 , typename T2 , typename ResultType = typename std::common_type< T1, T2 >::type>
__cuda_callable__ ResultType argMin (const T1 &a, const T2 &b)
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto asin (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto asin (const T &value) -> decltype(std::asin(value))
 This function returns the arc sine of the given value.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto asinh (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto asinh (const T &value) -> decltype(std::asinh(value))
 This function returns the inverse hyperbolic sine of the given value.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto atan (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto atan (const T &value) -> decltype(std::atan(value))
 This function returns the arc tangent of the given value.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto atanh (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto atanh (const T &value) -> decltype(std::atanh(value))
 This function returns the inverse hyperbolic tangent of the given value.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto binaryAnd (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto binaryOr (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename ResultType , typename Real , typename Device , typename Index , typename Allocator , template< typename > class Operation = Containers::Expressions::Cast< ResultType >::template Operation>
auto cast (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto cbrt (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto cbrt (const T &value) -> decltype(std::cbrt(value))
 This function returns cubic root of the given value.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto ceil (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto ceil (const T &value) -> decltype(std::ceil(value))
 This function returns the smallest integer value not less than the given value.
 
template<>
String convertToString (const bool &b)
 Specialization of function convertToString for boolean. More...
 
template<typename T >
String convertToString (const T &value)
 Converts value of type T to a String. More...
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto cos (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto cos (const T &value) -> decltype(std::cos(value))
 This function returns cosine of the given value.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto cosh (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto cosh (const T &value) -> decltype(std::cosh(value))
 This function returns the hyperbolic cosine of the given value.
 
template<typename ET1 , typename ET2 >
auto dot (const ET1 &a, const ET2 &b)
 Computes scalar product of vector and vector expression. Equivalent to TNL::Containers::operator,. More...
 
template<typename Vector , typename T1 , typename T2 , template< typename, typename > class Operation, typename Reduction , typename Result >
Result evaluateAndReduce (Vector &lhs, const Containers::Expressions::BinaryExpressionTemplate< T1, T2, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , typename T2 , template< typename, typename > class Operation, typename Reduction , typename Result >
Result evaluateAndReduce (Vector &lhs, const Containers::Expressions::DistributedBinaryExpressionTemplate< T1, T2, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , template< typename > class Operation, typename Reduction , typename Result >
Result evaluateAndReduce (Vector &lhs, const Containers::Expressions::DistributedUnaryExpressionTemplate< T1, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , typename T2 , template< typename, typename > class Operation, typename Reduction , typename Result >
__cuda_callable__ Result evaluateAndReduce (Vector &lhs, const Containers::Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , template< typename > class Operation, typename Reduction , typename Result >
__cuda_callable__ Result evaluateAndReduce (Vector &lhs, const Containers::Expressions::StaticUnaryExpressionTemplate< T1, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Vector , typename T1 , template< typename > class Operation, typename Reduction , typename Result >
Result evaluateAndReduce (Vector &lhs, const Containers::Expressions::UnaryExpressionTemplate< T1, Operation > &expression, const Reduction &reduction, const Result &zero)
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto exp (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto exp (const T &value) -> decltype(std::exp(value))
 This function returns the base-e exponential of the given value.
 
bool fileExists (const String &fileName)
 Returns true if the file exists and false otherwise. More...
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto floor (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto floor (const T &value) -> decltype(std::floor(value))
 This function returns largest integer value not greater than the given value.
 
String getFileExtension (const String fileName)
 Returns extension of given file name, i.e. part after the last dot. More...
 
String getObjectType (const String &fileName)
 Does the same as getObjectType but with a fileName parameter instead of file. More...
 
String getObjectType (File &file)
 Extracts object type from a binary file. More...
 
template<typename T , std::enable_if_t< ! HasStaticGetSerializationType< T >::value, bool > = true>
String getSerializationType ()
 Returns a string identifying a type for the purpose of serialization. More...
 
template<typename T >
String getType ()
 Returns a human-readable string representation of given type. More...
 
template<typename T >
String getType (T &&obj)
 Returns a human-readable string representation of given object's type. More...
 
__cuda_callable__ bool isPow2 (int x)
 This function checks if x is an integral power of two. More...
 
__cuda_callable__ bool isPow2 (long int x)
 This function checks if x is an integral power of two. More...
 
template<typename Real >
__cuda_callable__ bool isSmall (const Real &v, const Real &tolerance=1.0e-5)
 This function tests whether the given real number is small. More...
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto l1Norm (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto l2Norm (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto log (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto log (const T &value) -> decltype(std::log(value))
 This function returns the natural logarithm of the given value.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto log10 (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto log10 (const T &value) -> decltype(std::log10(value))
 This function returns the common logarithm of the given value.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto log2 (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto log2 (const T &value) -> decltype(std::log2(value))
 This function returns the binary logarithm of the given value.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto logicalAnd (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto logicalOr (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename Real , typename Device , typename Index , typename Allocator , typename Real2 >
auto lpNorm (const Containers::Vector< Real, Device, Index, Allocator > &a, const Real2 &p) -> double
 
template<typename Real , typename Device , typename Index , typename Allocator >
Real max (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename Real , typename Device , typename Index , typename Allocator , typename ET , typename... , typename = std::enable_if_t< Containers::Expressions::IsNumericExpression<ET>::value >>
auto max (const Containers::Vector< Real, Device, Index, Allocator > &a, const ET &b)
 
template<typename Real1 , typename Real2 , typename Device , typename Index , typename Allocator >
auto max (const Containers::Vector< Real1, Device, Index, Allocator > &a, const Containers::Vector< Real2, Device, Index, Allocator > &b)
 
template<typename Real1 , typename Real2 , typename Device , typename Index , typename Allocator >
auto max (const Containers::Vector< Real1, Device, Index, Allocator > &a, const Containers::VectorView< Real2, Device, Index > &b)
 
template<typename Real1 , typename Real2 , typename Device , typename Index , typename Allocator >
auto max (const Containers::VectorView< Real1, Device, Index > &a, const Containers::Vector< Real2, Device, Index, Allocator > &b)
 
template<typename ET , typename Real , typename Device , typename Index , typename Allocator , typename... , typename = std::enable_if_t< Containers::Expressions::IsNumericExpression<ET>::value >>
auto max (const ET &a, const Containers::Vector< Real, Device, Index, Allocator > &b)
 
template<typename T1 , typename T2 , typename ResultType = typename std::common_type< T1, T2 >::type, std::enable_if_t< ! HasSubscriptOperator< T1 >::value &&! HasSubscriptOperator< T2 >::value, bool > = true>
__cuda_callable__ ResultType max (const T1 &a, const T2 &b)
 This function returns maximum of two numbers. More...
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto maxNorm (const Containers::Vector< Real, Device, Index, Allocator > &a)
 Computes maximum norm of a vector. More...
 
template<typename Real , typename Device , typename Index , typename Allocator >
Real min (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename Real , typename Device , typename Index , typename Allocator , typename ET , typename... , typename = std::enable_if_t< Containers::Expressions::IsNumericExpression<ET>::value >>
auto min (const Containers::Vector< Real, Device, Index, Allocator > &a, const ET &b)
 
template<typename Real1 , typename Real2 , typename Device , typename Index , typename Allocator >
auto min (const Containers::Vector< Real1, Device, Index, Allocator > &a, const Containers::Vector< Real2, Device, Index, Allocator > &b)
 
template<typename Real1 , typename Real2 , typename Device , typename Index , typename Allocator >
auto min (const Containers::Vector< Real1, Device, Index, Allocator > &a, const Containers::VectorView< Real2, Device, Index > &b)
 
template<typename Real1 , typename Real2 , typename Device , typename Index , typename Allocator >
auto min (const Containers::VectorView< Real1, Device, Index > &a, const Containers::Vector< Real2, Device, Index, Allocator > &b)
 
template<typename ET , typename Real , typename Device , typename Index , typename Allocator , typename... , typename = std::enable_if_t< Containers::Expressions::IsNumericExpression<ET>::value >>
auto min (const ET &a, const Containers::Vector< Real, Device, Index, Allocator > &b)
 
template<typename T1 , typename T2 , typename ResultType = typename std::common_type< T1, T2 >::type, std::enable_if_t< ! HasSubscriptOperator< T1 >::value &&! HasSubscriptOperator< T2 >::value, bool > = true>
__cuda_callable__ ResultType min (const T1 &a, const T2 &b)
 This function returns minimum of two numbers. More...
 
void mpiReceive (String &str, int source, int tag=0, MPI_Comm mpi_comm=MPI_COMM_WORLD)
 Receives a string from the target MPI process. More...
 
void mpiSend (const String &str, int target, int tag=0, MPI_Comm mpi_comm=MPI_COMM_WORLD)
 Sends the string to the target MPI process. More...
 
String operator+ (char string1, const String &string2)
 Returns concatenation of string1 and string2.
 
String operator+ (const char *string1, const String &string2)
 Returns concatenation of string1 and string2.
 
String operator+ (const std::string &string1, const String &string2)
 Returns concatenation of string1 and string2.
 
Fileoperator<< (File &file, const std::string &str)
 Serialization of strings.
 
Fileoperator>> (File &file, std::string &str)
 Deserialization of strings.
 
std::vector< StringparseObjectType (const String &objectType)
 Parses the object type. More...
 
template<typename Real , typename Device , typename Index , typename Allocator , typename ExpType >
auto pow (const Containers::Vector< Real, Device, Index, Allocator > &a, const ExpType &exp)
 
template<typename T1 , typename T2 , typename ResultType = typename std::common_type< T1, T2 >::type>
__cuda_callable__ ResultType pow (const T1 &base, const T2 &exp)
 This function returns the result of base to the power of exp.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto product (const Containers::Vector< Real, Device, Index, Allocator > &a)
 Computes product of all vector elements. More...
 
String removeFileNameExtension (String fileName)
 Cuts off the file extension. More...
 
__cuda_callable__ int roundToMultiple (int number, int multiple)
 This function rounds up number to the nearest multiple of number multiple. More...
 
__cuda_callable__ int roundUpDivision (const int num, const int div)
 This function divides num by div and rounds up the result. More...
 
void saveObjectType (File &file, const String &type)
 Saves object type into a binary file. More...
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto sign (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<class T >
__cuda_callable__ T sign (const T &a)
 This function represents the signum function. More...
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto sin (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto sin (const T &value) -> decltype(std::sin(value))
 This function returns sine of the given value.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto sinh (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto sinh (const T &value) -> decltype(std::sinh(value))
 This function returns the hyperbolic sine of the given value.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto sqrt (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto sqrt (const T &value) -> decltype(std::sqrt(value))
 This function returns square root of the given value.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto sum (const Containers::Vector< Real, Device, Index, Allocator > &a)
 Computes sum of all vector elements. More...
 
template<typename T1 , typename T2 , typename ResultType = typename std::common_type< T1, T2 >::type>
__cuda_callable__ ResultType sum (const T1 &a, const T2 &b)
 
template<typename Type >
__cuda_callable__ void swap (Type &a, Type &b)
 This function swaps values of two parameters. More...
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto tan (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto tan (const T &value) -> decltype(std::tan(value))
 This function returns tangent of the given value.
 
template<typename Real , typename Device , typename Index , typename Allocator >
auto tanh (const Containers::Vector< Real, Device, Index, Allocator > &a)
 
template<typename T >
__cuda_callable__ auto tanh (const T &value) -> decltype(std::tanh(value))
 This function returns the hyperbolic tangent of the given value.
 

Detailed Description

The main TNL namespace.

Function Documentation

◆ abs()

template<class T , std::enable_if_t< ! std::is_unsigned< T >::value, bool > = true>
__cuda_callable__ T TNL::abs ( const T &  n)
inline

This function returns absolute value of given number n.

This function returns the absolute value of given unsigned number n, i.e. n.

◆ convertToString() [1/2]

template<>
String TNL::convertToString ( const bool &  b)
inline

Specialization of function convertToString for boolean.

The boolean type is converted to 'true' ot 'false'.

◆ convertToString() [2/2]

template<typename T >
String TNL::convertToString ( const T &  value)

Converts value of type T to a String.

Template Parameters
Tcan be any type fir which operator << is defined.

◆ dot()

template<typename ET1 , typename ET2 >
auto TNL::dot ( const ET1 &  a,
const ET2 &  b 
)

Computes scalar product of vector and vector expression. Equivalent to TNL::Containers::operator,.

Parameters
ainput vector
binput vector expression
Returns
scalar product of vector and vector expression

◆ fileExists()

bool TNL::fileExists ( const String fileName)
inline

Returns true if the file exists and false otherwise.

Finds out if the file fileName exists.

Parameters
fileNameName of the file to check.
Returns
returns true if the file exists and false othervise

◆ getFileExtension()

String TNL::getFileExtension ( const String  fileName)
inline

Returns extension of given file name, i.e. part after the last dot.

Parameters
fileNameInput file name.
Returns
Extension of the given file name.

◆ getObjectType() [1/2]

String TNL::getObjectType ( const String fileName)
inline

Does the same as getObjectType but with a fileName parameter instead of file.

Throws Exceptions::FileDeserializationError if the object type cannot be detected.

Parameters
fileNamename of a file where the object is stored
Returns
string with the object type

◆ getObjectType() [2/2]

String TNL::getObjectType ( File file)
inline

Extracts object type from a binary file.

Throws Exceptions::FileDeserializationError if the object type cannot be detected.

Parameters
fileis file where the object is stored
Returns
string with the object type

◆ getSerializationType()

template<typename T , std::enable_if_t< ! HasStaticGetSerializationType< T >::value, bool > = true>
String TNL::getSerializationType ( )

Returns a string identifying a type for the purpose of serialization.

Specialization of getSerializationType for types which provide a static getSerializationType method to override the default behaviour.

By default, this function returns the same string as getType. However, if a user-defined class has a static getSerializationType method, it is called instead. This is useful for overriding the default typeid name, which may be necessary e.g. for class templates which should have the same serialization type for multiple devices.

◆ getType() [1/2]

template<typename T >
String TNL::getType ( )

Returns a human-readable string representation of given type.

Note that since we use the typeid operator internally, the top-level cv-qualifiers are always ignored. See https://stackoverflow.com/a/8889143 for details.

◆ getType() [2/2]

template<typename T >
String TNL::getType ( T &&  obj)

Returns a human-readable string representation of given object's type.

Note that since we use the typeid operator internally, the top-level cv-qualifiers are always ignored. See https://stackoverflow.com/a/8889143 for details.

◆ isPow2() [1/2]

__cuda_callable__ bool TNL::isPow2 ( int  x)
inline

This function checks if x is an integral power of two.

Returns true if x is a power of two. Otherwise returns false.

Parameters
xInteger.

◆ isPow2() [2/2]

__cuda_callable__ bool TNL::isPow2 ( long int  x)
inline

This function checks if x is an integral power of two.

Returns true if x is a power of two. Otherwise returns false.

Parameters
xLong integer.

◆ isSmall()

template<typename Real >
__cuda_callable__ bool TNL::isSmall ( const Real &  v,
const Real &  tolerance = 1.0e-5 
)

This function tests whether the given real number is small.

It tests whether the number v is in tolerance, in other words, whether v in absolute value is less then or equal to tolerance.

Parameters
vReal number.
toleranceCritical value which is set to 0.00001 by defalt.

◆ max()

template<typename T1 , typename T2 , typename ResultType = typename std::common_type< T1, T2 >::type, std::enable_if_t< ! HasSubscriptOperator< T1 >::value &&! HasSubscriptOperator< T2 >::value, bool > = true>
__cuda_callable__ ResultType TNL::max ( const T1 &  a,
const T2 &  b 
)

This function returns maximum of two numbers.

GPU device code uses the functions defined in the CUDA's math_functions.h, host uses the STL functions.

◆ maxNorm()

template<typename Real , typename Device , typename Index , typename Allocator >
auto TNL::maxNorm ( const Containers::Vector< Real, Device, Index, Allocator > &  a)

Computes maximum norm of a vector.

Parameters
ainput vector
Returns
maximum norm

◆ min()

template<typename T1 , typename T2 , typename ResultType = typename std::common_type< T1, T2 >::type, std::enable_if_t< ! HasSubscriptOperator< T1 >::value &&! HasSubscriptOperator< T2 >::value, bool > = true>
__cuda_callable__ ResultType TNL::min ( const T1 &  a,
const T2 &  b 
)
inline

This function returns minimum of two numbers.

GPU device code uses the functions defined in the CUDA's math_functions.h, host uses the STL functions.

◆ mpiReceive()

void TNL::mpiReceive ( String str,
int  source,
int  tag = 0,
MPI_Comm  mpi_comm = MPI_COMM_WORLD 
)
inline

Receives a string from the target MPI process.

Parameters
strsays where the received string is to be saved to
sourcesource MPI process ID
tagMPI tag
mpi_commMPI communication group

◆ mpiSend()

void TNL::mpiSend ( const String str,
int  target,
int  tag = 0,
MPI_Comm  mpi_comm = MPI_COMM_WORLD 
)
inline

Sends the string to the target MPI process.

Parameters
strstring to be sent
targettarget MPI process ID
tagMPI tag
mpi_commMPI communication group

◆ parseObjectType()

std::vector< String > TNL::parseObjectType ( const String objectType)
inline

Parses the object type.

Parameters
objectTypeis a string with the object type to be parsed.
Returns
vector of strings where the first one is the object type and the next strings are the template parameters.
Example
#include <iostream>
#include <TNL/Object.h>
using namespace TNL;
int main()
{
auto parsedObjectType = parseObjectType( String( "MyObject< Value, Device, Index >" ) );
for( auto &token : parsedObjectType )
std::cout << token << std::endl;
}
Output
MyObject
Value
Device
Index

◆ product()

template<typename Real , typename Device , typename Index , typename Allocator >
auto TNL::product ( const Containers::Vector< Real, Device, Index, Allocator > &  a)

Computes product of all vector elements.

Parameters
a
Returns

◆ removeFileNameExtension()

String TNL::removeFileNameExtension ( String  fileName)
inline

Cuts off the file extension.

Parameters
file_nameInput file name.
Returns
String with the file name without extension.

◆ roundToMultiple()

__cuda_callable__ int TNL::roundToMultiple ( int  number,
int  multiple 
)
inline

This function rounds up number to the nearest multiple of number multiple.

Parameters
numberInteger we want to round.
multipleInteger.

◆ roundUpDivision()

__cuda_callable__ int TNL::roundUpDivision ( const int  num,
const int  div 
)
inline

This function divides num by div and rounds up the result.

Parameters
numAn integer considered as dividend.
divAn integer considered as divisor.

◆ saveObjectType()

void TNL::saveObjectType ( File file,
const String type 
)
inline

Saves object type into a binary file.

Throws Exceptions::FileDeserializationError if the object type cannot be detected.

Parameters
fileis the file where the object will be saved
typeis the object type to be saved

◆ sign()

template<class T >
__cuda_callable__ T TNL::sign ( const T &  a)

This function represents the signum function.

It extracts the sign of the number a. In other words, the signum function projects negative numbers to value -1, positive numbers to value 1 and zero to value 0.

◆ sum()

template<typename Real , typename Device , typename Index , typename Allocator >
auto TNL::sum ( const Containers::Vector< Real, Device, Index, Allocator > &  a)

Computes sum of all vector elements.

Parameters
ainput vector
Returns
sum of all vector elements

◆ swap()

template<typename Type >
__cuda_callable__ void TNL::swap ( Type &  a,
Type &  b 
)

This function swaps values of two parameters.

It assigns the value of a to the parameter b and vice versa.

TNL::String
Class for managing strings.
Definition: String.h:48
TNL
The main TNL namespace.
Definition: CudaMultireductionKernel.h:21
std::cout
std::endl
T endl(T... args)
TNL::parseObjectType
std::vector< String > parseObjectType(const String &objectType)
Parses the object type.
Definition: Object.hpp:83