Reference documentation for deal.II version Git cd8b20072f 2020-09-24 16:28:23 -0400
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
data_out_stack.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2019 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_data_out_stack_h
17 #define dealii_data_out_stack_h
18 
19 
20 #include <deal.II/base/config.h>
21 
24 
25 #include <deal.II/lac/vector.h>
26 
28 
29 #include <string>
30 #include <vector>
31 
33 
34 // Forward declaration
35 #ifndef DOXYGEN
36 template <int dim, int spacedim>
37 class DoFHandler;
38 #endif
39 
114 template <int dim,
115  int spacedim = dim,
116  typename DoFHandlerType = DoFHandler<dim, spacedim>>
117 class DataOutStack : public DataOutInterface<dim + 1>
118 {
119 public:
125  {
134  };
135 
139  virtual ~DataOutStack() override = default;
140 
147  void
148  new_parameter_value(const double parameter_value,
149  const double parameter_step);
150 
158  void
159  attach_dof_handler(const DoFHandlerType &dof_handler);
160 
169  void
170  declare_data_vector(const std::string &name, const VectorType vector_type);
171 
183  void
184  declare_data_vector(const std::vector<std::string> &name,
185  const VectorType vector_type);
186 
187 
207  template <typename number>
208  void
209  add_data_vector(const Vector<number> &vec, const std::string &name);
210 
229  template <typename number>
230  void
231  add_data_vector(const Vector<number> & vec,
232  const std::vector<std::string> &names);
233 
249  void
250  build_patches(const unsigned int n_subdivisions = 0);
251 
258  void
260 
265  std::size_t
266  memory_consumption() const;
267 
273  std::string,
274  << "The data vector for which the first component has the name " << arg1
275  << " has not been added before.");
280  "You cannot start a new time/parameter step before calling "
281  "finish_parameter_value() on the previous step.");
287  "You cannot declare additional vectors after already calling "
288  "build_patches(). All data vectors need to be declared "
289  "before you call this function the first time.");
294  std::string,
295  << "You tried to declare a component of a data vector with "
296  << "the name <" << arg1
297  << ">, but that name is already used.");
298 
299 private:
303  double parameter;
304 
310 
315  SmartPointer<const DoFHandlerType,
318 
322  std::vector<::DataOutBase::Patch<dim + 1, dim + 1>> patches;
323 
328  struct DataVector
329  {
334 
338  std::vector<std::string> names;
339 
344  std::size_t
345  memory_consumption() const;
346  };
347 
351  std::vector<DataVector> dof_data;
352 
356  std::vector<DataVector> cell_data;
357 
363  virtual const std::vector<::DataOutBase::Patch<dim + 1, dim + 1>> &
364  get_patches() const override;
365 
366 
371  virtual std::vector<std::string>
372  get_dataset_names() const override;
373 };
374 
375 
377 
378 #endif
static ::ExceptionBase & ExcNameAlreadyUsed(std::string arg1)
std::size_t memory_consumption() const
std::vector< DataVector > cell_data
static ::ExceptionBase & ExcDataAlreadyAdded()
void attach_dof_handler(const DoFHandlerType &dof_handler)
std::vector< DataVector > dof_data
virtual std::vector< std::string > get_dataset_names() const override
static ::ExceptionBase & ExcDataNotCleared()
SmartPointer< const DoFHandlerType, DataOutStack< dim, spacedim, DoFHandlerType > > dof_handler
std::size_t memory_consumption() const
double parameter_step
std::vector< std::string > names
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:515
void declare_data_vector(const std::string &name, const VectorType vector_type)
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:493
virtual const std::vector<::DataOutBase::Patch< dim+1, dim+1 > > & get_patches() const override
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:363
virtual ~DataOutStack() override=default
static ::ExceptionBase & ExcVectorNotDeclared(std::string arg1)
void build_patches(const unsigned int n_subdivisions=0)
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:362
std::vector<::DataOutBase::Patch< dim+1, dim+1 > > patches
void finish_parameter_value()
void new_parameter_value(const double parameter_value, const double parameter_step)
void add_data_vector(const Vector< number > &vec, const std::string &name)