Hermes2D  2.0
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 
32  {
33  if(iso_p)
34  {
36  return false;
37 
38  order_h++;
39  order_v++;
40  }
41  else
42  {
44  return false;
45 
46  order_h++;
47  if(order_h > end_order_h)
48  {
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 
60  {
63  if(tgt_quad_order != NULL)
64  *tgt_quad_order = H2D_MAKE_QUAD_ORDER(order_h, order_v);
65  }
66 
68  {
69  return order_h;
70  }
71 
73  {
74  return order_v;
75  }
76 
78  {
79  return H2D_MAKE_QUAD_ORDER(order_h, order_v);
80  }
81 
83  {
84  return H2D_MAKE_QUAD_ORDER(start_order_h, start_order_v);
85  }
86 
88  {
89  return H2D_MAKE_QUAD_ORDER(end_order_h, end_order_v);
90  }
91  }
92  }
93 }