From 647c85373393128a2ae2cdd0139e53b8b37ed6cc Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 5 Mar 2021 21:05:53 +0100 Subject: [PATCH] Mark some classes as 'extern template'. This saves a small amount of space and, possibly, compile time. Here is a comparison of the cumulative size of all object files for the debug and release configurations without and with the patch: without patch: debug 2,414,548,192 release 459,866,272 with patch: debug 2,404,864,416 release 459,686,888 One can also compare the sizes of the .so files. I did this only for the release library: without patch: 459,866,272 with patch: 459,686,888 So it's a rather minor improvement. One could do this to a lot more classes than just the two in this patch, though, if we wanted to go that route. --- include/deal.II/dofs/dof_handler.h | 9 +++++++++ include/deal.II/grid/tria.h | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/include/deal.II/dofs/dof_handler.h b/include/deal.II/dofs/dof_handler.h index 21687df85e..b1494ef54b 100644 --- a/include/deal.II/dofs/dof_handler.h +++ b/include/deal.II/dofs/dof_handler.h @@ -2272,6 +2272,15 @@ DoFHandler::MGVertexDoFs::set_index( } + +extern template class DoFHandler<1, 1>; +extern template class DoFHandler<1, 2>; +extern template class DoFHandler<1, 3>; +extern template class DoFHandler<2, 2>; +extern template class DoFHandler<2, 3>; +extern template class DoFHandler<3, 3>; + + #endif // DOXYGEN DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index 29a352deea..56e8d7243a 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -4399,6 +4399,13 @@ bool Triangulation<1, 3>::prepare_coarsening_and_refinement(); +extern template class Triangulation<1, 1>; +extern template class Triangulation<1, 2>; +extern template class Triangulation<1, 3>; +extern template class Triangulation<2, 2>; +extern template class Triangulation<2, 3>; +extern template class Triangulation<3, 3>; + #endif // DOXYGEN DEAL_II_NAMESPACE_CLOSE -- 2.39.5