Hermes2D  3.0
discrete_problem_thread_assembler.h
1 
16 #ifndef __H2D_DISCRETE_PROBLEM_ASSEMBLY_DATA_H
17 #define __H2D_DISCRETE_PROBLEM_ASSEMBLY_DATA_H
18 
19 #include "../weakform/weakform.h"
20 #include "../shapeset/precalc.h"
21 #include "../function/solution.h"
22 #include "discrete_problem_helpers.h"
23 #include "discrete_problem_integration_order_calculator.h"
24 #include "discrete_problem_selective_assembler.h"
25 
26 namespace Hermes
27 {
28  namespace Hermes2D
29  {
33  template<typename Scalar>
34  class HERMES_API DiscreteProblemThreadAssembler :
38  {
39  public:
41  void free();
42 
43  private:
46 
48  void init_spaces(const std::vector<SpaceSharedPtr<Scalar> > spaces);
50  void set_weak_formulation(WeakFormSharedPtr<Scalar> wf);
52  void init_u_ext(const std::vector<SpaceSharedPtr<Scalar> > spaces, Solution<Scalar>** u_ext_sln);
53 
55  void init_assembling(Solution<Scalar>** u_ext_sln, const std::vector<SpaceSharedPtr<Scalar> >& spaces, bool add_dirichlet_lift);
56 
58  void init_funcs_wf();
59  void init_funcs_space();
61  pj_pool_t *FuncMemoryPool;
62  void init_funcs_memory_pool();
63 
65  void deinit_funcs();
66 
67  void deinit_funcs_space();
68  bool funcs_space_initialized;
69  void deinit_funcs_wf();
70  bool funcs_wf_initialized;
72  void init_u_ext_values(int order);
74  template<typename Geom>
75  void init_ext_values(Func<Scalar>** target_array, std::vector<MeshFunctionSharedPtr<Scalar> >& ext, std::vector<UExtFunctionSharedPtr<Scalar> >& u_ext_fns, int order, Func<Scalar>** u_ext_func, Geom* geometry);
76 
78  void init_assembling_one_state(const std::vector<SpaceSharedPtr<Scalar> >& spaces, Traverse::State* current_state);
80  void assemble_one_state();
82  template<typename MatrixFormType, typename Geom>
83  void assemble_matrix_form(MatrixFormType* form, int order, Func<double>** base_fns, Func<double>** test_fns,
84  AsmList<Scalar>* current_als_i, AsmList<Scalar>* current_als_j, int n_quadrature_points, Geom* geometry, double* jacobian_x_weights);
86  template<typename VectorFormType, typename Geom>
87  void assemble_vector_form(VectorFormType* form, int order, Func<double>** test_fns, AsmList<Scalar>* current_als,
88  int n_quadrature_points, Geom* geometry, double* jacobian_x_weights);
90  void deinit_assembling_one_state();
91 
93  void deinit_assembling();
94 
96  void free_spaces();
98  void free_weak_formulation();
100  void free_u_ext();
101 
103  Vector<Scalar>* dirichlet_lift_rhs;
104 
106  RefMap** refmaps;
107  RefMap* rep_refmap;
108  Solution<Scalar>** u_ext;
109  std::vector<Transformable *> fns;
110 
112  DiscreteProblemSelectiveAssembler<Scalar>* selectiveAssembler;
113 
115  Traverse::State* current_state;
117  Scalar local_stiffness_matrix[H2D_MAX_LOCAL_BASIS_SIZE * H2D_MAX_LOCAL_BASIS_SIZE * 4];
118 
121  DiscreteProblemIntegrationOrderCalculator<Scalar> integrationOrderCalculator;
123  int order;
125  int orderSurface[H2D_MAX_NUMBER_EDGES];
126 
128  void init_calculation_variables();
129  void deinit_calculation_variables();
130  Func<double>* funcs[H2D_MAX_COMPONENTS][H2D_MAX_LOCAL_BASIS_SIZE];
131  Func<double>* funcsSurface[H2D_MAX_NUMBER_EDGES][H2D_MAX_COMPONENTS][H2D_MAX_LOCAL_BASIS_SIZE];
132  GeomVol<double> geometry;
133  GeomSurf<double> geometrySurface[H2D_MAX_NUMBER_EDGES];
134  double jacobian_x_weights[H2D_MAX_INTEGRATION_POINTS_COUNT];
135  double jacobian_x_weightsSurface[H2D_MAX_NUMBER_EDGES][H2D_MAX_INTEGRATION_POINTS_COUNT];
136  int n_quadrature_points;
137  int n_quadrature_pointsSurface[H2D_MAX_NUMBER_EDGES];
138 
140  Func<Scalar>* u_ext_funcs[H2D_MAX_COMPONENTS];
141  Func<Scalar>** ext_funcs;
142  int ext_funcs_allocated_size;
143  Func<Scalar>** ext_funcs_local;
144  int ext_funcs_local_allocated_size;
145 
146  AsmList<Scalar> als[H2D_MAX_COMPONENTS];
147  AsmList<Scalar> alsSurface[H2D_MAX_NUMBER_EDGES][H2D_MAX_COMPONENTS];
148  unsigned short spaces_size;
149  bool nonlinear, add_dirichlet_lift;
150 
151  friend class DiscreteProblem < Scalar > ;
152  friend class DiscreteProblemDGAssembler < Scalar > ;
153 
155  bool** reusable_DOFs;
156  bool** reusable_Dirichlet;
157  };
158  }
159 }
160 #endif
PrecalcShapeset variant for fast assembling.
Definition: precalc.h:109
Definition: adapt.h:24
Geometry (coordinates, normals, tangents) of either an element or an edge.
Definition: forms.h:40
Provides capabilities to (re-)assemble a matrix / vector only where necessary. See also Solver::keep_...
Used to pass the instances of Space around.
Definition: space.h:34
#define H2D_MAX_NUMBER_EDGES
A maximum number of edges of an element.
Definition: global.h:31
Used to pass the instances of WeakForm around.
Definition: weakform.h:55
Calculated function values (from the class Function) on an element for assembling.
Definition: forms.h:214
This class is a one-thread (non-DG) assembly worker.
Represents the reference mapping.
Definition: refmap.h:40
Represents the solution of a PDE.
Definition: api2d.h:35