$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_MESH_FUNCTION_H 00021 #define LIBMESH_MESH_FUNCTION_H 00022 00023 // Local Includes 00024 #include "libmesh/function_base.h" 00025 #include "libmesh/dense_vector.h" 00026 #include "libmesh/vector_value.h" 00027 #include "libmesh/tensor_value.h" 00028 #include "libmesh/tree_base.h" 00029 #include "libmesh/parallel_object.h" 00030 00031 // C++ includes 00032 #include <cstddef> 00033 #include <vector> 00034 00035 namespace libMesh 00036 { 00037 00038 00039 // Forward Declarations 00040 template <typename T> class DenseVector; 00041 class EquationSystems; 00042 template <typename T> class NumericVector; 00043 class DofMap; 00044 class PointLocatorBase; 00045 00046 00047 00055 // ------------------------------------------------------------ 00056 // MeshFunction class definition 00057 class MeshFunction : public FunctionBase<Number>, 00058 public ParallelObject 00059 { 00060 public: 00061 00070 MeshFunction (const EquationSystems& eqn_systems, 00071 const NumericVector<Number>& vec, 00072 const DofMap& dof_map, 00073 const std::vector<unsigned int>& vars, 00074 const FunctionBase<Number>* master=NULL); 00075 00084 MeshFunction (const EquationSystems& eqn_systems, 00085 const NumericVector<Number>& vec, 00086 const DofMap& dof_map, 00087 const unsigned int var, 00088 const FunctionBase<Number>* master=NULL); 00089 00093 ~MeshFunction (); 00094 00095 00096 00101 void init () { this->init(Trees::NODES); } 00102 00103 00108 virtual void init (const Trees::BuildType point_locator_build_type); 00109 00113 virtual void clear (); 00114 00122 virtual UniquePtr<FunctionBase<Number> > clone () const; 00123 00128 Number operator() (const Point& p, 00129 const Real time=0.); 00130 00135 Gradient gradient (const Point& p, 00136 const Real time=0.); 00137 00138 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 00139 00143 Tensor hessian (const Point& p, 00144 const Real time=0.); 00145 #endif 00146 00153 void operator() (const Point& p, 00154 const Real time, 00155 DenseVector<Number>& output); 00156 00162 void operator() (const Point& p, 00163 const Real time, 00164 DenseVector<Number>& output, 00165 const std::set<subdomain_id_type>* subdomain_ids); 00166 00173 void gradient (const Point& p, 00174 const Real time, 00175 std::vector<Gradient>& output, 00176 const std::set<subdomain_id_type>* subdomain_ids = NULL); 00177 00184 void hessian (const Point& p, 00185 const Real time, 00186 std::vector<Tensor>& output, 00187 const std::set<subdomain_id_type>* subdomain_ids = NULL); 00188 00194 const PointLocatorBase& get_point_locator (void) const; 00195 00206 void enable_out_of_mesh_mode(const DenseVector<Number>& value); 00207 00218 void enable_out_of_mesh_mode(const Number& value); 00219 00223 void disable_out_of_mesh_mode(void); 00224 00231 void set_point_locator_tolerance(Real tol); 00232 00236 void unset_point_locator_tolerance(); 00237 00238 protected: 00239 00243 const Elem* find_element( const Point& p, 00244 const std::set<subdomain_id_type>* subdomain_ids = NULL ) const; 00245 00250 const EquationSystems& _eqn_systems; 00251 00256 const NumericVector<Number>& _vector; 00257 00261 const DofMap& _dof_map; 00262 00267 const std::vector<unsigned int> _system_vars; 00268 00273 PointLocatorBase* _point_locator; 00274 00279 bool _out_of_mesh_mode; 00280 00285 DenseVector<Number> _out_of_mesh_value; 00286 }; 00287 00288 00289 00290 00291 // ------------------------------------------------------------ 00292 // MeshFunction inline methods 00293 00294 00295 } // namespace libMesh 00296 00297 00298 #endif // LIBMESH_MESH_FUNCTION_H