Go to the documentation of this file.
2 #ifndef DUNE_PDELAB_BACKEND_ISTL_BCRSMATRIXBACKEND_HH
3 #define DUNE_PDELAB_BACKEND_ISTL_BCRSMATRIXBACKEND_HH
19 template<
typename M,
typename RowOrdering,
typename ColOrdering,
bool pattern>
20 struct _build_bcrs_pattern_type
28 template<
typename M,
typename RowOrdering,
typename ColOrdering>
29 struct _build_bcrs_pattern_type<M,RowOrdering,ColOrdering,true>
33 typedef typename _build_bcrs_pattern_type<
34 typename M::block_type,
38 typename M::block_type
40 >::type BlockOrdering;
43 typedef typename std::conditional<
60 template<
typename M,
typename GFSV,
typename GFSU,
typename Tag>
61 struct build_bcrs_pattern_type
65 typename GFSV::Ordering::Traits::DOFIndex,
66 typename GFSV::Ordering::Traits::ContainerIndex
70 typename GFSU::Ordering::Traits::DOFIndex,
71 typename GFSU::Ordering::Traits::ContainerIndex
78 template<
typename M,
typename GFSV,
typename GFSU>
79 struct build_bcrs_pattern_type<M,GFSV,GFSU,FlatContainerAllocationTag>
81 typedef BCRSPattern<typename GFSV::Ordering, typename GFSU::Ordering> type;
86 template<
typename OrderingV,
typename OrderingU,
typename Pattern,
typename Container,
typename StatsVector>
87 typename std::enable_if<
90 allocate_bcrs_matrix(
const OrderingV& ordering_v,
91 const OrderingU& ordering_u,
96 c.setSize(ordering_v.blockCount(),ordering_u.blockCount(),0);
97 c.setBuildMode(Container::random);
99 std::vector<typename Pattern::size_type> row_sizes(
p.sizes());
101 typename Pattern::size_type nnz = 0;
102 typename Pattern::size_type longest_row = 0;
104 for (
typename Pattern::size_type i = 0; i < c.N(); ++i)
107 longest_row = std::max(longest_row,row_sizes[i]);
108 c.setrowsize(i,row_sizes[i]);
112 stats.push_back(
typename StatsVector::value_type(nnz,longest_row,
p.overflowCount(),
p.entriesPerRow(),ordering_v.blockCount()));
114 for (
typename Pattern::size_type i = 0; i < c.N(); ++i)
115 c.setIndices(i,
p.begin(i),
p.end(i));
135 template<
typename OrderingV,
typename OrderingU,
typename Pattern,
typename Container,
typename StatsVector>
136 typename std::enable_if<
140 allocate_bcrs_matrix(
const OrderingV& ordering_v,
141 const OrderingU& ordering_u,
146 c.setSize(ordering_v.blockCount(),ordering_u.blockCount(),ordering_v.blockCount()*ordering_u.blockCount());
147 c.setBuildMode(Container::random);
149 for (std::size_t i = 0; i < c.N(); ++i)
150 c.setrowsize(i,ordering_u.blockCount());
153 for (std::size_t i = 0; i < c.N(); ++i)
154 for (std::size_t j = 0; j < c.M(); ++j)
158 for (std::size_t i = 0; i < c.N(); ++i)
159 for (std::size_t j = 0; j < c.M(); ++j)
161 allocate_bcrs_matrix(ordering_v.childOrdering(i),
162 ordering_u.childOrdering(j),
186 template<
typename EntriesPerRow = std::
size_t>
197 template<
typename Matrix,
typename GFSV,
typename GFSU>
198 using Pattern =
typename build_bcrs_pattern_type<
199 typename Matrix::Container,
202 typename GFSV::Ordering::ContainerAllocationTag
205 template<
typename VV,
typename VU,
typename E>
209 typename VV::GridFunctionSpace,
210 typename VU::GridFunctionSpace,
211 typename build_matrix_type<
213 typename VV::Container,
214 typename VU::Container
224 template<
typename Gr
idOperator,
typename Matrix>
233 std::vector<Statistics> stats;
250 : _entries_per_row(entries_per_row)
255 EntriesPerRow _entries_per_row;
263 #endif // DUNE_PDELAB_BACKEND_ISTL_BCRSMATRIXBACKEND_HH
GFSU TrialGridFunctionSpace
The trial grid function space.
Definition: gridoperatorutilities.hh:37
typename build_bcrs_pattern_type< typename Matrix::Container, GFSV, GFSU, typename GFSV::Ordering::ContainerAllocationTag >::type Pattern
The type of the pattern object passed to the GridOperator for pattern construction.
Definition: bcrsmatrixbackend.hh:203
void fill_pattern(Pattern &p) const
Fill pattern of jacobian matrix.
Definition: gridoperator.hh:164
Standard grid operator implementation.
Definition: gridoperator.hh:35
GFSV TestGridFunctionSpace
The test grid function space.
Definition: gridoperatorutilities.hh:40
std::enable_if< std::is_base_of< impl::WrapperBase, T >::value, Native< T > & >::type native(T &t)
Definition: backend/interface.hh:192
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
Definition: bcrsmatrixbackend.hh:206
typename impl::BackendMatrixSelector< Backend, VU, VV, E >::Type Matrix
alias of the return type of BackendMatrixSelector
Definition: backend/interface.hh:127
Backend using (possibly nested) ISTL BCRSMatrices.
Definition: bcrsmatrixbackend.hh:187
Statistics about the pattern of a BCRSMatrix.
Definition: patternstatistics.hh:13
std::size_t size_type
The size type of the BCRSMatrix.
Definition: bcrsmatrixbackend.hh:191
Definition: bcrsmatrix.hh:18
const GFSU & trialGridFunctionSpace() const
Get the trial grid function space.
Definition: gridoperator.hh:92
PatternStatistics< size_type > Statistics
The type of the object holding the statistics generated during pattern construction.
Definition: bcrsmatrixbackend.hh:194
static const unsigned int value
Definition: gridfunctionspace/tags.hh:139
BCRSMatrixBackend(const EntriesPerRow &entries_per_row)
Constructs a BCRSMatrixBackend.
Definition: bcrsmatrixbackend.hh:249
std::vector< Statistics > buildPattern(const GridOperator &grid_operator, Matrix &matrix) const
Builds the matrix pattern associated with grid_operator and initializes matrix with it.
Definition: bcrsmatrixbackend.hh:225
const GFSV & testGridFunctionSpace() const
Get the test grid function space.
Definition: gridoperator.hh:98
BCRSMatrix< typename VV::GridFunctionSpace, typename VU::GridFunctionSpace, typename build_matrix_type< E, typename VV::Container, typename VU::Container >::type, Statistics > type
Definition: bcrsmatrixbackend.hh:217
const P & p
Definition: constraints.hh:147