14 #include "libmesh/elem.h" 23 const std::vector<dof_id_type> & primary_elem_ids,
24 const std::vector<std::tuple<dof_id_type, unsigned short int>> & secondary_boundary_info)
42 const std::vector<std::tuple<dof_id_type, unsigned short int>> & primary_boundary_info,
43 const std::vector<std::tuple<dof_id_type, unsigned short int>> & secondary_boundary_info)
66 std::vector<unsigned int> primary_elem_pairing_count(
_primary_elem_ids.size(), 0);
75 unsigned int patch_size = 1;
76 std::vector<std::size_t> return_index(patch_size);
78 const std::size_t i_primary = return_index[0];
91 primary_elem_pairing_count[i_primary]++;
97 for (std::size_t i_primary = 0; i_primary <
_primary_elem_ids.size(); i_primary++)
98 if (primary_elem_pairing_count[i_primary] != 1)
108 unsigned int patch_size = 1;
109 std::vector<std::size_t> return_index(patch_size);
111 const std::size_t i_primary = return_index[0];
131 std::map<dof_id_type, std::vector<Point>> primary_qp_map =
133 std::map<dof_id_type, std::vector<Point>> secondary_qp_map =
144 std::vector<Point> & primary_qps = primary_qp_map[primary_elem_id];
147 std::vector<Point> & secondary_qps = secondary_qp_map[secondary_elem_id];
149 mooseAssert(primary_qps.size() == secondary_qps.size(),
150 "The numbers of quadrature points for each element must be the same");
154 for (std::size_t i = 0; i < primary_qps.size(); i++)
156 unsigned int patch_size = 1;
157 std::vector<std::size_t> return_index(patch_size);
158 kd_tree_qp.neighborSearch(primary_qps[i], patch_size, return_index);
165 std::map<dof_id_type, std::vector<Point>>
167 const std::vector<dof_id_type> & elem_ids,
168 const std::vector<unsigned short int> & side_ids)
const 170 std::map<dof_id_type, std::vector<Point>> elem_id_to_qps;
171 for (
unsigned int i = 0; i < elem_ids.size(); i++)
173 const auto elem_id = elem_ids[i];
180 if (side_ids.size() > 0)
182 assembly.
reinit(elem, side_ids[i]);
191 for (std::size_t i = 0; i < q_points.
size(); i++)
192 elem_id_to_qps[elem_id].push_back(q_points[i]);
196 return elem_id_to_qps;
208 mooseAssert(
hasCoupledElemID(elem_id),
"The element ID has no coupled element.");
230 "The element ID has no coupled quadrature point indices.");
231 mooseAssert(qp < it->second.size(),
"The quadrature index does not exist in the map.");
232 return it->second[qp];
void extractFrom1DElements(const std::vector< dof_id_type > &elem_ids, std::vector< Point > &elem_points, std::vector< dof_id_type > &node_ids, std::vector< Point > &node_points) const
Extracts mesh information from 1D elements.
std::map< dof_id_type, std::vector< Point > > getLocalQuadraturePointMap(Assembly &assembly, const std::vector< dof_id_type > &elem_ids, const std::vector< unsigned short int > &side_ids) const
Gets the local quadrature point map for the primary or secondary side.
void buildMapping()
Builds the mapping using the extracted mesh information.
std::vector< Point > _secondary_elem_points
List of secondary element points.
Builds mapping between two aligned subdomains/boundaries.
std::map< dof_id_type, dof_id_type > _coupled_node_ids
Map of node ID to coupled node ID.
bool hasCoupledNodeID(const dof_id_type &node_id) const
Returns true if the node ID has a coupled node ID.
const MooseMesh & _mesh
Mesh.
bool _meshes_are_aligned
Flag that meshes are aligned.
void initialize(const std::vector< dof_id_type > &primary_elem_ids, const std::vector< std::tuple< dof_id_type, unsigned short int >> &secondary_boundary_info)
Extracts mesh information and builds the mapping.
std::vector< dof_id_type > _secondary_elem_ids
List of secondary element IDs.
const MooseArray< Point > & qPoints() const
std::vector< dof_id_type > _secondary_node_ids
List of secondary node IDs.
std::vector< unsigned short int > _secondary_side_ids
List of secondary side IDs (if any)
void reinit(const Elem *elem)
virtual Elem * queryElemPtr(const dof_id_type i)
const dof_id_type & getCoupledNodeID(const dof_id_type &node_id) const
Gets the coupled node ID for a given node ID.
const dof_id_type & getCoupledElemID(const dof_id_type &elem_id) const
Gets the coupled element ID for a given element ID.
unsigned int size() const
unsigned int getMaxLeafSize() const
std::vector< dof_id_type > _primary_node_ids
List of primary node IDs.
std::vector< Point > _primary_elem_points
List of primary element points.
MeshAlignment(const MooseMesh &mesh)
Constructor.
void buildCoupledElemQpIndexMap(Assembly &assembly)
Builds the map used for getting the coupled quadrature point index.
std::vector< Point > _primary_node_points
List of primary node points.
bool absolute_fuzzy_equals(const T &var1, const T2 &var2, const Real tol=TOLERANCE *TOLERANCE)
void setCurrentSubdomainID(SubdomainID i)
const MooseArray< Point > & qPointsFace() const
std::map< dof_id_type, std::vector< unsigned int > > _coupled_elem_qp_indices
Map of element ID to vector of coupled quadrature points.
std::vector< unsigned short int > _primary_side_ids
List of primary side IDs (if any)
void extractFromBoundaryInfo(const std::vector< std::tuple< dof_id_type, unsigned short int >> &boundary_info, std::vector< dof_id_type > &elem_ids, std::vector< unsigned short int > &side_ids, std::vector< Point > &side_points, std::vector< dof_id_type > &node_ids, std::vector< Point > &node_points) const
Extracts mesh information from boundary info.
std::vector< dof_id_type > _primary_elem_ids
List of primary element IDs.
std::map< dof_id_type, dof_id_type > _coupled_elem_ids
Map of element ID to coupled element ID.
processor_id_type processor_id() const
unsigned int getCoupledElemQpIndex(const dof_id_type &elem_id, const unsigned int &qp) const
Gets the quadrature point index on the coupled element corresponding to the quadrature point index on...
bool _meshes_are_coincident
Flag that meshes are coincident.
bool hasCoupledElemID(const dof_id_type &elem_id) const
Returns true if the element ID has a coupled element ID.
std::vector< Point > _secondary_node_points
List of secondary node points.