Hermes2D  2.0
space_h1.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_SPACE_H1_H
17 #define __H2D_SPACE_H1_H
18 
19 #include "../shapeset/shapeset_h1_all.h"
20 #include "space.h"
21 
22 namespace Hermes
23 {
24  namespace Hermes2D
25  {
35  template<typename Scalar>
36  class HERMES_API H1Space : public Space<Scalar>
37  {
38  public:
39  H1Space();
40  H1Space(const Mesh* mesh, EssentialBCs<Scalar>* boundary_conditions, int p_init = 1,
41  Shapeset* shapeset = NULL);
42 
43  H1Space(const Mesh* mesh, int p_init = 1,
44  Shapeset* shapeset = NULL);
45 
46  virtual ~H1Space();
47 
48  virtual void set_shapeset(Shapeset* shapeset);
49 
56  void fix_vertex(int id, Scalar value = 0.0);
57 
58  virtual Scalar* get_bc_projection(SurfPos* surf_pos, int order, EssentialBoundaryCondition<Scalar> *bc);
59 
61  virtual void copy(const Space<Scalar>* space, Mesh* new_mesh);
62 
63  protected:
64 
65  virtual SpaceType get_type() const { return HERMES_H1_SPACE; }
66 
68  void init(Shapeset* shapeset, int p_init);
69 
70  virtual void assign_vertex_dofs();
71  virtual void assign_edge_dofs();
72  virtual void assign_bubble_dofs();
73 
74  virtual void get_vertex_assembly_list(Element* e, int iv, AsmList<Scalar>* al) const;
75  virtual void get_boundary_assembly_list_internal(Element* e, int ie, AsmList<Scalar>* al) const;
76 
77  struct EdgeInfo
78  {
79  Node* node;
80  int part;
81  int ori;
82  double lo, hi;
83  };
84 
85  inline void output_component(typename Space<Scalar>::BaseComponent*& current, typename Space<Scalar>::BaseComponent*& last, typename Space<Scalar>::BaseComponent* min,
86  Node*& edge, typename Space<Scalar>::BaseComponent*& edge_dofs);
87 
88  typename Space<Scalar>::BaseComponent* merge_baselists(typename Space<Scalar>::BaseComponent* l1, int n1, typename Space<Scalar>::BaseComponent* l2, int n2,
89  Node* edge, typename Space<Scalar>::BaseComponent*& edge_dofs, int& ncomponents);
90 
91  void update_constrained_nodes(Element* e, EdgeInfo* ei0, EdgeInfo* ei1, EdgeInfo* ei2, EdgeInfo* ei3);
92 
93  virtual void update_constraints();
94 
95  struct FixedVertex
96  {
97  int id;
98  Scalar value;
99  };
100 
101  Hermes::vector<FixedVertex> fixed_vertices;
102 
103  inline bool is_fixed_vertex(int id) const;
104 
105  virtual void post_assign();
106  friend class Space<Scalar>;
107  };
108  }
109 }
110 #endif