$extrastylesheet
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 00019 00020 #ifndef LIBMESH_DIRICHLET_BOUNDARIES_H 00021 #define LIBMESH_DIRICHLET_BOUNDARIES_H 00022 00023 #include "libmesh/libmesh_config.h" 00024 00025 #ifdef LIBMESH_ENABLE_DIRICHLET 00026 00027 // Local Includes ----------------------------------- 00028 #include "libmesh/fem_function_base.h" 00029 #include "libmesh/function_base.h" 00030 #include "libmesh/id_types.h" 00031 #include "libmesh/system.h" 00032 #include "libmesh/vector_value.h" 00033 00034 // C++ Includes ----------------------------------- 00035 #include <algorithm> 00036 #include <cstddef> 00037 #include <iterator> 00038 #include <set> 00039 #include <string> 00040 #include <vector> 00041 00042 namespace libMesh 00043 { 00044 00045 // ------------------------------------------------------------ 00046 // DirichletBoundary class definition 00047 00064 class DirichletBoundary 00065 { 00066 public: 00067 DirichletBoundary(const std::set<boundary_id_type> &b_in, 00068 const std::vector<unsigned int>& variables_in, 00069 const FunctionBase<Number> *f_in, 00070 const FunctionBase<Gradient> *g_in = NULL) : 00071 b(b_in), 00072 variables(variables_in), 00073 f(f_in ? f_in->clone() : UniquePtr<FunctionBase<Number> >()), 00074 g(g_in ? g_in->clone() : UniquePtr<FunctionBase<Gradient> >()), 00075 f_fem(UniquePtr<FEMFunctionBase<Number> >()), 00076 g_fem(UniquePtr<FEMFunctionBase<Gradient> >()), 00077 f_system(NULL) 00078 { 00079 libmesh_assert(f.get()); 00080 f->init(); 00081 if (g.get()) 00082 g->init(); 00083 } 00084 00085 DirichletBoundary(const std::set<boundary_id_type> &b_in, 00086 const std::vector<unsigned int>& variables_in, 00087 const FunctionBase<Number> &f_in) : 00088 b(b_in), 00089 variables(variables_in), 00090 f(f_in.clone()), 00091 g(UniquePtr<FunctionBase<Gradient> >()), 00092 f_fem(UniquePtr<FEMFunctionBase<Number> >()), 00093 g_fem(UniquePtr<FEMFunctionBase<Gradient> >()), 00094 f_system(NULL) 00095 { 00096 f->init(); 00097 } 00098 00099 00100 DirichletBoundary(const std::set<boundary_id_type> &b_in, 00101 const std::vector<unsigned int>& variables_in, 00102 const FunctionBase<Number> &f_in, 00103 const FunctionBase<Gradient> &g_in) : 00104 b(b_in), 00105 variables(variables_in), 00106 f(f_in.clone()), 00107 g(g_in.clone()), 00108 f_fem(UniquePtr<FEMFunctionBase<Number> >()), 00109 g_fem(UniquePtr<FEMFunctionBase<Gradient> >()), 00110 f_system(NULL) 00111 { 00112 f->init(); 00113 g->init(); 00114 } 00115 00116 00117 DirichletBoundary(const std::set<boundary_id_type> &b_in, 00118 const std::vector<unsigned int>& variables_in, 00119 const System& f_sys_in, 00120 const FEMFunctionBase<Number> *f_in, 00121 const FEMFunctionBase<Gradient> *g_in = NULL) : 00122 b(b_in), 00123 variables(variables_in), 00124 f(UniquePtr<FunctionBase<Number> >()), 00125 g(UniquePtr<FunctionBase<Gradient> >()), 00126 f_fem(f_in ? f_in->clone() : UniquePtr<FEMFunctionBase<Number> >()), 00127 g_fem(g_in ? g_in->clone() : UniquePtr<FEMFunctionBase<Gradient> >()), 00128 f_system(&f_sys_in) 00129 { 00130 libmesh_assert(f_fem.get()); 00131 } 00132 00133 DirichletBoundary(const std::set<boundary_id_type> &b_in, 00134 const std::vector<unsigned int>& variables_in, 00135 const System& f_sys_in, 00136 const FEMFunctionBase<Number> &f_in) : 00137 b(b_in), 00138 variables(variables_in), 00139 f(UniquePtr<FunctionBase<Number> >()), 00140 g(UniquePtr<FunctionBase<Gradient> >()), 00141 f_fem(f_in.clone()), 00142 g_fem(UniquePtr<FEMFunctionBase<Gradient> >()), 00143 f_system(&f_sys_in) 00144 { 00145 } 00146 00147 00148 DirichletBoundary(const std::set<boundary_id_type> &b_in, 00149 const std::vector<unsigned int>& variables_in, 00150 const System& f_sys_in, 00151 const FEMFunctionBase<Number> &f_in, 00152 const FEMFunctionBase<Gradient> &g_in) : 00153 b(b_in), 00154 variables(variables_in), 00155 f(UniquePtr<FunctionBase<Number> >()), 00156 g(UniquePtr<FunctionBase<Gradient> >()), 00157 f_fem(f_in.clone()), 00158 g_fem(g_in.clone()), 00159 f_system(&f_sys_in) 00160 { 00161 } 00162 00163 00164 00165 00166 DirichletBoundary (const DirichletBoundary &dirichlet_in) : 00167 b(dirichlet_in.b), 00168 variables(dirichlet_in.variables), 00169 f(dirichlet_in.f.get() ? 00170 dirichlet_in.f->clone() : UniquePtr<FunctionBase<Number> >()), 00171 g(dirichlet_in.g.get() ? 00172 dirichlet_in.g->clone() : UniquePtr<FunctionBase<Gradient> >()), 00173 f_fem(dirichlet_in.f_fem.get() ? 00174 dirichlet_in.f_fem->clone() : UniquePtr<FEMFunctionBase<Number> >()), 00175 g_fem(dirichlet_in.g_fem.get() ? 00176 dirichlet_in.g_fem->clone() : UniquePtr<FEMFunctionBase<Gradient> >()), 00177 f_system(dirichlet_in.f_system) 00178 { 00179 libmesh_assert(f.get() || f_fem.get()); 00180 libmesh_assert(!(f.get() && f_fem.get())); 00181 libmesh_assert(!(f.get() && g_fem.get())); 00182 libmesh_assert(!(f_fem.get() && g.get())); 00183 libmesh_assert(!(f_fem.get() && !f_system)); 00184 if (f.get()) 00185 f->init(); 00186 if (g.get()) 00187 g->init(); 00188 } 00189 00190 std::set<boundary_id_type> b; 00191 std::vector<unsigned int> variables; 00192 00193 UniquePtr<FunctionBase<Number> > f; 00194 UniquePtr<FunctionBase<Gradient> > g; 00195 00196 UniquePtr<FEMFunctionBase<Number> > f_fem; 00197 UniquePtr<FEMFunctionBase<Gradient> > g_fem; 00198 00199 const System *f_system; 00200 }; 00201 00202 00208 class DirichletBoundaries : public std::vector<DirichletBoundary *> 00209 { 00210 public: 00211 DirichletBoundaries() {} 00212 00213 ~DirichletBoundaries(); 00214 }; 00215 00216 } // namespace libMesh 00217 00218 #endif // LIBMESH_ENABLE_DIRICHLET 00219 00220 #endif // LIBMESH_DIRICHLET_BOUNDARIES_H