Revision b3324a3d59c75129437b5e2ab80655887d882124 authored by Christoph Lehmann on 02 November 2023, 10:23:56 UTC, committed by Christoph Lehmann on 02 November 2023, 10:23:56 UTC
Draft: Remove coupled solutions Closes #3432 See merge request ogs/ogs!4784
Utils.cpp
/**
* \file
*
* \copyright
* Copyright (c) 2012-2023, 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 "Utils.h"
#include "BaseLib/Error.h"
namespace GeoLib
{
std::vector<GeoLib::Point*> generateEquidistantPoints(
MathLib::Point3d const& begin, MathLib::Point3d const& end,
int const number_of_subdivisions)
{
if (number_of_subdivisions < 0)
{
OGS_FATAL(
"generateEquidistantPoints: number of subdivisions is required to "
"be non-negative.");
}
auto const& start = begin.asEigenVector3d();
auto const& stop = end.asEigenVector3d();
auto const delta = (stop - start) / (number_of_subdivisions + 1);
std::vector<GeoLib::Point*> points;
for (int i = 0; i <= number_of_subdivisions; ++i)
{
auto const p = start + i * delta;
points.push_back(new GeoLib::Point{p[0], p[1], p[2]});
}
points.push_back(new GeoLib::Point{stop[0], stop[1], stop[2]});
return points;
}
} // namespace GeoLib
Computing file changes ...