GRINS-0.7.0
error_estimator_factory_base.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2016 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_ERROR_ESTIMATOR_FACTORY_BASE_H
26 #define GRINS_ERROR_ESTIMATOR_FACTORY_BASE_H
27 
28 // GRINS
30 #include "grins/multiphysics_sys.h"
32 
33 // libMesh
34 #include "libmesh/error_estimator.h"
35 
36 namespace GRINS
37 {
39 
42  class ErrorEstimatorFactoryBase : public FactoryWithGetPot<libMesh::ErrorEstimator>
43  {
44  public:
45  ErrorEstimatorFactoryBase( const std::string& estimator_name )
46  : FactoryWithGetPot<libMesh::ErrorEstimator>(estimator_name)
47  {}
48 
50 
51  static void set_system( MultiphysicsSystem& system )
52  { _system = &system; }
53 
54  static void set_estimator_options( const ErrorEstimatorOptions& estimator_options )
55  { _estimator_options = &estimator_options; }
56 
57  protected:
58 
60  virtual libMesh::UniquePtr<libMesh::ErrorEstimator> build_error_estimator( const GetPot& input,
61  MultiphysicsSystem& system,
62  const ErrorEstimatorOptions& estimator_options ) =0;
63 
65 
68 
70 
72 
73  private:
74 
75  virtual libMesh::UniquePtr<libMesh::ErrorEstimator> create();
76 
77  };
78 
79  inline
80  libMesh::UniquePtr<libMesh::ErrorEstimator> ErrorEstimatorFactoryBase::create()
81  {
82  if( !_input )
83  libmesh_error_msg("ERROR: must call set_getpot() before building ErrorEstimator!");
84  if( !_system )
85  libmesh_error_msg("ERROR: must call set_system() before building ErrorEstimator!");
86  if( !_estimator_options )
87  libmesh_error_msg("ERROR: must call set_estimator_options() before building ErrorEstimator!");
88 
89  libMesh::UniquePtr<libMesh::ErrorEstimator>
90  new_estimator = this->build_error_estimator( *_input, *_system, *_estimator_options );
91 
92  libmesh_assert(new_estimator);
93 
94  return new_estimator;
95  }
96 
97 } // end namespace GRINS
98 
99 #endif // GRINS_ERROR_ESTIMATOR_FACTORY_BASE_H
static const ErrorEstimatorOptions * _estimator_options
Cache pointer to system.
static void set_estimator_options(const ErrorEstimatorOptions &estimator_options)
virtual libMesh::UniquePtr< libMesh::ErrorEstimator > build_error_estimator(const GetPot &input, MultiphysicsSystem &system, const ErrorEstimatorOptions &estimator_options)=0
Subclasses implement this method for building the ErrorEstimator object.
GRINS namespace.
static const GetPot * _input
We store only a raw pointer here because we can't make a copy.
virtual libMesh::UniquePtr< libMesh::ErrorEstimator > create()
static void set_system(MultiphysicsSystem &system)
Container for ErrorEstimator options.
Interface with libMesh for solving Multiphysics problems.
ErrorEstimatorFactoryBase(const std::string &estimator_name)
Abstract factory that provides availability of GetPot.
static MultiphysicsSystem * _system
Cache pointer to system.

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