15 #ifndef KELLY_TYPE_ADAPT_H
16 #define KELLY_TYPE_ADAPT_H
19 #include "../neighbor.h"
20 #include "../discrete_problem.h"
30 virtual double value(
double e_diam,
const std::string& e_marker)
const = 0;
38 virtual double value(
double e_diam,
const std::string& e_marker)
const {
64 template<
typename Scalar>
94 Hermes::vector<MeshFunction<Scalar>*>
ext;
96 void setAsInterface();
100 : i(i), area(area), ext(ext) {}
107 throw Exceptions::MethodNotOverridenException(
"KellyTypeAdapt::ErrorEstimatorForm::value()");
116 throw Exceptions::MethodNotOverridenException(
"KellyTypeAdapt::ErrorEstimatorForm::ord().");
117 return Hermes::Ord();
148 Hermes::vector<typename KellyTypeAdapt::ErrorEstimatorForm *> error_estimators_surf;
150 Mesh::ElementMarkersConversion element_markers_conversion;
151 Mesh::BoundaryMarkersConversion boundary_markers_conversion;
156 bool use_aposteriori_interface_scaling;
177 Hermes::vector<double>* component_errors,
178 unsigned int error_flags);
212 bool ignore_visited_segments =
true,
213 Hermes::vector<const InterfaceEstimatorScalingFunction*>
214 interface_scaling_fns_ = Hermes::vector<const InterfaceEstimatorScalingFunction*>(),
215 Hermes::vector<ProjNormType> norms_ = Hermes::vector<ProjNormType>());
218 bool ignore_visited_segments =
true,
225 for (
unsigned int i = 0; i < error_estimators_surf.size(); i++)
226 delete error_estimators_surf[i];
227 error_estimators_surf.clear();
229 for (
unsigned int i = 0; i < error_estimators_vol.size(); i++)
230 delete error_estimators_vol[i];
231 error_estimators_vol.clear();
233 for (
unsigned int i = 0; i < interface_scaling_fns.size(); i++)
234 delete interface_scaling_fns[i];
235 interface_scaling_fns.clear();
238 Mesh::ElementMarkersConversion* get_element_markers_conversion()
240 return &this->element_markers_conversion;
242 Mesh::BoundaryMarkersConversion* get_boundary_markers_conversion()
244 return &this->boundary_markers_conversion;
254 void add_error_estimator_vol(ErrorEstimatorForm* form);
262 void add_error_estimator_surf(ErrorEstimatorForm* form);
272 throw Exceptions::Exception(
"Wrong number of solutions.");
273 Hermes::vector<Solution<Scalar>*> slns;
275 return calc_err_est(slns, NULL, error_flags);
279 Hermes::vector<double>* component_errors = NULL,
282 return calc_err_internal(slns, component_errors, error_flags);
288 bool adapt(
double thr,
int strat = 0,
int regularize = -1,
double to_be_processed = 0.0);
290 void disable_aposteriori_interface_scaling() { use_aposteriori_interface_scaling =
false; }
292 void set_volumetric_scaling_const(
double C) { volumetric_scaling_const = C; }
293 void set_boundary_scaling_const(
double C) { boundary_scaling_const = C; }
310 template<
typename Scalar>
325 for (
int i = 0; i < n; i++)
340 double const_by_laplacian;
348 double const_by_laplacian = 1.0,
349 Hermes::vector<ProjNormType> norms_ = Hermes::vector<ProjNormType>())
352 set_scaling_consts(const_by_laplacian);
353 for (
int i = 0; i < this->num; i++)
360 set_scaling_consts(const_by_laplacian);
361 this->error_estimators_surf.push_back(
new ErrorEstimatorFormKelly(0, const_by_laplacian));
365 void set_scaling_consts(
double C)
367 this->interface_scaling_const = 1./(24.*C);
368 this->volumetric_scaling_const = this->interface_scaling_const;
369 this->boundary_scaling_const = this->interface_scaling_const;