AutoPas  3.0.0
Loading...
Searching...
No Matches
Namespaces | Classes | Concepts | Typedefs | Enumerations | Functions
autopas::utils Namespace Reference

In this namespace some helper classes and functions can be found used inside of AutoPas. More...

Namespaces

namespace  ArrayMath
 Namespace to handle mathematical operations of std::array.
 
namespace  ArrayUtils
 In this namespace some helper functions for std::array can be found.
 
namespace  AutoPasConfigurationCommunicator
 Provides several functions for handling configurations among mpi ranks.
 
namespace  CompileInfo
 Namespace for functions that provide information about what the code was compiled with.
 
namespace  is_container_impl
 Collection of structs that define what we consider a container.
 
namespace  NumParticlesEstimator
 Functions to estimate numbers of particles.
 
namespace  quaternion
 Array utils specifically for handling quaternions.
 
namespace  StringUtils
 Some functions to parse enums from (input-) strings.
 
namespace  ThreeDimensionalMapping
 Namespace to handle the conversion between one dimensional and three dimensional indices.
 
namespace  TupleUtils
 In this namespace some helper functions for std::tuple can be found.
 

Classes

class  DataLayoutConverter
 This converts cells to the target data Layout using the given functor. More...
 
class  EnergySensor
 Measure the energy consumption of a simulation on multiple hardwares. More...
 
class  ExceptionHandler
 Defines and handles the throwing and printing of exceptions. More...
 
struct  is_shared_ptr
 Type trait to determine if a type is a shared pointer at compile time. More...
 
struct  is_shared_ptr< std::shared_ptr< T > >
 True specialization for shared_ptr. More...
 
struct  is_smart_ptr
 Type trait to determine if a type is a smart pointer at compile time. More...
 
struct  is_smart_ptr< std::shared_ptr< T > >
 True specialization for shared_ptr. More...
 
struct  is_smart_ptr< std::unique_ptr< T > >
 True specialization for unique_ptr. More...
 
struct  is_smart_ptr< std::weak_ptr< T > >
 True specialization for weak_ptr. More...
 
struct  is_unique_ptr
 Type trait to determine if a type is a unique pointer at compile time. More...
 
struct  is_unique_ptr< std::unique_ptr< T > >
 True specialization for unique_ptr. More...
 
class  ParticleBinStructure
 Particle-counting bin structure. More...
 
struct  ParticleTypeTrait
 ParticleTypeTrait class. More...
 
struct  ParticleTypeTrait< autopas::AutoPas< Particle_T > >
 Specialization for the AutoPas class. More...
 
struct  ParticleTypeTrait< std::vector< ParticleCell > >
 Specialization for vectors of ParticleCells. More...
 
class  SoAStorage
 SoAStorage is a helper to access the stored SoA's. More...
 
struct  SoAType
 Helper struct to get a the SoAType. More...
 
class  Timer
 Timer class to stop times. More...
 
class  TraceTimer
 A wrapper around autopas::utils::Timer that only compiles implementation logic if AUTOPAS_ACTIVE_LEVEL is set to TRACE. More...
 

Concepts

concept  ContainerType
 Concept to check if something is a container (vector, array or set).
 

Typedefs

template<typename FunctorT >
using isPairwiseFunctor = decltype(isPairwiseFunctorImpl(std::declval< FunctorT >()))
 Check whether a Functor Type is inheriting from PairwiseFunctor.
 
template<typename FunctorT >
using isTriwiseFunctor = decltype(isTriwiseFunctorImpl(std::declval< FunctorT >()))
 Check whether a Functor Type is inheriting from TriwiseFunctor.
 
template<typename T >
using optRef = std::optional< std::reference_wrapper< T > >
 Short alias for std::optional<std::reference_wrapper<T>>
 
using bestSteadyClock = std::conditional_t< std::chrono::high_resolution_clock::is_steady, std::chrono::high_resolution_clock, std::chrono::steady_clock >
 high_resolution_clock is not guaranteed to be monotonous in time, which can lead to negative duration times.
 

Enumerations

enum  ExceptionBehavior { ignore , throwException , printAbort , printCustomAbortFunction }
 Enum that defines the behavior of the expection handling. More...
 

Functions

template<class T >
std::size_t hashValue (const T &value)
 Hash of a single value.
 
template<class... Values_T>
std::size_t hashCombine (const Values_T &...values)
 Combines the hashes of an arbitrary number of values into one hash.
 
template<typename T >
bool inBox (const std::array< T, 3 > &position, const std::array< T, 3 > &low, const std::array< T, 3 > &high)
 Checks if position is inside of a box defined by low and high.
 
template<typename T >
bool notInBox (const std::array< T, 3 > &position, const std::array< T, 3 > &low, const std::array< T, 3 > &high)
 Checks if position is not inside of a box defined by low and high.
 
template<typename T >
bool boxesOverlap (const std::array< T, 3 > &boxALow, const std::array< T, 3 > &boxAHigh, const std::array< T, 3 > &boxBLow, const std::array< T, 3 > &boxBHigh)
 Checks if two boxes have overlap.
 
