GRINS-0.8.0
qoi_base.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2017 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 
26 // This class
27 #include "grins/qoi_base.h"
28 
29 // libMesh
30 #include "libmesh/getpot.h"
31 #include "libmesh/fem_system.h"
32 #include "libmesh/quadrature.h"
33 
34 // GRINS
35 #include "grins/assembly_context.h"
36 
37 namespace GRINS
38 {
39  QoIBase::QoIBase( const std::string& qoi_name )
40  : ParameterUser(qoi_name),
41  _qoi_name(qoi_name),
42  _qoi_value(0.0)
43  {}
44 
45  void QoIBase::parallel_op( const libMesh::Parallel::Communicator& communicator,
46  libMesh::Number& sys_qoi,
47  libMesh::Number& local_qoi )
48  {
49  communicator.sum(local_qoi);
50 
51  sys_qoi = local_qoi;
52 
53  _qoi_value = sys_qoi;
54  }
55 
56  void QoIBase::thread_join( libMesh::Number& qoi, const libMesh::Number& other_qoi )
57  {
58  qoi += other_qoi;
59  }
60 
61  void QoIBase::output_qoi( std::ostream& out ) const
62  {
63  out << _qoi_name+" = "
64  << std::setprecision(16)
65  << std::scientific
66  << _qoi_value << std::endl;
67  }
68 
69 } // namespace GRINS
std::string _qoi_name
Definition: qoi_base.h:130
libMesh::Number _qoi_value
Definition: qoi_base.h:132
QoIBase(const std::string &qoi_name)
Definition: qoi_base.C:39
GRINS namespace.
ParameterUser base class. Utility methods for subclasses.
virtual void output_qoi(std::ostream &out) const
Basic output for computed QoI's.
Definition: qoi_base.C:61
virtual void thread_join(libMesh::Number &qoi, const libMesh::Number &other_qoi)
Call the operation to accumulate this QoI from multiple threads.
Definition: qoi_base.C:56
virtual void parallel_op(const libMesh::Parallel::Communicator &communicator, libMesh::Number &sys_qoi, libMesh::Number &local_qoi)
Call the parallel operation for this QoI and cache the value.
Definition: qoi_base.C:45

Generated on Tue Dec 19 2017 12:47:28 for GRINS-0.8.0 by  doxygen 1.8.9.1