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_postprocessor.cc
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2007 - 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
17
19
20
21
23{
24 template <int spacedim>
26 : face_number(numbers::invalid_unsigned_int)
27 {}
28
29
30
31 template <int spacedim>
32 unsigned int
34 {
35 Assert(
36 face_number != numbers::invalid_unsigned_int,
38 "This function can only be called if set_cell_and_face() has "
39 "previously been called. Typically, this would be by using DataOutFaces "
40 "or a related class."));
41 return face_number;
42 }
43} // namespace DataPostprocessorInputs
44
45// -------------------------- DataPostprocessor ---------------------------
46
47template <int dim>
48void
51 std::vector<Vector<double>> &) const
52{
54}
55
56
57
58template <int dim>
59void
62 std::vector<Vector<double>> &) const
63{
65}
66
67
68
69template <int dim>
70std::vector<DataComponentInterpretation::DataComponentInterpretation>
72{
73 // default implementation assumes that all
74 // components are independent scalars
75 return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
77}
78
79
80// -------------------- DataPostprocessorScalar -------------------------
81
82template <int dim>
84 const std::string &name,
85 const UpdateFlags update_flags)
86 : name(name)
87 , update_flags(update_flags)
88{}
89
90
91
92template <int dim>
93std::vector<std::string>
95{
96 return std::vector<std::string>(1, name);
97}
98
99
100
101template <int dim>
102std::vector<DataComponentInterpretation::DataComponentInterpretation>
104{
105 return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
107}
108
109
110template <int dim>
113{
114 return update_flags;
115}
116
117
118
119// ------------------------- DataPostprocessorVector ------------------------
120
121template <int dim>
123 const std::string &name,
124 const UpdateFlags update_flags)
125 : name(name)
126 , update_flags(update_flags)
127{}
128
129
130
131template <int dim>
132std::vector<std::string>
134{
135 return std::vector<std::string>(dim, name);
136}
137
138
139
140template <int dim>
141std::vector<DataComponentInterpretation::DataComponentInterpretation>
143{
144 return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
146}
147
148
149template <int dim>
152{
153 return update_flags;
154}
155
156
157
158// ------------------------- DataPostprocessorTensor ------------------------
159
160template <int dim>
162 const std::string &name,
163 const UpdateFlags update_flags)
164 : name(name)
165 , update_flags(update_flags)
166{}
167
168
169
170template <int dim>
171std::vector<std::string>
173{
174 return std::vector<std::string>(dim * dim, name);
175}
176
177
178
179template <int dim>
180std::vector<DataComponentInterpretation::DataComponentInterpretation>
182{
183 return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
185}
186
187
188template <int dim>
191{
192 return update_flags;
193}
194
195
196
197namespace DataPostprocessors
198{
199 template <int dim>
201 : DataPostprocessorScalar<dim>("boundary_id", update_default)
202 {}
203
204
205 template <int dim>
206 void
209 std::vector<Vector<double>> & computed_quantities) const
210 {
211 AssertDimension(computed_quantities.size(), inputs.solution_values.size());
212
213 const typename DoFHandler<dim>::active_cell_iterator cell =
214 inputs.template get_cell<dim>();
215 const unsigned int face = inputs.get_face_number();
216
217 for (auto &output : computed_quantities)
218 {
219 AssertDimension(output.size(), 1);
220
221 // By default, DataOutFaces is only run on faces at the boundary of the
222 // domain. But one can instruct it to also run on internal faces, and in
223 // that case we cannot ask for the boundary id. Rather, we output -1, as
224 // described in the documentation.
225 if (cell->at_boundary(face))
226 output(0) = cell->face(face)->boundary_id();
227 else
228 output(0) = -1;
229 }
230 }
231} // namespace DataPostprocessors
232
233
234
235// explicit instantiation
236#include "data_postprocessor.inst"
237
238
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:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
#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:213
std::vector< double > solution_values