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 "MooseMesh.h" 13 : 14 : /** 15 : * Builds mapping between two aligned subdomains/boundaries 16 : * 17 : * This class handles the following cases: 18 : * - 1D subdomain coupled to 2D boundary 19 : * - 2D boundary coupled to 2D boundary 20 : */ 21 : class MeshAlignmentBase 22 : { 23 : public: 24 : /** 25 : * Constructor 26 : * 27 : * @param mesh[in] mesh Mesh 28 : */ 29 : MeshAlignmentBase(const MooseMesh & mesh); 30 : 31 : /** 32 : * Returns the list of element IDs on the primary boundary 33 : */ 34 : const std::vector<dof_id_type> & getPrimaryElemIDs() const { return _primary_elem_ids; } 35 : 36 : /** 37 : * Returns the list of element IDs on the secondary boundary 38 : */ 39 : const std::vector<dof_id_type> & getSecondaryElemIDs() const { return _secondary_elem_ids; } 40 : 41 : /** 42 : * Returns true if the primary and secondary meshes are aligned 43 : */ 44 836 : bool meshesAreAligned() const { return _meshes_are_aligned; } 45 : 46 : protected: 47 : /** 48 : * Extracts mesh information from 1D elements 49 : * 50 : * @param[in] elem_ids Vector of element IDs 51 : * @param[out] elem_points Vector of element centroids 52 : * @param[out] node_ids Vector of node IDs 53 : * @param[out] node_points Vector of node points 54 : */ 55 : void extractFrom1DElements(const std::vector<dof_id_type> & elem_ids, 56 : std::vector<Point> & elem_points, 57 : std::vector<dof_id_type> & node_ids, 58 : std::vector<Point> & node_points) const; 59 : 60 : /** 61 : * Extracts mesh information from boundary info 62 : * 63 : * @param[in] boundary_info Vector of tuples of element ID and side ID on boundary 64 : * @param[out] elem_ids Vector of element IDs 65 : * @param[out] side_ids Vector of side IDs 66 : * @param[out] side_points Vector of side centroids 67 : * @param[out] node_ids Vector of node IDs 68 : * @param[out] node_points Vector of node points 69 : */ 70 : void extractFromBoundaryInfo( 71 : const std::vector<std::tuple<dof_id_type, unsigned short int>> & boundary_info, 72 : std::vector<dof_id_type> & elem_ids, 73 : std::vector<unsigned short int> & side_ids, 74 : std::vector<Point> & side_points, 75 : std::vector<dof_id_type> & node_ids, 76 : std::vector<Point> & node_points) const; 77 : 78 : /// Mesh 79 : const MooseMesh & _mesh; 80 : 81 : /// List of primary element IDs 82 : std::vector<dof_id_type> _primary_elem_ids; 83 : /// List of secondary element IDs 84 : std::vector<dof_id_type> _secondary_elem_ids; 85 : /// List of primary element points 86 : std::vector<Point> _primary_elem_points; 87 : /// List of secondary element points 88 : std::vector<Point> _secondary_elem_points; 89 : 90 : /// List of primary side IDs (if any) 91 : std::vector<unsigned short int> _primary_side_ids; 92 : /// List of secondary side IDs (if any) 93 : std::vector<unsigned short int> _secondary_side_ids; 94 : 95 : /// List of primary node IDs 96 : std::vector<dof_id_type> _primary_node_ids; 97 : /// List of secondary node IDs 98 : std::vector<dof_id_type> _secondary_node_ids; 99 : /// List of primary node points 100 : std::vector<Point> _primary_node_points; 101 : /// List of secondary node points 102 : std::vector<Point> _secondary_node_points; 103 : 104 : /// Flag that meshes are aligned 105 : bool _meshes_are_aligned; 106 : };