From: bangerth Date: Sun, 18 Aug 2013 03:23:21 +0000 (+0000) Subject: Mark a member as const. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=274e878cb92d2c0bbaca4c56a66ee3a135f8d7cf;p=dealii-svn.git Mark a member as const. git-svn-id: https://svn.dealii.org/trunk@30333 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/fe/fe_system.h b/deal.II/include/deal.II/fe/fe_system.h index 083a167da2..0705632bac 100644 --- a/deal.II/include/deal.II/fe/fe_system.h +++ b/deal.II/include/deal.II/fe/fe_system.h @@ -846,9 +846,11 @@ private: public: /** * Constructor. Is called by the @p get_data function. Sets the size of - * the @p base_fe_datas vector to @p n_base_elements. + * the @p base_fe_datas vector to @p n_base_elements and initializes + * the compute_hessians field. */ - InternalData (const unsigned int n_base_elements); + InternalData (const unsigned int n_base_elements, + const bool compute_hessians); /** * Destructor. Deletes all @p InternalDatas whose pointers are stored by @@ -859,7 +861,7 @@ private: /** * Flag indicating whether second derivatives shall be computed. */ - bool compute_hessians; + const bool compute_hessians; /** * Gives write-access to the pointer to a @p InternalData of the @p diff --git a/deal.II/source/fe/fe_system.cc b/deal.II/source/fe/fe_system.cc index 3df96eddb3..2b5e504a5e 100644 --- a/deal.II/source/fe/fe_system.cc +++ b/deal.II/source/fe/fe_system.cc @@ -46,7 +46,10 @@ namespace template -FESystem::InternalData::InternalData(const unsigned int n_base_elements): +FESystem::InternalData::InternalData(const unsigned int n_base_elements, + const bool compute_hessians) +: + compute_hessians (compute_hessians), base_fe_datas(n_base_elements), base_fe_values_datas(n_base_elements) {} @@ -839,7 +842,8 @@ FESystem::get_data (const UpdateFlags flags_, const Quadrature &quadrature) const { UpdateFlags flags = flags_; - InternalData *data = new InternalData(this->n_base_elements()); + InternalData *data = new InternalData(this->n_base_elements(), + flags & update_hessians); data->update_once = update_once (flags); data->update_each = update_each (flags); @@ -850,7 +854,6 @@ FESystem::get_data (const UpdateFlags flags_, // finite differencing are required, // then initialize some objects for // that - data->compute_hessians = flags & update_hessians; if (data->compute_hessians) { // delete @@ -926,14 +929,14 @@ FESystem::get_face_data ( const Quadrature &quadrature) const { UpdateFlags flags = flags_; - InternalData *data = new InternalData(this->n_base_elements()); + InternalData *data = new InternalData(this->n_base_elements(), + flags & update_hessians); data->update_once = update_once (flags); data->update_each = update_each (flags); flags = data->update_once | data->update_each; UpdateFlags sub_flags = flags; - data->compute_hessians = flags & update_hessians; if (data->compute_hessians) { sub_flags = UpdateFlags (sub_flags ^ update_hessians); @@ -978,14 +981,14 @@ FESystem::get_subface_data ( const Quadrature &quadrature) const { UpdateFlags flags = flags_; - InternalData *data = new InternalData(this->n_base_elements()); + InternalData *data = new InternalData(this->n_base_elements(), + flags & update_hessians); data->update_once = update_once (flags); data->update_each = update_each (flags); flags = data->update_once | data->update_each; UpdateFlags sub_flags = flags; - data->compute_hessians = flags & update_hessians; if (data->compute_hessians) { sub_flags = UpdateFlags (sub_flags ^ update_hessians);