template<typename F >
decltype(auto) withStaticBool (bool theBool, F &&func)
 Function to execute the code passed in the lambda with a static bool.
 

Detailed Description

In this namespace some helper classes and functions can be found used inside of AutoPas.

These classes reside mostly in the utils directory. However, most commonly used function inside the utils directory might not be in the utils namespace.

Typedef Documentation

◆ bestSteadyClock

using autopas::utils::bestSteadyClock = typedef std::conditional_t<std::chrono::high_resolution_clock::is_steady, std::chrono::high_resolution_clock, std::chrono::steady_clock>

high_resolution_clock is not guaranteed to be monotonous in time, which can lead to negative duration times.

Swap to steady_clock then, which is usually the same precision or precise enough.

◆ isPairwiseFunctor

template<typename FunctorT >
using autopas::utils::isPairwiseFunctor = typedef decltype(isPairwiseFunctorImpl(std::declval<FunctorT>()))

Check whether a Functor Type is inheriting from PairwiseFunctor.

Template Parameters
FunctorT

◆ isTriwiseFunctor

template<typename FunctorT >
using autopas::utils::isTriwiseFunctor = typedef decltype(isTriwiseFunctorImpl(std::declval<FunctorT>()))

Check whether a Functor Type is inheriting from TriwiseFunctor.

Template Parameters
FunctorT

Enumeration Type Documentation

◆ ExceptionBehavior

Enum that defines the behavior of the expection handling.

Enumerator
ignore 

Ignore all exceptions.

throwException 

Throw the exception.

printAbort 

Print the exception and.

printCustomAbortFunction 

Print the exception and call a custom abort function.

Function Documentation

◆ boxesOverlap()

template<typename T >
bool autopas::utils::boxesOverlap ( const std::array< T, 3 > &  boxALow,
const std::array< T, 3 > &  boxAHigh,
const std::array< T, 3 > &  boxBLow,
const std::array< T, 3 > &  boxBHigh 
)

Checks if two boxes have overlap.

If the boxes touch (= exact same floating point values), they are not considered to have overlap.

Template Parameters
T
Parameters
boxALow
boxAHigh
boxBLow
boxBHigh
Returns

◆ hashCombine()

template<class... Values_T>
std::size_t autopas::utils::hashCombine ( const Values_T &...  values)

Combines the hashes of an arbitrary number of values into one hash.

Equivalent to repeated application of boost::hash_combine (Boost >= 1.81), i.e. seed = mix(seed + 0x9e3779b9 + hashValue(value)).

The mixer is the xmxmx bit mixer used by boost::hash_combine (boost/container_hash/detail/hash_mix.hpp). It is reproduced here instead of pulling in Boost, and as we use this for ease and not in performance critical situations, we do not care so much about getting the latest version from Boost.

The parameters used are those from Jon Maiga's implementation (https://jonkagstrom.com/mx3/mx3_rev2.html).

Template Parameters
Values_TTypes of the values to hash.
Parameters
valuesValues to hash.
Returns
Combined hash.

◆ hashValue()

template<class T >
std::size_t autopas::utils::hashValue ( const T &  value)

Hash of a single value.

Uses std::hash if it is specialized for T (arithmetic types, enums, strings, pointers, ...) and otherwise falls back to a static_cast to std::size_t. The latter covers AutoPas Option types, which implicitly convert to their underlying enum.

Template Parameters
TType of the value.
Parameters
valueValue to hash.
Returns
Hash of value.

◆ inBox()

template<typename T >
bool autopas::utils::inBox ( const std::array< T, 3 > &  position,
const std::array< T, 3 > &  low,
const std::array< T, 3 > &  high 
)

Checks if position is inside of a box defined by low and high.

The lower corner is included in, the upper is excluded from the box. i.e. [low[0], high[0]) x [low[1], high[1]) x [low[2], high[2])

Template Parameters
Tthe type of floating point check
Parameters
positionthe position that should be checked
lowthe lower corner of the box (inclusive)
highthe upper corner of the box (exclusive)
Returns
true if position is inside the box, false otherwise

◆ notInBox()

template<typename T >
bool autopas::utils::notInBox ( const std::array< T, 3 > &  position,
const std::array< T, 3 > &  low,
const std::array< T, 3 > &  high 
)

Checks if position is not inside of a box defined by low and high.

The lower corner is included in, the upper is excluded from the box. i.e. [low[0], high[0]) x [low[1], high[1]) x [low[2], high[2])

Template Parameters
Tthe type of floating point check
Parameters
positionthe position that should be checked
lowthe lower corner of the box (inclusive)
highthe upper corner of the box (exclusive)
Returns
true if position is not inside the box, false otherwise

◆ withStaticBool()

template<typename F >
decltype(auto) autopas::utils::withStaticBool ( bool  theBool,
F &&  func 
)

Function to execute the code passed in the lambda with a static bool.

The static value of the boolean will be passed using the first argument of function.

Parameters
theBoolThe bool that should be used statically.
funcFunction to be called, should accept a static bool type, e.g., [&](auto theBool){};
Returns
Returns whatever func returns.