Reference documentation for deal.II version 9.2.0
\(\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 
115 template <int dim,
116  int spacedim = dim,
117  typename DoFHandlerType = DoFHandler<dim, spacedim>>
118 class DataOutStack : public DataOutInterface<dim + 1>
119 {
120 public:
126  {
135  };
136 
140  virtual ~DataOutStack() override = default;
141 
148  void
149  new_parameter_value(const double parameter_value,
150  const double parameter_step);
151 
159  void
160  attach_dof_handler(const DoFHandlerType &dof_handler);
161 
170  void
171  declare_data_vector(const std::string &name, const VectorType vector_type);
172 
184  void
185  declare_data_vector(const std::vector<std::string> &name,
186  const VectorType vector_type);
187 
188 
208  template <typename number>
209  void
210  add_data_vector(const Vector<number> &vec, const std::string &name);
211 
230  template <typename number>
231  void
232  add_data_vector(const Vector<number> & vec,
233  const std::vector<std::string> &names);
234 
250  void
251  build_patches(const unsigned int n_subdivisions = 0);
252 
259  void
261 
266  std::size_t
267  memory_consumption() const;
268 
274  std::string,
275  << "The data vector for which the first component has the name " << arg1
276  << " has not been added before.");
281  "You cannot start a new time/parameter step before calling "
282  "finish_parameter_value() on the previous step.");
288  "You cannot declare additional vectors after already calling "
289  "build_patches(). All data vectors need to be declared "
290  "before you call this function the first time.");
295  std::string,
296  << "You tried to declare a component of a data vector with "
297  << "the name <" << arg1
298  << ">, but that name is already used.");
299 
300 private:
304  double parameter;
305 
311 
316  SmartPointer<const DoFHandlerType,
319 
323  std::vector<::DataOutBase::Patch<dim + 1, dim + 1>> patches;
324 
329  struct DataVector
330  {
335 
339  std::vector<std::string> names;
340 
345  std::size_t
346  memory_consumption() const;
347  };
348 
352  std::vector<DataVector> dof_data;
353 
357  std::vector<DataVector> cell_data;
358 
364  virtual const std::vector<::DataOutBase::Patch<dim + 1, dim + 1>> &
365  get_patches() const override;
366 
367 
372  virtual std::vector<std::string>
373  get_dataset_names() const override;
374 };
375 
376 
378 
379 #endif
DeclExceptionMsg
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:496
DataOutStack::ExcNameAlreadyUsed
static ::ExceptionBase & ExcNameAlreadyUsed(std::string arg1)
DataOutStack::get_dataset_names
virtual std::vector< std::string > get_dataset_names() const override
Definition: data_out_stack.cc:484
data_out_dof_data.h
DataOutStack::parameter_step
double parameter_step
Definition: data_out_stack.h:310
DataOutStack::ExcDataNotCleared
static ::ExceptionBase & ExcDataNotCleared()
DataOutStack::DataVector::names
std::vector< std::string > names
Definition: data_out_stack.h:339
VectorType
DataOutStack::parameter
double parameter
Definition: data_out_stack.h:304
DataOutStack::get_patches
virtual const std::vector<::DataOutBase::Patch< dim+1, dim+1 > > & get_patches() const override
Definition: data_out_stack.cc:475
DoFHandler
Definition: dof_handler.h:205
DataOutStack::attach_dof_handler
void attach_dof_handler(const DoFHandlerType &dof_handler)
Definition: data_out_stack.cc:77
data_out_base.h
DataOutStack::cell_vector
@ cell_vector
Definition: data_out_stack.h:130
DataOutStack::dof_data
std::vector< DataVector > dof_data
Definition: data_out_stack.h:352
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
DeclException1
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:518
smartpointer.h
DataOutStack::dof_handler
SmartPointer< const DoFHandlerType, DataOutStack< dim, spacedim, DoFHandlerType > > dof_handler
Definition: data_out_stack.h:318
DataOutStack::DataVector::memory_consumption
std::size_t memory_consumption() const
Definition: data_out_stack.cc:42
DataOutStack::memory_consumption
std::size_t memory_consumption() const
Definition: data_out_stack.cc:460
DataOutStack::declare_data_vector
void declare_data_vector(const std::string &name, const VectorType vector_type)
Definition: data_out_stack.cc:91
DataOutStack::dof_vector
@ dof_vector
Definition: data_out_stack.h:134
DataOutStack::patches
std::vector<::DataOutBase::Patch< dim+1, dim+1 > > patches
Definition: data_out_stack.h:323
SmartPointer
Definition: smartpointer.h:68
DataOutStack::~DataOutStack
virtual ~DataOutStack() override=default
DataOutStack::new_parameter_value
void new_parameter_value(const double parameter_value, const double parameter_step)
Definition: data_out_stack.cc:53
vector.h
DataOutStack::add_data_vector
void add_data_vector(const Vector< number > &vec, const std::string &name)
Definition: data_out_stack.cc:146
DataOutStack::ExcVectorNotDeclared
static ::ExceptionBase & ExcVectorNotDeclared(std::string arg1)
DataOutStack::finish_parameter_value
void finish_parameter_value()
Definition: data_out_stack.cc:441
DataOutStack::DataVector
Definition: data_out_stack.h:329
DataOutStack::VectorType
VectorType
Definition: data_out_stack.h:125
config.h
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
DataOutStack::build_patches
void build_patches(const unsigned int n_subdivisions=0)
Definition: data_out_stack.cc:255
Vector< number >
DataOutInterface
Definition: data_out_base.h:2598
DataOutStack
Definition: data_out_stack.h:118
DataOutStack::ExcDataAlreadyAdded
static ::ExceptionBase & ExcDataAlreadyAdded()
DataOutStack::cell_data
std::vector< DataVector > cell_data
Definition: data_out_stack.h:357
DataOutStack::DataVector::data
Vector< double > data
Definition: data_out_stack.h:334