29 #include "libmesh/adjoint_residual_error_estimator.h"
30 #include "libmesh/adjoint_refinement_estimator.h"
31 #include "libmesh/getpot.h"
32 #include "libmesh/patch_recovery_error_estimator.h"
33 #include "libmesh/qoi_set.h"
34 #include "libmesh/kelly_error_estimator.h"
50 const libMesh::QoISet& qoi_set )
52 std::string estimator_type = input(
"MeshAdaptivity/estimator_type",
"patch_recovery");
56 std::tr1::shared_ptr<libMesh::ErrorEstimator> error_estimator;
58 switch( estimator_enum )
62 error_estimator.reset(
new libMesh::AdjointResidualErrorEstimator );
64 libMesh::AdjointResidualErrorEstimator*
65 adjoint_error_estimator =
66 libMesh::libmesh_cast_ptr<libMesh::AdjointResidualErrorEstimator*>
67 ( error_estimator.get() );
69 adjoint_error_estimator->qoi_set() = qoi_set;
71 libMesh::PatchRecoveryErrorEstimator *p1 =
new libMesh::PatchRecoveryErrorEstimator;
72 adjoint_error_estimator->primal_error_estimator().reset( p1 );
74 libMesh::PatchRecoveryErrorEstimator *p2 =
new libMesh::PatchRecoveryErrorEstimator;
75 adjoint_error_estimator->dual_error_estimator().reset( p2 );
77 bool patch_reuse = input(
"MeshAdaptivity/patch_reuse",
false );
78 adjoint_error_estimator->primal_error_estimator()->error_norm.set_type
79 ( 0, libMesh::H1_SEMINORM );
80 p1->set_patch_reuse( patch_reuse );
82 adjoint_error_estimator->dual_error_estimator()->error_norm.set_type
83 ( 0, libMesh::H1_SEMINORM );
84 p2->set_patch_reuse( patch_reuse );
90 error_estimator.reset(
new libMesh::KellyErrorEstimator );
96 error_estimator.reset(
new libMesh::PatchRecoveryErrorEstimator );
102 error_estimator.reset(
new libMesh::AdjointRefinementEstimator );
104 libMesh::AdjointRefinementEstimator*
105 adjoint_error_estimator =
106 libMesh::libmesh_cast_ptr<libMesh::AdjointRefinementEstimator*>
107 ( error_estimator.get() );
109 adjoint_error_estimator->qoi_set() = qoi_set;
111 adjoint_error_estimator->number_h_refinements = 1;
112 adjoint_error_estimator->number_p_refinements = 0;
119 libmesh_not_implemented();
131 return error_estimator;
138 if( estimator_type == std::string(
"adjoint_residual") )
142 else if( estimator_type == std::string(
"adjoint_refinement") )
146 else if( estimator_type == std::string(
"kelly") )
150 else if( estimator_type == std::string(
"patch_recovery") )
154 else if( estimator_type == std::string(
"weighted_patch_recovery") )
158 else if( estimator_type == std::string(
"uniform_refinement") )
164 std::cerr <<
"Error: Invalid error estimator type " << estimator_type << std::endl
165 <<
"Valid error estimator types are: adjoint_residual" << std::endl
166 <<
" adjoint_refinement" << std::endl
167 <<
" kelly" << std::endl
168 <<
" patch_recovery" << std::endl
169 <<
" weighted_patch_recovery" << std::endl
170 <<
" uniform_refinement" << std::endl;
virtual ~ErrorEstimatorFactory()
virtual std::tr1::shared_ptr< libMesh::ErrorEstimator > build(const GetPot &input, const libMesh::QoISet &qoi_set)
ErrorEstimatorEnum string_to_enum(const std::string &estimator_type) const