#include <base/data_out_base.h>
+#include <base/smartpointer.h>
#include <base/multithread_info.h>
*/
virtual void clear ();
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception
*/
*/
DataEntry (const Vector<double> *data = 0,
const vector<string> &names = vector<string>());
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
/**
- * Pointer to the data vector.
+ * Pointer to the data
+ * vector. Note that
+ * ownership of the vector
+ * pointed to remains with
+ * the caller of this class.
*/
const Vector<double> *data;
/**
* Pointer to the dof handler object.
*/
- const DoFHandler<dof_handler_dim> *dofs;
+ SmartPointer<const DoFHandler<dof_handler_dim> > dofs;
/**
* List of data elements with vectors of
* in this object.
*/
void clear ();
-
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception
*/
* within each such data set.
*/
vector<string> names;
+
+ /**
+ * Determine an estimate for
+ * the memory consumption (in
+ * bytes) of this object.
+ */
+ unsigned int memory_consumption () const;
};
/**
*/
static IntervalSpacing parse_interval_spacing (const string &name);
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception.
*/
Interval (const double left_point,
const double right_point);
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Left bound of the interval.
*/
#include <lac/forward_declarations.h>
#include <grid/forward_declarations.h>
+#include <base/smartpointer.h>
#include <base/exceptions.h>
#include <vector>
void interpolate (const Vector<number> &in,
Vector<number> &out) const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception
*/
* Pointer to the degree of freedom handler
* to work with.
*/
- const DoFHandler<dim> *dof_handler;
+ SmartPointer<const DoFHandler<dim> > dof_handler;
/**
* Stores the number of DoFs before the
* 'multiplied' by this structure.
*/
struct Pointerstruct {
+ unsigned int memory_consumption () const;
+
vector<unsigned int> *indices_ptr;
vector<Vector<number> > *dof_values_ptr;
};
#include <base/exceptions.h>
#include <base/subscriptor.h>
+#include <base/smartpointer.h>
#include <grid/forward_declarations.h>
#include <lac/forward_declarations.h>
*/
virtual void end_sweep (const unsigned int n_threads = 1);
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
/**
* Exception.
*/
*/
double get_forward_timestep () const;
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ *
+ * You will want to overload
+ * this function in derived
+ * classes to compute the
+ * amount memory used by the
+ * derived class, and add the
+ * result of this function to
+ * your result.
+ */
+ virtual unsigned int memory_consumption () const;
+
/**
* Exception
*/
*/
void save_refine_flags ();
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ *
+ * You will want to overload
+ * this function in derived
+ * classes to compute the
+ * amount memory used by the
+ * derived class, and add the
+ * result of this function to
+ * your result.
+ */
+ virtual unsigned int memory_consumption () const;
+
/**
* Exception
*/
* is set through the
* constructor; ownership remains
* with the owner of this
- * management object. */
- const Triangulation<dim> &coarse_grid;
+ * management object.
+ */
+ SmartPointer<const Triangulation<dim> > coarse_grid;
/**
* Some flags about how this time level
#include <base/quadrature_lib.h>
+#include <base/memory_consumption.h>
#include <lac/vector.h>
#include <numerics/data_out.h>
#include <grid/tria.h>
#include <strstream>
+
template <int dof_handler_dim, int patch_dim, int patch_space_dim>
DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::DataEntry::
DataEntry (const Vector<double> *data,
+template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+unsigned int
+DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
+DataEntry::memory_consumption () const
+{
+ return (sizeof (data) +
+ MemoryConsumption::memory_consumption (names) +
+ MemoryConsumption::memory_consumption (units));
+};
+
+
+
+
+
template <int dof_handler_dim, int patch_dim, int patch_space_dim>
DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::DataOut_DoFData () :
dofs(0)
+template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+unsigned int
+DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::memory_consumption () const
+{
+ return (DataOutInterface<patch_dim,patch_space_dim>::memory_consumption () +
+ MemoryConsumption::memory_consumption (dofs) +
+ MemoryConsumption::memory_consumption (dof_data) +
+ MemoryConsumption::memory_consumption (cell_data) +
+ MemoryConsumption::memory_consumption (patches));
+};
+
+
+
/* ---------------------------------------------------------------------- */
#include <numerics/data_out_stack.h>
#include <base/quadrature_lib.h>
+#include <base/memory_consumption.h>
#include <lac/vector.h>
#include <dofs/dof_handler.h>
#include <dofs/dof_accessor.h>
#include <fe/fe_values.h>
+
+template <int dim>
+unsigned int
+DataOutStack<dim>::DataVector::memory_consumption () const
+{
+ return (MemoryConsumption::memory_consumption (data) +
+ MemoryConsumption::memory_consumption (names));
+};
+
+
+
template <int dim>
DataOutStack<dim>::~DataOutStack ()
{};
};
+
+template <int dim>
+unsigned int
+DataOutStack<dim>::memory_consumption () const
+{
+ return (DataOutInterface<dim+1>::memory_consumption () +
+ MemoryConsumption::memory_consumption (parameter) +
+ MemoryConsumption::memory_consumption (parameter_step) +
+ MemoryConsumption::memory_consumption (dof_handler) +
+ MemoryConsumption::memory_consumption (patches) +
+ MemoryConsumption::memory_consumption (dof_data) +
+ MemoryConsumption::memory_consumption (cell_data));
+};
+
+
+
template <int dim>
const vector<DataOutBase::Patch<dim+1> > &
DataOutStack<dim>::get_patches () const
};
+
template <int dim>
vector<string> DataOutStack<dim>::get_dataset_names () const
{
//---------------------------- histogram.cc ---------------------------
+#include <base/memory_consumption.h>
#include <lac/vector.h>
#include <numerics/histogram.h>
#include <algorithm>
};
+
Histogram::Interval::Interval (const double left_point,
const double right_point) :
left_point (left_point),
{};
+
+unsigned int
+Histogram::Interval::memory_consumption () const
+{
+ return sizeof(*this);
+};
+
+
+
template <typename number>
void Histogram::evaluate (const vector<Vector<number> > &values,
const vector<double> &_y_values,
};
+
template <typename number>
void Histogram::evaluate (const Vector<number> &values,
const unsigned int n_intervals,
};
+
void Histogram::write_gnuplot (ostream &out) const
{
AssertThrow (out, ExcIO());
};
+
string Histogram::get_interval_spacing_names ()
{
return "linear|logarithmic";
};
+
Histogram::IntervalSpacing
Histogram::parse_interval_spacing (const string &name)
{
};
+
+unsigned int
+Histogram::memory_consumption () const
+{
+ return (MemoryConsumption::memory_consumption (intervals) +
+ MemoryConsumption::memory_consumption (y_values));
+};
+
+
+
// explicit instantiations for float
template
void Histogram::evaluate (const vector<Vector<float> > &values,
//---------------------------- solution_transfer.cc ---------------------------
+#include <base/memory_consumption.h>
#include <grid/tria.h>
#include <dofs/dof_handler.h>
#include <grid/tria_accessor.h>
}
+
template<int dim, typename number>
void SolutionTransfer<dim, number>::interpolate(const Vector<number> &in,
Vector<number> &out) const
}
+
+template<int dim, typename number>
+unsigned int
+SolutionTransfer<dim, number>::memory_consumption () const
+{
+ return (MemoryConsumption::memory_consumption (dof_handler) +
+ MemoryConsumption::memory_consumption (n_dofs_old) +
+ sizeof (prepared_for) +
+ MemoryConsumption::memory_consumption (indices_on_cell) +
+ MemoryConsumption::memory_consumption (all_pointerstructs) +
+ MemoryConsumption::memory_consumption (dof_values_on_cell));
+};
+
+
+
+template<int dim, typename number>
+unsigned int
+SolutionTransfer<dim, number>::Pointerstruct::memory_consumption () const
+{
+ return sizeof(*this);
+};
+
+
+
template class SolutionTransfer<deal_II_dimension, float>;
template class SolutionTransfer<deal_II_dimension, double>;
#include <numerics/time_dependent.h>
+#include <base/memory_consumption.h>
#include <grid/tria.h>
#include <grid/tria_accessor.h>
#include <grid/tria_iterator.h>
}
+
void TimeDependent::end_sweep (const unsigned int begin,
const unsigned int end)
{
};
+
+unsigned int TimeDependent::memory_consumption () const
+{
+ unsigned int mem = (MemoryConsumption::memory_consumption (timesteps) +
+ MemoryConsumption::memory_consumption (sweep_no) +
+ sizeof(timestepping_data_primal) +
+ sizeof(timestepping_data_dual) +
+ sizeof(timestepping_data_postprocess));
+ for (unsigned int i=0; i<timesteps.size(); ++i)
+ mem += MemoryConsumption::memory_consumption (*timesteps[i]);
+
+ return mem;
+};
+
+
+
/* --------------------------------------------------------------------- */
{};
+
TimeStepBase::~TimeStepBase ()
{};
+
void
TimeStepBase::wake_up (const unsigned )
{};
+
void
TimeStepBase::sleep (const unsigned)
{};
+
void
TimeStepBase::start_sweep ()
{};
+
void
TimeStepBase::end_sweep ()
{};
+
void
TimeStepBase::init_for_primal_problem ()
{
};
+
void
TimeStepBase::init_for_dual_problem ()
{
};
+
void
TimeStepBase::init_for_postprocessing ()
{
};
+
void
TimeStepBase::solve_dual_problem ()
{
};
+
void
TimeStepBase::postprocess_timestep ()
{
};
+
double
TimeStepBase::get_time () const
{
};
+
unsigned int
TimeStepBase::get_timestep_no () const
{
};
+
double
TimeStepBase::get_backward_timestep () const
{
};
+
double
TimeStepBase::get_forward_timestep () const
{
};
+
void
TimeStepBase::set_previous_timestep (const TimeStepBase *previous)
{
};
+
void
TimeStepBase::set_next_timestep (const TimeStepBase *next)
{
};
+
void
TimeStepBase::set_timestep_no (const unsigned int step_no)
{
};
+
void
TimeStepBase::set_sweep_no (const unsigned int sweep)
{
};
+
+unsigned int
+TimeStepBase::memory_consumption () const
+{
+ // only simple data types
+ return sizeof(*this);
+};
+
+
/* ------------------------------------------------------------------------- */
TimeStepBase_Tria<dim>::TimeStepBase_Tria() :
TimeStepBase (0),
tria (0),
- coarse_grid (*reinterpret_cast<Triangulation<dim>*>(0))
+ coarse_grid (0)
{
Assert (false, ExcPureVirtualFunctionCalled());
};
+
template <int dim>
TimeStepBase_Tria<dim>::TimeStepBase_Tria (const double time,
const Triangulation<dim> &coarse_grid,
const RefinementFlags &refinement_flags) :
TimeStepBase (time),
tria(0),
- coarse_grid (coarse_grid),
+ coarse_grid (&coarse_grid),
flags (flags),
refinement_flags (refinement_flags)
-{
- coarse_grid.subscribe();
-};
+{};
+
template <int dim>
}
else
Assert (tria==0, ExcInternalError());
-
- coarse_grid.unsubscribe();
+
+ coarse_grid = 0;
};
+
template <int dim>
void
-TimeStepBase_Tria<dim>::wake_up (const unsigned wakeup_level) {
+TimeStepBase_Tria<dim>::wake_up (const unsigned wakeup_level)
+{
TimeStepBase::wake_up (wakeup_level);
if (wakeup_level == flags.wakeup_level_to_build_grid)
};
+
template <int dim>
void
TimeStepBase_Tria<dim>::sleep (const unsigned sleep_level)
};
+
template <int dim>
void TimeStepBase_Tria<dim>::save_refine_flags ()
{
};
+
template <int dim>
-void TimeStepBase_Tria<dim>::restore_grid () {
+void TimeStepBase_Tria<dim>::restore_grid ()
+{
Assert (tria == 0, ExcGridNotDeleted());
Assert (refine_flags.size() == coarsen_flags.size(),
ExcInternalError());
// set it to a copy of the coarse grid
tria = new Triangulation<dim> ();
tria->subscribe();
- tria->copy_triangulation (coarse_grid);
+ tria->copy_triangulation (*coarse_grid);
// for each of the previous refinement
// sweeps
};
+
template <int dim>
static void
mirror_refinement_flags (const Triangulation<dim>::cell_iterator &new_cell,
- const Triangulation<dim>::cell_iterator &old_cell) {
+ const Triangulation<dim>::cell_iterator &old_cell)
+{
// mirror the refinement
// flags from the present time level to
// the previous if the dual problem was
};
+
template <int dim>
static bool
adapt_grids (const Triangulation<dim>::cell_iterator &cell1,
- const Triangulation<dim>::cell_iterator &cell2) {
+ const Triangulation<dim>::cell_iterator &cell2)
+{
if (cell2->has_children() && cell1->has_children())
{
};
+
template <int dim>
static bool
adapt_grids (Triangulation<dim> &tria1,
- Triangulation<dim> &tria2) {
+ Triangulation<dim> &tria2)
+{
bool grids_changed = false;
Triangulation<dim>::cell_iterator cell1 = tria1.begin(),
};
+
template <int dim>
void TimeStepBase_Tria<dim>::refine_grid (const RefinementData refinement_data)
{
};
+
template <int dim>
void TimeStepBase_Tria<dim>::init_for_refinement ()
{
};
+
template <int dim>
-TimeStepBase_Tria<dim>::Flags::Flags () {
+unsigned int
+TimeStepBase_Tria<dim>::memory_consumption () const
+{
+ return (TimeStepBase::memory_consumption () +
+ sizeof(tria) +
+ MemoryConsumption::memory_consumption (coarse_grid) +
+ sizeof(flags) + sizeof(refinement_flags) +
+ MemoryConsumption::memory_consumption (refine_flags) +
+ MemoryConsumption::memory_consumption (coarsen_flags));
+};
+
+
+
+template <int dim>
+TimeStepBase_Tria<dim>::Flags::Flags ()
+{
Assert (false, ExcInternalError());
};
+
template <int dim>
TimeStepBase_Tria<dim>::Flags::Flags (const bool delete_and_rebuild_tria,
const unsigned int wakeup_level_to_build_grid,