1 // The libMesh Finite Element Library. 2 // Copyright (C) 2002-2020 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 32 namespace libMesh 33 { 34 35 // Forward Declarations 36 class Elem; 37 class PeriodicBoundaryBase; 38 class PointLocatorBase; 39 40 /** 41 * We're using a class instead of a typedef to allow forward 42 * declarations and future flexibility. 43 * 44 * \note \p std::map has no virtual destructor, so downcasting here 45 * would be dangerous. 46 * 47 * \author Roy Stogner 48 * \date 2010 49 * \brief Maps between boundary ids and PeriodicBoundaryBase objects. 50 */ 51 class PeriodicBoundaries : public std::map<boundary_id_type, PeriodicBoundaryBase *> 52 { 53 public: 54 PeriodicBoundaryBase * boundary(boundary_id_type id); 55 56 const PeriodicBoundaryBase * boundary(boundary_id_type id) const; 57 PeriodicBoundaries()58 PeriodicBoundaries() {} 59 60 ~PeriodicBoundaries(); 61 62 // \returns the periodic neighbor of \p e in direction \p side, if it 63 // exists, nullptr otherwise. 64 // 65 // If \p neigh_side is nullptr it is left alone; if not then it is 66 // used to output the side of the neighbor which corresponds to the 67 // given \p side of \p e, or invalid_uint if no possible neighbor or 68 // no corresponding side exists. 69 const Elem * neighbor(boundary_id_type boundary_id, 70 const PointLocatorBase & point_locator, 71 const Elem * e, 72 unsigned int side, 73 unsigned int * neigh_side = nullptr) const; 74 }; 75 76 } // namespace libMesh 77 78 #endif // LIBMESH_ENABLE_PERIODIC 79 80 #endif // LIBMESH_PERIODIC_BOUNDARIES_H 81