Skip to content
Snippets Groups Projects
Commit 79479c65 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

[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

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

or by implementing an abstract utility

```cpp
auto sumLocalAssembler = [](auto... localAssemblers) {
  return [=] (auto&&... args) {
    std::initializer_list<int> { (localAssemblers(args...), 0)...};
  };
};
auto h1Assembler = sumLocalAssembler(Dune::Fufem::MassAssembler(), Dune::Fufem::LaplaceAssembler());
```
parent 79ec00b6
Branches
No related tags found
1 merge request!151[cleanup] Don't zero-initialize matrix in local assemblers
Pipeline #59775 passed
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment