Line data Source code
1 : #include "Utility/IpplException.h"
2 :
3 : namespace ippl {
4 : namespace detail {
5 0 : bool isUpper(unsigned int face) {
6 0 : for (; face > 0; face /= 3) {
7 0 : if (face % 3 == 1) {
8 0 : return true;
9 : }
10 : }
11 0 : return false;
12 : }
13 :
14 0 : unsigned int getFaceDim(unsigned int face) {
15 0 : int dim = -1;
16 0 : unsigned int d = 0;
17 0 : for (; face > 0; face /= 3, d++) {
18 0 : if (face % 3 != 2) {
19 0 : if (dim == -1) {
20 0 : dim = d;
21 : } else {
22 : throw IpplException(
23 : "ippl::detail::getFaceDim",
24 0 : "Argument corresponds to lower dimension hypercube than a facet");
25 : }
26 : }
27 : }
28 0 : if (dim < 0) {
29 0 : return d;
30 : }
31 0 : return dim;
32 : }
33 : } // namespace detail
34 : } // namespace ippl
|