Reference documentation for deal.II version 9.4.1
\(\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 - 2022 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// -------------------------
121
122template <int dim>
124 const std::string &name,
125 const UpdateFlags update_flags)
126 : name(name)
127 , update_flags(update_flags)
128{}
129
130
131
132template <int dim>
133std::vector<std::string>
135{
136 return std::vector<std::string>(dim, name);
137}
138
139
140
141template <int dim>
142std::vector<DataComponentInterpretation::DataComponentInterpretation>
144{
145 return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
147}
148
149
150template <int dim>
153{
154 return update_flags;
155}
156
157
158
159// -------------------------- DataPostprocessorTensor
160// -------------------------
161
162template <int dim>
164 const std::string &name,
165 const UpdateFlags update_flags)
166 : name(name)
167 , update_flags(update_flags)
168{}
169
170
171
172template <int dim>
173std::vector<std::string>
175{
176 return std::vector<std::string>(dim * dim, name);
177}
178
179
180
181template <int dim>
182std::vector<DataComponentInterpretation::DataComponentInterpretation>
184{
185 return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
187}
188
189
190template <int dim>
193{
194 return update_flags;
195}
196
197
198
199namespace DataPostprocessors
200{
201 template <int dim>
204 {}
205
206
207 template <int dim>
208 void
211 std::vector<Vector<double>> & computed_quantities) const
212 {
213 AssertDimension(computed_quantities.size(), inputs.solution_values.size());
214
215 const typename DoFHandler<dim>::active_cell_iterator cell =
216 inputs.template get_cell<dim>();
217 const unsigned int face = inputs.get_face_number();
218
219 for (auto &output : computed_quantities)
220 {
221 AssertDimension(output.size(), 1);
222
223 // By default, DataOutFaces is only run on faces at the boundary of the
224 // domain. But one can instruct it to also run on internal faces, and in
225 // that case we cannot ask for the boundary id. Rather, we output -1, as
226 // described in the documentation.
227 if (cell->at_boundary(face))
228 output(0) = cell->face(face)->boundary_id();
229 else
230 output(0) = -1;
231 }
232 }
233} // namespace DataPostprocessors
234
235
236
237// explicit instantiation
238#include "data_postprocessor.inst"
239
240
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
Definition: vector.h:109
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
UpdateFlags
@ update_quadrature_points
Transformed quadrature points.
#define Assert(cond, exc)
Definition: exceptions.h:1473
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1667
static ::ExceptionBase & ExcPureFunctionCalled()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
Definition: exceptions.h:1583
typename ActiveSelector::active_cell_iterator active_cell_iterator
Definition: dof_handler.h:438
static const unsigned int invalid_unsigned_int
Definition: types.h:201
std::vector< double > solution_values