https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SubdomainGrainIDGenerator.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://www.mooseframework.org
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
13#include "libmesh/bounding_box.h"
14#include "SurfaceElement.h"
15#include "SurfaceEdge2.h"
16#include "SurfaceTri3.h"
18
24{
25public:
28
29 std::unique_ptr<libMesh::MeshBase> generate() override;
30
31protected:
42
44 std::unique_ptr<libMesh::MeshBase> & _boundary_mesh;
45
46protected:
48 std::unordered_map<SubdomainID, std::vector<Point>> _centroids_by_subdomain;
50 std::unordered_map<SubdomainID, std::vector<std::unique_ptr<SurfaceElement>>>
53 std::unordered_map<SubdomainID, BoundingBox> _bboxes_by_subdomain;
54
56 std::unordered_map<SubdomainID, std::unique_ptr<AdaptiveRayContainmentCheck>>
59 std::vector<SubdomainCheckerEntry> _checker_entries;
60
63
65 Real _eps;
67 unsigned int _leaf_max_size;
68
70 std::unique_ptr<libMesh::MeshBase> _boundary_owned;
71
74
76 void buildInOutTesters();
77
79 static bool
80 boundingBoxesIntersect(const BoundingBox & lhs, const BoundingBox & rhs, const Real tolerance);
81};
const InputParameters & parameters() const
Common parameters and members for shifted boundary subdomain mesh generators that classify volume ele...
Assigns grain subdomain IDs to a volume mesh based on watertight closed boundaries in an external bou...
Point _ray_direction
Ray shooting direction in Point format.
std::unique_ptr< libMesh::MeshBase > _boundary_owned
The boundary mesh to use for identifying grain IDs.
std::unique_ptr< libMesh::MeshBase > & _boundary_mesh
Reference to the external boundary mesh defining grain boundaries.
void buildInOutTesters()
Build the IN-OUT testers for each subdomain.
std::unique_ptr< libMesh::MeshBase > generate() override
void buildSubdomainGroupedData()
build the data structure grouping by different subdomains
std::unordered_map< SubdomainID, BoundingBox > _bboxes_by_subdomain
The bounding boxes of the boundary elements grouped by subdomains.
std::unordered_map< SubdomainID, std::unique_ptr< AdaptiveRayContainmentCheck > > _subdomain_id_checkers
The IN-OUT testers for each subdomain.
static InputParameters validParams()
static bool boundingBoxesIntersect(const BoundingBox &lhs, const BoundingBox &rhs, const Real tolerance)
Check whether two bounding boxes overlap within a small tolerance.
std::unordered_map< SubdomainID, std::vector< std::unique_ptr< SurfaceElement > > > _boundary_elements_by_subdomain
The boundary elements grouped by subdomains.
unsigned int _leaf_max_size
Maximum number of boundary-element centroids in a leaf node of the k-d tree.
std::unordered_map< SubdomainID, std::vector< Point > > _centroids_by_subdomain
The centroids of the boundary elements grouped by subdomains.
std::vector< SubdomainCheckerEntry > _checker_entries
Cache contiguous checker metadata for faster per-element scans.
Real _eps
eps for intersection or on surface checking
Cache of bounding box and checker pointers for fast spatial queries.
AdaptiveRayContainmentCheck * checker
Pointer to the ray-casting containment checker for this subdomain.
BoundingBox bbox
Bounding box enclosing the surface elements of this subdomain.
SubdomainID subdomain_id
Subdomain ID associated with this checker.