--- /dev/null
+New: The method memory_consumption has been implemented in and added
+to a variety of classes, e.g. FE_DGQ.
+<br>
+(Peter Munch, 2019/12/22)
void
serialize(Archive &ar, const unsigned int version);
+ /**
+ * Return an estimate (in bytes) for the memory consumption of this object.
+ */
+ virtual std::size_t
+ memory_consumption() const;
+
protected:
/**
* This function performs the actual scaling.
void
serialize(Archive &ar, const unsigned int version);
+ /**
+ * Return an estimate (in bytes) for the memory consumption of this object.
+ */
+ virtual std::size_t
+ memory_consumption() const;
+
protected:
/**
* Underlying polynomial object that is scaled to a subinterval and
virtual std::string
name() const = 0;
+ /**
+ * Return an estimate (in bytes) for the memory consumption of this object.
+ */
+ virtual std::size_t
+ memory_consumption() const;
+
private:
/**
* The highest polynomial degree of this functions represented by this object.
virtual std::unique_ptr<ScalarPolynomialsBase<dim>>
clone() const override;
+ /**
+ * Return an estimate (in bytes) for the memory consumption of this object.
+ */
+ virtual std::size_t
+ memory_consumption() const override;
+
protected:
/**
* Copy of the vector <tt>pols</tt> of polynomials given to the constructor.
UpdateFlags update_each;
/**
- * Return an estimate (in bytes) or the memory consumption of this object.
+ * Return an estimate (in bytes) for the memory consumption of this object.
*/
virtual std::size_t
memory_consumption() const;
const std::vector<Vector<double>> &support_point_values,
std::vector<double> & nodal_values) const override;
- /**
- * Determine an estimate for the memory consumption (in bytes) of this
- * object.
- *
- * This function is made virtual, since finite element objects are usually
- * accessed through pointers to their base class, rather than the class
- * itself.
- */
- virtual std::size_t
- memory_consumption() const override;
-
virtual std::unique_ptr<FiniteElement<dim, spacedim>>
clone() const override;
const Point<dim> & p,
const unsigned int component) const override;
+ /**
+ * Return an estimate (in bytes) for the memory consumption of this object.
+ */
+ virtual std::size_t
+ memory_consumption() const override;
+
protected:
/*
* NOTE: The following function has its definition inlined into the class
+template <class PolynomialType, int dim, int spacedim>
+std::size_t
+FE_Poly<PolynomialType, dim, spacedim>::memory_consumption() const
+{
+ return FiniteElement<dim, spacedim>::memory_consumption() +
+ poly_space.memory_consumption();
+}
+
+
+
DEAL_II_NAMESPACE_CLOSE
#endif
UpdateFlags update_each;
/**
- * Return an estimate (in bytes) or the memory consumption of this object.
+ * Return an estimate (in bytes) for the memory consumption of this object.
*/
virtual std::size_t
memory_consumption() const;
InternalData(const Quadrature<dim> &quadrature);
/**
- * Return an estimate (in bytes) or the memory consumption of this object.
+ * Return an estimate (in bytes) for the memory consumption of this object.
*/
virtual std::size_t
memory_consumption() const override;
fourth_derivative(const unsigned int qpoint, const unsigned int shape_nr);
/**
- * Return an estimate (in bytes) or the memory consumption of this object.
+ * Return an estimate (in bytes) for the memory consumption of this object.
*/
virtual std::size_t
memory_consumption() const override;
const typename Triangulation<dim, spacedim>::cell_iterator &cell) const;
/**
- * Return an estimate (in bytes) or the memory consumption of this object.
+ * Return an estimate (in bytes) for the memory consumption of this object.
*/
virtual std::size_t
memory_consumption() const override;
/**
- * Return an estimate (in bytes) or the memory consumption of this object.
+ * Return an estimate (in bytes) for the memory consumption of this object.
*/
virtual std::size_t
memory_consumption() const override;
fourth_derivative(const unsigned int qpoint, const unsigned int shape_nr);
/**
- * Return an estimate (in bytes) or the memory consumption of this object.
+ * Return an estimate (in bytes) for the memory consumption of this object.
*/
virtual std::size_t
memory_consumption() const override;
// ---------------------------------------------------------------------
#include <deal.II/base/exceptions.h>
+#include <deal.II/base/memory_consumption.h>
#include <deal.II/base/point.h>
#include <deal.II/base/polynomial.h>
#include <deal.II/base/quadrature_lib.h>
}
+ template <typename number>
+ std::size_t
+ Polynomial<number>::memory_consumption() const
+ {
+ return (MemoryConsumption::memory_consumption(coefficients) +
+ MemoryConsumption::memory_consumption(in_lagrange_product_form) +
+ MemoryConsumption::memory_consumption(lagrange_support_points) +
+ MemoryConsumption::memory_consumption(lagrange_weight));
+ }
+
+
// ------------------ class Monomial -------------------------- //
//
// ---------------------------------------------------------------------
+#include <deal.II/base/memory_consumption.h>
#include <deal.II/base/polynomials_piecewise.h>
+ template <typename number>
+ std::size_t
+ PiecewisePolynomial<number>::memory_consumption() const
+ {
+ return (polynomial.memory_consumption() +
+ MemoryConsumption::memory_consumption(n_intervals) +
+ MemoryConsumption::memory_consumption(interval) +
+ MemoryConsumption::memory_consumption(spans_two_intervals));
+ }
+
+
+
std::vector<PiecewisePolynomial<double>>
generate_complete_Lagrange_basis_on_subdivisions(
const unsigned int n_subdivisions,
+template <int dim>
+std::size_t
+ScalarPolynomialsBase<dim>::memory_consumption() const
+{
+ Assert(false, ExcNotImplemented());
+ return 0;
+}
+
+
+
template class ScalarPolynomialsBase<0>;
template class ScalarPolynomialsBase<1>;
template class ScalarPolynomialsBase<2>;
// ---------------------------------------------------------------------
#include <deal.II/base/exceptions.h>
+#include <deal.II/base/memory_consumption.h>
#include <deal.II/base/polynomials_piecewise.h>
#include <deal.II/base/std_cxx14/memory.h>
#include <deal.II/base/tensor_product_polynomials.h>
+template <int dim, typename PolynomialType>
+std::size_t
+TensorProductPolynomials<dim, PolynomialType>::memory_consumption() const
+{
+ return (MemoryConsumption::memory_consumption(polynomials) +
+ MemoryConsumption::memory_consumption(index_map) +
+ MemoryConsumption::memory_consumption(index_map_inverse));
+}
+
+
+
/* ------------------- AnisotropicPolynomials -------------- */
-template <int dim, int spacedim>
-std::size_t
-FE_DGQ<dim, spacedim>::memory_consumption() const
-{
- Assert(false, ExcNotImplemented());
- return 0;
-}
-
-
-
// ------------------------------ FE_DGQArbitraryNodes -----------------------
template <int dim, int spacedim>
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2019 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+// Test memory_consumption of FE_Q and FE_DGQ.
+
+
+#include <deal.II/fe/fe_dgq.h>
+#include <deal.II/fe/fe_q.h>
+
+#include "../tests.h"
+
+using namespace dealii;
+
+template <int dim>
+void
+test(const FiniteElement<dim> &fe)
+{
+ deallog << fe.get_name() << " " << fe.memory_consumption() << std::endl;
+}
+
+template <int dim>
+void
+tests()
+{
+ // FE_Q
+ for (unsigned int i = 1; i < 4; i++)
+ test(FE_Q<dim>(i));
+
+ // FE_DGQ
+ for (unsigned int i = 0; i < 4; i++)
+ test(FE_DGQ<dim>(i));
+}
+
+int
+main()
+{
+ initlog();
+
+ {
+ deallog.push("1d");
+ tests<1>();
+ deallog.pop();
+ }
+ {
+ deallog.push("2d");
+ tests<2>();
+ deallog.pop();
+ }
+ {
+ deallog.push("3d");
+ tests<3>();
+ deallog.pop();
+ }
+}
\ No newline at end of file
--- /dev/null
+
+DEAL:1d::FE_Q<1>(1) 1770
+DEAL:1d::FE_Q<1>(2) 1979
+DEAL:1d::FE_Q<1>(3) 2204
+DEAL:1d::FE_DGQ<1>(0) 1557
+DEAL:1d::FE_DGQ<1>(1) 1750
+DEAL:1d::FE_DGQ<1>(2) 1959
+DEAL:1d::FE_DGQ<1>(3) 2184
+DEAL:2d::FE_Q<2>(1) 4062
+DEAL:2d::FE_Q<2>(2) 4827
+DEAL:2d::FE_Q<2>(3) 5880
+DEAL:2d::FE_DGQ<2>(0) 3573
+DEAL:2d::FE_DGQ<2>(1) 4006
+DEAL:2d::FE_DGQ<2>(2) 4695
+DEAL:2d::FE_DGQ<2>(3) 5640
+DEAL:3d::FE_Q<3>(1) 10678
+DEAL:3d::FE_Q<3>(2) 14499
+DEAL:3d::FE_Q<3>(3) 23432
+DEAL:3d::FE_DGQ<3>(0) 9525
+DEAL:3d::FE_DGQ<3>(1) 10438
+DEAL:3d::FE_DGQ<3>(2) 12807
+DEAL:3d::FE_DGQ<3>(3) 17352