Reference documentation for deal.II version GIT relicensing-903-gcd01479aa8 2024-06-25 10:50:02+00:00
\(\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// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 1999 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_data_out_stack_h
16#define dealii_data_out_stack_h
17
18
19#include <deal.II/base/config.h>
20
23
24#include <deal.II/lac/vector.h>
25
27
28#include <string>
29#include <vector>
30
32
33// Forward declaration
34#ifndef DOXYGEN
35template <int dim, int spacedim>
37class DoFHandler;
38#endif
39
114template <int dim, int spacedim = dim>
115class DataOutStack : public DataOutInterface<dim + 1, spacedim + 1>
116{
117 static_assert(dim < 3,
118 "Because this class stacks data into the (dim+1)st "
119 "dimension to create graphical output, it only works for "
120 "dim<3.");
121 static_assert(dim == spacedim,
122 "This class is not implemented for dim != spacedim.");
123
124public:
128 static constexpr int patch_dim = dim + 1;
129 static constexpr int patch_spacedim = spacedim + 1;
130
146
150 virtual ~DataOutStack() override = default;
151
158 void
159 new_parameter_value(const double parameter_value,
160 const double parameter_step);
161
169 void
171
180 void
181 declare_data_vector(const std::string &name, const VectorType vector_type);
182
194 void
195 declare_data_vector(const std::vector<std::string> &name,
196 const VectorType vector_type);
197
198
218 template <typename number>
219 void
220 add_data_vector(const Vector<number> &vec, const std::string &name);
221
240 template <typename number>
241 void
243 const std::vector<std::string> &names);
244
260 void
261 build_patches(const unsigned int n_subdivisions = 0);
262
269 void
271
276 std::size_t
277 memory_consumption() const;
278
284 std::string,
285 << "The data vector for which the first component has the name " << arg1
286 << " has not been added before.");
291 "You cannot start a new time/parameter step before calling "
292 "finish_parameter_value() on the previous step.");
298 "You cannot declare additional vectors after already calling "
299 "build_patches(). All data vectors need to be declared "
300 "before you call this function the first time.");
305 std::string,
306 << "You tried to declare a component of a data vector with "
307 << "the name <" << arg1
308 << ">, but that name is already used.");
309
310private:
314 double parameter;
315
321
328
332 std::vector<::DataOutBase::Patch<patch_dim, patch_spacedim>> patches;
333
339 {
344
348 std::vector<std::string> names;
349
354 std::size_t
355 memory_consumption() const;
356 };
357
361 std::vector<DataVector> dof_data;
362
366 std::vector<DataVector> cell_data;
367
373 virtual const std::vector<
376 get_patches() const override;
377
378
383 virtual std::vector<std::string>
384 get_dataset_names() const override;
385};
386
387
389
390#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:502
#define DEAL_II_CXX20_REQUIRES(condition)
Definition config.h:177
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
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:494
#define DeclException1(Exception1, type1, outsequence)
Definition exceptions.h:516
std::size_t memory_consumption() const
std::vector< std::string > names