https://gitlab.opengeosys.org/ogs/ogs.git
Raw File
Tip revision: 555ba276a0c4ccf142e365b7ab12a1498cf2a82f authored by Lars Bilke on 19 December 2016, 09:55:52 UTC
Use Jenkins pipeline library 1.0.0
Tip revision: 555ba27
BoundaryElementsAtPoint.cpp
/**
 * @copyright
 * Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/LICENSE.txt
 */

#include "BoundaryElementsAtPoint.h"

#include "GeoLib/Point.h"
#include "MeshLib/Elements/Element.h"
#include "MeshLib/Elements/Point.h"
#include "MeshLib/Mesh.h"
#include "MeshLib/MeshSearch/ElementSearch.h"
#include "MeshLib/Node.h"

#include "MeshGeoToolsLib/MeshNodeSearcher.h"

namespace MeshGeoToolsLib
{
BoundaryElementsAtPoint::BoundaryElementsAtPoint(
    MeshLib::Mesh const &mesh, MeshNodeSearcher &mshNodeSearcher,
    GeoLib::Point const &point)
    : _mesh(mesh), _point(point)
{
    auto const node_ids = mshNodeSearcher.getMeshNodeIDs(_point);
    assert(node_ids.size() == 1);
    std::array<MeshLib::Node*, 1> const nodes = {{
        const_cast<MeshLib::Node*>(_mesh.getNode(node_ids[0]))}};

    _boundary_elements.push_back(new MeshLib::Point{nodes, node_ids[0]});
}

BoundaryElementsAtPoint::~BoundaryElementsAtPoint()
{
    for (auto p : _boundary_elements)
        delete p;
}

}  // MeshGeoToolsLib
back to top