https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CacheSubdomainInfoThread.C
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
11
12#include "libmesh/elem.h"
13#include "libmesh/threads.h"
14
16
22
23void
24CacheSubdomainInfoThread::operator()(const ConstElemRange & range)
25{
26 for (const auto & elem : range)
27 {
28 SubdomainID subdomain_id = elem->subdomain_id();
29 const auto elem_boundary_ids = _mesh.getBoundaryIDs(elem);
30 for (const auto side : make_range(elem->n_sides()))
31 {
32 const auto & boundary_ids = elem_boundary_ids[side];
33 _sub_boundary_ids[subdomain_id].insert(boundary_ids.begin(), boundary_ids.end());
34
35 const Elem * neig = elem->neighbor_ptr(side);
36 if (neig)
37 {
38 _neighbor_subdomain_boundary_ids[neig->subdomain_id()].insert(boundary_ids.begin(),
39 boundary_ids.end());
40 SubdomainID neighbor_subdomain_id = neig->subdomain_id();
41 if (neighbor_subdomain_id != subdomain_id)
42 _neighbor_subs[subdomain_id].insert(neighbor_subdomain_id);
43 }
44 }
45 }
46}
47
48void
50{
51 for (const auto & [key, values] : y._neighbor_subs)
52 _neighbor_subs[key].insert(values.begin(), values.end());
53
54 for (const auto & [key, values] : y._sub_boundary_ids)
55 _sub_boundary_ids[key].insert(values.begin(), values.end());
56
57 for (const auto & [key, values] : y._neighbor_subdomain_boundary_ids)
58 _neighbor_subdomain_boundary_ids[key].insert(values.begin(), values.end());
59}
subdomain_id_type SubdomainID
std::array< Real, 2 > values
Definition MortarUtils.C:52
Fills subdomain neighbor and attached boundary-id caches for MooseMesh::cacheInfo().
std::unordered_map< SubdomainID, std::set< SubdomainID > > _neighbor_subs
std::unordered_map< SubdomainID, std::set< BoundaryID > > _neighbor_subdomain_boundary_ids
void join(const CacheSubdomainInfoThread &y)
std::unordered_map< SubdomainID, std::set< BoundaryID > > _sub_boundary_ids
void operator()(const ConstElemRange &range)
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
Returns a vector of boundary IDs for the requested element on the requested side.
Definition MooseMesh.C:2990
MeshBase & mesh