OGS
GetElementRotationMatrices.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
6#include "GetSpaceDimension.h"
9#include "MeshLib/Mesh.h"
10
11namespace MeshLib
12{
13std::vector<Eigen::MatrixXd> getElementRotationMatrices(
14 int const space_dimension, int const mesh_dimension,
15 std::vector<Element*> const& elements)
16{
17 std::vector<Eigen::MatrixXd> element_rotation_matrices;
18 element_rotation_matrices.reserve(elements.size());
19 for (auto const* const element : elements)
20 {
21 int const element_dimension = static_cast<int>(element->getDimension());
22 if (element_dimension == space_dimension)
23 {
24 element_rotation_matrices.emplace_back(Eigen::MatrixXd::Identity(
25 element_dimension, element_dimension));
26 }
27 else
28 {
30 *element, mesh_dimension);
31
32 element_rotation_matrices.emplace_back(
33 coordinates_mapping.getRotationMatrixToGlobal().topLeftCorner(
34 space_dimension, element_dimension));
35 }
36 }
37
38 return element_rotation_matrices;
39}
40} // namespace MeshLib
const RotationMatrix & getRotationMatrixToGlobal() const
return a rotation matrix converting to global coordinates
std::vector< Eigen::MatrixXd > getElementRotationMatrices(int const space_dimension, int const mesh_dimension, std::vector< Element * > const &elements)
Element rotation matrix computation.