libMesh
diff_qoi.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_DIFF_QOI_H
21 #define LIBMESH_DIFF_QOI_H
22 
23 // Local Includes
24 #include "libmesh/diff_context.h"
25 
26 // C++ includes
27 #include <memory>
28 
29 namespace libMesh
30 {
31 
32 // Forward declarations
33 class DiffContext;
34 class QoISet;
35 
36 namespace Parallel {
37  class Communicator;
38 }
39 
53 {
54 public:
55 
61 
65  virtual ~DifferentiableQoI () {}
66 
71  virtual void init_qoi( std::vector<Number> & /*sys_qoi*/){}
72 
77  virtual void clear_qoi () {}
78 
86 
94 
102 
110  virtual void element_qoi (DiffContext &,
111  const QoISet &)
112  {}
113 
123  const QoISet &)
124  {}
125 
133  virtual void side_qoi (DiffContext &,
134  const QoISet &)
135  {}
136 
146  const QoISet &)
147  {}
148 
155  virtual void init_context(DiffContext &) {}
156 
160  virtual std::unique_ptr<DifferentiableQoI> clone() =0;
161 
165  virtual void thread_join(std::vector<Number> & qoi,
166  const std::vector<Number> & other_qoi,
167  const QoISet & qoi_indices);
168 
173  virtual void parallel_op(const Parallel::Communicator & communicator,
174  std::vector<Number> & sys_qoi,
175  std::vector<Number> & local_qoi,
176  const QoISet & qoi_indices);
177 
182  virtual void finalize_derivative(NumericVector<Number> & derivatives, std::size_t qoi_index);
183 };
184 
185 } // namespace libMesh
186 
187 
188 #endif // LIBMESH_DIFF_QOI_H
libMesh::DifferentiableQoI::side_qoi
virtual void side_qoi(DiffContext &, const QoISet &)
Does any work that needs to be done on side of elem in a quantity of interest assembly loop,...
Definition: diff_qoi.h:133
libMesh::DifferentiableQoI::thread_join
virtual void thread_join(std::vector< Number > &qoi, const std::vector< Number > &other_qoi, const QoISet &qoi_indices)
Method to combine thread-local qois.
Definition: diff_qoi.C:33
libMesh::DifferentiableQoI::assemble_qoi_elements
bool assemble_qoi_elements
If assemble_qoi_elements is false (it is true by default), the assembly loop for a quantity of intere...
Definition: diff_qoi.h:101
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::DifferentiableQoI::clear_qoi
virtual void clear_qoi()
Clear all the data structures associated with the QoI.
Definition: diff_qoi.h:77
libMesh::DifferentiableQoI::assemble_qoi_internal_sides
bool assemble_qoi_internal_sides
If assemble_qoi_internal_sides is true (it is false by default), the assembly loop for a quantity of ...
Definition: diff_qoi.h:93
libMesh::NumericVector< Number >
libMesh::DifferentiableQoI::DifferentiableQoI
DifferentiableQoI()
Constructor.
Definition: diff_qoi.C:26
libMesh::DifferentiableQoI
This class provides a specific system class.
Definition: diff_qoi.h:52
libMesh::DifferentiableQoI::init_context
virtual void init_context(DiffContext &)
Prepares the result of a build_context() call for use.
Definition: diff_qoi.h:155
libMesh::DifferentiableQoI::init_qoi
virtual void init_qoi(std::vector< Number > &)
Initialize system qoi.
Definition: diff_qoi.h:71
libMesh::QoISet
Data structure for specifying which Quantities of Interest should be calculated in an adjoint or a pa...
Definition: qoi_set.h:45
libMesh::DifferentiableQoI::element_qoi_derivative
virtual void element_qoi_derivative(DiffContext &, const QoISet &)
Does any work that needs to be done on elem in a quantity of interest derivative assembly loop,...
Definition: diff_qoi.h:122
libMesh::DifferentiableQoI::element_qoi
virtual void element_qoi(DiffContext &, const QoISet &)
Does any work that needs to be done on elem in a quantity of interest assembly loop,...
Definition: diff_qoi.h:110
libMesh::DifferentiableQoI::finalize_derivative
virtual void finalize_derivative(NumericVector< Number > &derivatives, std::size_t qoi_index)
Method to finalize qoi derivatives which require more than just a simple sum of element contributions...
Definition: diff_qoi.C:53
libMesh::DifferentiableQoI::side_qoi_derivative
virtual void side_qoi_derivative(DiffContext &, const QoISet &)
Does any work that needs to be done on side of elem in a quantity of interest derivative assembly loo...
Definition: diff_qoi.h:145
libMesh::DiffContext
This class provides all data required for a physics package (e.g.
Definition: diff_context.h:55
libMesh::DifferentiableQoI::assemble_qoi_sides
bool assemble_qoi_sides
If assemble_qoi_sides is true (it is false by default), the assembly loop for a quantity of interest ...
Definition: diff_qoi.h:85
libMesh::DifferentiableQoI::parallel_op
virtual void parallel_op(const Parallel::Communicator &communicator, std::vector< Number > &sys_qoi, std::vector< Number > &local_qoi, const QoISet &qoi_indices)
Method to populate system qoi data structure with process-local qoi.
Definition: diff_qoi.C:41
libMesh::DifferentiableQoI::~DifferentiableQoI
virtual ~DifferentiableQoI()
Destructor.
Definition: diff_qoi.h:65
libMesh::DifferentiableQoI::clone
virtual std::unique_ptr< DifferentiableQoI > clone()=0
Copy of this object.