deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+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: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 1999 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_data_out_stack_h
14#define dealii_data_out_stack_h
15
16
17#include <deal.II/base/config.h>
18
21
22#include <deal.II/lac/vector.h>
23
25
26#include <string>
27#include <vector>
28
30
31// Forward declaration
32#ifndef DOXYGEN
33template <int dim, int spacedim>
35class DoFHandler;
36#endif
37
112template <int dim, int spacedim = dim>
113class DataOutStack : public DataOutInterface<dim + 1, spacedim + 1>
114{
115 static_assert(dim < 3,
116 "Because this class stacks data into the (dim+1)st "
117 "dimension to create graphical output, it only works for "
118 "dim<3.");
119 static_assert(dim == spacedim,
120 "This class is not implemented for dim != spacedim.");
121
122public:
126 static constexpr int patch_dim = dim + 1;
127 static constexpr int patch_spacedim = spacedim + 1;
128
144
148 virtual ~DataOutStack() override = default;
149
156 void
157 new_parameter_value(const double parameter_value,
158 const double parameter_step);
159
167 void
169
178 void
179 declare_data_vector(const std::string &name, const VectorType vector_type);
180
192 void
193 declare_data_vector(const std::vector<std::string> &name,
194 const VectorType vector_type);
195
196
216 template <typename number>
217 void
218 add_data_vector(const Vector<number> &vec, const std::string &name);
219
238 template <typename number>
239 void
241 const std::vector<std::string> &names);
242
258 void
259 build_patches(const unsigned int n_subdivisions = 0);
260
267 void
269
274 std::size_t
275 memory_consumption() const;
276
282 std::string,
283 << "The data vector for which the first component has the name " << arg1
284 << " has not been added before.");
289 "You cannot start a new time/parameter step before calling "
290 "finish_parameter_value() on the previous step.");
296 "You cannot declare additional vectors after already calling "
297 "build_patches(). All data vectors need to be declared "
298 "before you call this function the first time.");
303 std::string,
304 << "You tried to declare a component of a data vector with "
305 << "the name <" << arg1
306 << ">, but that name is already used.");
307
308private:
312 double parameter;
313
319
326
330 std::vector<::DataOutBase::Patch<patch_dim, patch_spacedim>> patches;
331
337 {
342
346 std::vector<std::string> names;
347
352 std::size_t
353 memory_consumption() const;
354 };
355
359 std::vector<DataVector> dof_data;
360
364 std::vector<DataVector> cell_data;
365
371 virtual const std::vector<
374 get_patches() const override;
375
376
381 virtual std::vector<std::string>
382 get_dataset_names() const override;
383};
384
385
387
388#endif
std::size_t memory_consumption() const
ObserverPointer< const DoFHandler< dim, spacedim >, DataOutStack< dim, spacedim > > dof_handler
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
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:38
#define DEAL_II_CXX20_REQUIRES(condition)
Definition config.h:249
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
static ::ExceptionBase & ExcDataNotCleared()
static ::ExceptionBase & ExcDataAlreadyAdded()
static ::ExceptionBase & ExcVectorNotDeclared(std::string arg1)
static ::ExceptionBase & ExcNameAlreadyUsed(std::string arg1)
#define DeclExceptionMsg(Exception, defaulttext)
#define DeclException1(Exception1, type1, outsequence)
std::size_t memory_consumption() const
std::vector< std::string > names