Hermes2D
2.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
order_permutator.cpp
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
#include "
global.h
"
16
#include "order_permutator.h"
17
namespace
Hermes
18
{
19
namespace
Hermes2D
20
{
21
namespace
RefinementSelectors
22
{
23
OrderPermutator::OrderPermutator
(
int
start_quad_order,
int
end_quad_order,
bool
iso_p,
int
* tgt_quad_order)
24
: start_order_h(
H2D_GET_H_ORDER
(start_quad_order)), start_order_v(H2D_GET_V_ORDER(start_quad_order))
25
, end_order_h(
H2D_GET_H_ORDER
(end_quad_order)), end_order_v(H2D_GET_V_ORDER(end_quad_order))
26
, iso_p(iso_p), tgt_quad_order(tgt_quad_order)
27
{
28
reset
();
29
}
30
31
bool
OrderPermutator::next
()
32
{
33
if
(
iso_p
)
34
{
35
if
(
order_h
>=
end_order_h
||
order_v
>=
end_order_v
)
36
return
false
;
37
38
order_h
++;
39
order_v
++;
40
}
41
else
42
{
43
if
(
order_h
>=
end_order_h
&&
order_v
>=
end_order_v
)
44
return
false
;
45
46
order_h
++;
47
if
(
order_h
>
end_order_h
)
48
{
49
order_h
=
start_order_h
;
50
order_v
++;
51
}
52
}
53
54
if
(
tgt_quad_order
!= NULL)
55
*
tgt_quad_order
= H2D_MAKE_QUAD_ORDER(
order_h
,
order_v
);
56
return
true
;
57
}
58
59
void
OrderPermutator::reset
()
60
{
61
order_h
=
start_order_h
;
62
order_v
=
start_order_v
;
63
if
(
tgt_quad_order
!= NULL)
64
*
tgt_quad_order
= H2D_MAKE_QUAD_ORDER(
order_h
,
order_v
);
65
}
66
67
int
OrderPermutator::get_order_h
()
const
68
{
69
return
order_h
;
70
}
71
72
int
OrderPermutator::get_order_v
()
const
73
{
74
return
order_v
;
75
}
76
77
int
OrderPermutator::get_quad_order
()
const
78
{
79
return
H2D_MAKE_QUAD_ORDER(
order_h
,
order_v
);
80
}
81
82
int
OrderPermutator::get_start_quad_order
()
const
83
{
84
return
H2D_MAKE_QUAD_ORDER(
start_order_h
,
start_order_v
);
85
}
86
87
int
OrderPermutator::get_end_quad_order
()
const
88
{
89
return
H2D_MAKE_QUAD_ORDER(
end_order_h
,
end_order_v
);
90
}
91
}
92
}
93
}
src
refinement_selectors
order_permutator.cpp
Generated on Mon Feb 18 2013 14:36:14 for Hermes2D by
1.8.3.1