OGS
VectorizedTensor.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
4#include "VectorizedTensor.h"
5
7{
8
9bool isTensorConvertibleTo1d(Eigen::Matrix3d const& tensor)
10{
11 return (tensor(0, 1) == 0. && tensor(1, 0) == 0. && //
12 tensor(0, 2) == 0. && tensor(2, 0) == 0. && //
13 tensor(1, 2) == 0. && tensor(2, 1) == 0.);
14}
15
16bool isTensorConvertibleTo2d(Eigen::Matrix3d const& tensor)
17{
18 return (tensor(0, 2) == 0. && tensor(1, 2) == 0. && //
19 tensor(2, 0) == 0. && tensor(2, 1) == 0.);
20}
21
22} // namespace MathLib::VectorizedTensor
bool isTensorConvertibleTo2d(Eigen::Matrix3d const &tensor)
bool isTensorConvertibleTo1d(Eigen::Matrix3d const &tensor)
Only a diagonal tensor can be converted to a 1d vectorized tensor.