Reference documentation for deal.II version 8.5.1
data_postprocessor.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2007 - 2016 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 at
12 // the top level of the deal.II distribution.
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>
26 {}
27 
28 
29 
30 template <int dim>
31 void
34  std::vector<Vector<double> > &computed_quantities) const
35 {
36  // for backward compatibility, call the old function.
37  // this also requires converting the accidental use
38  // of Point<dim> for normal vectors
39  std::vector<Point<dim> > normals (inputs.normals.begin(),
40  inputs.normals.end());
41  compute_derived_quantities_scalar(inputs.solution_values,
42  inputs.solution_gradients,
43  inputs.solution_hessians,
44  normals,
45  inputs.evaluation_points,
46  computed_quantities);
47 }
48 
49 
50 
51 template <int dim>
52 void
54 compute_derived_quantities_scalar (const std::vector<double> &/*solution_values*/,
55  const std::vector<Tensor<1,dim> > &/*solution_gradients*/,
56  const std::vector<Tensor<2,dim> > &/*solution_hessians*/,
57  const std::vector<Point<dim> > &/*normals*/,
58  const std::vector<Point<dim> > &/*evaluation_points*/,
59  std::vector<Vector<double> > &computed_quantities) const
60 {
61  computed_quantities.clear();
63 }
64 
65 
66 
67 template <int dim>
68 void
71  std::vector<Vector<double> > &computed_quantities) const
72 {
73  // for backward compatibility, call the old function.
74  // this also requires converting the accidental use
75  // of Point<dim> for normal vectors
76  std::vector<Point<dim> > normals (inputs.normals.begin(),
77  inputs.normals.end());
78  compute_derived_quantities_vector(inputs.solution_values,
79  inputs.solution_gradients,
80  inputs.solution_hessians,
81  normals,
82  inputs.evaluation_points,
83  computed_quantities);
84 }
85 
86 
87 
88 template <int dim>
89 void
91 compute_derived_quantities_vector (const std::vector<Vector<double> > &/*solution_values*/,
92  const std::vector<std::vector<Tensor<1,dim> > > &/*solution_gradients*/,
93  const std::vector<std::vector<Tensor<2,dim> > > &/*solution_hessians*/,
94  const std::vector<Point<dim> > &/*normals*/,
95  const std::vector<Point<dim> > &/*evaluation_points*/,
96  std::vector<Vector<double> > &computed_quantities) const
97 {
98  computed_quantities.clear();
100 }
101 
102 
103 
104 template <int dim>
105 std::vector<DataComponentInterpretation::DataComponentInterpretation>
107 {
108  // default implementation assumes that all
109  // components are independent scalars
110  return
111  std::vector<DataComponentInterpretation::DataComponentInterpretation>
112  (get_names().size(),
114 }
115 
116 
117 // -------------------------- DataPostprocessorScalar ---------------------------
118 
119 template <int dim>
121 DataPostprocessorScalar (const std::string &name,
122  const UpdateFlags update_flags)
123  :
124  name (name),
125  update_flags (update_flags)
126 {}
127 
128 
129 
130 template <int dim>
131 std::vector<std::string>
133 get_names () const
134 {
135  return std::vector<std::string> (1, name);
136 }
137 
138 
139 
140 template <int dim>
141 std::vector<DataComponentInterpretation::DataComponentInterpretation>
144 {
145  return
146  std::vector<DataComponentInterpretation::DataComponentInterpretation>
148 }
149 
150 
151 template <int dim>
155 {
156  return update_flags;
157 }
158 
159 
160 
161 // -------------------------- DataPostprocessorVector ---------------------------
162 
163 template <int dim>
165 DataPostprocessorVector (const std::string &name,
166  const UpdateFlags update_flags)
167  :
168  name (name),
169  update_flags (update_flags)
170 {}
171 
172 
173 
174 template <int dim>
175 std::vector<std::string>
177 get_names () const
178 {
179  return std::vector<std::string> (dim, name);
180 }
181 
182 
183 
184 template <int dim>
185 std::vector<DataComponentInterpretation::DataComponentInterpretation>
188 {
189  return
190  std::vector<DataComponentInterpretation::DataComponentInterpretation>
192 }
193 
194 
195 template <int dim>
199 {
200  return update_flags;
201 }
202 
203 
204 // explicit instantiation
205 #include "data_postprocessor.inst"
206 
207 
208 DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcPureFunctionCalled()
virtual void evaluate_vector_field(const DataPostprocessorInputs::Vector< dim > &input_data, std::vector< Vector< double > > &computed_quantities) const
std::vector< std::vector< Tensor< 2, spacedim > > > solution_hessians
virtual void evaluate_scalar_field(const DataPostprocessorInputs::Scalar< dim > &input_data, std::vector< Vector< double > > &computed_quantities) const
std::vector< double > solution_values
virtual std::vector< DataComponentInterpretation::DataComponentInterpretation > get_data_component_interpretation() const
#define AssertThrow(cond, exc)
Definition: exceptions.h:369
DataPostprocessorScalar(const std::string &name, const UpdateFlags update_flags)
virtual UpdateFlags get_needed_update_flags() const
UpdateFlags
std::vector< std::vector< Tensor< 1, spacedim > > > solution_gradients
std::vector< Tensor< 2, spacedim > > solution_hessians
virtual std::vector< std::string > get_names() const
virtual void compute_derived_quantities_scalar(const std::vector< double > &solution_values, const std::vector< Tensor< 1, dim > > &solution_gradients, const std::vector< Tensor< 2, dim > > &solution_hessians, const std::vector< Point< dim > > &normals, const std::vector< Point< dim > > &evaluation_points, std::vector< Vector< double > > &computed_quantities) const 1
std::vector< Tensor< 1, spacedim > > solution_gradients
virtual std::vector< std::string > get_names() const
virtual UpdateFlags get_needed_update_flags() const
std::vector< Point< spacedim > > evaluation_points
virtual void compute_derived_quantities_vector(const std::vector< Vector< double > > &solution_values, const std::vector< std::vector< Tensor< 1, dim > > > &solution_gradients, const std::vector< std::vector< Tensor< 2, dim > > > &solution_hessians, const std::vector< Point< dim > > &normals, const std::vector< Point< dim > > &evaluation_points, std::vector< Vector< double > > &computed_quantities) const 1
DataPostprocessorVector(const std::string &name, const UpdateFlags update_flags)
virtual std::vector< DataComponentInterpretation::DataComponentInterpretation > get_data_component_interpretation() const
virtual std::vector< DataComponentInterpretation::DataComponentInterpretation > get_data_component_interpretation() const
std::vector< Tensor< 1, spacedim > > normals
std::vector<::Vector< double > > solution_values