From: Wolfgang Bangerth Date: Mon, 19 Jun 2017 11:58:14 +0000 (-0600) Subject: Add a couple of static asserts to SolutionTransfer. X-Git-Tag: v9.0.0-rc1~1489^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1bf0e8269360153ce9072e9b85f1fdf705199c7;p=dealii.git Add a couple of static asserts to SolutionTransfer. This class (in both of its incarnations) takes both a dimension and a DoFHandler as template argument. The dimension of the DoFHandler better match the explicitly given dimension. The added static_assert checks that and prevents instantiation of the class if that is not the case. --- diff --git a/include/deal.II/distributed/solution_transfer.h b/include/deal.II/distributed/solution_transfer.h index 6717495d6e..2f14a8b4e0 100644 --- a/include/deal.II/distributed/solution_transfer.h +++ b/include/deal.II/distributed/solution_transfer.h @@ -112,9 +112,15 @@ namespace parallel * @ingroup distributed * @author Timo Heister, 2009-2011 */ - template > + template > class SolutionTransfer { + static_assert (dim == DoFHandlerType::dimension, + "The dimension explicitly provided as a template " + "argument, and the dimension of the DoFHandlerType " + "template argument must match."); public: /** * Constructor, takes the current DoFHandler as argument. diff --git a/include/deal.II/numerics/solution_transfer.h b/include/deal.II/numerics/solution_transfer.h index 3ed4f297ac..b033ca6203 100644 --- a/include/deal.II/numerics/solution_transfer.h +++ b/include/deal.II/numerics/solution_transfer.h @@ -288,10 +288,15 @@ DEAL_II_NAMESPACE_OPEN * @author Ralf Hartmann, 1999, Oliver Kayser-Herold and Wolfgang Bangerth, * 2006, Wolfgang Bangerth 2014 */ -template, - typename DoFHandlerType=DoFHandler > +template, + typename DoFHandlerType = DoFHandler > class SolutionTransfer { + static_assert (dim == DoFHandlerType::dimension, + "The dimension explicitly provided as a template " + "argument, and the dimension of the DoFHandlerType " + "template argument must match."); public: /**