Reference documentation for deal.II version 9.5.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\}}\)
Loading...
Searching...
No Matches
data_out_stack.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 1999 - 2023 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
36template <int dim, int spacedim>
38class DoFHandler;
39#endif
40
115template <int dim, int spacedim = dim>
116class DataOutStack : public DataOutInterface<dim + 1, spacedim + 1>
117{
118 static_assert(dim < 3,
119 "Because this class stacks data into the (dim+1)st "
120 "dimension to create graphical output, it only works for "
121 "dim<3.");
122 static_assert(dim == spacedim,
123 "This class is not implemented for dim != spacedim.");
124
125public:
129 static constexpr int patch_dim = dim + 1;
130 static constexpr int patch_spacedim = spacedim + 1;
131
137 {
146 };
147
151 virtual ~DataOutStack() override = default;
152
159 void
160 new_parameter_value(const double parameter_value,
161 const double parameter_step);
162
170 void
172
181 void
182 declare_data_vector(const std::string &name, const VectorType vector_type);
183
195 void
196 declare_data_vector(const std::vector<std::string> &name,
197 const VectorType vector_type);
198
199
219 template <typename number>
220 void
221 add_data_vector(const Vector<number> &vec, const std::string &name);
222
241 template <typename number>
242 void
244 const std::vector<std::string> &names);
245
261 void
262 build_patches(const unsigned int n_subdivisions = 0);
263
270 void
272
277 std::size_t
278 memory_consumption() const;
279
285 std::string,
286 << "The data vector for which the first component has the name " << arg1
287 << " has not been added before.");
292 "You cannot start a new time/parameter step before calling "
293 "finish_parameter_value() on the previous step.");
299 "You cannot declare additional vectors after already calling "
300 "build_patches(). All data vectors need to be declared "
301 "before you call this function the first time.");
306 std::string,
307 << "You tried to declare a component of a data vector with "
308 << "the name <" << arg1
309 << ">, but that name is already used.");
310
311private:
315 double parameter;
316
322
329
333 std::vector<::DataOutBase::Patch<patch_dim, patch_spacedim>> patches;
334
340 {
345
349 std::vector<std::string> names;
350
355 std::size_t
356 memory_consumption() const;
357 };
358
362 std::vector<DataVector> dof_data;
363
367 std::vector<DataVector> cell_data;
368
374 virtual const std::vector<
377 get_patches() const override;
378
379
384 virtual std::vector<std::string>
385 get_dataset_names() const override;
386};
387
388
390
391#endif
std::size_t memory_consumption() const
static constexpr int patch_dim
void declare_data_vector(const std::string &name, const VectorType vector_type)
virtual std::vector< std::string > get_dataset_names() const override
std::vector< DataVector > cell_data
virtual ~DataOutStack() override=default
void new_parameter_value(const double parameter_value, const double parameter_step)
std::vector< DataVector > dof_data
SmartPointer< const DoFHandler< dim, spacedim >, DataOutStack< dim, spacedim > > dof_handler
void finish_parameter_value()
void attach_dof_handler(const DoFHandler< dim, spacedim > &dof_handler)
double parameter_step
static constexpr int patch_spacedim
void build_patches(const unsigned int n_subdivisions=0)
std::vector<::DataOutBase::Patch< patch_dim, patch_spacedim > > patches
virtual const std::vector< ::DataOutBase::Patch< DataOutStack< dim, spacedim >::patch_dim, DataOutStack< dim, spacedim >::patch_spacedim > > & get_patches() const override
void add_data_vector(const Vector< number > &vec, const std::string &name)
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:472
#define DEAL_II_CXX20_REQUIRES(condition)
Definition config.h:160
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
static ::ExceptionBase & ExcDataNotCleared()
static ::ExceptionBase & ExcDataAlreadyAdded()
static ::ExceptionBase & ExcVectorNotDeclared(std::string arg1)
static ::ExceptionBase & ExcNameAlreadyUsed(std::string arg1)
#define DeclExceptionMsg(Exception, defaulttext)
Definition exceptions.h:488
#define DeclException1(Exception1, type1, outsequence)
Definition exceptions.h:510
std::size_t memory_consumption() const
std::vector< std::string > names