Reference documentation for deal.II version 9.3.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 - 2020 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 
43 template <int dim, int spacedim = dim, typename DoFHandlerType = void>
45 
46 #ifndef DOXYGEN
47 // prevent doxygen from complaining about potential recursive class relations
48 template <int dim, int spacedim, typename DoFHandlerType>
49 class DataOutStack : public DataOutStack<dim, spacedim, void>
50 {
51 public:
53  DataOutStack()
54  : DataOutStack<dim, spacedim, void>()
55  {}
56 };
57 #endif // DOXYGEN
58 
133 template <int dim, int spacedim>
134 class DataOutStack<dim, spacedim, void> : public DataOutInterface<dim + 1>
135 {
136 public:
142  {
150  dof_vector
151  };
152 
156  virtual ~DataOutStack() override = default;
157 
164  void
165  new_parameter_value(const double parameter_value,
166  const double parameter_step);
167 
175  void
176  attach_dof_handler(const DoFHandler<dim, spacedim> &dof_handler);
177 
186  void
187  declare_data_vector(const std::string &name, const VectorType vector_type);
188 
200  void
201  declare_data_vector(const std::vector<std::string> &name,
202  const VectorType vector_type);
203 
204 
224  template <typename number>
225  void
226  add_data_vector(const Vector<number> &vec, const std::string &name);
227 
246  template <typename number>
247  void
248  add_data_vector(const Vector<number> & vec,
249  const std::vector<std::string> &names);
250 
266  void
267  build_patches(const unsigned int n_subdivisions = 0);
268 
275  void
276  finish_parameter_value();
277 
282  std::size_t
283  memory_consumption() const;
284 
289  ExcVectorNotDeclared,
290  std::string,
291  << "The data vector for which the first component has the name " << arg1
292  << " has not been added before.");
296  DeclExceptionMsg(ExcDataNotCleared,
297  "You cannot start a new time/parameter step before calling "
298  "finish_parameter_value() on the previous step.");
303  ExcDataAlreadyAdded,
304  "You cannot declare additional vectors after already calling "
305  "build_patches(). All data vectors need to be declared "
306  "before you call this function the first time.");
310  DeclException1(ExcNameAlreadyUsed,
311  std::string,
312  << "You tried to declare a component of a data vector with "
313  << "the name <" << arg1
314  << ">, but that name is already used.");
315 
316 private:
320  double parameter;
321 
327 
335 
339  std::vector<::DataOutBase::Patch<dim + 1, dim + 1>> patches;
340 
345  struct DataVector
346  {
350  Vector<double> data;
351 
355  std::vector<std::string> names;
356 
361  std::size_t
362  memory_consumption() const;
363  };
364 
368  std::vector<DataVector> dof_data;
369 
373  std::vector<DataVector> cell_data;
374 
380  virtual const std::vector<::DataOutBase::Patch<dim + 1, dim + 1>> &
381  get_patches() const override;
382 
383 
388  virtual std::vector<std::string>
389  get_dataset_names() const override;
390 };
391 
392 
394 
395 #endif
std::vector< DataVector > cell_data
SmartPointer< const DoFHandler< dim, spacedim >, DataOutStack< dim, spacedim, void > > dof_handler
std::vector<::DataOutBase::Patch< dim+1, dim+1 > > patches
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:515
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:493
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:395
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:394
#define DEAL_II_DEPRECATED
Definition: config.h:157
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
std::vector< DataVector > dof_data