Line data Source code
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 "MeshAlignmentBase.h" 13 : 14 : /** 15 : * Builds mapping between a 1D/2D boundary and a 3D boundary 16 : * 17 : * The "primary" mesh is the 1D/2D boundary, and the "secondary" mesh is the 3D boundary. 18 : */ 19 : class MeshAlignmentOneToMany : public MeshAlignmentBase 20 : { 21 : public: 22 : /** 23 : * Constructor 24 : * 25 : * @param mesh[in] mesh Mesh 26 : */ 27 : MeshAlignmentOneToMany(const MooseMesh & mesh); 28 : 29 : /** 30 : * Returns true if the given secondary element ID has a coupled primary element 31 : * 32 : * @param[in] secondary_elem_id Secondary element ID for which to find the coupled primary 33 : * element ID 34 : */ 35 : bool hasCoupledPrimaryElemID(const dof_id_type & secondary_elem_id) const; 36 : 37 : /** 38 : * Gets the coupled primary element ID for a given secondary element ID 39 : * 40 : * @param[in] secondary_elem_id Secondary element ID for which to find the coupled primary 41 : * element ID 42 : */ 43 : dof_id_type getCoupledPrimaryElemID(const dof_id_type & secondary_elem_id) const; 44 : 45 : /** 46 : * Returns true if the given primary element ID has coupled secondary elements 47 : * 48 : * @param[in] primary_elem_id Primary element ID for which to find the coupled secondary element 49 : * IDs 50 : */ 51 : bool hasCoupledSecondaryElemIDs(const dof_id_type & primary_elem_id) const; 52 : 53 : /** 54 : * Gets the coupled secondary element IDs for a given primary element ID 55 : * 56 : * @param[in] primary_elem_id Primary element ID for which to find the coupled secondary element 57 : * IDs 58 : */ 59 : const std::vector<dof_id_type> & 60 : getCoupledSecondaryElemIDs(const dof_id_type & primary_elem_id) const; 61 : 62 : /** 63 : * Gets the number of quadrature points for faces on the primary boundary 64 : */ 65 90401 : unsigned int getPrimaryNumberOfQuadraturePoints() const { return _n_qp_primary; } 66 : 67 : /** 68 : * Gets the number of quadrature points for faces on the secondary boundary 69 : */ 70 247500 : unsigned int getSecondaryNumberOfQuadraturePoints() const { return _n_qp_secondary; } 71 : 72 : /** 73 : * Gets the quadrature point index on the primary element corresponding to the 74 : * quadrature point index on the provided secondary element 75 : * 76 : * Only secondary elements corresponding to local primary elements may be queried. 77 : * 78 : * @param[in] secondary_elem_id Secondary element ID for which to find the coupled quadrature 79 : * point 80 : * @param[in] secondary_qp Quadrature point index on the given secondary element 81 : */ 82 : unsigned int getCoupledPrimaryElemQpIndex(const dof_id_type & secondary_elem_id, 83 : const unsigned int & secondary_qp) const; 84 : 85 : /** 86 : * Gets the maximum number of secondary elements coupled to any primary element 87 : */ 88 69 : unsigned int getMaxCouplingSize() const { return _max_coupling_size; } 89 : 90 : protected: 91 : /** 92 : * Builds the mapping using the extracted mesh information 93 : */ 94 : void buildMapping(); 95 : 96 : /** 97 : * Checks the alignment and sets \c _mesh_alignment accordingly 98 : * 99 : * @param[in] axis_point Any point on the axis of the 1D or 2D boundary 100 : * @param[in] axis_direction Direction of the axis for the 1D or 2D boundary 101 : */ 102 : void checkAlignment(const Point & axis_point, const RealVectorValue & axis_direction); 103 : 104 : /// Map of primary element ID to coupled secondary element IDs 105 : std::map<dof_id_type, std::vector<dof_id_type>> _primary_elem_id_to_secondary_elem_ids; 106 : /// Map of secondary element ID to coupled primary element ID 107 : std::map<dof_id_type, dof_id_type> _secondary_elem_id_to_primary_elem_id; 108 : /// Map of secondary element ID to vector of coupled quadrature points 109 : std::map<dof_id_type, std::vector<unsigned int>> _secondary_elem_id_to_qp_indices; 110 : 111 : /// Number of quadrature points for faces on the primary boundary 112 : unsigned int _n_qp_primary; 113 : /// Number of quadrature points for faces on the secondary boundary 114 : unsigned int _n_qp_secondary; 115 : 116 : /// The maximum number of secondary elements coupled to any primary element 117 : unsigned long _max_coupling_size; 118 : };