https://gitlab.opengeosys.org/ogs/ogs.git
Raw File
Tip revision: cbe58dbeaf96a2fc57b243531973a1ac88019924 authored by Christoph Lehmann on 18 September 2023, 16:08:20 UTC
Merge branch 'rtp-compute-only-upon-timestep-change' into 'master'
Tip revision: cbe58db
MeshNodesOnPoint.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 "MeshNodesOnPoint.h"

#include <range/v3/algorithm/copy_if.hpp>

#include "MeshLib/Mesh.h"

namespace MeshGeoToolsLib
{
MeshNodesOnPoint::MeshNodesOnPoint(MeshLib::Mesh const& mesh,
                                   GeoLib::Grid<MeshLib::Node> const& mesh_grid,
                                   GeoLib::Point const& pnt,
                                   double epsilon_radius,
                                   SearchAllNodes search_all_nodes)
    : _mesh(mesh), _pnt(pnt)
{
    std::vector<std::size_t> vec_ids(
        mesh_grid.getPointsInEpsilonEnvironment(pnt, epsilon_radius));
    if (search_all_nodes == SearchAllNodes::Yes)
    {
        _msh_node_ids = vec_ids;
    }
    else
    {
        auto is_base_node = [this](std::size_t const id)
        {
            return MeshLib::isBaseNode(*_mesh.getNode(id),
                                       _mesh.getElementsConnectedToNode(id));
        };

        ranges::copy_if(
            vec_ids, std::back_inserter(_msh_node_ids), is_base_node);
    }
}

}  // end namespace MeshGeoToolsLib
back to top