https://mooseframework.inl.gov
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MeshAlignmentBase Class Reference

Builds mapping between two aligned subdomains/boundaries. More...

#include <MeshAlignmentBase.h>

Inheritance diagram for MeshAlignmentBase:
[legend]

Public Member Functions

 MeshAlignmentBase (const MooseMesh &mesh)
 Constructor. More...
 
const std::vector< dof_id_type > & getPrimaryElemIDs () const
 Returns the list of element IDs on the primary boundary. More...
 
const std::vector< dof_id_type > & getSecondaryElemIDs () const
 Returns the list of element IDs on the secondary boundary. More...
 
bool meshesAreAligned () const
 Returns true if the primary and secondary meshes are aligned. More...
 

Protected Member Functions

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. More...
 
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. More...
 

Protected Attributes

const MooseMesh_mesh
 Mesh. More...
 
std::vector< dof_id_type_primary_elem_ids
 List of primary element IDs. More...
 
std::vector< dof_id_type_secondary_elem_ids
 List of secondary element IDs. More...
 
std::vector< Point > _primary_elem_points
 List of primary element points. More...
 
std::vector< Point > _secondary_elem_points
 List of secondary element points. More...
 
std::vector< unsigned short int_primary_side_ids
 List of primary side IDs (if any) More...
 
std::vector< unsigned short int_secondary_side_ids
 List of secondary side IDs (if any) More...
 
std::vector< dof_id_type_primary_node_ids
 List of primary node IDs. More...
 
std::vector< dof_id_type_secondary_node_ids
 List of secondary node IDs. More...
 
std::vector< Point > _primary_node_points
 List of primary node points. More...
 
std::vector< Point > _secondary_node_points
 List of secondary node points. More...
 
bool _meshes_are_aligned
 Flag that meshes are aligned. More...
 

Detailed Description

Builds mapping between two aligned subdomains/boundaries.

This class handles the following cases:

Definition at line 21 of file MeshAlignmentBase.h.

Constructor & Destructor Documentation

◆ MeshAlignmentBase()

MeshAlignmentBase::MeshAlignmentBase ( const MooseMesh mesh)

Constructor.

Parameters
mesh[in]mesh Mesh

Definition at line 14 of file MeshAlignmentBase.C.

15  : _mesh(mesh), _meshes_are_aligned(false)
16 {
17 }
const MooseMesh & _mesh
Mesh.
bool _meshes_are_aligned
Flag that meshes are aligned.

Member Function Documentation

◆ extractFrom1DElements()

void MeshAlignmentBase::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
protected

Extracts mesh information from 1D elements.

Parameters
[in]elem_idsVector of element IDs
[out]elem_pointsVector of element centroids
[out]node_idsVector of node IDs
[out]node_pointsVector of node points

Definition at line 20 of file MeshAlignmentBase.C.

Referenced by MeshAlignment1D3D::initialize(), and MeshAlignment::initialize().

24 {
25  elem_points.clear();
26  node_ids.clear();
27  node_points.clear();
28 
29  for (const auto & elem_id : elem_ids)
30  {
31  const Elem * elem = _mesh.elemPtr(elem_id);
32  elem_points.push_back(elem->vertex_average());
33 
34  for (const auto j : elem->node_index_range())
35  {
36  const Node & node = elem->node_ref(j);
37  const auto node_id = node.id();
38  if (std::find(node_ids.begin(), node_ids.end(), node_id) == node_ids.end())
39  {
40  node_ids.push_back(node_id);
41  node_points.push_back(node);
42  }
43  }
44  }
45 }
virtual Elem * elemPtr(const dof_id_type i)
const MooseMesh & _mesh
Mesh.
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")

◆ extractFromBoundaryInfo()

void MeshAlignmentBase::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
protected

Extracts mesh information from boundary info.

Parameters
[in]boundary_infoVector of tuples of element ID and side ID on boundary
[out]elem_idsVector of element IDs
[out]side_idsVector of side IDs
[out]side_pointsVector of side centroids
[out]node_idsVector of node IDs
[out]node_pointsVector of node points

Definition at line 48 of file MeshAlignmentBase.C.

