GRINS-0.6.0
composite_qoi.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2015 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef GRINS_COMPOSITE_QOI_H
26 #define GRINS_COMPOSITE_QOI_H
27 
28 // C++
29 #include <vector>
30 #include <ostream>
31 
32 // libMesh
33 #include "libmesh/libmesh_common.h"
34 #include "libmesh/diff_qoi.h"
35 
36 // libMesh forward declarations
37 class GetPot;
38 namespace libMesh
39 {
40  class DiffContext;
41  class QoISet;
42  namespace Parallel
43  {
44  class Communicator;
45  }
46 }
47 
48 // GRINS
49 #include "grins/qoi_base.h"
50 
51 namespace GRINS
52 {
53  // GRINS forward declarations
54  class MultiphysicsSystem;
55 
56  class CompositeQoI : public libMesh::DifferentiableQoI
57  {
58  public:
59  CompositeQoI();
60 
61  virtual ~CompositeQoI();
62 
64 
66  virtual libMesh::AutoPtr<libMesh::DifferentiableQoI> clone();
67 
68  virtual void add_qoi( const QoIBase& qoi );
69 
70  unsigned int n_qois() const;
71 
73  // named in this call.
75  ( const std::string & param_name,
77  const;
78 
83  virtual void init( const GetPot& input, const MultiphysicsSystem& system );
84 
88  virtual void init_qoi( std::vector<libMesh::Number>& sys_qoi );
89 
90  virtual void init_context( libMesh::DiffContext& context );
91 
93  virtual void element_qoi( libMesh::DiffContext& context,
94  const libMesh::QoISet& qoi_indices );
95 
97  virtual void element_qoi_derivative( libMesh::DiffContext &context,
98  const libMesh::QoISet &qoi_indices );
99 
101  virtual void side_qoi( libMesh::DiffContext& context, const libMesh::QoISet& qoi_indices );
102 
104  virtual void side_qoi_derivative( libMesh::DiffContext &context, const libMesh::QoISet &qois );
105 
107 
110  virtual void parallel_op( const libMesh::Parallel::Communicator& communicator,
111  std::vector<libMesh::Number>& sys_qoi,
112  std::vector<libMesh::Number>& local_qoi,
113  const libMesh::QoISet& qoi_indices );
114 
116 
119  virtual void thread_join( std::vector<libMesh::Number>& qoi,
120  const std::vector<libMesh::Number>& other_qoi,
121  const libMesh::QoISet& qoi_indices );
122 
124  void output_qoi( std::ostream& out ) const;
125 
127  libMesh::Number get_qoi_value( unsigned int qoi_index ) const;
128 
129  const QoIBase& get_qoi( unsigned int qoi_index ) const;
130 
131  protected:
132 
133  std::vector<QoIBase*> _qois;
134 
135  };
136 
137  inline
138  unsigned int CompositeQoI::n_qois() const
139  {
140  return _qois.size();
141  }
142 
143  inline
144  const QoIBase& CompositeQoI::get_qoi( unsigned int qoi_index ) const
145  {
146  libmesh_assert_less( qoi_index, this->n_qois() );
147 
148  return (*_qois[qoi_index]);
149  }
150 
151 } // end namespace GRINS
152 
153 #endif // GRINS_COMPOSITE_QOI_H
virtual void thread_join(std::vector< libMesh::Number > &qoi, const std::vector< libMesh::Number > &other_qoi, const libMesh::QoISet &qoi_indices)
Operation to accumulate the QoI from multiple MPI processes.
std::vector< QoIBase * > _qois
virtual void init_context(libMesh::DiffContext &context)
virtual void side_qoi_derivative(libMesh::DiffContext &context, const libMesh::QoISet &qois)
Compute the qoi derivative with respect to the solution on the domain boundary.
const QoIBase & get_qoi(unsigned int qoi_index) const
virtual ~CompositeQoI()
Definition: composite_qoi.C:47
GRINS namespace.
void register_parameter(const std::string &param_name, libMesh::ParameterMultiPointer< libMesh::Number > &param_pointer) const
Each QoI will register its copy(s) of an independent variable.
virtual void side_qoi(libMesh::DiffContext &context, const libMesh::QoISet &qoi_indices)
Compute the qoi value on the domain boundary.
virtual void element_qoi(libMesh::DiffContext &context, const libMesh::QoISet &qoi_indices)
Compute the qoi value for element interiors.
virtual void init_qoi(std::vector< libMesh::Number > &sys_qoi)
Method to allow QoI to resize libMesh::System storage of QoI computations.
Definition: composite_qoi.C:87
virtual void parallel_op(const libMesh::Parallel::Communicator &communicator, std::vector< libMesh::Number > &sys_qoi, std::vector< libMesh::Number > &local_qoi, const libMesh::QoISet &qoi_indices)
Operation to accumulate the QoI from multiple MPI processes.
Interface with libMesh for solving Multiphysics problems.
virtual void add_qoi(const QoIBase &qoi)
Definition: composite_qoi.C:70
void output_qoi(std::ostream &out) const
Basic output for computed QoI's.
virtual void init(const GetPot &input, const MultiphysicsSystem &system)
Method to allow QoI to cache any system information needed for QoI calculation, for example...
Definition: composite_qoi.C:94
virtual void element_qoi_derivative(libMesh::DiffContext &context, const libMesh::QoISet &qoi_indices)
Compute the qoi derivative with respect to the solution on element interiors.
virtual libMesh::AutoPtr< libMesh::DifferentiableQoI > clone()
Required to provide clone for adding QoI object to libMesh objects.
Definition: composite_qoi.C:58
libMesh::Number get_qoi_value(unsigned int qoi_index) const
Accessor for value of QoI for given qoi_index.
unsigned int n_qois() const

Generated on Mon Jun 22 2015 21:32:20 for GRINS-0.6.0 by  doxygen 1.8.9.1