deal.II version GIT relicensing-6809-ge913b9bb34 2026-09-25 17: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_postprocessor.cc
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) 2007 - 2025 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
14
16
17
18
20{
21 template <int spacedim>
23 : face_number(numbers::invalid_unsigned_int)
24 {}
25
26
27
28 template <int spacedim>
29 unsigned int
31 {
32 Assert(
33 face_number != numbers::invalid_unsigned_int,
35 "This function can only be called if set_cell_and_face() has "
36 "previously been called. Typically, this would be by using DataOutFaces "
37 "or a related class."));
38 return face_number;
39 }
40} // namespace DataPostprocessorInputs
41
42// -------------------------- DataPostprocessor ---------------------------
43
44template <int dim>
45void
52
53
54
55template <int dim>
56void
63
64
65
66template <int dim>
67std::vector<DataComponentInterpretation::DataComponentInterpretation>
69{
70 // default implementation assumes that all
71 // components are independent scalars
72 return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
74}
75
76
77// -------------------- DataPostprocessorScalar -------------------------
78
79template <int dim>
81 const std::string &name,
82 const UpdateFlags update_flags)
83 : name(name)
84 , update_flags(update_flags)
85{}
86
87
88
89template <int dim>
90std::vector<std::string>
92{
93 return std::vector<std::string>(1, name);
94}
95
96
97
98template <int dim>
99std::vector<DataComponentInterpretation::DataComponentInterpretation>
101{
102 return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
104}
105
106
107template <int dim>
110{
111 return update_flags;
112}
113
114
115
116// ------------------------- DataPostprocessorVector ------------------------
117
118template <int dim>
120 const std::string &name,
121 const UpdateFlags update_flags)
122 : name(name)
123 , update_flags(update_flags)
124{}
125
126
127
128template <int dim>
129std::vector<std::string>
131{
132 return std::vector<std::string>(dim, name);
133}
134
135
136
137template <int dim>
138std::vector<DataComponentInterpretation::DataComponentInterpretation>
140{
141 return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
143}
144
145
146template <int dim>
149{
150 return update_flags;
151}
152
153
154
155// ------------------------- DataPostprocessorTensor ------------------------
156
157template <int dim>
159 const std::string &name,
160 const UpdateFlags update_flags)
161 : name(name)
162 , update_flags(update_flags)
163{}
164
165
166
167template <int dim>
168std::vector<std::string>
170{
171 return std::vector<std::string>(dim * dim, name);
172}
173
174
175
176template <int dim>
177std::vector<DataComponentInterpretation::DataComponentInterpretation>
179{
180 return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
182}
183
184
185template <int dim>
188{
189 return update_flags;
190}
191
192
193
194namespace DataPostprocessors
195{
196 template <int dim>
200
201
202 template <int dim>
203 void
206 std::vector<Vector<double>> &computed_quantities) const
207 {
208 AssertDimension(computed_quantities.size(), inputs.solution_values.size());
209
210 const typename DoFHandler<dim>::active_cell_iterator cell =
211 inputs.template get_cell<dim>();
212 const unsigned int face = inputs.get_face_number();
213
214 for (auto &output : computed_quantities)
215 {
216 AssertDimension(output.size(), 1);
217
218 // By default, DataOutFaces is only run on faces at the boundary of the
219 // domain. But one can instruct it to also run on internal faces, and in
220 // that case we cannot ask for the boundary id. Rather, we output -1, as
221 // described in the documentation.
222 if (cell->at_boundary(face))
223 output(0) = cell->face(face)->boundary_id();
224 else
225 output(0) = -1;
226 }
227 }
228} // namespace DataPostprocessors
229
230
231
232// explicit instantiation
233#include "numerics/data_postprocessor.inst"
234
235
DataPostprocessorScalar(const std::string &name, const UpdateFlags update_flags)
virtual std::vector< std::string > get_names() const override
virtual UpdateFlags get_needed_update_flags() const override
virtual std::vector< DataComponentInterpretation::DataComponentInterpretation > get_data_component_interpretation() const override
DataPostprocessorTensor(const std::string &name, const UpdateFlags update_flags)
virtual std::vector< std::string > get_names() const override
virtual std::vector< DataComponentInterpretation::DataComponentInterpretation > get_data_component_interpretation() const override
virtual UpdateFlags get_needed_update_flags() const override
virtual std::vector< std::string > get_names() const override
virtual UpdateFlags get_needed_update_flags() const override
DataPostprocessorVector(const std::string &name, const UpdateFlags update_flags)
virtual std::vector< DataComponentInterpretation::DataComponentInterpretation > get_data_component_interpretation() const override
virtual void evaluate_vector_field(const DataPostprocessorInputs::Vector< dim > &input_data, std::vector< Vector< double > > &computed_quantities) const
virtual void evaluate_scalar_field(const DataPostprocessorInputs::Scalar< dim > &input_data, std::vector< Vector< double > > &computed_quantities) const
virtual std::vector< DataComponentInterpretation::DataComponentInterpretation > get_data_component_interpretation() const
virtual void evaluate_scalar_field(const DataPostprocessorInputs::Scalar< dim > &inputs, std::vector< Vector< double > > &computed_quantities) const override
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcPureFunctionCalled()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
typename ActiveSelector::active_cell_iterator active_cell_iterator
UpdateFlags
@ update_default
No update.
std::size_t size
Definition mpi.cc:733
constexpr unsigned int invalid_unsigned_int
Definition types.h:228
std::vector< double > solution_values