From f519cfaa2451e4248be759c08cdac60064d2b3ec Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Fri, 22 Mar 2019 09:35:20 +0100 Subject: [PATCH] Rename the helper classes in the Differentiation::AD namespace --- .../changes/major/20180827Jean-PaulPelteret | 2 +- .../changes/major/20180930Jean-PaulPelteret | 2 +- .../changes/major/20190220Jean-PaulPelteret | 2 +- .../changes/major/20190321Jean-PaulPelteret | 2 +- .../deal.II/differentiation/ad/ad_helpers.h | 198 ++++++------ source/differentiation/ad/ad_helpers.cc | 281 +++++++++--------- source/differentiation/ad/ad_helpers.inst1.in | 84 +++--- source/differentiation/ad/ad_helpers.inst2.in | 140 ++++----- .../step-44-helper_res_lin_01.h | 4 +- .../step-44-helper_var_form_01.h | 4 +- 10 files changed, 348 insertions(+), 371 deletions(-) diff --git a/doc/news/changes/major/20180827Jean-PaulPelteret b/doc/news/changes/major/20180827Jean-PaulPelteret index d0476e4b3b..6ff2bb4b71 100644 --- a/doc/news/changes/major/20180827Jean-PaulPelteret +++ b/doc/news/changes/major/20180827Jean-PaulPelteret @@ -1,4 +1,4 @@ -New: A new class Differentiation::AD::ADHelperEnergyFunctional has been +New: A new class Differentiation::AD::EnergyFunctional has been added to help implement (incremental) variational formulations using automatic differentiation. In particular, this class is designed to compute the finite element residuals and their linearizations. diff --git a/doc/news/changes/major/20180930Jean-PaulPelteret b/doc/news/changes/major/20180930Jean-PaulPelteret index 1c5bf9ae19..3fbe9844e1 100644 --- a/doc/news/changes/major/20180930Jean-PaulPelteret +++ b/doc/news/changes/major/20180930Jean-PaulPelteret @@ -1,4 +1,4 @@ -New: A new class Differentiation::AD::ADHelperResidualLinearization has been +New: A new class Differentiation::AD::ResidualLinearization has been added to help compute the linearization of a residual vector defined on the level of a cell (a finite element residual), or for local nonlinear equations.
diff --git a/doc/news/changes/major/20190220Jean-PaulPelteret b/doc/news/changes/major/20190220Jean-PaulPelteret index c9df4e7cb7..3a0e37fe0d 100644 --- a/doc/news/changes/major/20190220Jean-PaulPelteret +++ b/doc/news/changes/major/20190220Jean-PaulPelteret @@ -1,4 +1,4 @@ -New: A new class Differentiation::AD::ADHelperScalarFunction has been +New: A new class Differentiation::AD::ScalarFunction has been added to help implement point-wise scalar functions using automatic differentiation. In particular, this class is designed to compute the gradient and Hessian of a scalar function that is parameterized in diff --git a/doc/news/changes/major/20190321Jean-PaulPelteret b/doc/news/changes/major/20190321Jean-PaulPelteret index 54b796a6d6..80e70e9e66 100644 --- a/doc/news/changes/major/20190321Jean-PaulPelteret +++ b/doc/news/changes/major/20190321Jean-PaulPelteret @@ -1,4 +1,4 @@ -New: A new class Differentiation::AD::ADHelperVectorFunction has been +New: A new class Differentiation::AD::VectorFunction has been added to help implement point-wise vector functions using automatic differentiation. In particular, this class is designed to compute the Jacobian of a vector function that is parameterized in diff --git a/include/deal.II/differentiation/ad/ad_helpers.h b/include/deal.II/differentiation/ad/ad_helpers.h index 7619901a82..507803a0dc 100644 --- a/include/deal.II/differentiation/ad/ad_helpers.h +++ b/include/deal.II/differentiation/ad/ad_helpers.h @@ -169,7 +169,7 @@ namespace Differentiation */ template - class ADHelperBase + class HelperBase { public: /** @@ -205,13 +205,13 @@ namespace Differentiation * be the number of outputs $\mathbf{f}$, i.e., the dimension of the * image space. */ - ADHelperBase(const unsigned int n_independent_variables, - const unsigned int n_dependent_variables); + HelperBase(const unsigned int n_independent_variables, + const unsigned int n_dependent_variables); /** * Destructor */ - virtual ~ADHelperBase() = default; + virtual ~HelperBase() = default; //@} @@ -279,7 +279,7 @@ namespace Differentiation * Pre-specify the number of @p independent_variables to be used in * tapeless mode. * - * Although this function is called internally in the ADHelperBase + * Although this function is called internally in the HelperBase * constructor, there may be occasions when ADOL-C tapeless numbers * (adtl::adoubles) are created before an instance of this class * is created. This function therefore allows one to declare at the @@ -307,7 +307,7 @@ namespace Differentiation /** * Reset the state of the helper class. * - * When an instance of an ADHelperBase is stored as a class member object + * When an instance of an HelperBase is stored as a class member object * with the intention to reuse its instance, it may be necessary to reset * the state of the object before use. This is because, internally, there * is error checking performed to ensure that the correct @@ -788,7 +788,7 @@ namespace Differentiation //@} - }; // class ADHelperBase + }; // class HelperBase @@ -824,8 +824,8 @@ namespace Differentiation * @endcode * Note that the quotation marks are mandatory. * An alternative approach that allows for run-time decision making is to - * use the ADHelperBase::set_tape_buffer_sizes() function before starting - * taping (as done via the ADHelperBase::start_recording_operations() + * use the HelperBase::set_tape_buffer_sizes() function before starting + * taping (as done via the HelperBase::start_recording_operations() * function). * * @warning ADOL-C does not support the standard threading models used by @@ -837,8 +837,7 @@ namespace Differentiation */ template - class ADHelperCellLevelBase - : public ADHelperBase + class CellLevelBase : public HelperBase { public: /** @@ -846,14 +845,14 @@ namespace Differentiation * and results from, all computations. */ using scalar_type = - typename ADHelperBase::scalar_type; + typename HelperBase::scalar_type; /** * Type definition for the auto-differentiation number type that is used * in all computations. */ using ad_type = - typename ADHelperBase::ad_type; + typename HelperBase::ad_type; /** * @name Constructor / destructor @@ -874,13 +873,13 @@ namespace Differentiation * be the number of outputs $\mathbf{f}$, i.e., the dimension of the * image space. */ - ADHelperCellLevelBase(const unsigned int n_independent_variables, - const unsigned int n_dependent_variables); + CellLevelBase(const unsigned int n_independent_variables, + const unsigned int n_dependent_variables); /** * Destructor */ - virtual ~ADHelperCellLevelBase() = default; + virtual ~CellLevelBase() = default; //@} @@ -976,7 +975,7 @@ namespace Differentiation * correspond with the @p ScalarType prescribed as a template argument. * * @note If the @p keep_independent_values flag has been set when - * ADHelperBase::start_recording_operations() is called then the tape is + * HelperBase::start_recording_operations() is called then the tape is * immediately usable after creation, and the values of the independent * variables set by register_dof_values() are those at which the function * is to be evaluated. In this case, a separate call to this function is @@ -996,7 +995,7 @@ namespace Differentiation * typically obtained by calling cell->get_dof_indices(). * * @note If the @p keep_independent_values flag has been set when - * ADHelperBase::start_recording_operations() is called then the tape is + * HelperBase::start_recording_operations() is called then the tape is * immediately usable after creation, and the values of the independent * variables set by register_dof_values() are those at which the function * is to be evaluated. In this case, a separate call to this function is @@ -1054,7 +1053,7 @@ namespace Differentiation //@} - }; // class ADHelperCellLevelBase + }; // class CellLevelBase @@ -1091,7 +1090,7 @@ namespace Differentiation * // Create some aliases for the AD helper. * // In the example, the AD_typecode used for the template argument can * // be refer to either a taped or tapeless type. - * using ADHelper = AD::ADHelperEnergyFunctional<...>; + * using ADHelper = AD::EnergyFunctional<...>; * using ADNumberType = typename ADHelper::ad_type; * * // Create and initialize an instance of the helper class. @@ -1222,8 +1221,7 @@ namespace Differentiation */ template - class ADHelperEnergyFunctional - : public ADHelperCellLevelBase + class EnergyFunctional : public CellLevelBase { public: /** @@ -1231,14 +1229,14 @@ namespace Differentiation * and results from, all computations. */ using scalar_type = - typename ADHelperBase::scalar_type; + typename HelperBase::scalar_type; /** * Type definition for the auto-differentiation number type that is used * in all computations. */ using ad_type = - typename ADHelperBase::ad_type; + typename HelperBase::ad_type; /** * @name Constructor / destructor @@ -1260,12 +1258,12 @@ namespace Differentiation * is computed from the first and second derivatives of a scalar * function $\Psi(\mathbf{X})$. */ - ADHelperEnergyFunctional(const unsigned int n_independent_variables); + EnergyFunctional(const unsigned int n_independent_variables); /** * Destructor */ - virtual ~ADHelperEnergyFunctional() = default; + virtual ~EnergyFunctional() = default; //@} @@ -1298,7 +1296,7 @@ namespace Differentiation * @f] * * The values at the evaluation point $\mathbf{X}$ are obtained by calling - * ADHelperCellLevelBase::set_dof_values(). + * CellLevelBase::set_dof_values(). * * @return The value of the energy functional at the evaluation point * corresponding to a chosen set of local degree of freedom values. @@ -1318,7 +1316,7 @@ namespace Differentiation * @f] * * The values at the evaluation point $\mathbf{X}$ are obtained by calling - * ADHelperCellLevelBase::set_dof_values(). + * CellLevelBase::set_dof_values(). * * @param[out] residual A Vector object, for which the value for each * entry represents the residual value for the corresponding local @@ -1341,7 +1339,7 @@ namespace Differentiation * @f] * * The values at the evaluation point $\mathbf{X}$ are obtained by calling - * ADHelperCellLevelBase::set_dof_values(). + * CellLevelBase::set_dof_values(). * * @param[out] linearization A FullMatrix representing the linearization * of the residual vector. The output @p linearization matrix has @@ -1354,7 +1352,7 @@ namespace Differentiation //@} - }; // class ADHelperEnergyFunctional + }; // class EnergyFunctional @@ -1398,9 +1396,9 @@ namespace Differentiation * // In this example, we strictly assume that we're using tapeless * // AD types, and so the AD_typecode used in the template argument * // must refer to one of these types. See the example for the - * // ADHelperEnergyFunctional for details on how to extend + * // EnergyFunctional for details on how to extend * // support to taped AD numbers. - * using ADHelper = AD::ADHelperResidualLinearization<...>; + * using ADHelper = AD::ResidualLinearization<...>; * using ADNumberType = typename ADHelper::ad_type; * * // Create and initialize an instance of the helper class. @@ -1538,8 +1536,8 @@ namespace Differentiation */ template - class ADHelperResidualLinearization - : public ADHelperCellLevelBase + class ResidualLinearization + : public CellLevelBase { public: /** @@ -1547,14 +1545,14 @@ namespace Differentiation * and results from, all computations. */ using scalar_type = - typename ADHelperBase::scalar_type; + typename HelperBase::scalar_type; /** * Type definition for the auto-differentiation number type that is used * in all computations. */ using ad_type = - typename ADHelperBase::ad_type; + typename HelperBase::ad_type; /** * @name Constructor / destructor @@ -1575,13 +1573,13 @@ namespace Differentiation * be the number of outputs $\mathbf{r}$, i.e., the dimension of the * image space. */ - ADHelperResidualLinearization(const unsigned int n_independent_variables, - const unsigned int n_dependent_variables); + ResidualLinearization(const unsigned int n_independent_variables, + const unsigned int n_dependent_variables); /** * Destructor */ - virtual ~ADHelperResidualLinearization() = default; + virtual ~ResidualLinearization() = default; //@} @@ -1615,7 +1613,7 @@ namespace Differentiation * @f] * * The values at the evaluation point $\mathbf{X}$ are obtained by calling - * ADHelperCellLevelBase::set_dof_values(). + * CellLevelBase::set_dof_values(). * * @param[out] residual A Vector object, for which the value for each * entry represents the residual value for the corresponding local @@ -1635,7 +1633,7 @@ namespace Differentiation * @f] * * The values at the evaluation point $\mathbf{X}$ are obtained by calling - * ADHelperCellLevelBase::set_dof_values(). + * CellLevelBase::set_dof_values(). * * @param[out] linearization A FullMatrix representing the linearization * of the residual vector. The output @p linearization matrix has @@ -1648,7 +1646,7 @@ namespace Differentiation //@} - }; // class ADHelperResidualLinearization + }; // class ResidualLinearization @@ -2623,7 +2621,7 @@ namespace Differentiation /** * A base helper class that facilitates the evaluation of point-wise defined * functions. This is the point-wise counterpart of the - * ADHelperCellLevelBase class, and was conceived for computations at a + * CellLevelBase class, and was conceived for computations at a * continuum point, or quadrature point, rather than for finite-element * level calculations. That being said, the interface to this and the * derived classes are sufficiently generic that the dependent function(s) @@ -2646,8 +2644,8 @@ namespace Differentiation template - class ADHelperPointLevelFunctionsBase - : public ADHelperBase + class PointLevelFunctionsBase + : public HelperBase { public: /** @@ -2661,14 +2659,14 @@ namespace Differentiation * and results from, all computations. */ using scalar_type = - typename ADHelperBase::scalar_type; + typename HelperBase::scalar_type; /** * Type definition for the auto-differentiation number type that is used * in all computations. */ using ad_type = - typename ADHelperBase::ad_type; + typename HelperBase::ad_type; /** * @name Constructor / destructor @@ -2689,14 +2687,13 @@ namespace Differentiation * be the number of outputs $\mathbf{f}$, i.e., the dimension of the * image space. */ - ADHelperPointLevelFunctionsBase( - const unsigned int n_independent_variables, - const unsigned int n_dependent_variables); + PointLevelFunctionsBase(const unsigned int n_independent_variables, + const unsigned int n_dependent_variables); /** * Destructor */ - virtual ~ADHelperPointLevelFunctionsBase() = default; + virtual ~PointLevelFunctionsBase() = default; //@} @@ -2706,7 +2703,7 @@ namespace Differentiation //@{ /** - * @copydoc ADHelperBase::reset() + * @copydoc HelperBase::reset() */ virtual void reset(const unsigned int n_independent_variables = @@ -2837,7 +2834,7 @@ namespace Differentiation * correspond with the @p ScalarType prescribed as a template argument. * * @note If the @p keep_independent_values flag has been set when - * ADHelperBase::start_recording_operations() is called then the tape is + * HelperBase::start_recording_operations() is called then the tape is * immediately usable after creation, and the values of the independent * variables set by register_independent_variables() are those at which * the function is to be evaluated. In this case, a separate call to this @@ -2866,7 +2863,7 @@ namespace Differentiation * be an FEValuesExtractors::Vector or FEValuesExtractors::Tensor<1>. * * @note If the @p keep_independent_values flag has been set when - * ADHelperBase::start_recording_operations() is called then the tape is + * HelperBase::start_recording_operations() is called then the tape is * immediately usable after creation, and the values of the independent * variables set by register_independent_variable() are those at which the * function is to be evaluated. In this case, a separate call to this @@ -2931,7 +2928,7 @@ namespace Differentiation //@} - }; // class ADHelperPointLevelFunctionsBase + }; // class PointLevelFunctionsBase @@ -2964,7 +2961,7 @@ namespace Differentiation * // Define the helper that we will use in the AD computations for our * // scalar energy function. Note that we expect it to return values of * // type double. - * ADHelperScalarFunction ad_helper (n_independent_variables); + * ScalarFunction ad_helper (n_independent_variables); * using ADNumberType = typename ADHelper::ad_type; * * // Compute the fields that provide the independent values. @@ -3094,10 +3091,8 @@ namespace Differentiation template - class ADHelperScalarFunction - : public ADHelperPointLevelFunctionsBase + class ScalarFunction + : public PointLevelFunctionsBase { public: /** @@ -3105,14 +3100,14 @@ namespace Differentiation * and results from, all computations. */ using scalar_type = - typename ADHelperBase::scalar_type; + typename HelperBase::scalar_type; /** * Type definition for the auto-differentiation number type that is used * in all computations. */ using ad_type = - typename ADHelperBase::ad_type; + typename HelperBase::ad_type; /** * @name Constructor / destructor @@ -3128,12 +3123,12 @@ namespace Differentiation * $\mathbf{f}(\mathbf{X})$, this will be the number of inputs * $\mathbf{X}$, i.e., the dimension of the domain space. */ - ADHelperScalarFunction(const unsigned int n_independent_variables); + ScalarFunction(const unsigned int n_independent_variables); /** * Destructor. */ - virtual ~ADHelperScalarFunction() = default; + virtual ~ScalarFunction() = default; //@} @@ -3323,7 +3318,7 @@ namespace Differentiation //@} - }; // class ADHelperScalarFunction + }; // class ScalarFunction @@ -3366,7 +3361,7 @@ namespace Differentiation * // Define the helper that we will use in the AD computations for our * // scalar energy function. Note that we expect it to return values of * // type double. - * ADHelperVectorFunction ad_helper (n_independent_variables, + * VectorFunction ad_helper (n_independent_variables, * n_dependent_variables); * using ADNumberType = typename ADHelper::ad_type; * @@ -3489,10 +3484,8 @@ namespace Differentiation template - class ADHelperVectorFunction - : public ADHelperPointLevelFunctionsBase + class VectorFunction + : public PointLevelFunctionsBase { public: /** @@ -3500,14 +3493,14 @@ namespace Differentiation * and results from, all computations. */ using scalar_type = - typename ADHelperBase::scalar_type; + typename HelperBase::scalar_type; /** * Type definition for the auto-differentiation number type that is used * in all computations. */ using ad_type = - typename ADHelperBase::ad_type; + typename HelperBase::ad_type; /** * @name Constructor / destructor @@ -3528,13 +3521,13 @@ namespace Differentiation * be the number of outputs $\mathbf{f}$, i.e., the dimension of the * image space. */ - ADHelperVectorFunction(const unsigned int n_independent_variables, - const unsigned int n_dependent_variables); + VectorFunction(const unsigned int n_independent_variables, + const unsigned int n_dependent_variables); /** * Destructor. */ - virtual ~ADHelperVectorFunction() = default; + virtual ~VectorFunction() = default; //@} @@ -3726,7 +3719,7 @@ namespace Differentiation //@} - }; // class ADHelperVectorFunction + }; // class VectorFunction } // namespace AD @@ -3742,14 +3735,14 @@ namespace Differentiation { namespace AD { - /* ----------------- ADHelperCellLevelBase ----------------- */ + /* ----------------- CellLevelBase ----------------- */ template template void - ADHelperCellLevelBase::register_dof_values( + CellLevelBase::register_dof_values( const VectorType & values, const std::vector &local_dof_indices) { @@ -3774,7 +3767,7 @@ namespace Differentiation template template void - ADHelperCellLevelBase::set_dof_values( + CellLevelBase::set_dof_values( const VectorType & values, const std::vector &local_dof_indices) { @@ -3782,13 +3775,13 @@ namespace Differentiation ExcMessage( "Vector size does not match number of independent variables")); for (unsigned int i = 0; i < this->n_independent_variables(); ++i) - ADHelperBase::set_sensitivity_value( + HelperBase::set_sensitivity_value( i, values[local_dof_indices[i]]); } - /* ----------------- ADHelperPointLevelFunctionsBase ----------------- */ + /* ----------------- PointLevelFunctionsBase ----------------- */ @@ -3797,7 +3790,7 @@ namespace Differentiation typename ScalarType> template void - ADHelperPointLevelFunctionsBase:: + PointLevelFunctionsBase:: register_independent_variable(const ValueType & value, const ExtractorType &extractor) { @@ -3833,7 +3826,7 @@ namespace Differentiation typename ScalarType> template void - ADHelperPointLevelFunctionsBase:: + PointLevelFunctionsBase:: set_independent_variable(const ValueType & value, const ExtractorType &extractor) { @@ -3855,8 +3848,8 @@ namespace Differentiation typename ScalarType> template typename internal::Extractor::template tensor_type< - typename ADHelperBase::ad_type> - ADHelperPointLevelFunctionsBase:: + typename HelperBase::ad_type> + PointLevelFunctionsBase:: get_sensitive_variables(const ExtractorType &extractor) const { if (ADNumberTraits::is_taped == true) @@ -3895,7 +3888,7 @@ namespace Differentiation - /* ----------------- ADHelperScalarFunction ----------------- */ + /* ----------------- ScalarFunction ----------------- */ @@ -3905,10 +3898,9 @@ namespace Differentiation template typename internal::ScalarFieldGradient< dim, - typename ADHelperScalarFunction:: - scalar_type, + typename ScalarFunction::scalar_type, ExtractorType_Row>::type - ADHelperScalarFunction:: + ScalarFunction:: extract_gradient_component(const Vector &gradient, const ExtractorType_Row & extractor_row) { @@ -3937,11 +3929,10 @@ namespace Differentiation template typename internal::ScalarFieldHessian< dim, - typename ADHelperScalarFunction:: - scalar_type, + typename ScalarFunction::scalar_type, ExtractorType_Row, ExtractorType_Col>::type - ADHelperScalarFunction:: + ScalarFunction:: extract_hessian_component(const FullMatrix &hessian, const ExtractorType_Row & extractor_row, const ExtractorType_Col & extractor_col) @@ -3996,7 +3987,7 @@ namespace Differentiation - /* ----------------- ADHelperVectorFunction ----------------- */ + /* ----------------- VectorFunction ----------------- */ @@ -4005,7 +3996,7 @@ namespace Differentiation typename ScalarType> template void - ADHelperVectorFunction:: + VectorFunction:: register_dependent_variable(const ValueType & funcs, const ExtractorType &extractor) { @@ -4016,9 +4007,8 @@ namespace Differentiation Assert(this->registered_marked_dependent_variables[index_set[i]] == false, ExcMessage("Overlapping indices for dependent variables.")); - ADHelperBase:: - register_dependent_variable(index_set[i], - internal::get_tensor_entry(funcs, i)); + HelperBase::register_dependent_variable( + index_set[i], internal::get_tensor_entry(funcs, i)); } } @@ -4030,12 +4020,11 @@ namespace Differentiation template typename internal::VectorFieldValue< dim, - typename ADHelperVectorFunction:: - scalar_type, + typename VectorFunction::scalar_type, ExtractorType_Row>::type - ADHelperVectorFunction:: - extract_value_component(const Vector &values, - const ExtractorType_Row & extractor_row) + VectorFunction::extract_value_component( + const Vector &values, + const ExtractorType_Row & extractor_row) { // NOTE: The order of components must be consistently defined throughout // this class. @@ -4062,11 +4051,10 @@ namespace Differentiation template typename internal::VectorFieldJacobian< dim, - typename ADHelperVectorFunction:: - scalar_type, + typename VectorFunction::scalar_type, ExtractorType_Row, ExtractorType_Col>::type - ADHelperVectorFunction:: + VectorFunction:: extract_jacobian_component(const FullMatrix &jacobian, const ExtractorType_Row & extractor_row, const ExtractorType_Col & extractor_col) diff --git a/source/differentiation/ad/ad_helpers.cc b/source/differentiation/ad/ad_helpers.cc index 4d67b34ad7..fac44b98a5 100644 --- a/source/differentiation/ad/ad_helpers.cc +++ b/source/differentiation/ad/ad_helpers.cc @@ -30,12 +30,12 @@ namespace Differentiation { namespace AD { - /* -------------------------- ADHelperBase -------------------------- */ + /* -------------------------- HelperBase -------------------------- */ template - ADHelperBase::ADHelperBase( + HelperBase::HelperBase( const unsigned int n_independent_variables, const unsigned int n_dependent_variables) : independent_variable_values( @@ -65,8 +65,8 @@ namespace Differentiation template void - ADHelperBase::reset_registered_independent_variables() + HelperBase::reset_registered_independent_variables() { for (typename std::vector::iterator it = registered_independent_variable_values.begin(); @@ -79,7 +79,7 @@ namespace Differentiation template void - ADHelperBase:: + HelperBase:: reset_registered_dependent_variables(const bool flag) { for (typename std::vector::iterator it = @@ -93,7 +93,7 @@ namespace Differentiation template void - ADHelperBase::set_sensitivity_value( + HelperBase::set_sensitivity_value( const unsigned int index, const scalar_type &value) { @@ -130,7 +130,7 @@ namespace Differentiation template void - ADHelperBase::mark_independent_variable( + HelperBase::mark_independent_variable( const unsigned int index, ad_type & out) const { @@ -168,8 +168,8 @@ namespace Differentiation template void - ADHelperBase::finalize_sensitive_independent_variables() const + HelperBase::finalize_sensitive_independent_variables() const { // Double check that we've actually registered all DoFs Assert(n_registered_independent_variables() == n_independent_variables(), @@ -192,7 +192,7 @@ namespace Differentiation template void - ADHelperBase:: + HelperBase:: initialize_non_sensitive_independent_variable(const unsigned int index, ad_type &out) const { @@ -217,8 +217,8 @@ namespace Differentiation template unsigned int - ADHelperBase::n_registered_independent_variables() const + HelperBase::n_registered_independent_variables() const { return std::count(registered_independent_variable_values.begin(), registered_independent_variable_values.end(), @@ -229,7 +229,7 @@ namespace Differentiation template std::size_t - ADHelperBase::n_independent_variables() const + HelperBase::n_independent_variables() const { return independent_variable_values.size(); } @@ -238,8 +238,8 @@ namespace Differentiation template unsigned int - ADHelperBase::n_registered_dependent_variables() const + HelperBase::n_registered_dependent_variables() + const { return std::count(registered_marked_dependent_variables.begin(), registered_marked_dependent_variables.end(), @@ -250,7 +250,7 @@ namespace Differentiation template std::size_t - ADHelperBase::n_dependent_variables() const + HelperBase::n_dependent_variables() const { return dependent_variables.size(); } @@ -259,7 +259,7 @@ namespace Differentiation template bool - ADHelperBase::is_recording() const + HelperBase::is_recording() const { if (AD::is_taped_ad_number::value) return taped_driver.is_recording(); @@ -271,8 +271,8 @@ namespace Differentiation template typename Types< - typename ADHelperBase::ad_type>::tape_index - ADHelperBase::active_tape_index() const + typename HelperBase::ad_type>::tape_index + HelperBase::active_tape_index() const { if (AD::is_taped_ad_number::value) return taped_driver.active_tape_index(); @@ -284,7 +284,7 @@ namespace Differentiation template bool - ADHelperBase::is_registered_tape( + HelperBase::is_registered_tape( const typename Types::tape_index tape_index) const { if (AD::is_taped_ad_number::value) @@ -297,8 +297,7 @@ namespace Differentiation template void - ADHelperBase::print( - std::ostream &stream) const + HelperBase::print(std::ostream &stream) const { // Store stream flags const std::ios_base::fmtflags stream_flags(stream.flags()); @@ -353,7 +352,7 @@ namespace Differentiation template void - ADHelperBase::print_values( + HelperBase::print_values( std::ostream &stream) const { for (unsigned int i = 0; i < n_independent_variables(); i++) @@ -367,7 +366,7 @@ namespace Differentiation template void - ADHelperBase::print_tape_stats( + HelperBase::print_tape_stats( const typename Types::tape_index tape_index, std::ostream & stream) const { @@ -384,7 +383,7 @@ namespace Differentiation template void - ADHelperBase::reset( + HelperBase::reset( const unsigned int n_independent_variables, const unsigned int n_dependent_variables, const bool clear_registered_tapes) @@ -442,7 +441,7 @@ namespace Differentiation template void - ADHelperBase::configure_tapeless_mode( + HelperBase::configure_tapeless_mode( const unsigned int n_independent_variables, const bool ensure_persistent_setting) { @@ -467,7 +466,7 @@ namespace Differentiation template void - ADHelperBase::activate_recorded_tape( + HelperBase::activate_recorded_tape( const typename Types::tape_index tape_index) { activate_tape(tape_index, true /*read_mode*/); @@ -477,7 +476,7 @@ namespace Differentiation template bool - ADHelperBase::recorded_tape_requires_retaping( + HelperBase::recorded_tape_requires_retaping( const typename Types::tape_index tape_index) const { if (ADNumberTraits::is_tapeless == true) @@ -490,7 +489,7 @@ namespace Differentiation template bool - ADHelperBase::active_tape_requires_retaping() + HelperBase::active_tape_requires_retaping() const { if (ADNumberTraits::is_tapeless == true) @@ -503,7 +502,7 @@ namespace Differentiation template void - ADHelperBase::clear_active_tape() + HelperBase::clear_active_tape() { if (ADNumberTraits::is_tapeless == true) return; @@ -515,7 +514,7 @@ namespace Differentiation template void - ADHelperBase::activate_tape( + HelperBase::activate_tape( const typename Types::tape_index tape_index, const bool read_mode) { @@ -552,7 +551,7 @@ namespace Differentiation template void - ADHelperBase::set_tape_buffer_sizes( + HelperBase::set_tape_buffer_sizes( const typename Types::tape_buffer_sizes obufsize, const typename Types::tape_buffer_sizes lbufsize, const typename Types::tape_buffer_sizes vbufsize, @@ -571,7 +570,7 @@ namespace Differentiation template bool - ADHelperBase::start_recording_operations( + HelperBase::start_recording_operations( const typename Types::tape_index tape_index, const bool overwrite_tape, const bool keep_independent_values) @@ -636,7 +635,7 @@ namespace Differentiation template void - ADHelperBase::stop_recording_operations( + HelperBase::stop_recording_operations( const bool write_tapes_to_file) { Assert(is_recording() == true, ExcMessage("Not currently recording...")); @@ -672,7 +671,7 @@ namespace Differentiation template void - ADHelperBase::register_dependent_variable( + HelperBase::register_dependent_variable( const unsigned int index, const ad_type & func) { @@ -698,23 +697,23 @@ namespace Differentiation - /* -------------------- ADHelperCellLevelBase -------------------- */ + /* -------------------- CellLevelBase -------------------- */ template - ADHelperCellLevelBase::ADHelperCellLevelBase( + CellLevelBase::CellLevelBase( const unsigned int n_independent_variables, const unsigned int n_dependent_variables) - : ADHelperBase(n_independent_variables, - n_dependent_variables) + : HelperBase(n_independent_variables, + n_dependent_variables) {} template void - ADHelperCellLevelBase::register_dof_values( + CellLevelBase::register_dof_values( const std::vector &dof_values) { // This is actually the same thing the set_independent_variable function, @@ -736,9 +735,9 @@ namespace Differentiation template const std::vector< - typename ADHelperCellLevelBase::ad_type> & - ADHelperCellLevelBase::get_sensitive_dof_values() const + typename CellLevelBase::ad_type> & + CellLevelBase::get_sensitive_dof_values() + const { if (ADNumberTraits::is_taped == true) { @@ -762,7 +761,7 @@ namespace Differentiation template void - ADHelperCellLevelBase::set_dof_values( + CellLevelBase::set_dof_values( const std::vector &values) { if (ADNumberTraits::is_taped == true) @@ -775,42 +774,39 @@ namespace Differentiation ExcMessage( "Vector size does not match number of independent variables")); for (unsigned int i = 0; i < this->n_independent_variables(); ++i) - ADHelperBase::set_sensitivity_value( + HelperBase::set_sensitivity_value( i, values[i]); } - /* ------------------ ADHelperEnergyFunctional ------------------ */ + /* ------------------ EnergyFunctional ------------------ */ template - ADHelperEnergyFunctional:: - ADHelperEnergyFunctional(const unsigned int n_independent_variables) - : ADHelperCellLevelBase( - n_independent_variables, - 1) + EnergyFunctional::EnergyFunctional( + const unsigned int n_independent_variables) + : CellLevelBase(n_independent_variables, 1) {} template void - ADHelperEnergyFunctional:: - register_energy_functional(const ad_type &energy) + EnergyFunctional::register_energy_functional( + const ad_type &energy) { Assert(this->n_dependent_variables() == 1, ExcInternalError()); - ADHelperBase::register_dependent_variable( + HelperBase::register_dependent_variable( 0, energy); } template - typename ADHelperEnergyFunctional::scalar_type - ADHelperEnergyFunctional::compute_energy() - const + typename EnergyFunctional::scalar_type + EnergyFunctional::compute_energy() const { if ((ADNumberTraits::is_taped == true && this->taped_driver.keep_independent_values() == false) || @@ -829,7 +825,7 @@ namespace Differentiation Assert( this->n_dependent_variables() == 1, ExcMessage( - "The ADHelperEnergyFunctional class expects there to be only one dependent variable.")); + "The EnergyFunctional class expects there to be only one dependent variable.")); if (ADNumberTraits::is_taped == true) { @@ -864,7 +860,7 @@ namespace Differentiation template void - ADHelperEnergyFunctional::compute_residual( + EnergyFunctional::compute_residual( Vector &gradient) const { if ((ADNumberTraits::is_taped == true && @@ -884,7 +880,7 @@ namespace Differentiation Assert( this->n_dependent_variables() == 1, ExcMessage( - "The ADHelperEnergyFunctional class expects there to be only one dependent variable.")); + "The EnergyFunctional class expects there to be only one dependent variable.")); // We can neglect correctly initializing the entries as // we'll be overwriting them immediately in the succeeding call to @@ -929,8 +925,8 @@ namespace Differentiation template void - ADHelperEnergyFunctional:: - compute_linearization(FullMatrix &hessian) const + EnergyFunctional::compute_linearization( + FullMatrix &hessian) const { Assert(AD::ADNumberTraits::n_supported_derivative_levels >= 2, ExcMessage( @@ -953,7 +949,7 @@ namespace Differentiation Assert( this->n_dependent_variables() == 1, ExcMessage( - "The ADHelperEnergyFunctional class expects there to be only one dependent variable.")); + "The EnergyFunctional class expects there to be only one dependent variable.")); // We can neglect correctly initializing the entries as // we'll be overwriting them immediately in the succeeding call to @@ -997,31 +993,30 @@ namespace Differentiation } - /* ------------------- ADHelperResidualLinearization ------------------- */ + /* ------------------- ResidualLinearization ------------------- */ template - ADHelperResidualLinearization:: - ADHelperResidualLinearization(const unsigned int n_independent_variables, - const unsigned int n_dependent_variables) - : ADHelperCellLevelBase( - n_independent_variables, - n_dependent_variables) + ResidualLinearization::ResidualLinearization( + const unsigned int n_independent_variables, + const unsigned int n_dependent_variables) + : CellLevelBase(n_independent_variables, + n_dependent_variables) {} template void - ADHelperResidualLinearization:: + ResidualLinearization:: register_residual_vector(const std::vector &residual) { Assert(residual.size() == this->n_dependent_variables(), ExcMessage( "Vector size does not match number of dependent variables")); for (unsigned int i = 0; i < this->n_dependent_variables(); ++i) - ADHelperBase::register_dependent_variable( + HelperBase::register_dependent_variable( i, residual[i]); } @@ -1029,8 +1024,8 @@ namespace Differentiation template void - ADHelperResidualLinearization:: - compute_residual(Vector &values) const + ResidualLinearization::compute_residual( + Vector &values) const { if ((ADNumberTraits::is_taped == true && this->taped_driver.keep_independent_values() == false) || @@ -1083,8 +1078,8 @@ namespace Differentiation template void - ADHelperResidualLinearization:: - compute_linearization(FullMatrix &jacobian) const + ResidualLinearization::compute_linearization( + FullMatrix &jacobian) const { if ((ADNumberTraits::is_taped == true && this->taped_driver.keep_independent_values() == false) || @@ -1144,19 +1139,18 @@ namespace Differentiation - /* ----------------- ADHelperPointLevelFunctionsBase ----------------- */ + /* ----------------- PointLevelFunctionsBase ----------------- */ template - ADHelperPointLevelFunctionsBase:: - ADHelperPointLevelFunctionsBase( - const unsigned int n_independent_variables, - const unsigned int n_dependent_variables) - : ADHelperBase(n_independent_variables, - n_dependent_variables) + PointLevelFunctionsBase:: + PointLevelFunctionsBase(const unsigned int n_independent_variables, + const unsigned int n_dependent_variables) + : HelperBase(n_independent_variables, + n_dependent_variables) , symmetric_independent_variables(n_independent_variables, false) {} @@ -1166,14 +1160,14 @@ namespace Differentiation enum AD::NumberTypes ADNumberTypeCode, typename ScalarType> void - ADHelperPointLevelFunctionsBase::reset( + PointLevelFunctionsBase::reset( const unsigned int n_independent_variables, const unsigned int n_dependent_variables, const bool clear_registered_tapes) { - ADHelperBase::reset(n_independent_variables, - n_dependent_variables, - clear_registered_tapes); + HelperBase::reset(n_independent_variables, + n_dependent_variables, + clear_registered_tapes); const unsigned int new_n_independent_variables = (n_independent_variables != dealii::numbers::invalid_unsigned_int ? @@ -1189,7 +1183,7 @@ namespace Differentiation enum AD::NumberTypes ADNumberTypeCode, typename ScalarType> bool - ADHelperPointLevelFunctionsBase:: + PointLevelFunctionsBase:: is_symmetric_independent_variable(const unsigned int index) const { Assert(index < symmetric_independent_variables.size(), @@ -1203,7 +1197,7 @@ namespace Differentiation enum AD::NumberTypes ADNumberTypeCode, typename ScalarType> unsigned int - ADHelperPointLevelFunctionsBase:: + PointLevelFunctionsBase:: n_symmetric_independent_variables() const { return std::count(symmetric_independent_variables.begin(), @@ -1217,7 +1211,7 @@ namespace Differentiation enum AD::NumberTypes ADNumberTypeCode, typename ScalarType> void - ADHelperPointLevelFunctionsBase:: + PointLevelFunctionsBase:: register_independent_variables(const std::vector &values) { // This is actually the same thing the set_independent_variable function, @@ -1240,11 +1234,10 @@ namespace Differentiation template - const std::vector< - typename ADHelperPointLevelFunctionsBase::ad_type> & - ADHelperPointLevelFunctionsBase:: + const std::vector::ad_type> & + PointLevelFunctionsBase:: get_sensitive_variables() const { if (ADNumberTraits::is_taped == true) @@ -1272,13 +1265,13 @@ namespace Differentiation enum AD::NumberTypes ADNumberTypeCode, typename ScalarType> void - ADHelperPointLevelFunctionsBase:: + PointLevelFunctionsBase:: set_sensitivity_value(const unsigned int index, const bool symmetric_component, const scalar_type &value) { - ADHelperBase::set_sensitivity_value(index, - value); + HelperBase::set_sensitivity_value(index, + value); Assert( index < this->n_independent_variables(), ExcMessage( @@ -1294,7 +1287,7 @@ namespace Differentiation enum AD::NumberTypes ADNumberTypeCode, typename ScalarType> void - ADHelperPointLevelFunctionsBase:: + PointLevelFunctionsBase:: set_independent_variables(const std::vector &values) { if (ADNumberTraits::is_taped == true) @@ -1307,22 +1300,22 @@ namespace Differentiation ExcMessage( "Vector size does not match number of independent variables")); for (unsigned int i = 0; i < this->n_independent_variables(); ++i) - ADHelperBase::set_sensitivity_value( + HelperBase::set_sensitivity_value( i, values[i]); } - /* -------------------- ADHelperScalarFunction -------------------- */ + /* -------------------- ScalarFunction -------------------- */ template - ADHelperScalarFunction:: - ADHelperScalarFunction(const unsigned int n_independent_variables) - : ADHelperPointLevelFunctionsBase( + ScalarFunction::ScalarFunction( + const unsigned int n_independent_variables) + : PointLevelFunctionsBase( n_independent_variables, 1) {} @@ -1333,11 +1326,11 @@ namespace Differentiation enum AD::NumberTypes ADNumberTypeCode, typename ScalarType> void - ADHelperScalarFunction:: + ScalarFunction:: register_dependent_variable(const ad_type &func) { Assert(this->n_dependent_variables() == 1, ExcInternalError()); - ADHelperBase::register_dependent_variable( + HelperBase::register_dependent_variable( 0, func); } @@ -1346,10 +1339,8 @@ namespace Differentiation template - typename ADHelperScalarFunction:: - scalar_type - ADHelperScalarFunction::compute_value() - const + typename ScalarFunction::scalar_type + ScalarFunction::compute_value() const { if ((ADNumberTraits::is_taped == true && this->taped_driver.keep_independent_values() == false) || @@ -1368,7 +1359,7 @@ namespace Differentiation Assert( this->n_dependent_variables() == 1, ExcMessage( - "The ADHelperScalarFunction class expects there to be only one dependent variable.")); + "The ScalarFunction class expects there to be only one dependent variable.")); if (ADNumberTraits::is_taped == true) { @@ -1399,7 +1390,7 @@ namespace Differentiation enum AD::NumberTypes ADNumberTypeCode, typename ScalarType> void - ADHelperScalarFunction::compute_gradient( + ScalarFunction::compute_gradient( Vector &gradient) const { if ((ADNumberTraits::is_taped == true && @@ -1419,7 +1410,7 @@ namespace Differentiation Assert( this->n_dependent_variables() == 1, ExcMessage( - "The ADHelperScalarFunction class expects there to be only one dependent variable.")); + "The ScalarFunction class expects there to be only one dependent variable.")); // We can neglect correctly initializing the entries as // we'll be overwriting them immediately in the succeeding call to @@ -1473,7 +1464,7 @@ namespace Differentiation enum AD::NumberTypes ADNumberTypeCode, typename ScalarType> void - ADHelperScalarFunction::compute_hessian( + ScalarFunction::compute_hessian( FullMatrix &hessian) const { Assert(AD::ADNumberTraits::n_supported_derivative_levels >= 2, @@ -1497,7 +1488,7 @@ namespace Differentiation Assert( this->n_dependent_variables() == 1, ExcMessage( - "The ADHelperScalarFunction class expects there to be only one dependent variable.")); + "The ScalarFunction class expects there to be only one dependent variable.")); // We can neglect correctly initializing the entries as // we'll be overwriting them immediately in the succeeding call to @@ -1567,11 +1558,11 @@ namespace Differentiation template - Tensor<0, - dim, - typename ADHelperScalarFunction:: - scalar_type> - ADHelperScalarFunction:: + Tensor< + 0, + dim, + typename ScalarFunction::scalar_type> + ScalarFunction:: extract_hessian_component(const FullMatrix & hessian, const FEValuesExtractors::Scalar &extractor_row, const FEValuesExtractors::Scalar &extractor_col) @@ -1604,12 +1595,11 @@ namespace Differentiation template - SymmetricTensor<4, - dim, - typename ADHelperScalarFunction::scalar_type> - ADHelperScalarFunction:: + SymmetricTensor< + 4, + dim, + typename ScalarFunction::scalar_type> + ScalarFunction:: extract_hessian_component( const FullMatrix & hessian, const FEValuesExtractors::SymmetricTensor<2> &extractor_row, @@ -1641,17 +1631,17 @@ namespace Differentiation - /* -------------------- ADHelperVectorFunction -------------------- */ + /* -------------------- VectorFunction -------------------- */ template - ADHelperVectorFunction:: - ADHelperVectorFunction(const unsigned int n_independent_variables, - const unsigned int n_dependent_variables) - : ADHelperPointLevelFunctionsBase( + VectorFunction::VectorFunction( + const unsigned int n_independent_variables, + const unsigned int n_dependent_variables) + : PointLevelFunctionsBase( n_independent_variables, n_dependent_variables) {} @@ -1662,14 +1652,14 @@ namespace Differentiation enum AD::NumberTypes ADNumberTypeCode, typename ScalarType> void - ADHelperVectorFunction:: + VectorFunction:: register_dependent_variables(const std::vector &funcs) { Assert(funcs.size() == this->n_dependent_variables(), ExcMessage( "Vector size does not match number of dependent variables")); for (unsigned int i = 0; i < this->n_dependent_variables(); ++i) - ADHelperBase::register_dependent_variable( + HelperBase::register_dependent_variable( i, funcs[i]); } @@ -1679,7 +1669,7 @@ namespace Differentiation enum AD::NumberTypes ADNumberTypeCode, typename ScalarType> void - ADHelperVectorFunction::compute_values( + VectorFunction::compute_values( Vector &values) const { if ((ADNumberTraits::is_taped == true && @@ -1735,7 +1725,7 @@ namespace Differentiation enum AD::NumberTypes ADNumberTypeCode, typename ScalarType> void - ADHelperVectorFunction::compute_jacobian( + VectorFunction::compute_jacobian( FullMatrix &jacobian) const { if ((ADNumberTraits::is_taped == true && @@ -1809,11 +1799,11 @@ namespace Differentiation template - Tensor<0, - dim, - typename ADHelperVectorFunction:: - scalar_type> - ADHelperVectorFunction:: + Tensor< + 0, + dim, + typename VectorFunction::scalar_type> + VectorFunction:: extract_jacobian_component( const FullMatrix & jacobian, const FEValuesExtractors::Scalar &extractor_row, @@ -1847,12 +1837,11 @@ namespace Differentiation template - SymmetricTensor<4, - dim, - typename ADHelperVectorFunction::scalar_type> - ADHelperVectorFunction:: + SymmetricTensor< + 4, + dim, + typename VectorFunction::scalar_type> + VectorFunction:: extract_jacobian_component( const FullMatrix & jacobian, const FEValuesExtractors::SymmetricTensor<2> &extractor_row, diff --git a/source/differentiation/ad/ad_helpers.inst1.in b/source/differentiation/ad/ad_helpers.inst1.in index 1c1ff5a534..87a4356550 100644 --- a/source/differentiation/ad/ad_helpers.inst1.in +++ b/source/differentiation/ad/ad_helpers.inst1.in @@ -21,37 +21,37 @@ for (number : REAL_SCALARS) \{ namespace AD \{ - // -------------------------- ADHelperBase ---------------------- + // -------------------------- HelperBase ---------------------- template - class ADHelperBase; + class HelperBase; template - class ADHelperBase; + class HelperBase; - // -------------------------- ADHelperCellLevelBase ---------------------- + // -------------------------- CellLevelBase ---------------------- template - class ADHelperCellLevelBase; + class CellLevelBase; template - class ADHelperCellLevelBase; + class CellLevelBase; - // -------------------------- ADHelperEnergyFunctional ---------------------- + // -------------------------- EnergyFunctional ---------------------- template - class ADHelperEnergyFunctional; + class EnergyFunctional; template - class ADHelperEnergyFunctional; + class EnergyFunctional; - // -------------------------- ADHelperResidualLinearization ---------------------- + // -------------------------- ResidualLinearization ---------------------- template - class ADHelperResidualLinearization; + class ResidualLinearization; template - class ADHelperResidualLinearization; + class ResidualLinearization; \} \} @@ -65,37 +65,37 @@ for () namespace AD \{ - // -------------------------- ADHelperBase ---------------------- + // -------------------------- HelperBase ---------------------- template - class ADHelperBase::ad_type>; + class HelperBase::ad_type>; template - class ADHelperBase::ad_type>; + class HelperBase::ad_type>; - // -------------------------- ADHelperCellLevelBase ---------------------- + // -------------------------- CellLevelBase ---------------------- template - class ADHelperCellLevelBase::ad_type>; + class CellLevelBase::ad_type>; template - class ADHelperCellLevelBase::ad_type>; + class CellLevelBase::ad_type>; - // -------------------------- ADHelperEnergyFunctional ---------------------- + // -------------------------- EnergyFunctional ---------------------- template - class ADHelperEnergyFunctional::ad_type>; + class EnergyFunctional::ad_type>; template - class ADHelperEnergyFunctional::ad_type>; + class EnergyFunctional::ad_type>; - // -------------------------- ADHelperResidualLinearization ---------------------- + // -------------------------- ResidualLinearization ---------------------- template - class ADHelperResidualLinearization::ad_type>; + class ResidualLinearization::ad_type>; template - class ADHelperResidualLinearization::ad_type>; + class ResidualLinearization::ad_type>; \} @@ -109,29 +109,29 @@ for (deal_II_dimension : DIMENSIONS ; number : REAL_SCALARS) \{ namespace AD \{ - // -------------------------- ADHelperPointLevelFunctionsBase ---------------------- + // -------------------------- PointLevelFunctionsBase ---------------------- template - class ADHelperPointLevelFunctionsBase; + class PointLevelFunctionsBase; template - class ADHelperPointLevelFunctionsBase; + class PointLevelFunctionsBase; - // -------------------------- ADHelperScalarFunction ---------------------- + // -------------------------- ScalarFunction ---------------------- template - class ADHelperScalarFunction; + class ScalarFunction; template - class ADHelperScalarFunction; + class ScalarFunction; - // -------------------------- ADHelperVectorFunction ---------------------- + // -------------------------- VectorFunction ---------------------- template - class ADHelperVectorFunction; + class VectorFunction; template - class ADHelperVectorFunction; + class VectorFunction; \} \} @@ -145,29 +145,29 @@ for (deal_II_dimension : DIMENSIONS) namespace AD \{ - // -------------------------- ADHelperPointLevelFunctionsBase ---------------------- + // -------------------------- PointLevelFunctionsBase ---------------------- template - class ADHelperPointLevelFunctionsBase::ad_type>; + class PointLevelFunctionsBase::ad_type>; template - class ADHelperPointLevelFunctionsBase::ad_type>; + class PointLevelFunctionsBase::ad_type>; - // -------------------------- ADHelperScalarFunction ---------------------- + // -------------------------- ScalarFunction ---------------------- template - class ADHelperScalarFunction::ad_type>; + class ScalarFunction::ad_type>; template - class ADHelperScalarFunction::ad_type>; + class ScalarFunction::ad_type>; - // -------------------------- ADHelperVectorFunction ---------------------- + // -------------------------- VectorFunction ---------------------- template - class ADHelperVectorFunction::ad_type>; + class VectorFunction::ad_type>; template - class ADHelperVectorFunction::ad_type>; + class VectorFunction::ad_type>; \} \} diff --git a/source/differentiation/ad/ad_helpers.inst2.in b/source/differentiation/ad/ad_helpers.inst2.in index 800b697f99..a39f35029f 100644 --- a/source/differentiation/ad/ad_helpers.inst2.in +++ b/source/differentiation/ad/ad_helpers.inst2.in @@ -21,61 +21,61 @@ for (number : REAL_SCALARS) \{ namespace AD \{ - // -------------------------- ADHelperBase ---------------------- + // -------------------------- HelperBase ---------------------- template - class ADHelperBase; + class HelperBase; template - class ADHelperBase; + class HelperBase; template - class ADHelperBase; + class HelperBase; template - class ADHelperBase; + class HelperBase; - // -------------------------- ADHelperCellLevelBase ---------------------- + // -------------------------- CellLevelBase ---------------------- template - class ADHelperCellLevelBase; + class CellLevelBase; template - class ADHelperCellLevelBase; + class CellLevelBase; template - class ADHelperCellLevelBase; + class CellLevelBase; template - class ADHelperCellLevelBase; + class CellLevelBase; - // -------------------------- ADHelperEnergyFunctional ---------------------- + // -------------------------- EnergyFunctional ---------------------- template - class ADHelperEnergyFunctional; + class EnergyFunctional; template - class ADHelperEnergyFunctional; + class EnergyFunctional; template - class ADHelperEnergyFunctional; + class EnergyFunctional; template - class ADHelperEnergyFunctional; + class EnergyFunctional; - // -------------------------- ADHelperResidualLinearization ---------------------- + // -------------------------- ResidualLinearization ---------------------- template - class ADHelperResidualLinearization; + class ResidualLinearization; template - class ADHelperResidualLinearization; + class ResidualLinearization; template - class ADHelperResidualLinearization; + class ResidualLinearization; template - class ADHelperResidualLinearization; + class ResidualLinearization; \} \} @@ -89,61 +89,61 @@ for () namespace AD \{ - // -------------------------- ADHelperBase ---------------------- + // -------------------------- HelperBase ---------------------- template - class ADHelperBase::ad_type>; + class HelperBase::ad_type>; template - class ADHelperBase::ad_type>; + class HelperBase::ad_type>; template - class ADHelperBase::ad_type>; + class HelperBase::ad_type>; template - class ADHelperBase::ad_type>; + class HelperBase::ad_type>; - // -------------------------- ADHelperCellLevelBase ---------------------- + // -------------------------- CellLevelBase ---------------------- template - class ADHelperCellLevelBase::ad_type>; + class CellLevelBase::ad_type>; template - class ADHelperCellLevelBase::ad_type>; + class CellLevelBase::ad_type>; template - class ADHelperCellLevelBase::ad_type>; + class CellLevelBase::ad_type>; template - class ADHelperCellLevelBase::ad_type>; + class CellLevelBase::ad_type>; - // -------------------------- ADHelperEnergyFunctional ---------------------- + // -------------------------- EnergyFunctional ---------------------- template - class ADHelperEnergyFunctional::ad_type>; + class EnergyFunctional::ad_type>; template - class ADHelperEnergyFunctional::ad_type>; + class EnergyFunctional::ad_type>; template - class ADHelperEnergyFunctional::ad_type>; + class EnergyFunctional::ad_type>; template - class ADHelperEnergyFunctional::ad_type>; + class EnergyFunctional::ad_type>; - // -------------------------- ADHelperResidualLinearization ---------------------- + // -------------------------- ResidualLinearization ---------------------- template - class ADHelperResidualLinearization::ad_type>; + class ResidualLinearization::ad_type>; template - class ADHelperResidualLinearization::ad_type>; + class ResidualLinearization::ad_type>; template - class ADHelperResidualLinearization::ad_type>; + class ResidualLinearization::ad_type>; template - class ADHelperResidualLinearization::ad_type>; + class ResidualLinearization::ad_type>; \} @@ -158,47 +158,47 @@ for (deal_II_dimension : DIMENSIONS ; number : REAL_SCALARS) namespace AD \{ - // -------------------------- ADHelperPointLevelFunctionsBase ---------------------- + // -------------------------- PointLevelFunctionsBase ---------------------- template - class ADHelperPointLevelFunctionsBase; + class PointLevelFunctionsBase; template - class ADHelperPointLevelFunctionsBase; + class PointLevelFunctionsBase; template - class ADHelperPointLevelFunctionsBase; + class PointLevelFunctionsBase; template - class ADHelperPointLevelFunctionsBase; + class PointLevelFunctionsBase; - // -------------------------- ADHelperScalarFunction ---------------------- + // -------------------------- ScalarFunction ---------------------- template - class ADHelperScalarFunction; + class ScalarFunction; template - class ADHelperScalarFunction; + class ScalarFunction; template - class ADHelperScalarFunction; + class ScalarFunction; template - class ADHelperScalarFunction; + class ScalarFunction; - // -------------------------- ADHelperVectorFunction ---------------------- + // -------------------------- VectorFunction ---------------------- template - class ADHelperVectorFunction; + class VectorFunction; template - class ADHelperVectorFunction; + class VectorFunction; template - class ADHelperVectorFunction; + class VectorFunction; template - class ADHelperVectorFunction; + class VectorFunction; \} \} @@ -212,47 +212,47 @@ for (deal_II_dimension : DIMENSIONS) namespace AD \{ - // -------------------------- ADHelperPointLevelFunctionsBase ---------------------- + // -------------------------- PointLevelFunctionsBase ---------------------- template - class ADHelperPointLevelFunctionsBase::ad_type>; + class PointLevelFunctionsBase::ad_type>; template - class ADHelperPointLevelFunctionsBase::ad_type>; + class PointLevelFunctionsBase::ad_type>; template - class ADHelperPointLevelFunctionsBase::ad_type>; + class PointLevelFunctionsBase::ad_type>; template - class ADHelperPointLevelFunctionsBase::ad_type>; + class PointLevelFunctionsBase::ad_type>; - // -------------------------- ADHelperScalarFunction ---------------------- + // -------------------------- ScalarFunction ---------------------- template - class ADHelperScalarFunction::ad_type>; + class ScalarFunction::ad_type>; template - class ADHelperScalarFunction::ad_type>; + class ScalarFunction::ad_type>; template - class ADHelperScalarFunction::ad_type>; + class ScalarFunction::ad_type>; template - class ADHelperScalarFunction::ad_type>; + class ScalarFunction::ad_type>; - // -------------------------- ADHelperVectorFunction ---------------------- + // -------------------------- VectorFunction ---------------------- template - class ADHelperVectorFunction::ad_type>; + class VectorFunction::ad_type>; template - class ADHelperVectorFunction::ad_type>; + class VectorFunction::ad_type>; template - class ADHelperVectorFunction::ad_type>; + class VectorFunction::ad_type>; template - class ADHelperVectorFunction::ad_type>; + class VectorFunction::ad_type>; \} \} diff --git a/tests/ad_common_tests/step-44-helper_res_lin_01.h b/tests/ad_common_tests/step-44-helper_res_lin_01.h index 75913c796e..b0059c1c7c 100644 --- a/tests/ad_common_tests/step-44-helper_res_lin_01.h +++ b/tests/ad_common_tests/step-44-helper_res_lin_01.h @@ -1202,8 +1202,8 @@ namespace Step44 Assert(n_dependent_variables == n_independent_variables, ExcMessage("Expect square system.")); - typedef AD::ADHelperResidualLinearization ADHelper; - typedef typename ADHelper::ad_type ADNumberType; + typedef AD::ResidualLinearization ADHelper; + typedef typename ADHelper::ad_type ADNumberType; ADHelper ad_helper(n_independent_variables, n_dependent_variables); ad_helper.set_tape_buffer_sizes(); // Increase the buffer size from the // default values diff --git a/tests/ad_common_tests/step-44-helper_var_form_01.h b/tests/ad_common_tests/step-44-helper_var_form_01.h index f8b7f1b030..8e2da6205b 100644 --- a/tests/ad_common_tests/step-44-helper_var_form_01.h +++ b/tests/ad_common_tests/step-44-helper_var_form_01.h @@ -1165,8 +1165,8 @@ namespace Step44 const unsigned int n_independent_variables = data.local_dof_indices.size(); - typedef AD::ADHelperEnergyFunctional ADHelper; - typedef typename ADHelper::ad_type ADNumberType; + typedef AD::EnergyFunctional ADHelper; + typedef typename ADHelper::ad_type ADNumberType; ADHelper ad_helper(n_independent_variables); ad_helper.set_tape_buffer_sizes(); // Increase the buffer size from the // default values -- 2.39.5