GRINS-0.7.0
List of all members | Public Member Functions | Protected Attributes
GRINS::CompositeQoI Class Reference

#include <composite_qoi.h>

Inheritance diagram for GRINS::CompositeQoI:
Inheritance graph
[legend]
Collaboration diagram for GRINS::CompositeQoI:
Collaboration graph
[legend]

Public Member Functions

 CompositeQoI ()
 
virtual ~CompositeQoI ()
 
virtual libMesh::UniquePtr< libMesh::DifferentiableQoI > clone ()
 Required to provide clone for adding QoI object to libMesh objects. More...
 
virtual void add_qoi (const QoIBase &qoi)
 
unsigned int n_qois () const
 
void register_parameter (const std::string &param_name, libMesh::ParameterMultiAccessor< libMesh::Number > &param_pointer) const
 Each QoI will register its copy(s) of an independent variable. More...
 
virtual void init (const GetPot &input, const MultiphysicsSystem &system)
 Method to allow QoI to cache any system information needed for QoI calculation, for example, solution variable indices. More...
 
virtual void init_qoi (std::vector< libMesh::Number > &sys_qoi)
 Method to allow QoI to resize libMesh::System storage of QoI computations. More...
 
virtual void init_context (libMesh::DiffContext &context)
 
virtual void element_qoi (libMesh::DiffContext &context, const libMesh::QoISet &qoi_indices)
 Compute the qoi value for element interiors. More...
 
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. More...
 
virtual void side_qoi (libMesh::DiffContext &context, const libMesh::QoISet &qoi_indices)
 Compute the qoi value on the domain boundary. More...
 
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. More...
 
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. More...
 
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. More...
 
void output_qoi (std::ostream &out) const
 Basic output for computed QoI's. More...
 
libMesh::Number get_qoi_value (unsigned int qoi_index) const
 Accessor for value of QoI for given qoi_index. More...
 
const QoIBaseget_qoi (unsigned int qoi_index) const
 

Protected Attributes

std::vector< QoIBase * > _qois
 

Detailed Description

Definition at line 56 of file composite_qoi.h.

Constructor & Destructor Documentation

GRINS::CompositeQoI::CompositeQoI ( )

Definition at line 37 of file composite_qoi.C.

Referenced by clone().

38  : libMesh::DifferentiableQoI()
39  {
40  // We initialize these to false and then reset as needed by each QoI
41  assemble_qoi_sides = false;
42  assemble_qoi_elements = false;
43 
44  return;
45  }
GRINS::CompositeQoI::~CompositeQoI ( )
virtual

Definition at line 47 of file composite_qoi.C.

References _qois.

48  {
49  for( std::vector<QoIBase*>::iterator qoi = _qois.begin();
50  qoi != _qois.end(); ++qoi )
51  {
52  delete (*qoi);
53  }
54 
55  return;
56  }
std::vector< QoIBase * > _qois

Member Function Documentation

void GRINS::CompositeQoI::add_qoi ( const QoIBase qoi)
virtual

Definition at line 70 of file composite_qoi.C.

References _qois, GRINS::QoIBase::assemble_on_interior(), GRINS::QoIBase::assemble_on_sides(), and GRINS::QoIBase::clone().

Referenced by clone().

71  {
72  _qois.push_back( qoi.clone() );
73 
74  if( qoi.assemble_on_interior() )
75  {
76  this->assemble_qoi_elements = true;
77  }
78 
79  if( qoi.assemble_on_sides() )
80  {
81  this->assemble_qoi_sides = true;
82  }
83 
84  return;
85  }
std::vector< QoIBase * > _qois
libMesh::UniquePtr< libMesh::DifferentiableQoI > GRINS::CompositeQoI::clone ( )
virtual

Required to provide clone for adding QoI object to libMesh objects.

Note that we do a deep copy here since the previous object might get destroyed and wipe out the objects being pointed to in _qois.

Definition at line 58 of file composite_qoi.C.

References add_qoi(), CompositeQoI(), get_qoi(), and n_qois().

