Line data Source code
1 : // The libMesh Finite Element Library. 2 : // Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 3 : 4 : // This library is free software; you can redistribute it and/or 5 : // modify it under the terms of the GNU Lesser General Public 6 : // License as published by the Free Software Foundation; either 7 : // version 2.1 of the License, or (at your option) any later version. 8 : 9 : // This library is distributed in the hope that it will be useful, 10 : // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 : // Lesser General Public License for more details. 13 : 14 : // You should have received a copy of the GNU Lesser General Public 15 : // License along with this library; if not, write to the Free Software 16 : // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 : 18 : #ifndef LIBMESH_INF_ELEM_BUILDER_H 19 : #define LIBMESH_INF_ELEM_BUILDER_H 20 : 21 : 22 : #include "libmesh/libmesh_config.h" 23 : 24 : 25 : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 26 : 27 : // Local includes 28 : #include "libmesh/id_types.h" 29 : #include "libmesh/point.h" 30 : 31 : // C++ includes 32 : #include <cstddef> 33 : #include <set> 34 : #include <utility> 35 : #include <vector> 36 : 37 : namespace libMesh 38 : { 39 : 40 : // Forward Declarations 41 : class MeshBase; 42 : class Node; 43 : 44 : /** 45 : * This class is used to build infinite elements on 46 : * top of an existing mesh. It only makes sense to 47 : * use this if LIBMESH_ENABLE_INFINITE_ELEMENTS is true. 48 : * 49 : * \author Daniel Dreyer 50 : * \author John W. Peterson 51 : * \date 2004 52 : */ 53 : class InfElemBuilder 54 : { 55 : public: 56 : /** 57 : * Constructor. 58 : */ 59 : explicit 60 0 : InfElemBuilder(MeshBase & mesh) : _mesh(mesh) {} 61 : 62 : /** 63 : * Useful typedef 64 : */ 65 : typedef std::pair<bool, double> InfElemOriginValue; 66 : 67 : /** 68 : * Build infinite elements atop a volume-based mesh, determine 69 : * origin automatically. 70 : * 71 : * \returns The origin as a \p const \p Point to make it more 72 : * obvious that the origin should not change after the infinite 73 : * elements have been built. 74 : * 75 : * When symmetry planes are present, use the version with optional 76 : * symmetry switches. The flag \p be_verbose enables some 77 : * diagnostic output. 78 : */ 79 : const Point build_inf_elem (const bool be_verbose = false); 80 : 81 : /** 82 : * \returns The origin of the infinite elements. 83 : * Builds infinite elements atop a volume-based mesh. 84 : * Finds all faces on the outer boundary and build infinite elements 85 : * on them. Using the \p InfElemOriginValue the user can 86 : * prescribe only selected origin coordinates. The remaining 87 : * coordinates are computed from the center of the bounding box 88 : * of the mesh. 89 : * 90 : * During the search for faces on which infinite elements are built, 91 : * interior faces that are not on symmetry planes are found, too. 92 : * When an (optional) pointer to \p inner_boundary_nodes is provided, 93 : * then this vector will be filled with the nodes that lie on the 94 : * inner boundary. 95 : * 96 : * Faces which lie in at least one symmetry plane are skipped. 97 : * The three optional booleans \p x_sym, \p y_sym, 98 : * \p z_sym indicate symmetry planes (through the origin, obviously) 99 : * perpendicular to the \p x, \p y and \p z direction, 100 : * respectively. 101 : * The flag \p be_verbose enables some diagnostic output. 102 : */ 103 : const Point build_inf_elem (const InfElemOriginValue & origin_x, 104 : const InfElemOriginValue & origin_y, 105 : const InfElemOriginValue & origin_z, 106 : const bool x_sym = false, 107 : const bool y_sym = false, 108 : const bool z_sym = false, 109 : const bool be_verbose = false, 110 : std::vector<const Node *> * inner_boundary_nodes = nullptr); 111 : 112 : 113 : 114 : private: 115 : /** 116 : * Build infinite elements atop a volume-based mesh. 117 : * Actual implementation. 118 : */ 119 : void build_inf_elem (const Point & origin, 120 : const bool x_sym = false, 121 : const bool y_sym = false, 122 : const bool z_sym = false, 123 : const bool be_verbose = false, 124 : std::set<std::pair<dof_id_type, 125 : unsigned int>> * inner_faces = nullptr); 126 : /** 127 : * Reference to the mesh we're building infinite 128 : * elements for. 129 : */ 130 : MeshBase & _mesh; 131 : }; 132 : 133 : 134 : } // namespace libMesh 135 : 136 : #endif // LIBMESH_ENABLE_INFINITE_ELEMENTS 137 : #endif // LIBMESH_INF_ELEM_BUILDER_H