Reference documentation for deal.II version GIT relicensing-487-ge9eb5ab491 2024-04-25 07:20: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_postprocessor.cc
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2007 - 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
16
18
19
20
22{
23 template <int spacedim>
25 : face_number(numbers::invalid_unsigned_int)
26 {}
27
28
29
30 template <int spacedim>
31 unsigned int
33 {
34 Assert(
35 face_number != numbers::invalid_unsigned_int,
37 "This function can only be called if set_cell_and_face() has "
38 "previously been called. Typically, this would be by using DataOutFaces "
39 "or a related class."));
40 return face_number;
41 }
42} // namespace DataPostprocessorInputs
43
44// -------------------------- DataPostprocessor ---------------------------
45
46template <int dim>
47void
54
55
56
57template <int dim>
58void
65
66
67
68template <int dim>
69std::vector<DataComponentInterpretation::DataComponentInterpretation>
71{
72 // default implementation assumes that all
73 // components are independent scalars
74 return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
76}
77
78
79// -------------------- DataPostprocessorScalar -------------------------
80
81template <int dim>
83 const std::string &name,
84 const UpdateFlags update_flags)
85 : name(name)
86 , update_flags(update_flags)
87{}
88
89
90
91template <int dim>
92std::vector<std::string>
94{
95 return std::vector<std::string>(1, name);
96}
97
98
99
100template <int dim>
101std::vector<DataComponentInterpretation::DataComponentInterpretation>
103{
104 return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
106}
107
108
109template <int dim>
112{
113 return update_flags;
114}
115
116
117
118// ------------------------- DataPostprocessorVector ------------------------
119
120template <int dim>
122 const std::string &name,
123 const UpdateFlags update_flags)
124 : name(name)
125 , update_flags(update_flags)
126{}
127
128
129
130template <int dim>
131std::vector<std::string>
133{
134 return std::vector<std::string>(dim, name);
135}
136
137
138
139template <int dim>
140std::vector<DataComponentInterpretation::DataComponentInterpretation>
142{
143 return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
145}
146
147
148template <int dim>
151{
152 return update_flags;
153}
154
155
156
157// ------------------------- DataPostprocessorTensor ------------------------
158
159template <int dim>
161 const std::string &name,
162 const UpdateFlags update_flags)
163 : name(name)
164 , update_flags(update_flags)
165{}
166
167
168
169template <int dim>
170std::vector<std::string>
172{
173 return std::vector<std::string>(dim * dim, name);
174}
175
176
177
178template <int dim>
179std::vector<DataComponentInterpretation::DataComponentInterpretation>
181{
182 return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
184}
185
186
187template <int dim>
190{
191 return update_flags;
192}
193
194
195
196namespace DataPostprocessors
197{
198 template <int dim>
202
203
204 template <int dim>
205 void
208 std::vector<Vector<double>> &computed_quantities) const
209 {
210 AssertDimension(computed_quantities.size(), inputs.solution_values.size());
211
212 const typename DoFHandler<dim>::active_cell_iterator cell =
213 inputs.template get_cell<dim>();
214 const unsigned int face = inputs.get_face_number();
215
216 for (auto &output : computed_quantities)
217 {
218 AssertDimension(output.size(), 1);
219
220 // By default, DataOutFaces is only run on faces at the boundary of the
221 // domain. But one can instruct it to also run on internal faces, and in
222 // that case we cannot ask for the boundary id. Rather, we output -1, as
223 // described in the documentation.
224 if (cell->at_boundary(face))
225 output(0) = cell->face(face)->boundary_id();
226 else
227 output(0) = -1;
228 }
229 }
230} // namespace DataPostprocessors
231
232
233
234// explicit instantiation
235#include "data_postprocessor.inst"
236
237
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:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
#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.
static const unsigned int invalid_unsigned_int
Definition types.h:220
std::vector< double > solution_values