Reference documentation for deal.II version GIT relicensing-837-gaf73e64026 2024-06-15 22:40:02+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
internal::AlignedVectorCopyConstruct< T > Class Template Reference
Inheritance diagram for internal::AlignedVectorCopyConstruct< T >:
Inheritance graph

Public Member Functions

 AlignedVectorCopyConstruct (const T *const source_begin, const T *const source_end, T *const destination)
virtual void apply_to_subrange (const std::size_t begin, const std::size_t end) const override

Private Member Functions

void apply_parallel (const std::size_t begin, const std::size_t end, const std::size_t minimum_parallel_grain_size) const

Private Attributes

const T *const source_
T *const destination_

Static Private Attributes

static const std::size_t minimum_parallel_grain_size

Detailed Description

template<typename T>
class internal::AlignedVectorCopyConstruct< T >

A class that given a range of memory locations calls the placement-new operator on these memory locations and copy-constructs objects of type T there.

This class is based on the specialized for loop base class ParallelForLoop in parallel.h whose purpose is the following: When calling a parallel for loop on AlignedVector with apply_to_subranges, it generates different code for every different argument we might choose (as it is templated). This gives a lot of code (e.g. it triples the memory required for compiling the file and the final object size is several times larger) which is completely useless. Therefore, this class channels all copy commands through one call to apply_to_subrange for all possible types, which makes the copy operation much cleaner (thanks to a virtual function, whose cost is negligible in this context).

Definition at line 747 of file aligned_vector.h.

Constructor & Destructor Documentation

◆ AlignedVectorCopyConstruct()

template<typename T >
internal::AlignedVectorCopyConstruct< T >::AlignedVectorCopyConstruct ( const T *const  source_begin,
const T *const  source_end,
T *const  destination 

Constructor. Issues a parallel call if there are sufficiently many elements, otherwise works in serial. Copies the data from the half-open interval between source_begin and source_end to array starting at destination (by calling the copy constructor with placement new).

The elements from the source array are simply copied via the placement new copy constructor.

Definition at line 763 of file aligned_vector.h.

Member Function Documentation

◆ apply_to_subrange()

template<typename T >
virtual void internal::AlignedVectorCopyConstruct< T >::apply_to_subrange ( const std::size_t  begin,
const std::size_t  end 
) const

This method moves elements from the source to the destination given in the constructor on a subrange given by two integers.

Implements parallel::ParallelForInteger.

Definition at line 784 of file aligned_vector.h.

◆ apply_parallel()

void parallel::ParallelForInteger::apply_parallel ( const std::size_t  begin,
const std::size_t  end,
const std::size_t  minimum_parallel_grain_size 
) const

This function runs the for loop over the given range [lower,upper), possibly in parallel when end-begin is larger than the minimum parallel grain size. This function is marked const because it any operation that changes the data of a derived class will inherently not be thread-safe when several threads work with the same data simultaneously.

Definition at line 742 of file parallel.h.

Member Data Documentation

◆ minimum_parallel_grain_size

template<typename T >
const std::size_t internal::AlignedVectorCopyConstruct< T >::minimum_parallel_grain_size
Initial value:
160000 / sizeof(T) + 1

Definition at line 750 of file aligned_vector.h.

◆ source_

template<typename T >
const T* const internal::AlignedVectorCopyConstruct< T >::source_

Definition at line 804 of file aligned_vector.h.

◆ destination_

template<typename T >
T* const internal::AlignedVectorCopyConstruct< T >::destination_

Definition at line 805 of file aligned_vector.h.

The documentation for this class was generated from the following file: