Skip to content
Snippets Groups Projects
Commit a4e0243d authored by Dmitri Naumov's avatar Dmitri Naumov Committed by Christoph Lehmann
Browse files

[MGTL] Add a BoundaryElementsAtPoint.

This will be used in the element searcher.
parent 7c8c5a6b
No related branches found
No related tags found
No related merge requests found
/**
* @copyright
* Copyright (c) 2012-2015, 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, 0, node_ids[0]});
}
BoundaryElementsAtPoint::~BoundaryElementsAtPoint()
{
for (auto p : _boundary_elements)
delete p;
}
} // MeshGeoToolsLib
/**
* @copyright
* Copyright (c) 2012-2015, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/LICENSE.txt
*/
#ifndef BOUNDARYELEMENTSATPOINT_H_
#define BOUNDARYELEMENTSATPOINT_H_
#include <vector>
namespace GeoLib
{
class Point;
}
namespace MeshLib
{
class Mesh;
class Element;
}
namespace MeshGeoToolsLib
{
class MeshNodeSearcher;
/// This class collects point elements located at a given point elements.
class BoundaryElementsAtPoint final
{
public:
/// Constructor
/// \param mesh a mesh object
/// \param mshNodeSearcher a MeshNodeSearcher object which is internally
/// used to search mesh nodes
/// \param point a point object where edges are searched
BoundaryElementsAtPoint(MeshLib::Mesh const& mesh,
MeshNodeSearcher& mshNodeSearcher,
GeoLib::Point const& point);
~BoundaryElementsAtPoint();
MeshLib::Mesh const& getMesh() const
{
return _mesh;
}
GeoLib::Point const& getPoint() const
{
return _point;
}
/// Return the vector of boundary elements (i.e. points).
std::vector<MeshLib::Element*> const& getBoundaryElements() const
{
return _boundary_elements;
}
private:
MeshLib::Mesh const& _mesh;
GeoLib::Point const& _point;
std::vector<MeshLib::Element*> _boundary_elements;
};
} // end namespace MeshGeoToolsLib
#endif // BOUNDARYELEMENTSATPOINT_H_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment