86template <
typename SCALAR,
typename SELECTOR,
typename RHSVECTOR>
90 LF_ASSERT_MSG(A.
rows() == N,
"Matrix must be square!");
91 LF_ASSERT_MSG(N == b.size(),
92 "Mismatch N = " << N <<
" <-> b.size() = " << b.size());
97 Eigen::Matrix<SCALAR, Eigen::Dynamic, 1> tmp_vec(N);
99 const auto selval{selectvals(k)};
101 tmp_vec[k] = selval.second;
103 tmp_vec[k] = SCALAR();
110 const auto selval{selectvals(k)};
112 b[k] = selval.second;
118 return (selectvals(i).first || selectvals(j).first);
133 const auto selval{selectvals(dofnum)};
183template <
typename SCALAR,
typename SELECTOR,
typename RHSVECTOR>
187 LF_ASSERT_MSG(A.
rows() == N,
"Matrix must be square!");
188 LF_ASSERT_MSG(N == b.size(),
189 "Mismatch N = " << N <<
" <-> b.size() = " << b.size());
193 const auto selval{selectvals(k)};
195 b[k] = selval.second;
201 return (selectvals(i).first);
215 if (selectvals(dofnum).first) {
224template <
typename SCALAR>
226 std::vector<std::pair<lf::assemble::gdof_idx_t, SCALAR>>;
250template <
typename SCALAR,
typename RHSVECTOR>
255 LF_ASSERT_MSG(A.
rows() == N,
"Matrix must be square!");
256 LF_ASSERT_MSG(N == b.size(),
257 "Mismatch N = " << N <<
" <-> b.size() = " << b.size());
261 Eigen::Matrix<SCALAR, Eigen::Dynamic, 1> fixed_vec(b.size());
263 std::vector<bool> fixed_comp_flags(N,
false);
266 LF_ASSERT_MSG(idx_val_pair.first < N,
267 "Index " << idx_val_pair.first <<
" >= N = " << N);
268 fixed_vec[idx_val_pair.first] += idx_val_pair.second;
269 fixed_comp_flags[idx_val_pair.first] =
true;
272 FixFlaggedSolutionCompAlt<SCALAR>(
275 LF_ASSERT_MSG((i < fixed_comp_flags.size()) && (i < fixed_vec.size()),
276 "Illegal index " << i);
277 return std::make_pair(fixed_comp_flags[i], fixed_vec[i]);
A temporary data structure for matrix in COO format.
void setZero()
Erase all entries of the matrix.
Index cols() const
return number of column
Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > MatVecMult(SCALAR alpha, const VECTOR &vec) const
Computes the product of a (scaled) vector with the matrix in COO format.
Index rows() const
return number of rows
void AddToEntry(gdof_idx_t i, gdof_idx_t j, SCALAR increment)
Add a value to the specified entry.
D.o.f. index mapping and assembly facilities.
lf::base::size_type size_type
void FixSolutionComponentsLse(const fixed_components_t< SCALAR > &fixed_components, COOMatrix< SCALAR > &A, RHSVECTOR &b)
manipulate a square linear system of equations with a coefficient matrix in COO format so that some s...
void FixFlaggedSolutionComponents(SELECTOR &&selectvals, COOMatrix< SCALAR > &A, RHSVECTOR &b)
enforce prescribed solution components
void FixFlaggedSolutionCompAlt(SELECTOR &&selectvals, COOMatrix< SCALAR > &A, RHSVECTOR &b)
Setting unknowns of a sparse linear system of equations to fixed values.
std::vector< std::pair< lf::assemble::gdof_idx_t, SCALAR > > fixed_components_t
Information about fixed solution components.