Skip to content

WIP: Explicit template instantiation of YaspGrid

Simon Praetorius requested to merge feature/explicit-template-instantiation into master

Summary

Explicit template instantiation of YaspGrid for some common template parameters.

Details

Using explicit template instantiation could reduce the overall compile time of targets significantly. YaspGrid is one of the heavy templates used in several tests and in a lot of real applications. Some initial benchmarks of the compile time for the dune-grid tests showed an improvement of 25% to up to 80%. If this instantiation technique is extended to other grid types it does not only show code errors in the templates, the overall compile time can be reduced further.

Discussion

The YaspGrid class has some problem with explicit template instantiation. This is because of the static_assertions in the constructor of the class. A workaround could be to conditionally compile the constructors only and throw an exception instead of a static assertion. An alternative would be to deactivate constructor that do not belong to the class template parameters (i.e. the coordinate types)

Changes

  • Separate declaration from definition of many YaspGrid member functions. Therefore, I have introduced the implementation file yaspgrid/yaspgrid.impl.hh
  • Remove static_assert from constructors of YaspGrid and replace with DUNE_THROW (*).
  • Add Explicit template instantiation of YaspGrid<1, C>, YaspGrid<2, C>, YaspGrid<3, C>, for ctype=double and C the various coordinate times
  • Add explicit template instantiation of BackupRestore<YaspGrid<[...]>>

(*) This change is subject of discussion, see above.

Edited by Simon Praetorius

Merge request reports

Loading