From 5e022e29d5ae7379c72b09e7207b38214b3a2fd2 Mon Sep 17 00:00:00 2001 From: wolf Date: Fri, 13 Jul 2001 08:08:27 +0000 Subject: [PATCH] Fix some TODOs. Add memory_consumption functions in several places. git-svn-id: https://svn.dealii.org/trunk@4841 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/fe/fe_values.h | 8 ++++++ deal.II/deal.II/include/fe/mapping.h | 8 ++++++ .../deal.II/include/fe/mapping_cartesian.h | 8 ++++++ deal.II/deal.II/include/fe/mapping_q.h | 9 +++++++ deal.II/deal.II/include/fe/mapping_q1.h | 8 ++++++ deal.II/deal.II/source/fe/fe_values.cc | 27 ++++++++++++++++--- deal.II/deal.II/source/fe/mapping.cc | 9 +++++++ .../deal.II/source/fe/mapping_cartesian.cc | 14 ++++++++++ deal.II/deal.II/source/fe/mapping_q.cc | 14 ++++++++++ deal.II/deal.II/source/fe/mapping_q1.cc | 20 ++++++++++++++ 10 files changed, 121 insertions(+), 4 deletions(-) diff --git a/deal.II/deal.II/include/fe/fe_values.h b/deal.II/deal.II/include/fe/fe_values.h index 32e9b974a6..713505d481 100644 --- a/deal.II/deal.II/include/fe/fe_values.h +++ b/deal.II/deal.II/include/fe/fe_values.h @@ -802,6 +802,13 @@ class FEFaceValuesBase : public FEValuesBase */ const Quadrature & get_quadrature () const; + /** + * Determine an estimate for the + * memory consumption (in bytes) + * of this object. + */ + unsigned int memory_consumption () const; + protected: /** * Store a copy of the quadrature @@ -820,6 +827,7 @@ class FEFaceValuesBase : public FEValuesBase }; + /** * Finite element evaluated in quadrature points on a face. * diff --git a/deal.II/deal.II/include/fe/mapping.h b/deal.II/deal.II/include/fe/mapping.h index 46eb825b24..9c2793ab8d 100644 --- a/deal.II/deal.II/include/fe/mapping.h +++ b/deal.II/deal.II/include/fe/mapping.h @@ -142,6 +142,14 @@ class Mapping : public Subscriptor * cell-independent fields. */ bool first_cell; + + /** + * Return an estimate (in + * bytes) or the memory + * consumption of this + * object. + */ + virtual unsigned int memory_consumption () const; }; /** diff --git a/deal.II/deal.II/include/fe/mapping_cartesian.h b/deal.II/deal.II/include/fe/mapping_cartesian.h index a724685948..43534ca29f 100644 --- a/deal.II/deal.II/include/fe/mapping_cartesian.h +++ b/deal.II/deal.II/include/fe/mapping_cartesian.h @@ -213,6 +213,14 @@ class MappingCartesian : public Mapping */ InternalData (const Quadrature &quadrature); + /** + * Return an estimate (in + * bytes) or the memory + * consumption of this + * object. + */ + virtual unsigned int memory_consumption () const; + /** * Length of the cell in * different coordinate diff --git a/deal.II/deal.II/include/fe/mapping_q.h b/deal.II/deal.II/include/fe/mapping_q.h index 5f3f5ce849..4433a4d04d 100644 --- a/deal.II/deal.II/include/fe/mapping_q.h +++ b/deal.II/deal.II/include/fe/mapping_q.h @@ -168,6 +168,15 @@ class MappingQ : public MappingQ1 */ InternalData (const unsigned int n_shape_functions); + + /** + * Return an estimate (in + * bytes) or the memory + * consumption of this + * object. + */ + virtual unsigned int memory_consumption () const; + /** * Unit normal vectors. Used * for the alternative diff --git a/deal.II/deal.II/include/fe/mapping_q1.h b/deal.II/deal.II/include/fe/mapping_q1.h index 56f44931b6..9f267dc62c 100644 --- a/deal.II/deal.II/include/fe/mapping_q1.h +++ b/deal.II/deal.II/include/fe/mapping_q1.h @@ -226,6 +226,14 @@ class MappingQ1 : public Mapping */ Tensor<1,dim> &derivative (const unsigned int qpoint, const unsigned int shape_nr); + + /** + * Return an estimate (in + * bytes) or the memory + * consumption of this + * object. + */ + virtual unsigned int memory_consumption () const; /** * Values of shape diff --git a/deal.II/deal.II/source/fe/fe_values.cc b/deal.II/deal.II/source/fe/fe_values.cc index 824a129154..193eb7cd35 100644 --- a/deal.II/deal.II/source/fe/fe_values.cc +++ b/deal.II/deal.II/source/fe/fe_values.cc @@ -431,15 +431,23 @@ template unsigned int FEValuesBase::memory_consumption () const { -//TODO:[WB] check whether this is up to date return (MemoryConsumption::memory_consumption (shape_values) + MemoryConsumption::memory_consumption (shape_gradients) + MemoryConsumption::memory_consumption (shape_2nd_derivatives) + MemoryConsumption::memory_consumption (JxW_values) + MemoryConsumption::memory_consumption (quadrature_points) + + MemoryConsumption::memory_consumption (normal_vectors) + + MemoryConsumption::memory_consumption (boundary_forms) + sizeof(update_flags) + MemoryConsumption::memory_consumption (present_cell) + - MemoryConsumption::memory_consumption (fe)); + MemoryConsumption::memory_consumption (n_quadrature_points) + + MemoryConsumption::memory_consumption (dofs_per_cell) + + MemoryConsumption::memory_consumption (mapping) + + MemoryConsumption::memory_consumption (fe) + + MemoryConsumption::memory_consumption (mapping_data) + + MemoryConsumption::memory_consumption (*mapping_data) + + MemoryConsumption::memory_consumption (fe_data) + + MemoryConsumption::memory_consumption (*fe_data)); }; @@ -567,8 +575,8 @@ template unsigned int FEValues::memory_consumption () const { -//TODO:[WB] check whether this is up to date - return FEValuesBase::memory_consumption (); + return (FEValuesBase::memory_consumption () + + MemoryConsumption::memory_consumption (quadrature)); }; @@ -616,6 +624,17 @@ FEFaceValuesBase::get_boundary_forms () const }; + +template +unsigned int +FEFaceValuesBase::memory_consumption () const +{ + return (FEValuesBase::memory_consumption () + + MemoryConsumption::memory_consumption (quadrature) + + MemoryConsumption::memory_consumption (present_face)); +}; + + /*------------------------------- FEFaceValues -------------------------------*/ diff --git a/deal.II/deal.II/source/fe/mapping.cc b/deal.II/deal.II/source/fe/mapping.cc index 0a8fd3918d..fde86eda63 100644 --- a/deal.II/deal.II/source/fe/mapping.cc +++ b/deal.II/deal.II/source/fe/mapping.cc @@ -69,6 +69,15 @@ Mapping::InternalDataBase::~InternalDataBase () {} + +template +unsigned int +Mapping::InternalDataBase::memory_consumption () const +{ + return sizeof(*this); +} + + /*------------------------------ InternalData ------------------------------*/ diff --git a/deal.II/deal.II/source/fe/mapping_cartesian.cc b/deal.II/deal.II/source/fe/mapping_cartesian.cc index 79509f6cfc..0827a59444 100644 --- a/deal.II/deal.II/source/fe/mapping_cartesian.cc +++ b/deal.II/deal.II/source/fe/mapping_cartesian.cc @@ -39,6 +39,20 @@ MappingCartesian::InternalData::InternalData (const Quadrature& q) +template +unsigned int +MappingCartesian::InternalData::memory_consumption () const +{ + return (Mapping::InternalDataBase::memory_consumption() + + MemoryConsumption::memory_consumption (length) + + MemoryConsumption::memory_consumption (quadrature_points) + + MemoryConsumption::memory_consumption (unit_tangentials) + + MemoryConsumption::memory_consumption (aux)); +}; + + + + template UpdateFlags MappingCartesian::update_once (const UpdateFlags) const diff --git a/deal.II/deal.II/source/fe/mapping_q.cc b/deal.II/deal.II/source/fe/mapping_q.cc index 582866a116..649292e046 100644 --- a/deal.II/deal.II/source/fe/mapping_q.cc +++ b/deal.II/deal.II/source/fe/mapping_q.cc @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,19 @@ MappingQ::InternalData::InternalData (const unsigned int n_shape_functions) } + +template +unsigned int +MappingQ::InternalData::memory_consumption () const +{ + return (MappingQ1::InternalData::memory_consumption () + + MemoryConsumption::memory_consumption (unit_normals) + + MemoryConsumption::memory_consumption (use_mapping_q1_on_current_cell) + + MemoryConsumption::memory_consumption (mapping_q1_data)); +}; + + + #if deal_II_dimension == 1 // in 1d, it is irrelevant which polynomial degree to use, since all diff --git a/deal.II/deal.II/source/fe/mapping_q1.cc b/deal.II/deal.II/source/fe/mapping_q1.cc index 3632debff4..2b5837bea7 100644 --- a/deal.II/deal.II/source/fe/mapping_q1.cc +++ b/deal.II/deal.II/source/fe/mapping_q1.cc @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -91,6 +92,25 @@ MappingQ1::InternalData::derivative (const unsigned int qpoint, +template +unsigned int +MappingQ1::InternalData::memory_consumption () const +{ + return (Mapping::InternalDataBase::memory_consumption() + + MemoryConsumption::memory_consumption (shape_values) + + MemoryConsumption::memory_consumption (shape_derivatives) + + MemoryConsumption::memory_consumption (covariant) + + MemoryConsumption::memory_consumption (contravariant) + + MemoryConsumption::memory_consumption (unit_tangentials) + + MemoryConsumption::memory_consumption (aux) + + MemoryConsumption::memory_consumption (mapping_support_points) + + MemoryConsumption::memory_consumption (cell_of_current_support_points) + + MemoryConsumption::memory_consumption (is_mapping_q1_data) + + MemoryConsumption::memory_consumption (n_shape_functions)); +}; + + + template MappingQ1::MappingQ1 () {}; -- 2.39.5