Referenced by MeshAlignment2D2D::initialize(), MeshAlignment1D3D::initialize(), MeshAlignment2D3D::initialize(), and MeshAlignment::initialize().

55 {
56  elem_ids.clear();
57  side_ids.clear();
58  side_points.clear();
59  node_ids.clear();
60  node_points.clear();
61 
62  for (const auto & elem_id_and_side : boundary_info)
63  {
64  auto elem_id = std::get<0>(elem_id_and_side);
65  elem_ids.push_back(elem_id);
66 
67  auto side = std::get<1>(elem_id_and_side);
68  side_ids.push_back(side);
69 
70  const Elem * elem = _mesh.elemPtr(elem_id);
71  const Elem * side_elem = elem->build_side_ptr(side).release();
72  const Point side_center = side_elem->vertex_average();
73  side_points.push_back(side_center);
74 
75  for (const auto j : side_elem->node_index_range())
76  {
77  const Node & node = side_elem->node_ref(j);
78  const auto node_id = node.id();
79  if (std::find(node_ids.begin(), node_ids.end(), node_id) == node_ids.end())
80  {
81  node_ids.push_back(node_id);
82  node_points.push_back(node);
83  }
84  }
85  delete side_elem;
86  }
87 }
virtual Elem * elemPtr(const dof_id_type i)
const MooseMesh & _mesh
Mesh.
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")

◆ getPrimaryElemIDs()

const std::vector<dof_id_type>& MeshAlignmentBase::getPrimaryElemIDs ( ) const
inline

Returns the list of element IDs on the primary boundary.

Definition at line 34 of file MeshAlignmentBase.h.

Referenced by HeatStructure2DCouplerBase::setupMesh(), and HSCoupler2D2DRadiation::setupMesh().

34 { return _primary_elem_ids; }
std::vector< dof_id_type > _primary_elem_ids
List of primary element IDs.

◆ getSecondaryElemIDs()

const std::vector<dof_id_type>& MeshAlignmentBase::getSecondaryElemIDs ( ) const
inline

Returns the list of element IDs on the secondary boundary.

Definition at line 39 of file MeshAlignmentBase.h.

Referenced by HSCoupler2D3D::setupMesh().

39 { return _secondary_elem_ids; }
std::vector< dof_id_type > _secondary_elem_ids
List of secondary element IDs.

◆ meshesAreAligned()

bool MeshAlignmentBase::meshesAreAligned ( ) const
inline

Member Data Documentation

◆ _mesh

const MooseMesh& MeshAlignmentBase::_mesh
protected

◆ _meshes_are_aligned

bool MeshAlignmentBase::_meshes_are_aligned
protected

Flag that meshes are aligned.

Definition at line 105 of file MeshAlignmentBase.h.

Referenced by MeshAlignment::buildMapping(), MeshAlignmentOneToMany::checkAlignment(), and meshesAreAligned().

◆ _primary_elem_ids

std::vector<dof_id_type> MeshAlignmentBase::_primary_elem_ids
protected

◆ _primary_elem_points

std::vector<Point> MeshAlignmentBase::_primary_elem_points
protected

◆ _primary_node_ids

std::vector<dof_id_type> MeshAlignmentBase::_primary_node_ids
protected

◆ _primary_node_points

std::vector<Point> MeshAlignmentBase::_primary_node_points
protected

◆ _primary_side_ids

std::vector<unsigned short int> MeshAlignmentBase::_primary_side_ids
protected

◆ _secondary_elem_ids

std::vector<dof_id_type> MeshAlignmentBase::_secondary_elem_ids
protected

◆ _secondary_elem_points

std::vector<Point> MeshAlignmentBase::_secondary_elem_points
protected

◆ _secondary_node_ids

std::vector<dof_id_type> MeshAlignmentBase::_secondary_node_ids
protected

◆ _secondary_node_points

std::vector<Point> MeshAlignmentBase::_secondary_node_points
protected

◆ _secondary_side_ids

std::vector<unsigned short int> MeshAlignmentBase::_secondary_side_ids
protected

The documentation for this class was generated from the following files: