GRINS-0.8.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 reinit (MultiphysicsSystem &system)
 Reinitialize qoi. More...
 
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
 
QoIBaseget_qoi (unsigned int qoi_index)
 Non-const version needed for reinit() More...
 

Protected Attributes

std::vector< QoIBase * > _qois
 

Detailed Description

Definition at line 57 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(), and GRINSTesting::IntegratedFunctionTest::reinit_through_system().

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(), clone(), CompositeQoI(), get_qoi(), and n_qois().

Referenced by clone().

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 129 of file composite_qoi.C.

References _qois.

131  {
132  AssemblyContext& c = libMesh::cast_ref<AssemblyContext&>(context);
133 
134  for( unsigned int q = 0; q < _qois.size(); q++ )
135  {
136  (*_qois[q]).element_qoi(c,q);
137  }
138 
139  return;
140  }
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 142 of file composite_qoi.C.

References _qois.

144  {
145  AssemblyContext& c = libMesh::cast_ref<AssemblyContext&>(context);
146 
147  for( unsigned int q = 0; q < _qois.size(); q++ )
148  {
149  (*_qois[q]).element_qoi_derivative(c,q);
150  }
151 
152  return;
153  }
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 151 of file composite_qoi.h.

References _qois, and n_qois().

Referenced by clone(), GRINS::SteadyVisualization::output_adjoint(), GRINS::UnsteadyVisualization::output_adjoint(), reinit(), and GRINSTesting::IntegratedFunctionTest::reinit_through_system().

152  {
153  libmesh_assert_less( qoi_index, this->n_qois() );
154 
155  return (*_qois[qoi_index]);
156  }
std::vector< QoIBase * > _qois
unsigned int n_qois() const
QoIBase & GRINS::CompositeQoI::get_qoi ( unsigned int  qoi_index)
inline

Non-const version needed for reinit()

Definition at line 159 of file composite_qoi.h.

References _qois, and n_qois().

160  {
161  libmesh_assert_less( qoi_index, this->n_qois() );
162 
163  return (*_qois[qoi_index]);
164  }
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 217 of file composite_qoi.C.

References _qois.

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

218  {
219  return (*_qois[qoi_index]).value();
220  }
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.

Referenced by GRINSTesting::IntegratedFunctionTest::reinit_through_system().

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::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 145 of file composite_qoi.h.

References _qois.

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

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

Basic output for computed QoI's.

Definition at line 206 of file composite_qoi.C.

References _qois.

Referenced by GRINS::QoIOutput::output_qois().

207  {
208  for( std::vector<QoIBase*>::const_iterator qoi = _qois.begin();
209  qoi != _qois.end(); ++qoi )
210  {
211  (*qoi)->output_qoi(out);
212  }
213 
214  return;
215  }
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 181 of file composite_qoi.C.

References _qois.

185  {
186  for( unsigned int q = 0; q < _qois.size(); q++ )
187  {
188  (*_qois[q]).parallel_op( communicator, sys_qoi[q], local_qoi[q] );
189  }
190 
191  return;
192  }
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::reinit ( MultiphysicsSystem system)
virtual

Reinitialize qoi.

Definition at line 122 of file composite_qoi.C.

References get_qoi(), and n_qois().

Referenced by GRINS::MultiphysicsSystem::reinit(), and GRINSTesting::IntegratedFunctionTest::test_convergence().

123  {
124  // call reinit() on each qoi
125  for (unsigned int i=0; i<this->n_qois(); i++)
126  (this->get_qoi(i)).reinit(system);
127  }
const QoIBase & get_qoi(unsigned int qoi_index) const
virtual void reinit(MultiphysicsSystem &system)
Reinitialize qoi.
unsigned int n_qois() const
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 155 of file composite_qoi.C.

References _qois.

157  {
158  AssemblyContext& c = libMesh::cast_ref<AssemblyContext&>(context);
159 
160  for( unsigned int q = 0; q < _qois.size(); q++ )
161  {
162  (*_qois[q]).side_qoi(c,q);
163  }
164 
165  return;
166  }
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 168 of file composite_qoi.C.

References _qois.

170  {
171  AssemblyContext& c = libMesh::cast_ref<AssemblyContext&>(context);
172 
173  for( unsigned int q = 0; q < _qois.size(); q++ )
174  {
175  (*_qois[q]).side_qoi_derivative(c,q);
176  }
177 
178  return;
179  }
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 194 of file composite_qoi.C.

References _qois.

197  {
198  for( unsigned int q = 0; q < _qois.size(); q++ )
199  {
200  (*_qois[q]).thread_join( qoi[q], other_qoi[q] );
201  }
202 
203  return;
204  }
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 Tue Dec 19 2017 12:47:30 for GRINS-0.8.0 by  doxygen 1.8.9.1