Hermes2D  3.0
mesh_function.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_MESH_FUNCTION_H
17 #define __H2D_MESH_FUNCTION_H
18 
19 #include "function.h"
20 #include "../mesh/refmap.h"
21 #include "../space/space.h"
22 #include "exceptions.h"
23 
24 namespace Hermes
25 {
26  namespace Hermes2D
27  {
28  template<typename Scalar>
29  class HERMES_API MeshFunctionSharedPtr : public std::tr1::shared_ptr < Hermes::Hermes2D::MeshFunction<Scalar> >
30  {
31  public:
33 
35 
36  void operator=(const MeshFunctionSharedPtr<Scalar>& other);
37 
38  Hermes::Hermes2D::Solution<Scalar>* get_solution();
39  };
40 
46  template<typename Scalar>
56  class HERMES_API MeshFunction : public Function<Scalar>, public Hermes::Mixins::StateQueryable
57  {
58  public:
60  MeshFunction();
61 
63  MeshFunction(MeshSharedPtr mesh);
64 
66  virtual ~MeshFunction();
67 
69  MeshSharedPtr get_mesh() const;
70 
72  virtual void copy(const MeshFunction<Scalar>* sln);
73  virtual void copy(MeshFunctionSharedPtr<Scalar> sln);
74 
76  RefMap* get_refmap(bool update = true);
77 
79  virtual Func<Scalar>* get_pt_value(double x, double y, bool use_MeshHashGrid = false, Element* e = nullptr) = 0;
80 
83  virtual MeshFunction<Scalar>* clone() const = 0;
84 
86  virtual void multiply(Scalar coef);
87 
90  virtual void add(MeshFunctionSharedPtr<Scalar>& other_mesh_function, SpaceSharedPtr<Scalar> target_space);
91 
93  virtual Scalar get_approx_max_value(int item = H2D_FN_VAL_0);
94 
96  virtual Scalar get_approx_min_value(int item = H2D_FN_VAL_0);
97 
99  virtual bool isOkay() const;
100 
102  std::string getClassName() const;
103 
105  virtual void init();
106 
107  virtual void free();
108 
110  virtual void reinit();
111 
114  virtual void set_quad_2d(Quad2D* quad_2d);
115 
118  virtual void set_active_element(Element* e);
119 
121  virtual int get_edge_fn_order(int edge);
122  protected:
123  ElementMode2D mode;
124  MeshSharedPtr mesh;
125  RefMap refmap;
126 
127  void update_refmap();
128 
129  friend class RefMap;
130  template<typename T> friend class KellyTypeAdapt;
131  template<typename T> friend class Adapt;
132 
133  template<typename T> friend class Func;
134 
135  template<typename T> friend HERMES_API Func<T>* init_fn(MeshFunction<T>*fu, const int order);
136 
137  template<typename T> friend class DiscontinuousFunc;
138  template<typename T> friend class DiscreteProblem;
139  template<typename T> friend class NeighborSearch;
140  };
141  }
142 }
143 
144 #endif
Definition: adapt.h:24
Stores one element of a mesh.
Definition: element.h:107
This class represents a function with jump discontinuity on an interface of two elements.
Definition: forms.h:335
Represents a function defined on a mesh.
Definition: mesh_function.h:56
Used to pass the instances of Space around.
Definition: space.h:34
HERMES_API Func< double > * init_fn(PrecalcShapeset *fu, RefMap *rm, const int order)
Init the shape function for the evaluation of the volumetric/surface integral (transformation of valu...
Definition: forms.cpp:469
Represents an arbitrary function defined on an element.
Definition: function.h:106
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Represents the reference mapping.
Definition: refmap.h:40
This class characterizes a neighborhood of a given edge in terms of adjacent elements and provides me...
Represents the solution of a PDE.
Definition: api2d.h:35