Hermes2D  3.0
error_thread_calculator.h
1 // This file is part of Hermes2D.
2 //
3 // Hermes2D is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // Hermes2D is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Hermes2D. If not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef __H2D_ERROR_THREAD_CALCULATOR_H
17 #define __H2D_ERROR_THREAD_CALCULATOR_H
18 
19 #include "error_calculator.h"
20 #include "../forms.h"
21 
22 namespace Hermes
23 {
24  namespace Hermes2D
25  {
26  template<typename Scalar> class ErrorCalculator;
27  template<typename Scalar> class NeighborSearch;
28  template<typename Scalar> class GeomVol;
29  template<typename Scalar> class GeomSurf;
30 
31  template<typename Scalar>
33  {
34  public:
37  void free();
38  void evaluate_one_state(Traverse::State* current_state);
39 
41  {
42  public:
43  DGErrorCalculator(ErrorThreadCalculator* errorThreadCalculator);
44 
46  void assemble_one_edge();
47 
49  bool init_neighbors();
50  void free();
51 
52  void assemble_one_neighbor(unsigned int neighbor_i);
53  private:
54  void initialize_error_and_norm_functions(NormFormDG<Scalar>* mfs, DiscontinuousFunc<Scalar>* error_func[2], DiscontinuousFunc<Scalar>* norm_func[2]);
55 
56  ErrorThreadCalculator* errorThreadCalculator;
57  Traverse::State* current_state;
58 
59  NeighborSearch<Scalar>** neighbor_searches;
60  unsigned int num_neighbors;
61  };
62  private:
63  void evaluate_volumetric_forms(Traverse::State* current_state, int order);
64  void evaluate_surface_forms_one_edge(Traverse::State* current_state, int order);
65 
66  void evaluate_volumetric_form(NormFormVol<Scalar>* form, Func<Scalar>* difference_func_i, Func<Scalar>* difference_func_j, Func<Scalar>* rsln_i, Func<Scalar>* rsln_j, double* error, double* norm);
67 
68  void evaluate_surface_form(NormFormSurf<Scalar>* form, Func<Scalar>* difference_func_i, Func<Scalar>* difference_func_j, Func<Scalar>* rsln_i, Func<Scalar>* rsln_j, double* error, double* norm);
69  void initialize_error_and_norm_functions_surf(NormFormSurf<Scalar>* mfs, Func<Scalar>* error_func[2], Func<Scalar>* norm_func[2]);
70 
71  template<typename NormFormType>
72  void initialize_error_and_norm_functions(NormFormType* mf, Func<Scalar>* error_func[2], Func<Scalar>* norm_func[2], int order);
73  template<typename NormFormType, typename FuncType>
74  void deinitialize_error_and_norm_functions(NormFormType* mf, FuncType* error_func[2], FuncType* norm_func[2]);
75 
76  void evaluate_DG_form(NormFormDG<Scalar>* form, DiscontinuousFunc<Scalar>* difference_func_i, DiscontinuousFunc<Scalar>* difference_func_j, DiscontinuousFunc<Scalar>* rsln_i, DiscontinuousFunc<Scalar>* rsln_j, double* error, double* norm);
77 
78  unsigned char n_quadrature_points;
79  GeomVol<double> geometry_vol;
80  GeomSurf<double> geometry_surf;
81  double jacobian_x_weights[H2D_MAX_INTEGRATION_POINTS_COUNT];
82  Solution<Scalar>** slns;
83  Solution<Scalar>** rslns;
84 
85  Traverse::State* current_state;
86 
87  ErrorCalculator<Scalar>* errorCalculator;
88  };
89  }
90 }
91 
92 #endif
Definition: adapt.h:24
This class represents a function with jump discontinuity on an interface of two elements.
Definition: forms.h:335
Evaluation of an error between a (coarse) solution and a reference solution.
Definition: adapt.h:28
This class characterizes a neighborhood of a given edge in terms of adjacent elements and provides me...
::xsd::cxx::tree::error< char > error
Error condition.
Represents the solution of a PDE.
Definition: api2d.h:35