GRINS-0.6.0
Public Member Functions | Protected Attributes | List of all members
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::AutoPtr< 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::ParameterMultiPointer< 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::AutoPtr< 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::AutoPtr<libMesh::DifferentiableQoI>(clone);
68  }
const QoIBase & get_qoi(unsigned int qoi_index) const
virtual libMesh::AutoPtr< 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 127 of file composite_qoi.C.

References _qois.

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

References _qois.

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

References _qois.

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

216  {
217  return (*_qois[qoi_index]).value();
218  }
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( std::vector<QoIBase*>::iterator qoi = _qois.begin();
97  qoi != _qois.end(); ++qoi )
98  {
99  (*qoi)->init(input,system);
100  }
101 
102  return;
103  }
std::vector< QoIBase * > _qois
void GRINS::CompositeQoI::init_context ( libMesh::DiffContext &  context)
virtual

Definition at line 105 of file composite_qoi.C.

References _qois.

106  {
107  AssemblyContext& c = libMesh::libmesh_cast_ref<AssemblyContext&>(context);
108 
109  for( std::vector<QoIBase*>::iterator qoi = _qois.begin();
110  qoi != _qois.end(); ++qoi )
111  {
112  (*qoi)->init_context(c);
113  }
114 
115  return;
116  }
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 204 of file composite_qoi.C.

References _qois.

Referenced by GRINS::Simulation::run(), and GRINS::SteadyMeshAdaptiveSolver::solve().

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

References _qois.

183  {
184  for( unsigned int q = 0; q < _qois.size(); q++ )
185  {
186  (*_qois[q]).parallel_op( communicator, sys_qoi[q], local_qoi[q] );
187  }
188 
189  return;
190  }
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::ParameterMultiPointer< libMesh::Number > &  param_pointer 
) const

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

Definition at line 119 of file composite_qoi.C.

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

122  {
123  for( unsigned int q = 0; q < _qois.size(); q++ )
124  (*_qois[q]).register_parameter(param_name, param_pointer);
125  }
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 153 of file composite_qoi.C.

References _qois.

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

References _qois.

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

References _qois.

195  {
196  for( unsigned int q = 0; q < _qois.size(); q++ )
197  {
198  (*_qois[q]).thread_join( qoi[q], other_qoi[q] );
199  }
200 
201  return;
202  }
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 Mon Jun 22 2015 21:32:22 for GRINS-0.6.0 by  doxygen 1.8.9.1