GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/linear/matrixconverter.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 74 74 100.0%
Functions: 710 802 88.5%
Branches: 249 361 69.0%

Line Branch Exec Source
1 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 //
4 // SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 /*!
8 * \file
9 * \ingroup Linear
10 * \brief A helper class that converts a Dune::MultiTypeBlockMatrix into a plain Dune::BCRSMatrix
11 */
12 #ifndef DUMUX_MATRIX_CONVERTER
13 #define DUMUX_MATRIX_CONVERTER
14
15 #include <cmath>
16 #include <utility>
17 #include <dune/common/indices.hh>
18 #include <dune/common/hybridutilities.hh>
19 #include <dune/istl/bvector.hh>
20 #include <dune/istl/bcrsmatrix.hh>
21 #include <dune/istl/matrixindexset.hh>
22
23 #include <dumux/common/parameters.hh>
24
25 namespace Dumux {
26
27 /*!
28 * \ingroup Linear
29 * \brief A helper class that converts a Dune::MultiTypeBlockMatrix into a plain Dune::BCRSMatrix
30 * TODO: allow block sizes for BCRSMatrix other than 1x1 ?
31 *
32 */
33 template <class MultiTypeBlockMatrix, class Scalar=double>
34 class MatrixConverter
35 {
36 using MatrixBlock = typename Dune::FieldMatrix<Scalar, 1, 1>;
37 using BCRSMatrix = typename Dune::BCRSMatrix<MatrixBlock>;
38
39 public:
40
41 /*!
42 * \brief Converts the matrix to a type the IterativeSolverBackend can handle
43 *
44 * \param A The original multitype blockmatrix
45 */
46 5845 static auto multiTypeToBCRSMatrix(const MultiTypeBlockMatrix &A)
47 {
48 // get the size for the converted matrix
49 11690 const auto numRows = getNumRows_(A);
50
51 // create an empty BCRS matrix with 1x1 blocks
52 5845 auto M = BCRSMatrix(numRows, numRows, BCRSMatrix::random);
53
54 // set the occupation pattern and copy the values
55
1/2
✓ Branch 1 taken 5845 times.
✗ Branch 2 not taken.
5845 setOccupationPattern_(M, A);
56
1/2
✓ Branch 1 taken 5124 times.
✗ Branch 2 not taken.
6566 copyValues_(M, A);
57
58 5845 return M;
59 }
60
61 private:
62
63 /*!
64 * \brief Sets the occupation pattern and indices for the converted matrix
65 *
66 * \param M The converted matrix
67 * \param A The original multitype blockmatrix
68 */
69 5845 static void setOccupationPattern_(BCRSMatrix& M, const MultiTypeBlockMatrix& A)
70 {
71 // prepare the occupation pattern
72 5845 const auto numRows = M.N();
73
1/2
✓ Branch 1 taken 5845 times.
✗ Branch 2 not taken.
11690 Dune::MatrixIndexSet occupationPattern;
74
1/2
✓ Branch 1 taken 5845 times.
✗ Branch 2 not taken.
5845 occupationPattern.resize(numRows, numRows);
75
76 // lambda function to fill the occupation pattern
77 54260 auto addIndices = [&](const auto& subMatrix, const std::size_t startRow, const std::size_t startCol)
78 {
79 using std::abs;
80
16/24
✓ Branch 0 taken 153 times.
✓ Branch 1 taken 10877 times.
✓ Branch 3 taken 153 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 153 times.
✗ Branch 7 not taken.
✓ Branch 10 taken 61 times.
✓ Branch 11 taken 5394 times.
✓ Branch 13 taken 61 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 61 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 61 times.
✓ Branch 21 taken 5394 times.
✓ Branch 23 taken 61 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 61 times.
✗ Branch 27 not taken.
✓ Branch 30 taken 61 times.
✓ Branch 31 taken 4984 times.
✓ Branch 33 taken 61 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 61 times.
✗ Branch 37 not taken.
26985 static const Scalar eps = getParam<Scalar>("MatrixConverter.DeletePatternEntriesBelowAbsThreshold", -1.0);
81
82 using BlockType = typename std::decay_t<decltype(subMatrix)>::block_type;
83 26985 const auto blockSizeI = BlockType::rows;
84 26985 const auto blockSizeJ = BlockType::cols;
85
16/24
✗ Branch 0 not taken.
✓ Branch 1 taken 17249364 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 17249364 times.
✓ Branch 4 taken 17238334 times.
✓ Branch 5 taken 11030 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2031827 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2031827 times.
✓ Branch 10 taken 2026372 times.
✓ Branch 11 taken 5455 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 4123778 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 4123778 times.
✓ Branch 16 taken 4118323 times.
✓ Branch 17 taken 5455 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 3914448 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 3914448 times.
✓ Branch 22 taken 3909403 times.
✓ Branch 23 taken 5045 times.
27346402 for(auto row = subMatrix.begin(); row != subMatrix.end(); ++row)
86
20/32
✗ Branch 0 not taken.
✓ Branch 1 taken 88841588 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 88841588 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 88841588 times.
✓ Branch 6 taken 71603254 times.
✓ Branch 7 taken 17238334 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 10559510 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 10559510 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 10559510 times.
✓ Branch 14 taken 8533138 times.
✓ Branch 15 taken 2026372 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 22196773 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 22196773 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 22196773 times.
✓ Branch 22 taken 18078450 times.
✓ Branch 23 taken 4118323 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 35333288 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 35333288 times.
✗ Branch 28 not taken.
✓ Branch 29 taken 35333288 times.
✓ Branch 30 taken 31423885 times.
✓ Branch 31 taken 3909403 times.
184223591 for(auto col = row->begin(); col != row->end(); ++col)
87
8/8
✓ Branch 0 taken 91240156 times.
✓ Branch 1 taken 71603254 times.
✓ Branch 2 taken 19514466 times.
✓ Branch 3 taken 8533138 times.
✓ Branch 4 taken 21171949 times.
✓ Branch 5 taken 18078450 times.
✓ Branch 6 taken 36369881 times.
✓ Branch 7 taken 31423885 times.
297935179 for(std::size_t i = 0; i < blockSizeI; ++i)
88
8/8
✓ Branch 0 taken 152337240 times.
✓ Branch 1 taken 91240156 times.
✓ Branch 2 taken 19597410 times.
✓ Branch 3 taken 22518109 times.
✓ Branch 4 taken 21531373 times.
✓ Branch 5 taken 51380937 times.
✓ Branch 6 taken 46902493 times.
✓ Branch 7 taken 36369881 times.
441877599 for(std::size_t j = 0; j < blockSizeJ; ++j)
89
34/39
✓ Branch 3 taken 91892916 times.
✓ Branch 4 taken 60444324 times.
✓ Branch 5 taken 91892916 times.
✓ Branch 6 taken 60444324 times.
✓ Branch 7 taken 91892916 times.
✓ Branch 8 taken 60444324 times.
✓ Branch 9 taken 91892916 times.
✓ Branch 10 taken 5664 times.
✓ Branch 12 taken 5919869 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 6087021 times.
✓ Branch 15 taken 16514032 times.
✓ Branch 16 taken 6087021 times.
✓ Branch 17 taken 16514032 times.
✓ Branch 18 taken 6087021 times.
✓ Branch 19 taken 16514032 times.
✓ Branch 20 taken 165888 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 45275520 times.
✓ Branch 24 taken 5925705 times.
✓ Branch 25 taken 45814656 times.
✓ Branch 26 taken 5925705 times.
✓ Branch 27 taken 45814656 times.
✓ Branch 28 taken 5925705 times.
✓ Branch 29 taken 45814656 times.
✓ Branch 30 taken 5836 times.
✓ Branch 31 taken 539136 times.
✓ Branch 32 taken 20028262 times.
✗ Branch 33 not taken.
✓ Branch 34 taken 20031160 times.
✓ Branch 35 taken 26795301 times.
✓ Branch 36 taken 20107192 times.
✓ Branch 37 taken 26795301 times.
✓ Branch 38 taken 20107192 times.
✓ Branch 39 taken 26795301 times.
✓ Branch 40 taken 76032 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 76032 times.
✗ Branch 43 not taken.
820743441 if(abs(subMatrix[row.index()][col.index()][i][j]) > eps)
90 547130970 occupationPattern.add(startRow + row.index()*blockSizeI + i, startCol + col.index()*blockSizeJ + j);
91 };
92
93 // fill the pattern
94 using namespace Dune::Hybrid;
95 5845 std::size_t rowIndex = 0;
96
1/2
✓ Branch 1 taken 5845 times.
✗ Branch 2 not taken.
129955 forEach(std::make_index_sequence<MultiTypeBlockMatrix::N()>(), [&A, &addIndices, &rowIndex, numRows](const auto i)
97 {
98 12411 std::size_t colIndex = 0;
99
0/17
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
319494 forEach(A[i], [&](const auto& subMatrix)
100 {
101 26985 addIndices(subMatrix, rowIndex, colIndex);
102
103 using SubBlockType = typename std::decay_t<decltype(subMatrix)>::block_type;
104
105 53970 colIndex += SubBlockType::cols * subMatrix.M();
106
107 // if we have arrived at the right side of the matrix, increase the row index
108
10/12
✓ Branch 0 taken 5845 times.
✓ Branch 1 taken 1679 times.
✓ Branch 2 taken 1037 times.
✓ Branch 3 taken 5998 times.
✓ Branch 4 taken 4882 times.
✓ Branch 5 taken 716 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4887 times.
✓ Branch 8 taken 647 times.
✓ Branch 9 taken 568 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 726 times.
26985 if(colIndex == numRows)
109 12411 rowIndex += SubBlockType::rows * subMatrix.N();
110 });
111 });
112
113
1/2
✓ Branch 1 taken 5845 times.
✗ Branch 2 not taken.
5845 occupationPattern.exportIdx(M);
114 5845 }
115
116 /*!
117 * \brief Sets the occupation pattern (i.e. indices) for the converted matrix
118 *
119 * \param M The converted matrix
120 * \param A The original subMatrix of the multitype blockmatrix
121 */
122 5124 static void copyValues_(BCRSMatrix& M, const MultiTypeBlockMatrix& A)
123 {
124 // get number of rows
125 5845 const auto numRows = M.N();
126
127 // lambda function to copy the values
128 54260 auto copyValues = [&](const auto& subMatrix, const std::size_t startRow, const std::size_t startCol)
129 {
130 using std::abs;
131
16/24
✓ Branch 0 taken 153 times.
✓ Branch 1 taken 10877 times.
✓ Branch 3 taken 153 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 153 times.
✗ Branch 7 not taken.
✓ Branch 10 taken 61 times.
✓ Branch 11 taken 5394 times.
✓ Branch 13 taken 61 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 61 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 61 times.
✓ Branch 21 taken 5394 times.
✓ Branch 23 taken 61 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 61 times.
✗ Branch 27 not taken.
✓ Branch 30 taken 61 times.
✓ Branch 31 taken 4984 times.
✓ Branch 33 taken 61 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 61 times.
✗ Branch 37 not taken.
26985 static const Scalar eps = getParam<Scalar>("MatrixConverter.DeletePatternEntriesBelowAbsThreshold", -1.0);
132
133 using BlockType = typename std::decay_t<decltype(subMatrix)>::block_type;
134 26985 const auto blockSizeI = BlockType::rows;
135 26985 const auto blockSizeJ = BlockType::cols;
136
16/24
✗ Branch 0 not taken.
✓ Branch 1 taken 17249364 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 17249364 times.
✓ Branch 4 taken 17238334 times.
✓ Branch 5 taken 11030 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2031827 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2031827 times.
✓ Branch 10 taken 2026372 times.
✓ Branch 11 taken 5455 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 4123778 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 4123778 times.
✓ Branch 16 taken 4118323 times.
✓ Branch 17 taken 5455 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 3914448 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 3914448 times.
✓ Branch 22 taken 3909403 times.
✓ Branch 23 taken 5045 times.
27346402 for (auto row = subMatrix.begin(); row != subMatrix.end(); ++row)
137
20/32
✗ Branch 0 not taken.
✓ Branch 1 taken 88841588 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 88841588 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 88841588 times.
✓ Branch 6 taken 71603254 times.
✓ Branch 7 taken 17238334 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 10559510 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 10559510 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 10559510 times.
✓ Branch 14 taken 8533138 times.
✓ Branch 15 taken 2026372 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 22196773 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 22196773 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 22196773 times.
✓ Branch 22 taken 18078450 times.
✓ Branch 23 taken 4118323 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 35333288 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 35333288 times.
✗ Branch 28 not taken.
✓ Branch 29 taken 35333288 times.
✓ Branch 30 taken 31423885 times.
✓ Branch 31 taken 3909403 times.
184223591 for (auto col = row->begin(); col != row->end(); ++col)
138
8/8
✓ Branch 0 taken 91240156 times.
✓ Branch 1 taken 71603254 times.
✓ Branch 2 taken 19514466 times.
✓ Branch 3 taken 8533138 times.
✓ Branch 4 taken 21171949 times.
✓ Branch 5 taken 18078450 times.
✓ Branch 6 taken 36369881 times.
✓ Branch 7 taken 31423885 times.
297935179 for (std::size_t i = 0; i < blockSizeI; ++i)
139
8/8
✓ Branch 0 taken 152337240 times.
✓ Branch 1 taken 91240156 times.
✓ Branch 2 taken 19597410 times.
✓ Branch 3 taken 22518109 times.
✓ Branch 4 taken 21531373 times.
✓ Branch 5 taken 51380937 times.
✓ Branch 6 taken 46902493 times.
✓ Branch 7 taken 36369881 times.
441877599 for (std::size_t j = 0; j < blockSizeJ; ++j)
140
34/39
✓ Branch 3 taken 91892916 times.
✓ Branch 4 taken 60444324 times.
✓ Branch 5 taken 91892916 times.
✓ Branch 6 taken 60444324 times.
✓ Branch 7 taken 91892916 times.
✓ Branch 8 taken 60444324 times.
✓ Branch 9 taken 91892916 times.
✓ Branch 10 taken 5664 times.
✓ Branch 12 taken 5919869 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 6087021 times.
✓ Branch 15 taken 16514032 times.
✓ Branch 16 taken 6087021 times.
✓ Branch 17 taken 16514032 times.
✓ Branch 18 taken 6087021 times.
✓ Branch 19 taken 16514032 times.
✓ Branch 20 taken 165888 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 45275520 times.
✓ Branch 24 taken 5925705 times.
✓ Branch 25 taken 45814656 times.
✓ Branch 26 taken 5925705 times.
✓ Branch 27 taken 45814656 times.
✓ Branch 28 taken 5925705 times.
✓ Branch 29 taken 45814656 times.
✓ Branch 30 taken 5836 times.
✓ Branch 31 taken 539136 times.
✓ Branch 32 taken 20028262 times.
✗ Branch 33 not taken.
✓ Branch 34 taken 20031160 times.
✓ Branch 35 taken 26795301 times.
✓ Branch 36 taken 20107192 times.
✓ Branch 37 taken 26795301 times.
✓ Branch 38 taken 20107192 times.
✓ Branch 39 taken 26795301 times.
✓ Branch 40 taken 76032 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 76032 times.
✗ Branch 43 not taken.
820743441 if(abs(subMatrix[row.index()][col.index()][i][j]) > eps)
141 820696455 M[startRow + row.index()*blockSizeI + i][startCol + col.index()*blockSizeJ + j] = subMatrix[row.index()][col.index()][i][j];
142
143 };
144
145 using namespace Dune::Hybrid;
146 5845 std::size_t rowIndex = 0;
147
1/2
✓ Branch 1 taken 5845 times.
✗ Branch 2 not taken.
129955 forEach(std::make_index_sequence<MultiTypeBlockMatrix::N()>(), [&A, &copyValues, &rowIndex, numRows](const auto i)
148 {
149 12411 std::size_t colIndex = 0;
150
0/17
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
319494 forEach(A[i], [&](const auto& subMatrix)
151 {
152 26985 copyValues(subMatrix, rowIndex, colIndex);
153
154 using SubBlockType = typename std::decay_t<decltype(subMatrix)>::block_type;
155
156 53970 colIndex += SubBlockType::cols * subMatrix.M();
157
158 // if we have arrived at the right side of the matrix, increase the row index
159
10/12
✓ Branch 0 taken 5845 times.
✓ Branch 1 taken 1679 times.
✓ Branch 2 taken 1037 times.
✓ Branch 3 taken 5998 times.
✓ Branch 4 taken 4882 times.
✓ Branch 5 taken 716 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4887 times.
✓ Branch 8 taken 647 times.
✓ Branch 9 taken 568 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 726 times.
26985 if(colIndex == numRows)
160 12411 rowIndex += SubBlockType::rows * subMatrix.N();
161 });
162 });
163 5124 }
164
165 /*!
166 * \brief Calculates the total number of rows (== number of cols) for the converted matrix, assuming a block size of 1x1
167 *
168 * \param A The original multitype blockmatrix
169 */
170 static std::size_t getNumRows_(const MultiTypeBlockMatrix& A)
171 {
172 // iterate over the first row of the multitype blockmatrix
173 std::size_t numRows = 0;
174 17535 Dune::Hybrid::forEach(Dune::Hybrid::elementAt(A, Dune::Indices::_0), [&numRows](const auto& subMatrixInFirstRow)
175 {
176 // the number of cols of the individual submatrice's block equals the respective number of equations.
177 12411 const auto numEq = std::decay_t<decltype(subMatrixInFirstRow)>::block_type::cols;
178 12411 numRows += numEq * subMatrixInFirstRow.M();
179 });
180
181 return numRows;
182 }
183
184 };
185
186 /*!
187 * \ingroup Linear
188 * \brief A helper class that converts a Dune::MultiTypeBlockVector into a plain Dune::BlockVector and transfers back values
189 */
190 template<class MultiTypeBlockVector, class Scalar=double>
191 class VectorConverter
192 {
193 using VectorBlock = typename Dune::FieldVector<Scalar, 1>;
194 using BlockVector = typename Dune::BlockVector<VectorBlock>;
195
196 public:
197
198 /*!
199 * \brief Converts a Dune::MultiTypeBlockVector to a plain 1x1 Dune::BlockVector
200 *
201 * \param b The original multitype blockvector
202 */
203 6127 static auto multiTypeToBlockVector(const MultiTypeBlockVector& b)
204 {
205 6127 BlockVector bTmp;
206
2/3
✓ Branch 1 taken 5404 times.
✓ Branch 2 taken 723 times.
✗ Branch 3 not taken.
11531 bTmp.resize(b.dim());
207
208 6127 std::size_t startIndex = 0;
209 19088133 Dune::Hybrid::forEach(b, [&](const auto& subVector)
210 {
211 12977 const auto numEq = std::decay_t<decltype(subVector)>::block_type::size();
212
213
4/4
✓ Branch 0 taken 8500728 times.
✓ Branch 1 taken 8072 times.
✓ Branch 2 taken 3836907 times.
✓ Branch 3 taken 4905 times.
12350612 for(std::size_t i = 0; i < subVector.size(); ++i)
214
4/4
✓ Branch 0 taken 12451175 times.
✓ Branch 1 taken 8500728 times.
✓ Branch 2 taken 4542369 times.
✓ Branch 3 taken 3836907 times.
29331179 for(std::size_t j = 0; j < numEq; ++j)
215 84967720 bTmp[startIndex + i*numEq + j] = subVector[i][j];
216
217 25954 startIndex += numEq*subVector.size();
218 });
219
220 6127 return bTmp;
221 }
222
223 /*!
224 * \brief Copies the entries of a Dune::BlockVector to a Dune::MultiTypeBlockVector
225 *
226 * \param x The multitype blockvector where the values are copied to
227 * \param y The regular blockvector where the values are copied from
228 */
229 5120 static void retrieveValues(MultiTypeBlockVector& x, const BlockVector& y)
230 {
231 5841 std::size_t startIndex = 0;
232 18992667 Dune::Hybrid::forEach(x, [&](auto& subVector)
233 {
234 12403 const auto numEq = std::decay_t<decltype(subVector)>::block_type::size();
235
236
4/4
✓ Branch 0 taken 8253825 times.
✓ Branch 1 taken 7520 times.
✓ Branch 2 taken 3809507 times.
✓ Branch 3 taken 4883 times.
12075735 for(std::size_t i = 0; i < subVector.size(); ++i)
237
4/4
✓ Branch 0 taken 11918715 times.
✓ Branch 1 taken 8253825 times.
✓ Branch 2 taken 4514969 times.
✓ Branch 3 taken 3809507 times.
28497016 for(std::size_t j = 0; j < numEq; ++j)
238 56382628 subVector[i][j] = y[startIndex + i*numEq + j];
239
240 24806 startIndex += numEq*subVector.size();
241 });
242 5120 }
243 };
244
245 } // end namespace Dumux
246
247 #endif
248