Revision 7577fb898dbfe74566da2304cc3d4ce3c0d89f34 authored by Dmitri Naumov on 29 September 2021, 20:20:03 UTC, committed by Dmitri Naumov on 01 October 2021, 09:18:56 UTC
Derivatives used in the advection related parts of the Jacobian.
1 parent dda1185
CoordinateSystem.cpp
/**
* \file
* \copyright
* Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/
#include "CoordinateSystem.h"
#include "MeshLib/Elements/Element.h"
#include "MeshLib/Node.h"
namespace MeshLib
{
CoordinateSystem::CoordinateSystem(const Element& ele)
{
GeoLib::AABB const aabb(ele.getNodes(),
ele.getNodes() + ele.getNumberOfNodes());
CoordinateSystem const bboxCoordSys(getCoordinateSystem(aabb));
if (bboxCoordSys.getDimension() >= ele.getDimension())
{
_type = bboxCoordSys.getType();
}
else
{ // e.g. zero volume elements
if (ele.getDimension() >= 1)
{
_type = CoordinateSystemType::X;
}
if (ele.getDimension() >= 2)
{
_type |= CoordinateSystemType::Y;
}
if (ele.getDimension() == 3)
{
_type |= CoordinateSystemType::Z;
}
}
}
unsigned char CoordinateSystem::getCoordinateSystem(
const GeoLib::AABB& bbox) const
{
unsigned char coords = 0;
auto const& bbox_min = bbox.getMinPoint();
auto const& bbox_max = bbox.getMaxPoint();
Eigen::Vector3d const pt_diff = bbox_max - bbox_min;
// The axis aligned bounding box is a from the right half-open interval.
// Therefore, the difference between the particular coordinates of the
// points is modified by the unit in the last place towards zero.
if (std::nexttoward(std::abs(pt_diff[0]), 0.0) > .0)
{
coords |= CoordinateSystemType::X;
}
if (std::nexttoward(std::abs(pt_diff[1]), 0.0) > .0)
{
coords |= CoordinateSystemType::Y;
}
if (std::nexttoward(std::abs(pt_diff[2]), 0.0) > .0)
{
coords |= CoordinateSystemType::Z;
}
return coords;
}
} // namespace MeshLib
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...