Flow123d
field_fe.hh
Go to the documentation of this file.
1 /*
2  * field_constant.hh
3  *
4  * Created on: Dec 15, 2012
5  * Author: jb
6  */
7 
8 
9 #ifndef FIELD_FE_HH_
10 #define FIELD_FE_HH_
11 
12 #include "petscmat.h"
13 #include "system/system.hh"
14 #include "fields/field_base.hh"
15 #include "mesh/point.hh"
16 #include "fem/dofhandler.hh"
17 #include "fem/mapping.hh"
18 
19 
20 
21 
22 /**
23  * Class representing fields given by finite element approximation.
24  *
25  */
26 template <int spacedim, class Value>
27 class FieldFE : public FieldBase<spacedim, Value>
28 {
29 public:
31 
32  /**
33  * Default constructor, optionally we need number of components @p n_comp in the case of Vector valued fields.
34  */
35  FieldFE(unsigned int n_comp=0);
36 
37  /**
38  * Setter for the finite element data. The mappings are required for computation of local coordinates.
39  * @param dh Dof handler.
40  * @param map1 1D mapping.
41  * @param map2 2D mapping.
42  * @param map3 3D mapping.
43  * @param data Vector of dof values.
44  */
45  void set_fe_data(const DOFHandlerMultiDim *dh,
46  Mapping<1,3> *map1,
47  Mapping<2,3> *map2,
48  Mapping<3,3> *map3,
49  const Vec *data);
50 
51  /**
52  * Returns one value in one given point. ResultType can be used to avoid some costly calculation if the result is trivial.
53  */
54  virtual typename Value::return_type const &value(const Point &p, const ElementAccessor<spacedim> &elm);
55 
56  /**
57  * Returns std::vector of scalar values in several points at once.
58  */
59  virtual void value_list (const std::vector< Point > &point_list, const ElementAccessor<spacedim> &elm,
61 
62 
63  virtual ~FieldFE();
64 
65 private:
66 
68  double *data_;
69  const Vec *data_vec_;
70  unsigned int *dof_indices;
71 
75 };
76 
77 
78 #endif /* FIELD_FE_HH_ */