59  {
61 
62  for( unsigned int q = 0; q < this->n_qois(); q++ )
63  {
64  clone->add_qoi( this->get_qoi(q) );
65  }
66 
67  return libMesh::UniquePtr<libMesh::DifferentiableQoI>(clone);
68  }
const QoIBase & get_qoi(unsigned int qoi_index) const
virtual libMesh::UniquePtr< libMesh::DifferentiableQoI > clone()
Required to provide clone for adding QoI object to libMesh objects.
Definition: composite_qoi.C:58
unsigned int n_qois() const
void GRINS::CompositeQoI::element_qoi ( libMesh::DiffContext &  context,
const libMesh::QoISet &  qoi_indices 
)
virtual

Compute the qoi value for element interiors.

Definition at line 122 of file composite_qoi.C.

References _qois.

124  {
125  AssemblyContext& c = libMesh::libmesh_cast_ref<AssemblyContext&>(context);
126 
127  for( unsigned int q = 0; q < _qois.size(); q++ )
128  {
129  (*_qois[q]).element_qoi(c,q);
130  }
131 
132  return;
133  }
std::vector< QoIBase * > _qois
virtual void element_qoi(libMesh::DiffContext &context, const libMesh::QoISet &qoi_indices)
Compute the qoi value for element interiors.
void GRINS::CompositeQoI::element_qoi_derivative ( libMesh::DiffContext &  context,
const libMesh::QoISet &  qoi_indices 
)
virtual

Compute the qoi derivative with respect to the solution on element interiors.

Definition at line 135 of file composite_qoi.C.

References _qois.

137  {
138  AssemblyContext& c = libMesh::libmesh_cast_ref<AssemblyContext&>(context);
139 
140  for( unsigned int q = 0; q < _qois.size(); q++ )
141  {
142  (*_qois[q]).element_qoi_derivative(c,q);
143  }
144 
145  return;
146  }
std::vector< QoIBase * > _qois
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.
const QoIBase & GRINS::CompositeQoI::get_qoi ( unsigned int  qoi_index) const
inline

Definition at line 144 of file composite_qoi.h.

References _qois, and n_qois().

Referenced by clone(), GRINS::SteadyVisualization::output_adjoint(), and GRINS::UnsteadyVisualization::output_adjoint().

145  {
146  libmesh_assert_less( qoi_index, this->n_qois() );
147 
148  return (*_qois[qoi_index]);
149  }
std::vector< QoIBase * > _qois
unsigned int n_qois() const
libMesh::Number GRINS::CompositeQoI::get_qoi_value ( unsigned int  qoi_index) const

Accessor for value of QoI for given qoi_index.

Definition at line 210 of file composite_qoi.C.

References _qois.

Referenced by GRINS::Simulation::get_qoi_value().

211  {
212  return (*_qois[qoi_index]).value();
213  }
std::vector< QoIBase * > _qois
void GRINS::CompositeQoI::init ( const GetPot &  input,
const MultiphysicsSystem system 
)
virtual

Method to allow QoI to cache any system information needed for QoI calculation, for example, solution variable indices.

Definition at line 94 of file composite_qoi.C.

References _qois.

95  {
96  for( unsigned int q = 0; q < _qois.size(); q++ )
97  _qois[q]->init(input,system,q);
98  }
std::vector< QoIBase * > _qois
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
void GRINS::CompositeQoI::init_context ( libMesh::DiffContext &  context)
virtual

Definition at line 100 of file composite_qoi.C.

References _qois.

101  {
102  AssemblyContext& c = libMesh::libmesh_cast_ref<AssemblyContext&>(context);
103 
104  for( std::vector<QoIBase*>::iterator qoi = _qois.begin();
105  qoi != _qois.end(); ++qoi )
106  {
107  (*qoi)->init_context(c);
108  }
109 
110  return;
111  }
std::vector< QoIBase * > _qois
void GRINS::CompositeQoI::init_qoi ( std::vector< libMesh::Number > &  sys_qoi)
virtual

Method to allow QoI to resize libMesh::System storage of QoI computations.

Definition at line 87 of file composite_qoi.C.

References _qois.

88  {
89  sys_qoi.resize(_qois.size(), 0.0);
90 
91  return;
92  }
std::vector< QoIBase * > _qois
unsigned int GRINS::CompositeQoI::n_qois ( ) const
inline

Definition at line 138 of file composite_qoi.h.

References _qois.

