preCICE v3.2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Dimensions.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Eigen/Core>
4
5namespace precice::utils {
6
7const Eigen::VectorXd &delinearize(
8 int toDelinearize,
9 int dimensions);
10
11template <typename VECTOR_T>
13 const VECTOR_T &toLinearize)
14{
15 int index = 0;
16 for (int dim = 0; dim < toLinearize.size(); dim++) {
17 if (toLinearize(dim) > 0.0) {
18 index += (int) std::pow(2.0, dim);
19 }
20 }
21 return index;
22}
23
25template <int dimension>
26struct IndexMaps {
27};
28
29template <>
30struct IndexMaps<2> {
31 static const int CUBOID_EDGE_VERTICES[4][2];
32};
33
34template <>
35struct IndexMaps<3> {
36 static const int CUBOID_FACE_VERTICES[6][4];
37 static const int CUBOID_FACE_EDGES[6][4];
38 static const int CUBOID_EDGE_VERTICES[12][2];
39};
40
41} // namespace precice::utils
unsigned int index
contains precice-related utilities.
const Eigen::VectorXd & delinearize(int toDelinearize, int dimensions)
int linearize(const VECTOR_T &toLinearize)
T pow(T... args)
Provides mappings of indices for dimensions 2 and 3.