$extrastylesheet
hp_singular.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 // C++ includes
00019 
00020 // Local Includes
00021 #include "libmesh/elem.h"
00022 #include "libmesh/hp_singular.h"
00023 #include "libmesh/libmesh_logging.h"
00024 #include "libmesh/mesh_base.h"
00025 #include "libmesh/system.h"
00026 
00027 #ifdef LIBMESH_ENABLE_AMR
00028 
00029 namespace libMesh
00030 {
00031 
00032 //-----------------------------------------------------------------
00033 // HPSingularity implementations
00034 
00035 
00036 void HPSingularity::select_refinement (System &system)
00037 {
00038   START_LOG("select_refinement()", "HPSingularity");
00039 
00040   // The current mesh
00041   MeshBase& mesh = system.get_mesh();
00042 
00043   MeshBase::element_iterator       elem_it  =
00044     mesh.active_local_elements_begin();
00045   const MeshBase::element_iterator elem_end =
00046     mesh.active_local_elements_end();
00047 
00048   for (; elem_it != elem_end; ++elem_it)
00049     {
00050       Elem* elem = *elem_it;
00051 
00052       // We're only checking elements that are already flagged for h
00053       // refinement
00054       if (elem->refinement_flag() != Elem::REFINE)
00055         continue;
00056 
00057       elem->set_p_refinement_flag(Elem::REFINE);
00058       elem->set_refinement_flag(Elem::DO_NOTHING);
00059 
00060       for (std::list<Point>::iterator ppoint =
00061              singular_points.begin();
00062            ppoint != singular_points.end(); ++ppoint)
00063         {
00064           if (elem->contains_point(*ppoint))
00065             {
00066               elem->set_p_refinement_flag(Elem::DO_NOTHING);
00067               elem->set_refinement_flag(Elem::REFINE);
00068               break;
00069             }
00070         }
00071     }
00072 
00073   STOP_LOG("select_refinement()", "HPSingularity");
00074 }
00075 
00076 } // namespace libMesh
00077 
00078 #endif // #ifdef LIBMESH_ENABLE_AMR