OGS
ProcessLib::Assembly::ConcurrentMatrixView< Dim > Class Template Reference

Detailed Description

template<std::size_t Dim>
class ProcessLib::Assembly::ConcurrentMatrixView< Dim >

Definition at line 67 of file MatrixElementCache.h.

#include <MatrixElementCache.h>

Public Member Functions

 ConcurrentMatrixView (GlobalMatOrVec &mat_or_vec)
 
void add (std::vector< MatrixElementCacheEntry< Dim > > const &entries)
 

Private Types

using GlobalMatOrVec
 

Private Attributes

GlobalMatOrVecmat_or_vec_
 

Member Typedef Documentation

◆ GlobalMatOrVec

template<std::size_t Dim>
using ProcessLib::Assembly::ConcurrentMatrixView< Dim >::GlobalMatOrVec
private
Initial value:
std::conditional_t<Dim == 1, GlobalVector, GlobalMatrix>

Definition at line 70 of file MatrixElementCache.h.

Constructor & Destructor Documentation

◆ ConcurrentMatrixView()

template<std::size_t Dim>
ProcessLib::Assembly::ConcurrentMatrixView< Dim >::ConcurrentMatrixView ( GlobalMatOrVec & mat_or_vec)
inlineexplicit

Definition at line 74 of file MatrixElementCache.h.

75 : mat_or_vec_{mat_or_vec}
76 {
77 }

Member Function Documentation

◆ add()

template<std::size_t Dim>
void ProcessLib::Assembly::ConcurrentMatrixView< Dim >::add ( std::vector< MatrixElementCacheEntry< Dim > > const & entries)
inline

Definition at line 79 of file MatrixElementCache.h.

80 {
81#pragma omp critical
82 {
83 if constexpr (Dim == 2)
84 {
85 auto const n_cols = mat_or_vec_.getNumberOfColumns();
86
87 // TODO would be more efficient if our global matrix and vector
88 // implementations supported batch addition of matrix elements
89 // with arbitrary indices (not restricted to (n x m) shaped
90 // submatrices).
91 for (auto const [rc, value] : entries)
92 {
93 auto const [r, c] = rc;
94
95 auto const c_no_ghost =
97
98 mat_or_vec_.add(r, c_no_ghost, value);
99 }
100 }
101 else
102 {
103 // TODO batch addition would be more efficient. That needs the
104 // refactoring of the matrix element cache.
105 for (auto const [r, value] : entries)
106 {
107 mat_or_vec_.add(r.front(), value);
108 }
109 }
110 }
111 }
GlobalIndexType transformToNonGhostIndex(GlobalIndexType const i, GlobalIndexType const n)

References ProcessLib::Assembly::ConcurrentMatrixView< Dim >::mat_or_vec_, and ProcessLib::Assembly::detail::transformToNonGhostIndex().

Referenced by ProcessLib::Assembly::MatrixElementCache< Dim >::addToGlobal().

Member Data Documentation

◆ mat_or_vec_

template<std::size_t Dim>
GlobalMatOrVec& ProcessLib::Assembly::ConcurrentMatrixView< Dim >::mat_or_vec_
private

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