$extrastylesheet
periodic_boundary.C
Go to the documentation of this file.
00001 // The libMesh Finite Element Library.
00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
00003 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 of the License, or (at your option) any later version.
00008 
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Lesser General Public License for more details.
00013 
00014 // You should have received a copy of the GNU Lesser General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 // Local Includes -----------------------------------
00019 #include "libmesh/libmesh_config.h"
00020 
00021 #ifdef LIBMESH_ENABLE_PERIODIC
00022 
00023 #include "libmesh/libmesh.h" // libMesh::invalid_uint
00024 #include "libmesh/periodic_boundary.h"
00025 
00026 namespace libMesh {
00027 
00028 // ------------------------------------------------------------
00029 // PeriodicBoundary member functions
00030 
00031 
00032 PeriodicBoundary::PeriodicBoundary() :
00033   PeriodicBoundaryBase(),
00034   translation_vector()
00035 {
00036 }
00037 
00038 
00039 
00040 
00041 PeriodicBoundary::PeriodicBoundary(const PeriodicBoundary& o, TransformationType t) :
00042   PeriodicBoundaryBase(o),
00043   translation_vector(o.translation_vector)
00044 {
00045   if (t == INVERSE)
00046     {
00047       std::swap(myboundary, pairedboundary);
00048       translation_vector *= -1.0;
00049     }
00050 }
00051 
00052 
00053 
00054 PeriodicBoundary::PeriodicBoundary(const RealVectorValue& vector) :
00055   PeriodicBoundaryBase(),
00056   translation_vector(vector)
00057 {
00058 }
00059 
00060 
00061 
00062 Point PeriodicBoundary::get_corresponding_pos(const Point& pt) const
00063 {
00064   return pt + translation_vector;
00065 }
00066 
00067 
00068 
00069 UniquePtr<PeriodicBoundaryBase> PeriodicBoundary::clone(TransformationType t) const
00070 {
00071   return UniquePtr<PeriodicBoundaryBase>(new PeriodicBoundary(*this, t));
00072 }
00073 
00074 
00075 } // namespace libMesh
00076 
00077 
00078 #endif // LIBMESH_ENABLE_PERIODIC