ug4
p1_continuity_constraints.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2015: G-CSC, Goethe University Frankfurt
3  * Author: Andreas Vogel
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__UG__LIB_DISC__SPATIAL_DISC__CONSTRAINTS__CONTINUITY_CONSTRAINTS__P1_CONTINUITY_CONSTRAINTS__
34 #define __H__UG__LIB_DISC__SPATIAL_DISC__CONSTRAINTS__CONTINUITY_CONSTRAINTS__P1_CONTINUITY_CONSTRAINTS__
35 
39 
40 namespace ug {
41 
43 void CollectConstraining(std::vector<Vertex*>& vConstrainingVrt,
44  const Grid& grid,
45  ConstrainedVertex* hgVrt,
46  bool bClearContainer = true);
47 
48 
49 template <typename TDomain, typename TAlgebra>
51  : public IDomainConstraint<TDomain, TAlgebra>
52 {
53  public:
54  // Algebra type
55  typedef TAlgebra algebra_type;
56 
57  // Type of algebra matrix
58  typedef typename algebra_type::matrix_type matrix_type;
59 
60  // Type of algebra vector
61  typedef typename algebra_type::vector_type vector_type;
62 
63  public:
64  SymP1Constraints() : IDomainConstraint<TDomain, TAlgebra>(), m_bAssembleLinearProblem(false) {}
65  virtual ~SymP1Constraints() {}
66 
67  virtual int type() const {return CT_HANGING;}
68 
69  void adjust_jacobian(matrix_type& J, const vector_type& u,
72  const number s_a0 = 1.0);
73 
74  void adjust_defect(vector_type& d, const vector_type& u,
77  const std::vector<number>* vScaleMass = NULL,
78  const std::vector<number>* vScaleStiff = NULL);
79 
80  void adjust_rhs(vector_type& rhs, const vector_type& u,
81  ConstSmartPtr<DoFDistribution> dd, int type, number time = 0.0);
82 
83  void adjust_linear(matrix_type& mat, vector_type& rhs,
84  ConstSmartPtr<DoFDistribution> dd, int type, number time = 0.0);
85 
87  int type, number time = 0.0);
88 
92  int type,
93  number time = 0.0);
94 
98  int type,
99  number time = 0.0);
100 
101  virtual void adjust_correction
102  ( vector_type& u,
104  int type,
105  number time = 0.0
106  );
107 
108  protected:
110 };
111 
112 
113 
114 template <typename TDomain, typename TAlgebra>
116  : public IDomainConstraint<TDomain, TAlgebra>
117 {
118  public:
119  // Algebra type
120  typedef TAlgebra algebra_type;
121 
122  // Type of algebra matrix
123  typedef typename algebra_type::matrix_type matrix_type;
124 
125  // Type of algebra vector
126  typedef typename algebra_type::vector_type vector_type;
127 
128  protected:
130 
131  public:
134 
135  virtual int type() const {return CT_HANGING;}
136 
137  void adjust_jacobian(matrix_type& J, const vector_type& u,
138  ConstSmartPtr<DoFDistribution> dd, int type, number time = 0.0,
140  const number s_a0 = 1.0);
141 
142  void adjust_defect(vector_type& d, const vector_type& u,
143  ConstSmartPtr<DoFDistribution> dd, int type, number time = 0.0,
145  const std::vector<number>* vScaleMass = NULL,
146  const std::vector<number>* vScaleStiff = NULL);
147 
148  void adjust_rhs(vector_type& rhs, const vector_type& u,
149  ConstSmartPtr<DoFDistribution> dd, int type, number time = 0.0);
150 
151  void adjust_linear(matrix_type& mat, vector_type& rhs,
152  ConstSmartPtr<DoFDistribution> dd, int type, number time = 0.0);
153 
155  int type, number time = 0.0);
156 
160  int type,
161  number time = 0.0);
162 
166  int type,
167  number time = 0.0);
168 
169  virtual void adjust_correction
170  ( vector_type& u,
172  int type,
173  number time = 0.0
174  );
175 
176  protected:
178 };
179 
180 }; // namespace ug
181 
183 
184 #endif /* __H__UG__LIB_DISC__SPATIAL_DISC__CONSTRAINTS__CONTINUITY_CONSTRAINTS__P1_CONTINUITY_CONSTRAINTS__ */
Definition: smart_pointer.h:296
Definition: constraint_interface.h:162
ConstSmartPtr< DoFDistribution > dd(const GridLevel &gl) const
returns the level dof distribution
Definition: constraint_interface.h:242
Definition: p1_continuity_constraints.h:117
algebra_type::vector_type vector_type
Definition: p1_continuity_constraints.h:126
IDomainConstraint< TDomain, TAlgebra > base_type
Definition: p1_continuity_constraints.h:129
virtual ~OneSideP1Constraints()
Definition: p1_continuity_constraints.h:133
void adjust_jacobian(matrix_type &J, const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol=NULL, const number s_a0=1.0)
adapts jacobian to enforce constraints
Definition: p1_continuity_constraints_impl.h:917
virtual void adjust_correction(vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
Definition: p1_continuity_constraints_impl.h:1112
TAlgebra algebra_type
Definition: p1_continuity_constraints.h:120
void adjust_prolongation(matrix_type &P, ConstSmartPtr< DoFDistribution > ddFine, ConstSmartPtr< DoFDistribution > ddCoarse, int type, number time=0.0)
sets constraints in prolongation
Definition: p1_continuity_constraints_impl.h:1051
void adjust_rhs(vector_type &rhs, const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
adapts a rhs to enforce constraints
Definition: p1_continuity_constraints_impl.h:875
algebra_type::matrix_type matrix_type
Definition: p1_continuity_constraints.h:123
void adjust_solution(vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
sets the constraints in a solution vector
Definition: p1_continuity_constraints_impl.h:1014
bool m_bAssembleLinearProblem
Definition: p1_continuity_constraints.h:177
void adjust_defect(vector_type &d, const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol=NULL, const std::vector< number > *vScaleMass=NULL, const std::vector< number > *vScaleStiff=NULL)
adapts defect to enforce constraints
Definition: p1_continuity_constraints_impl.h:829
void adjust_restriction(matrix_type &R, ConstSmartPtr< DoFDistribution > ddCoarse, ConstSmartPtr< DoFDistribution > ddFine, int type, number time=0.0)
sets constraints in restriction
Definition: p1_continuity_constraints_impl.h:1096
OneSideP1Constraints()
Definition: p1_continuity_constraints.h:132
virtual int type() const
returns the type of constraints
Definition: p1_continuity_constraints.h:135
void adjust_linear(matrix_type &mat, vector_type &rhs, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
adapts matrix and rhs (linear case) to enforce constraints
Definition: p1_continuity_constraints_impl.h:964
Wrapper for sequential matrices to handle them in parallel.
Definition: parallel_matrix.h:65
Definition: p1_continuity_constraints.h:52
void adjust_defect(vector_type &d, const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol=NULL, const std::vector< number > *vScaleMass=NULL, const std::vector< number > *vScaleStiff=NULL)
adapts defect to enforce constraints
Definition: p1_continuity_constraints_impl.h:399
void adjust_prolongation(matrix_type &P, ConstSmartPtr< DoFDistribution > ddFine, ConstSmartPtr< DoFDistribution > ddCoarse, int type, number time=0.0)
sets constraints in prolongation
Definition: p1_continuity_constraints_impl.h:588
void adjust_restriction(matrix_type &R, ConstSmartPtr< DoFDistribution > ddCoarse, ConstSmartPtr< DoFDistribution > ddFine, int type, number time=0.0)
sets constraints in restriction
Definition: p1_continuity_constraints_impl.h:633
void adjust_rhs(vector_type &rhs, const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
adapts a rhs to enforce constraints
Definition: p1_continuity_constraints_impl.h:437
void adjust_jacobian(matrix_type &J, const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol=NULL, const number s_a0=1.0)
adapts jacobian to enforce constraints
Definition: p1_continuity_constraints_impl.h:471
SymP1Constraints()
Definition: p1_continuity_constraints.h:64
algebra_type::matrix_type matrix_type
Definition: p1_continuity_constraints.h:58
virtual void adjust_correction(vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
Definition: p1_continuity_constraints_impl.h:650
TAlgebra algebra_type
Definition: p1_continuity_constraints.h:55
virtual int type() const
returns the type of constraints
Definition: p1_continuity_constraints.h:67
void adjust_linear(matrix_type &mat, vector_type &rhs, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
adapts matrix and rhs (linear case) to enforce constraints
Definition: p1_continuity_constraints_impl.h:510
virtual ~SymP1Constraints()
Definition: p1_continuity_constraints.h:65
algebra_type::vector_type vector_type
Definition: p1_continuity_constraints.h:61
bool m_bAssembleLinearProblem
Definition: p1_continuity_constraints.h:109
void adjust_solution(vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
sets the constraints in a solution vector
Definition: p1_continuity_constraints_impl.h:552
time series of solutions and corresponding time point
Definition: solution_time_series.h:59
double number
Definition: types.h:124
CPUAlgebra::vector_type vector_type
the ug namespace
@ CT_HANGING
Definition: ass_tuner.h:57
void CollectConstraining(std::vector< Vertex * > &vConstrainingVrt, const Grid &grid, ConstrainedVertex *hgVrt, bool bClearContainer)
returns the vertices of the object constraining a hanging vertex
Definition: p1_continuity_constraints.cpp:41