Skip to content

[cleanup] Don't zero-initialize matrix in local assemblers

Zero-initilization already happens in the global assembler. Hence you don't need to and in fact should not do this in the local one, too. This has the advantage, that you can chain local assembler. E.g. you can get a local assembler for the H^1 norm using

auto massAssembler = Dune::Fufem::MassAssembler();
auto laplaceAssembler = Dune::Fufem::LaplaceAssembler();
auto h1Assembler = [=](auto&&... args) {
  massAssembler(args...);
  laplaceAssembler(args...);
};

or by implementing an abstract utility

auto sumLocalAssembler = [](auto... localAssemblers) {
  return [=] (auto&&... args) {
    std::initializer_list<int> { (localAssemblers(args...), 0)...};
  };
};
auto h1Assembler = sumLocalAssembler(Dune::Fufem::MassAssembler(), Dune::Fufem::LaplaceAssembler());

Merge request reports

Loading