https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SurfaceElementSet.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "SurfaceElement.h"
13
14#include "libmesh/bounding_box.h"
15
16#include <memory>
17#include <vector>
18
36{
37public:
39 static SurfaceElementSet fromMesh(const MeshBase & mesh);
40
42 static SurfaceElementSet fromElements(const std::vector<const Elem *> & elems);
43
45 const std::vector<std::unique_ptr<SurfaceElement>> & elements() const { return _elements; }
46
48 const std::vector<Point> & centroids() const { return _centroids; }
49
52
54 std::size_t size() const { return _elements.size(); }
55
56private:
58 SurfaceElementSet() = default;
59
62 void addElement(const Elem * elem);
63
64 std::vector<std::unique_ptr<SurfaceElement>> _elements;
65 std::vector<Point> _centroids;
67};
A group of surface elements wrapped for point-containment / distance queries.
const libMesh::BoundingBox & boundingBox() const
Global AABB of the group (plain union of element loose bounding boxes).
void addElement(const Elem *elem)
Validate, wrap, and append a single element, growing centroids and the AABB.
std::vector< std::unique_ptr< SurfaceElement > > _elements
std::size_t size() const
Number of surface elements in the group.
static SurfaceElementSet fromElements(const std::vector< const Elem * > &elems)
Build a set from a caller-provided subset of surface elements.
static SurfaceElementSet fromMesh(const MeshBase &mesh)
Build a set from every active element of a surface mesh.
libMesh::BoundingBox _bounding_box
const std::vector< Point > & centroids() const
Per-element centroids (vertex averages), aligned index-for-index with elements().
const std::vector< std::unique_ptr< SurfaceElement > > & elements() const
Owned surface-element wrappers, one per input element (input order preserved).
std::vector< Point > _centroids
SurfaceElementSet()=default
Built only through the factories.
MeshBase & mesh