88 assign(
const BaseVec& x, BaseVec& y) {
89 ::std::ranges::copy(x, y.begin());
93 template <
class Scalar>
95 assign(
const Scalar& a,
const BaseVec& x, BaseVec& y) {
96 ::std::ranges::transform(x, y.begin(),
97 [&a](
auto z) { return a * z; });
139 enum { Residual = 0, Increment = 1, Solution = 2 };
143 setSize(::std::size_t ndof, ::std::size_t m) {
145 typedef typename ::std::array<BaseVec, 3>::iterator VAI;
147 for (VAI i = vcoll_.begin(), e = vcoll_.end(); i != e; ++i) {
148 VSzSetter<BaseVec>(*i).setSize(ndof, m);
151 for (::std::size_t i = 0; i <
sizeof (vcoll_) /
sizeof (vcoll_[0]); ++i) {
152 VSzSetter<BaseVec>(vcoll_[i]).setSize(ndof, m);
160 VAdd<BaseVec>::add(vcoll_[ Increment ], vcoll_[ Solution ]);
163 template <
class Block>
165 assembleBlock(::std::size_t ndof,
170 assert (ndof == ndof_);
172 VBlkAsm<BaseVec>::assemble(ndof, i, b, vcoll_[ Residual ]);
175 typedef BaseVec vector_type;
177 const vector_type& increment()
const {
return vcoll_[ Increment ]; }
178 const vector_type& residual ()
const {
return vcoll_[ Residual ]; }
179 const vector_type& solution ()
const {
return vcoll_[ Solution ]; }
182 vector_type& writableIncrement() {
return vcoll_[ Increment ]; }
183 vector_type& writableResidual () {
return vcoll_[ Residual ]; }
184 vector_type& writableSolution () {
return vcoll_[ Solution ]; }
187 ::std::size_t ndof_ ;
216 class JacobianSystem {
220 typedef Matrix matrix_type;
221 typedef MatrixBlockAssembler<Matrix> assembler_type;
222 typedef NVecCollection vector_collection_type;
223 typedef typename NVecCollection::vector_type vector_type;
225 assembler_type& matasm() {
return mba_ ; }
226 NVecCollection& vector() {
return sysvec_ ; }
227 const matrix_type& matrix()
const {
return mba_.matrix(); }
228 matrix_type& writableMatrix() {
return mba_.matrix(); }
231 setSize(::std::size_t ndof,
233 ::std::size_t nnz = 0) {
235 mba_ .setSize(ndof, m, m, nnz);
236 sysvec_.setSize(ndof, m );
240 JacobianSystem (
const JacobianSystem&);
241 JacobianSystem& operator=(
const JacobianSystem&);
243 MatrixBlockAssembler<Matrix> mba_ ;
244 NVecCollection sysvec_;