preCICE v3.1.2
Loading...
Searching...
No Matches
Dimensions.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Eigen/Core>
4
5namespace precice {
6namespace utils {
7
8const Eigen::VectorXd &delinearize(
9 int toDelinearize,
10 int dimensions);
11
12template <typename VECTOR_T>
14 const VECTOR_T &toLinearize)
15{
16 int index = 0;
17 for (int dim = 0; dim < toLinearize.size(); dim++) {
18 if (toLinearize(dim) > 0.0) {
19 index += (int) std::pow(2.0, dim);
20 }
21 }
22 return index;
23}
24
26template <int dimension>
27struct IndexMaps {
28};
29
30template <>
31struct IndexMaps<2> {
32 static const int CUBOID_EDGE_VERTICES[4][2];
33};
34
35template <>
36struct IndexMaps<3> {
37 static const int CUBOID_FACE_VERTICES[6][4];
38 static const int CUBOID_FACE_EDGES[6][4];
39 static const int CUBOID_EDGE_VERTICES[12][2];
40};
41
42} // namespace utils
43} // namespace precice
unsigned int index
const Eigen::VectorXd & delinearize(int toDelinearize, int dimensions)
int linearize(const VECTOR_T &toLinearize)
Main namespace of the precice library.
T pow(T... args)
Provides mappings of indices for dimensions 2 and 3.