From: Wolfgang Bangerth Date: Fri, 5 Mar 2021 20:05:53 +0000 (+0100) Subject: Mark some classes as 'extern template'. X-Git-Tag: v9.3.0-rc1~362^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11861%2Fhead;p=dealii.git 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. --- 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