Class documentation of Concepts

Loading...
Searching...
No Matches
innerResidual.hh
Go to the documentation of this file.
1
7#ifndef innerResidual_own_hh
8#define innerResidual_own_hh
9
10//TODO: Includes
11#include "basics/exceptions.hh"
12
13#include "space.hh"
14#include "hp2D.hh"
15#include "geometry.hh"
16#include "toolbox.hh"
17#include "operator.hh"
18
19#include "basics.hh"
20#include "function.hh"
21
22#define fillEntrieAddM 0
23#define ADD_D 0
24
25namespace concepts{
26
27// forward declaration
28template<class F, class G>
29class LinearForm;
30
31template<class F>
32class Space;
33
34using concepts::Real;
35
36/* TODO:
37 * - Documenntation beispielklassen nennen die nur auf randbasisfunktionen aufbauen
38 * - Schreibe Operator und PatchRHS operator
39 * - dont make ElementMatrix use Array
40 *
41 * -Der Space muss ein hpAdaptiveSpaceH1 erstmal sein sonst nicht implementiert
42 * -Die Linearform muss Elemente aus dem entsprechenden Raum nur annehmen können!
43 * -Die Linearform darf nur eine Linearform_0 oder _1 sein da diese nur die enstsprechenden
44 * -Shapefunktion integrale berechnet ! Alles andere wäre falsch
45 * -Vermeide doppelte Matrix resizing durch fillEntries bei add und Constructor
46 *
47 * -Deconstructor schreiben
48 * -Add routine muss linearForm bekommen die auf den Space zugreift
49 *
50 * TODO: Const routine umschreibung, todo: documentation
51 */
52
53template<class F>
54class InnerResidual: public OutputOperator { //Function<F> {
55public:
56
61 template<class G>
63
64
72 template<class G>
74
75
76 virtual ~InnerResidual() {};
77
85 return hashM_[quadKey];
86 }
87
88
95 typename concepts::HashMap<concepts::ElementMatrix<F> >::const_iterator iter = hashM_.find(quadKey);
96 assert(iter!=hashM_.end());
97 return iter->second;
98 }
99
105 const F operator()(const hp2D::Quad<F>& quad,const uint locNode) {
106 uint K = quad.support().key();
107 conceptsAssert(hashM_.exists(K),Assertion());
108 return hashM_[K].getData()[getPos_(locNode,quad.p())];
109 }
110
111
117 template<class G>
118 void add(LinearForm<F, G>& lform, const F a = 1);
119
120
121
122 /*Operator gets a Patch an computes right hand side for the
123 * corresponding linear system due to the topology of the
124 * Patch
125 */
126
127 /* template<class G>
128 Vector<F> operator()(ElementPatch<G> Patch){
129 }*/
130
131
132
133protected:
134 inline std::ostream& info(std::ostream& os) const {
135 return os << concepts::typeOf(*this) <<"( \n" << hashM_ << "\n )";
136 }
137
138
139
140
141private:
142
143 //TODO: dont make ElementMatrix use Array
145 //local reference to the current space
146 const Space<F>& spc_;
147
148
149 //maps from ElementKey to its belonging polynomial degree.
151
152 //all appearing polynomial degrees in x and y direction
153 //concepts::Sequence<const ushort*> degP_;
154
155
156
157 template<class G>
158 void fillEntries_(LinearForm<F, G>& lform, const F a = 1);
159
160
161
162// Method is used to read the correct innerResidual due to first order Basisfunctions.
163// Let N0,N1, E1,...,EP-1 be the Basis functions on [-1,1] ( [0,1] )
164// Then Innerresidual is computed due to first x then y tensor basis ordering :
165// Elementmatrix of size 2(p[0]+p[1]) iterative filled with :
166//
167// N0_x*N0_y , N1_x * N0_y , E1_x *N0_y,... EP-1_x * N0_y first p[0]+1 entries
168// increasing y-directed basis:
169// N0_x*N1_y , N1_x * N1_y , E1_x *N1_y,... EP-1_x * N1_y ...
170// increasing y-directed basis:
171// ...
172//
173// So the necassary nodal basis functions are
174// N0_x*N0_y at positon 0
175// N1_x * N0_y at position 1
176// N0_x*N1_y at position p[0]+1
177// N1_x * N1_y at position p[0]+2
178//
179// where p[0] is degree of basis functions in x direction
180//
181//
182// i=0..3 is the i-th (local numbered) node of quad, this local numbering is counter clockwise.
183//
184// But the polynomials are given first x then y order,
185// means for first order basis functioN:
186//
187// 0 node is 0th basis function
188// 1 node is 1th basis function
189// 2 node is 3th basis function
190// 3 node is 2th basis function
191//
192// For higher order including edge functions therefore 0-> 0 , 1 -> 1 , 2->p[0]+1+1 , 3->p[0]+1
193// For p[0]=1 this coincides with the shown example.
194
195 //TODO: This will be be used in new class anymore
199 uint getPos_(const uint i, const ushort* p) {
201 uint pos = 0;
202 switch (i) {
203 case (0):
204 return pos = 0;
205 break;
206 case (1):
207 return pos = 1;
208 break;
209 case (2):
210 return pos = p[0] + 2;
211 break;
212 case (3):
213 return pos = p[0] + 1;
214 break;
215 default:
216 return -1;
217 }
218 }
219
220};
221
222}//namespace
223#endif
const Key & key() const
Returns the key of the connector.
Definition connector.hh:105
bool exists(uint i) const
Returns true if the entrance exists.
Definition hashMap.hh:23
std::ostream & info(std::ostream &os) const
Returns information in an output stream.
void add(LinearForm< F, G > &lform, const F a=1)
const concepts::ElementMatrix< F > & operator[](uint quadKey)
InnerResidual(const SpaceOnCells< G > &spc, LinearForm< F, G > &lform, const F a=1)
InnerResidual(const SpaceOnCells< G > &spc)
const concepts::ElementMatrix< F > & operator()(uint quadKey) const
const F operator()(const hp2D::Quad< F > &quad, const uint locNode)
virtual const concepts::Quad & support() const
Definition quad.hh:194
const ushort * p() const
Definition quad.hh:229
#define conceptsAssert(cond, exc)
std::string typeOf(const T &t)
Definition output.hh:43
double Real
Definition typedefs.hh:39
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320
unsigned short ushort
Abbreviation for unsigned short.
Definition typedefs.hh:51