Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
data_postprocessor.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2007 - 2018 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 
16 #include <deal.II/numerics/data_postprocessor.h>
17 
18 DEAL_II_NAMESPACE_OPEN
19 
20 
21 
22 // -------------------------- DataPostprocessor ---------------------------
23 
24 template <int dim>
25 void
28  std::vector<Vector<double>> &) const
29 {
31 }
32 
33 
34 
35 template <int dim>
36 void
39  std::vector<Vector<double>> &) const
40 {
42 }
43 
44 
45 
46 template <int dim>
47 std::vector<DataComponentInterpretation::DataComponentInterpretation>
49 {
50  // default implementation assumes that all
51  // components are independent scalars
52  return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
54 }
55 
56 
57 // -------------------------- DataPostprocessorScalar -------------------------
58 
59 template <int dim>
61  const std::string &name,
62  const UpdateFlags update_flags)
63  : name(name)
64  , update_flags(update_flags)
65 {}
66 
67 
68 
69 template <int dim>
70 std::vector<std::string>
72 {
73  return std::vector<std::string>(1, name);
74 }
75 
76 
77 
78 template <int dim>
79 std::vector<DataComponentInterpretation::DataComponentInterpretation>
81 {
82  return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
84 }
85 
86 
87 template <int dim>
90 {
91  return update_flags;
92 }
93 
94 
95 
96 // -------------------------- DataPostprocessorVector -------------------------
97 
98 template <int dim>
100  const std::string &name,
101  const UpdateFlags update_flags)
102  : name(name)
103  , update_flags(update_flags)
104 {}
105 
106 
107 
108 template <int dim>
109 std::vector<std::string>
111 {
112  return std::vector<std::string>(dim, name);
113 }
114 
115 
116 
117 template <int dim>
118 std::vector<DataComponentInterpretation::DataComponentInterpretation>
120 {
121  return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
123 }
124 
125 
126 template <int dim>
129 {
130  return update_flags;
131 }
132 
133 
134 
135 // -------------------------- DataPostprocessorTensor -------------------------
136 
137 template <int dim>
139  const std::string &name,
140  const UpdateFlags update_flags)
141  : name(name)
142  , update_flags(update_flags)
143 {}
144 
145 
146 
147 template <int dim>
148 std::vector<std::string>
150 {
151  static_assert(dim <= 3,
152  "The following variable needs to be expanded for dim>3");
153  static const char suffixes[] = {'x', 'y', 'z'};
154 
155  std::vector<std::string> names;
156  for (unsigned int d = 0; d < dim; ++d)
157  for (unsigned int e = 0; e < dim; ++e)
158  names.push_back(name + '_' + suffixes[d] + suffixes[e]);
159  return names;
160 }
161 
162 
163 
164 template <int dim>
165 std::vector<DataComponentInterpretation::DataComponentInterpretation>
167 {
168  return std::vector<DataComponentInterpretation::DataComponentInterpretation>(
170 }
171 
172 
173 template <int dim>
176 {
177  return update_flags;
178 }
179 
180 
181 
182 // explicit instantiation
183 #include "data_postprocessor.inst"
184 
185 
186 DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcPureFunctionCalled()
virtual std::vector< std::string > get_names() const override
DataPostprocessorTensor(const std::string &name, const UpdateFlags update_flags)
virtual std::vector< std::string > get_names() const override
virtual std::vector< std::string > get_names() const override
virtual UpdateFlags get_needed_update_flags() const override
virtual void evaluate_vector_field(const DataPostprocessorInputs::Vector< dim > &input_data, std::vector< Vector< double >> &computed_quantities) const
#define AssertThrow(cond, exc)
Definition: exceptions.h:1519
DataPostprocessorScalar(const std::string &name, const UpdateFlags update_flags)
virtual std::vector< DataComponentInterpretation::DataComponentInterpretation > get_data_component_interpretation() const override
UpdateFlags
virtual std::vector< DataComponentInterpretation::DataComponentInterpretation > get_data_component_interpretation() const override
virtual std::vector< DataComponentInterpretation::DataComponentInterpretation > get_data_component_interpretation() const override
virtual void evaluate_scalar_field(const DataPostprocessorInputs::Scalar< dim > &input_data, std::vector< Vector< double >> &computed_quantities) const
DataPostprocessorVector(const std::string &name, const UpdateFlags update_flags)
virtual UpdateFlags get_needed_update_flags() const override
virtual std::vector< DataComponentInterpretation::DataComponentInterpretation > get_data_component_interpretation() const
virtual UpdateFlags get_needed_update_flags() const override