16 #ifndef __H2D_WEAKFORM_H
17 #define __H2D_WEAKFORM_H
19 #include "../function/exact_solution.h"
25 #pragma region forward-declarations
27 template<
typename Scalar>
class DiscreteProblem;
28 template<
typename Scalar>
class DiscreteProblemSelectiveAssembler;
29 template<
typename Scalar>
class DiscreteProblemIntegrationOrderCalculator;
31 template<
typename Scalar>
class Space;
37 template<
typename T>
class Func;
40 template<
typename T>
class GeomVol;
43 template<
typename Scalar>
class Form;
54 template<
typename Scalar>
55 class HERMES_API
WeakFormSharedPtr :
public std::tr1::shared_ptr < Hermes::Hermes2D::WeakForm<Scalar> >
75 template<
typename Scalar>
76 class HERMES_API
WeakForm :
public Hermes::Mixins::IntegrableWithGlobalOrder,
public Hermes::Mixins::Loggable
84 WeakForm(
unsigned int neq = 1,
bool mat_free =
false);
89 enum FormIntegrationDimension
102 void add_matrix_form(MatrixFormVol<Scalar>* mfv);
105 void add_matrix_form_surf(MatrixFormSurf<Scalar>* mfs);
108 void add_matrix_form_DG(MatrixFormDG<Scalar>* mfDG);
111 void add_vector_form(VectorFormVol<Scalar>* vfv);
114 void add_vector_form_surf(VectorFormSurf<Scalar>* vfs);
117 void add_vector_form_DG(VectorFormDG<Scalar>* vfDG);
123 virtual void set_active_state(Element** e);
129 virtual void set_active_edge_state(Element** e,
unsigned char isurf);
135 virtual void set_active_DG_state(Element** e,
unsigned char isurf);
138 inline unsigned char get_neq()
const {
return neq; }
145 void set_current_time(
double time);
149 void set_current_time_step(
double time_step);
153 virtual double get_current_time()
const;
157 virtual double get_current_time_step()
const;
181 std::vector<MeshFunctionSharedPtr<Scalar> > get_ext()
const;
190 std::vector<Form<Scalar> *> get_forms()
const;
191 std::vector<MatrixFormVol<Scalar> *> get_mfvol()
const;
192 std::vector<MatrixFormSurf<Scalar> *> get_mfsurf()
const;
193 std::vector<MatrixFormDG<Scalar> *> get_mfDG()
const;
194 std::vector<VectorFormVol<Scalar> *> get_vfvol()
const;
195 std::vector<VectorFormSurf<Scalar> *> get_vfsurf()
const;
196 std::vector<VectorFormDG<Scalar> *> get_vfDG()
const;
203 std::vector<MeshFunctionSharedPtr<Scalar> >
ext;
204 std::vector<UExtFunctionSharedPtr<Scalar> > u_ext_fn;
207 double current_time_step;
221 std::vector<MatrixFormVol<Scalar> *>
mfvol;
224 std::vector<MatrixFormSurf<Scalar> *>
mfsurf;
227 std::vector<MatrixFormDG<Scalar> *>
mfDG;
230 std::vector<VectorFormVol<Scalar> *>
vfvol;
233 std::vector<VectorFormSurf<Scalar> *>
vfsurf;
236 std::vector<VectorFormDG<Scalar> *>
vfDG;
238 bool** get_blocks(
bool force_diagonal_blocks)
const;
241 friend class Form < Scalar > ;
248 friend class Hermes::Preconditioners::Precond < Scalar > ;
256 template<
typename FormType>
257 void processFormMarkers(
const std::vector<
SpaceSharedPtr<Scalar> > spaces,
bool surface, std::vector<FormType> forms_to_process);
269 template<
typename Scalar>
270 class HERMES_API
Form
280 void set_areas(std::vector<std::string> areas);
281 std::vector<std::string> getAreas()
const;
295 std::vector<MeshFunctionSharedPtr<Scalar> > get_ext()
const;
298 void setScalingFactor(
double scalingFactor);
328 std::vector<MeshFunctionSharedPtr<Scalar> >
ext;
329 std::vector<UExtFunctionSharedPtr<Scalar> > u_ext_fn;
331 double get_current_stage_time()
const;
336 void set_uExtOffset(
int u_ext_offset);
338 double scaling_factor;
341 void set_current_stage_time(
double time);
356 template<
typename Scalar>
374 template<
typename Scalar>
396 template<
typename Scalar>
397 class HERMES_API MatrixFormSurf :
public MatrixForm < Scalar >
401 MatrixFormSurf(
unsigned int i,
unsigned int j);
403 virtual ~MatrixFormSurf();
405 virtual Scalar value(
int n,
double *wt, Func<Scalar> **u_ext, Func<double> *u, Func<double> *v,
406 GeomSurf<double> *e, Func<Scalar> **ext)
const;
408 virtual Hermes::Ord ord(
int n,
double *wt, Func<Hermes::Ord> **u_ext, Func<Hermes::Ord> *u, Func<Hermes::Ord> *v,
409 GeomSurf<Hermes::Ord> *e, Func<Ord> **ext)
const;
411 virtual MatrixFormSurf* clone()
const;
415 template<
typename Scalar>
416 class HERMES_API MatrixFormDG :
public Form < Scalar >
420 MatrixFormDG(
unsigned int i,
unsigned int j);
422 virtual ~MatrixFormDG();
426 virtual Scalar value(
int n,
double *wt, DiscontinuousFunc<Scalar> **u_ext, DiscontinuousFunc<double> *u, DiscontinuousFunc<double> *v,
427 InterfaceGeom<double> *e, DiscontinuousFunc<Scalar> **ext)
const;
429 virtual Hermes::Ord ord(
int n,
double *wt, DiscontinuousFunc<Hermes::Ord> **u_ext, DiscontinuousFunc<Hermes::Ord> *u, DiscontinuousFunc<Hermes::Ord> *v,
430 InterfaceGeom<Hermes::Ord> *e, DiscontinuousFunc<Ord> **ext)
const;
432 virtual MatrixFormDG* clone()
const;
434 friend class DiscreteProblem < Scalar > ;
438 template<
typename Scalar>
452 template<
typename Scalar>
471 template<
typename Scalar>
472 class VectorFormSurf :
public VectorForm < Scalar >
480 virtual Scalar value(
int n,
double *wt, Func<Scalar> **u_ext, Func<double> *v,
481 GeomSurf<double> *e, Func<Scalar> **
ext)
const;
483 virtual Hermes::Ord ord(
int n,
double *wt, Func<Hermes::Ord> **u_ext, Func<Hermes::Ord> *v, GeomSurf<Hermes::Ord> *e,
484 Func<Ord> **
ext)
const;
490 template<
typename Scalar>
491 class VectorFormDG :
public Form < Scalar >
499 virtual Scalar value(
int n,
double *wt, DiscontinuousFunc<Scalar> **u_ext, Func<double> *v,
500 InterfaceGeom<double> *e, DiscontinuousFunc<Scalar> **
ext)
const;
502 virtual Hermes::Ord ord(
int n,
double *wt, DiscontinuousFunc<Hermes::Ord> **u_ext, Func<Hermes::Ord> *v, InterfaceGeom<Hermes::Ord> *e,
503 DiscontinuousFunc<Ord> **
ext)
const;
507 friend class DiscreteProblem < Scalar > ;
Geometry - volumetric - for order calculation.
Stores one element of a mesh.
This class represents a function with jump discontinuity on an interface of two elements.
Represents a function defined on a mesh.
Provides capabilities to (re-)assemble a matrix / vector only where necessary. See also Solver::keep_...
Class for (global) orthogonal projecting. If the projection is not necessary (if a solution belongs t...
Used to pass the instances of Space around.
::xsd::cxx::tree::time< char, simple_type > time
C++ type corresponding to the time XML Schema built-in type.
Determines the position on an element surface (edge in 2D and Face in 3D).
SymFlag
Bilinear form symmetry flag, see WeakForm::add_matrix_form.
Should be exactly the same as is the count of enum ShapesetType.
Calculated function values (from the class Function) on an element for assembling.
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
This class is a one-thread (non-DG) assembly worker.
Represents a finite element space over a domain.
Provides methods of integration order calculation.