Referenced by clone(), get_qoi(), GRINS::SteadyVisualization::output_adjoint(), and GRINS::UnsteadyVisualization::output_adjoint().

139  {
140  return _qois.size();
141  }
std::vector< QoIBase * > _qois
void GRINS::CompositeQoI::output_qoi ( std::ostream &  out) const

Basic output for computed QoI's.

Definition at line 199 of file composite_qoi.C.

References _qois.

Referenced by GRINS::Solver::print_qoi(), and GRINS::Simulation::run().

200  {
201  for( std::vector<QoIBase*>::const_iterator qoi = _qois.begin();
202  qoi != _qois.end(); ++qoi )
203  {
204  (*qoi)->output_qoi(out);
205  }
206 
207  return;
208  }
std::vector< QoIBase * > _qois
void GRINS::CompositeQoI::parallel_op ( const libMesh::Parallel::Communicator &  communicator,
std::vector< libMesh::Number > &  sys_qoi,
std::vector< libMesh::Number > &  local_qoi,
const libMesh::QoISet &  qoi_indices 
)
virtual

Operation to accumulate the QoI from multiple MPI processes.

Calls each QoI's parallel_op function.

Definition at line 174 of file composite_qoi.C.

References _qois.

178  {
179  for( unsigned int q = 0; q < _qois.size(); q++ )
180  {
181  (*_qois[q]).parallel_op( communicator, sys_qoi[q], local_qoi[q] );
182  }
183 
184  return;
185  }
std::vector< QoIBase * > _qois
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.
void GRINS::CompositeQoI::register_parameter ( const std::string &  param_name,
libMesh::ParameterMultiAccessor< libMesh::Number > &  param_pointer 
) const

Each QoI will register its copy(s) of an independent variable.

Definition at line 114 of file composite_qoi.C.

Referenced by GRINS::ParameterManager::initialize().

117  {
118  for( unsigned int q = 0; q < _qois.size(); q++ )
119  (*_qois[q]).register_parameter(param_name, param_pointer);
120  }
std::vector< QoIBase * > _qois
void GRINS::CompositeQoI::side_qoi ( libMesh::DiffContext &  context,
const libMesh::QoISet &  qoi_indices 
)
virtual

Compute the qoi value on the domain boundary.

Definition at line 148 of file composite_qoi.C.

References _qois.

150  {
151  AssemblyContext& c = libMesh::libmesh_cast_ref<AssemblyContext&>(context);
152 
153  for( unsigned int q = 0; q < _qois.size(); q++ )
154  {
155  (*_qois[q]).side_qoi(c,q);
156  }
157 
158  return;
159  }
std::vector< QoIBase * > _qois
virtual void side_qoi(libMesh::DiffContext &context, const libMesh::QoISet &qoi_indices)
Compute the qoi value on the domain boundary.
void GRINS::CompositeQoI::side_qoi_derivative ( libMesh::DiffContext &  context,
const libMesh::QoISet &  qois 
)
virtual

Compute the qoi derivative with respect to the solution on the domain boundary.

Definition at line 161 of file composite_qoi.C.

References _qois.

163  {
164  AssemblyContext& c = libMesh::libmesh_cast_ref<AssemblyContext&>(context);
165 
166  for( unsigned int q = 0; q < _qois.size(); q++ )
167  {
168  (*_qois[q]).side_qoi_derivative(c,q);
169  }
170 
171  return;
172  }
std::vector< QoIBase * > _qois
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.
void GRINS::CompositeQoI::thread_join ( std::vector< libMesh::Number > &  qoi,
const std::vector< libMesh::Number > &  other_qoi,
const libMesh::QoISet &  qoi_indices 
)
virtual

Operation to accumulate the QoI from multiple MPI processes.

Calls each QoI's thread_join function.

Definition at line 187 of file composite_qoi.C.

References _qois.

190  {
191  for( unsigned int q = 0; q < _qois.size(); q++ )
192  {
193  (*_qois[q]).thread_join( qoi[q], other_qoi[q] );
194  }
195 
196  return;
197  }
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

Member Data Documentation

std::vector<QoIBase*> GRINS::CompositeQoI::_qois
protected

The documentation for this class was generated from the following files:

Generated on Thu Jun 2 2016 21:52:30 for GRINS-0.7.0 by  doxygen 1.8.10