GRINS-0.8.0
adjoint_error_estimator_factories.h
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 #ifndef GRINS_ADJOINT_ERROR_ESTIMATOR_FACTORIES_H
26 #define GRINS_ADJOINT_ERROR_ESTIMATOR_FACTORIES_H
27 
28 // GRINS
30 
31 // libMesh
32 #include "libmesh/adjoint_residual_error_estimator.h"
33 #include "libmesh/adjoint_refinement_estimator.h"
34 #include "libmesh/qoi_set.h"
35 
36 namespace GRINS
37 {
38  template<typename EstimatorType>
40  {
41  public:
42  AdjointErrorEstimatorFactoryBase( const std::string& estimator_name )
43  : ErrorEstimatorFactoryBase(estimator_name)
44  {}
45 
47 
48  protected:
49 
50  virtual libMesh::UniquePtr<libMesh::ErrorEstimator>
51  build_error_estimator( const GetPot& input, MultiphysicsSystem& system,
52  const ErrorEstimatorOptions& estimator_options )
53  {
54  libMesh::UniquePtr<libMesh::ErrorEstimator>
55  raw_error_estimator( new EstimatorType );
56 
57  // Now cast to derived type
58  EstimatorType* adjoint_error_estimator =
59  libMesh::cast_ptr<EstimatorType*>(raw_error_estimator.get() );
60 
61  // Set a QoISet
62  libMesh::QoISet qoi_set(system);
63  adjoint_error_estimator->qoi_set() = qoi_set;
64 
65  // Now set the options for the derived type
66  this->set_adjoint_estimator_options( input, estimator_options, *adjoint_error_estimator );
67 
68  return raw_error_estimator;
69  }
70 
71  virtual void set_adjoint_estimator_options( const GetPot& input,
72  const ErrorEstimatorOptions& estimator_options,
73  EstimatorType& estimator ) =0;
74  };
75 
76  class AdjointResidualErrorEstimatorFactory : public AdjointErrorEstimatorFactoryBase<libMesh::AdjointResidualErrorEstimator>
77  {
78  public:
79 
80  AdjointResidualErrorEstimatorFactory( const std::string& estimator_name )
81  : AdjointErrorEstimatorFactoryBase<libMesh::AdjointResidualErrorEstimator>(estimator_name)
82  {}
83 
85 
86  protected:
87 
88  virtual void set_adjoint_estimator_options( const GetPot& input,
89  const ErrorEstimatorOptions& estimator_options,
90  libMesh::AdjointResidualErrorEstimator& estimator );
91  };
92 
93  class AdjointRefinementErrorEstimatorFactory : public AdjointErrorEstimatorFactoryBase<libMesh::AdjointRefinementEstimator>
94  {
95  public:
96 
97  AdjointRefinementErrorEstimatorFactory( const std::string& estimator_name )
98  : AdjointErrorEstimatorFactoryBase<libMesh::AdjointRefinementEstimator>(estimator_name)
99  {}
100 
102 
103  protected:
104 
105  virtual void set_adjoint_estimator_options( const GetPot& input,
106  const ErrorEstimatorOptions& estimator_options,
107  libMesh::AdjointRefinementEstimator& estimator );
108  };
109 } // end namespace GRINS
110 
111 #endif // GRINS_ADJOINT_ERROR_ESTIMATOR_FACTORIES_H
virtual libMesh::UniquePtr< libMesh::ErrorEstimator > build_error_estimator(const GetPot &input, MultiphysicsSystem &system, const ErrorEstimatorOptions &estimator_options)
Subclasses implement this method for building the ErrorEstimator object.
virtual void set_adjoint_estimator_options(const GetPot &input, const ErrorEstimatorOptions &estimator_options, libMesh::AdjointResidualErrorEstimator &estimator)
GRINS namespace.
virtual void set_adjoint_estimator_options(const GetPot &input, const ErrorEstimatorOptions &estimator_options, libMesh::AdjointRefinementEstimator &estimator)
Container for ErrorEstimator options.
Interface with libMesh for solving Multiphysics problems.
virtual void set_adjoint_estimator_options(const GetPot &input, const ErrorEstimatorOptions &estimator_options, EstimatorType &estimator)=0
AdjointRefinementErrorEstimatorFactory(const std::string &estimator_name)
AdjointErrorEstimatorFactoryBase(const std::string &estimator_name)
AdjointResidualErrorEstimatorFactory(const std::string &estimator_name)

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