LoAdSG
interatorBasisFunction.h
1
/**********************************************************************************
2
* Author: Christoph Pflaum, Riccarda Scherner-Griesshammer, Rainer Hartmann
3
* Department Informatik Lehrstuhl 10 - Systemsimulation
4
* Friedrich-Alexander Universität Erlangen-Nürnberg
5
*
6
*********************************************/
7
8
#ifndef INTERATORBASISFUNCTION_H
9
#define INTERATORBASISFUNCTION_H
10
11
12
/***
13
* iterator of all possible basis function in a d-dimensional cell
14
* 2^d possibilities
15
* Use iterator in the following form:
16
*
17
* for(IteratorBasisFunction<Dim> iterU;iterU.hasNext();iterU.next()) {
18
* ..... iterU.getBasisTypeCoord(d);
19
* ..... iterU.getBasisTypeNum(d);
20
* }
21
*
22
*/
23
template
<
size_t
DIM>
24
class
IteratorBasisFunction {
25
public
:
26
IteratorBasisFunction() { value = 0; maxValue=1; maxValue = maxValue << DIM; }
27
void
next() { ++value; }
28
bool
hasNext() {
return
value<maxValue; }
29
BasisFunctionType getBasisTypeCoord(
int
d) {
return
BasisFunctionType((value>>d)&1); }
30
int
getBasisTypeNum(
int
d) {
return
((value>>d)&1); }
31
private
:
32
long
value;
33
long
maxValue;
34
};
35
36
37
38
39
40
#endif
// INTERATORBASISFUNCTION_H
41
home
runner
work
LoAdSG
LoAdSG
library
source
stencils
InterfaceIntegration
interatorBasisFunction.h
Generated by
1.9.8