Loading...
Searching...
No Matches
Foam::ListPolicy Namespace Reference

Additional compile-time controls of List behaviour. More...

Classes

struct  short_length
 Number of items before requiring line-breaks in the list output. More...
struct  no_linebreak
 Can suppress additional line breaks separate ASCII data content when the data elements are primitives, or contiguous. More...
struct  no_linebreak< keyType >
 Suppress line-breaks for keyType. More...
struct  no_linebreak< word >
 Suppress line-breaks for word. More...
struct  no_linebreak< wordRe >
 Suppress line-breaks for wordRe. More...

Enumerations

enum  uniformity : unsigned char { EMPTY = 0 , UNIFORM = 0x1 , NONUNIFORM = 0x2 , MIXED = 0x3 }
 Classification of list/container uniformity. The values can be used with bit-wise or reduction. More...

Functions

template<class T>
constexpr bool is_aligned_type () noexcept
 Consider aligned allocation for the given type?
template<class IntType>
constexpr bool use_alignment (IntType n) noexcept
 True if size exceeds the min-size for using memory alignment.
template<class IntType>
constexpr bool use_memory_pool (IntType n) noexcept
 True if size exceeds the min-size for using the memory pool.
template<class IntType>
constexpr bool use_offload (IntType n) noexcept
 True if size exceeds the min-size for offloading.
constexpr std::align_val_t default_alignment () noexcept
 Default alignment for larger fields.
template<class T, class IntType>
Tallocate (IntType n)
 Allocate from memory pool (if active), or aligned, or normal.
template<class T, class IntType>
void deallocate (T *ptr)
 Deallocate from memory pool, or normal.
template<class T, class IntType>
void deallocate (T *ptr, IntType n)
 Deallocate from memory pool, or aligned, or normal.
template<int SizeMin, int Numerator, class IntType>
IntType reserve_size (IntType requested, IntType capacity) noexcept
 Calculate a reserve size (eg, doubling) based on the requested length and the current capacity.
template<int SizeMin, int Numerator, int Denominator, class IntType>
IntType reserve_size (IntType requested, IntType capacity) noexcept
 Calculate a reserve size based on the requested length and the current capacity.
template<class InputIt>
enum uniformity check_uniformity (InputIt first, InputIt last)
 Algorithm to determine list/container uniformity.

Detailed Description

Additional compile-time controls of List behaviour.

Enumeration Type Documentation

◆ uniformity

enum uniformity : unsigned char

Classification of list/container uniformity. The values can be used with bit-wise or reduction.

Enumerator
EMPTY 

An empty container.

UNIFORM 

Container (non-empty) with identical values.

NONUNIFORM 

Container (non-empty) with different values.

MIXED 

Mixed uniform/non-uniform (eg, after reduction).

Definition at line 353 of file ListPolicy.H.

Function Documentation

◆ is_aligned_type()

template<class T>
bool is_aligned_type ( )
inlineconstexprnoexcept

Consider aligned allocation for the given type?

Benefits for field data (floating-point, ints, vectorspace), but avoid for char data, strings, pointers etc

Definition at line 134 of file ListPolicy.H.

References Foam::is_contiguous_v, Foam::noexcept, and Foam::T().

Referenced by allocate(), deallocate(), and deallocate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ use_alignment()

template<class IntType>
bool use_alignment ( IntType n)
inlineconstexprnoexcept

True if size exceeds the min-size for using memory alignment.

Definition at line 151 of file ListPolicy.H.

References n.

Referenced by allocate(), and deallocate().

Here is the caller graph for this function:

◆ use_memory_pool()

template<class IntType>
bool use_memory_pool ( IntType n)
inlineconstexprnoexcept

True if size exceeds the min-size for using the memory pool.

Definition at line 161 of file ListPolicy.H.

References n.

Referenced by allocate().

Here is the caller graph for this function:

◆ use_offload()

template<class IntType>
bool use_offload ( IntType n)
inlineconstexprnoexcept

True if size exceeds the min-size for offloading.

Definition at line 171 of file ListPolicy.H.

References n.

◆ default_alignment()

std::align_val_t default_alignment ( )
inlineconstexprnoexcept

Default alignment for larger fields.

Definition at line 180 of file ListPolicy.H.

References Foam::noexcept.

Referenced by allocate(), and deallocate().

Here is the caller graph for this function:

◆ allocate()

template<class T, class IntType>
T * allocate ( IntType n)
inline

Allocate from memory pool (if active), or aligned, or normal.

Definition at line 190 of file ListPolicy.H.

References default_alignment(), is_aligned_type(), n, Foam::T(), MemoryPool::try_allocate(), use_alignment(), and use_memory_pool().

Referenced by List< T >::resize_copy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deallocate() [1/2]

template<class T, class IntType>
void deallocate ( T * ptr)
inline

Deallocate from memory pool, or normal.

Definition at line 236 of file ListPolicy.H.

References is_aligned_type(), Foam::T(), and MemoryPool::try_deallocate().

Referenced by List< T >::clear(), Matrix< Form, Type >::clear(), List< T >::resize_copy(), and List< T >::~List().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deallocate() [2/2]

template<class T, class IntType>
void deallocate ( T * ptr,
IntType n )
inline

Deallocate from memory pool, or aligned, or normal.

Definition at line 258 of file ListPolicy.H.

References default_alignment(), is_aligned_type(), n, Foam::T(), MemoryPool::try_deallocate(), and use_alignment().

Here is the call graph for this function:

◆ reserve_size() [1/2]

template<int SizeMin, int Numerator, class IntType>
IntType reserve_size ( IntType requested,
IntType capacity )
inlinenoexcept

Calculate a reserve size (eg, doubling) based on the requested length and the current capacity.

Definition at line 293 of file ListPolicy.H.

Referenced by PtrDynList< T, SizeMin >::reserve().

Here is the caller graph for this function:

◆ reserve_size() [2/2]

template<int SizeMin, int Numerator, int Denominator, class IntType>
IntType reserve_size ( IntType requested,
IntType capacity )
inlinenoexcept

Calculate a reserve size based on the requested length and the current capacity.

Definition at line 321 of file ListPolicy.H.

◆ check_uniformity()

template<class InputIt>
enum uniformity check_uniformity ( InputIt first,
InputIt last )

Algorithm to determine list/container uniformity.

Definition at line 365 of file ListPolicy.H.

References EMPTY, NONUNIFORM, and UNIFORM.

Referenced by exprValueFieldTag::set().

Here is the caller graph for this function: