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_PERIODIC_BOUNDARIES_H 19 : #define LIBMESH_PERIODIC_BOUNDARIES_H 20 : 21 : // Local Includes 22 : #include "libmesh/libmesh_config.h" 23 : 24 : #ifdef LIBMESH_ENABLE_PERIODIC 25 : 26 : // Local Includes 27 : #include "libmesh/vector_value.h" // RealVectorValue 28 : 29 : // C++ Includes 30 : #include <map> 31 : #include <memory> 32 : 33 : namespace libMesh 34 : { 35 : 36 : // Forward Declarations 37 : class Elem; 38 : class PeriodicBoundaryBase; 39 : class PointLocatorBase; 40 : 41 : /** 42 : * We're using a class instead of a typedef to allow forward 43 : * declarations and future flexibility. 44 : * 45 : * \author Roy Stogner 46 : * \date 2010 47 : * \brief Maps between boundary ids and PeriodicBoundaryBase objects. 48 : */ 49 13548 : class PeriodicBoundaries : public std::map<boundary_id_type, std::unique_ptr<PeriodicBoundaryBase>> 50 : { 51 : public: 52 : PeriodicBoundaryBase * boundary(boundary_id_type id); 53 : 54 : const PeriodicBoundaryBase * boundary(boundary_id_type id) const; 55 : 56 6774 : PeriodicBoundaries() = default; 57 : 58 : ~PeriodicBoundaries(); 59 : 60 : // \returns the periodic neighbor of \p e in direction \p side, if it 61 : // exists, nullptr otherwise. 62 : // 63 : // If \p neigh_side is nullptr it is left alone; if not then it is 64 : // used to output the side of the neighbor which corresponds to the 65 : // given \p side of \p e, or invalid_uint if no possible neighbor or 66 : // no corresponding side exists. 67 : const Elem * neighbor(boundary_id_type boundary_id, 68 : const PointLocatorBase & point_locator, 69 : const Elem * e, 70 : unsigned int side, 71 : unsigned int * neigh_side = nullptr) const; 72 : }; 73 : 74 : } // namespace libMesh 75 : 76 : #endif // LIBMESH_ENABLE_PERIODIC 77 : 78 : #endif // LIBMESH_PERIODIC_BOUNDARIES_H