46 const std::vector<unsigned int> & vars,
50 _eqn_systems (eqn_systems),
54 _point_locator (nullptr),
55 _out_of_mesh_mode (false),
65 const unsigned int var,
69 _eqn_systems (eqn_systems),
73 _point_locator (nullptr),
74 _out_of_mesh_mode (false),
120 cast_ptr<const MeshFunction *>(this->
_master);
123 libmesh_error_msg(
"ERROR: When the master-servant concept is used, the master has to be initialized first!");
169 return std::unique_ptr<FunctionBase<Number>>(mf_clone);
189 std::map<const Elem *, DenseVector<Number>> buffer;
191 std::map<const Elem *, Number> return_value;
192 for (
const auto & pr : buffer)
193 return_value[pr.first] = pr.second(0);
204 std::vector<Gradient> buf (1);
214 std::map<const Elem *, std::vector<Gradient>> buffer;
216 std::map<const Elem *, Gradient> return_value;
217 for (
const auto & pr : buffer)
218 return_value[pr.first] = pr.second[0];
224 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 230 std::vector<Tensor> buf (1);
246 const std::set<subdomain_id_type> * subdomain_ids)
263 output.
resize (cast_int<unsigned int>
268 const unsigned int dim = element->
dim();
283 for (
unsigned int index=0,
285 index != sz; ++index)
312 std::vector<dof_id_type> dof_indices;
319 for (std::size_t i=0; i<dof_indices.size(); i++)
322 output(index) =
value;
346 const std::set<subdomain_id_type> * subdomain_ids)
354 std::set<const Elem *> candidate_element = this->
find_elements(p,subdomain_ids);
358 for (
const auto & element : candidate_element)
360 const unsigned int dim = element->dim();
377 for (
unsigned int index=0,
379 index != sz; ++index)
406 std::vector<dof_id_type> dof_indices;
413 for (std::size_t i=0; i<dof_indices.size(); i++)
416 temp_output(index) =
value;
425 output[element] = temp_output;
433 std::vector<Gradient> & output,
434 const std::set<subdomain_id_type> * subdomain_ids)
452 const unsigned int dim = element->
dim();
465 std::vector<Point> point_list (1, mapped_point);
468 for (
unsigned int index=0,
470 index != sz; ++index)
487 std::unique_ptr<FEBase> point_fe (
FEBase::build(dim, fe_type));
488 const std::vector<std::vector<RealGradient>> & dphi = point_fe->get_dphi();
489 point_fe->reinit(element, &point_list);
492 std::vector<dof_id_type> dof_indices;
498 for (std::size_t i=0; i<dof_indices.size(); i++)
499 grad.
add_scaled(dphi[i][0], this->_vector(dof_indices[i]));
501 output[index] = grad;
510 std::map<
const Elem *, std::vector<Gradient>> & output)
519 std::map<
const Elem *, std::vector<Gradient>> & output,
520 const std::set<subdomain_id_type> * subdomain_ids)
528 std::set<const Elem *> candidate_element = this->
find_elements(p,subdomain_ids);
532 for (
const auto & element : candidate_element)
534 const unsigned int dim = element->dim();
537 std::vector<Gradient> temp_output (cast_int<unsigned int>(this->
_system_vars.size()));
551 std::vector<Point> point_list (1, mapped_point);
552 for (
unsigned int index=0,
554 index != sz; ++index)
571 std::unique_ptr<FEBase> point_fe (
FEBase::build(dim, fe_type));
572 const std::vector<std::vector<RealGradient>> & dphi = point_fe->get_dphi();
573 point_fe->reinit(element, &point_list);
576 std::vector<dof_id_type> dof_indices;
581 for (std::size_t i = 0; i < dof_indices.size(); ++i)
582 grad.
add_scaled(dphi[i][0], this->_vector(dof_indices[i]));
584 temp_output[index] = grad;
590 output[element] = temp_output;
596 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 599 std::vector<Tensor> & output,
600 const std::set<subdomain_id_type> * subdomain_ids)
618 const unsigned int dim = element->
dim();
631 std::vector<Point> point_list (1, mapped_point);
634 for (
unsigned int index=0,
636 index != sz; ++index)
652 std::unique_ptr<FEBase> point_fe (
FEBase::build(dim, fe_type));
653 const std::vector<std::vector<RealTensor>> & d2phi =
654 point_fe->get_d2phi();
655 point_fe->reinit(element, &point_list);
658 std::vector<dof_id_type> dof_indices;
664 for (std::size_t i=0; i<dof_indices.size(); i++)
665 hess.
add_scaled(d2phi[i][0], this->_vector(dof_indices[i]));
667 output[index] = hess;
675 const std::set<subdomain_id_type> * subdomain_ids)
const 686 cast_ptr<const MeshFunction *>(this->
_master);
688 libmesh_error_msg(
"ERROR: If you use out-of-mesh-mode in connection with master mesh " \
689 <<
"functions, you must enable out-of-mesh mode for both the master and the slave mesh function.");
704 std::set<const Elem *> point_neighbors;
707 for (
const auto & elem : point_neighbors)
719 const std::set<subdomain_id_type> * subdomain_ids)
const 730 cast_ptr<const MeshFunction *>(this->
_master);
732 libmesh_error_msg(
"ERROR: If you use out-of-mesh-mode in connection with master mesh " \
733 <<
"functions, you must enable out-of-mesh mode for both the master and the slave mesh function.");
738 std::set<const Elem *> candidate_elements;
739 std::set<const Elem *> final_candidate_elements;
740 this->
_point_locator->operator()(p,candidate_elements,subdomain_ids);
741 for (
const auto & element : candidate_elements)
751 std::set<const Elem *> point_neighbors;
752 element->find_point_neighbors(p, point_neighbors);
753 for (
const auto & elem : point_neighbors)
756 final_candidate_elements.insert(elem);
761 final_candidate_elements.insert(element);
764 return final_candidate_elements;
Manages the family, order, etc. parameters for a given FE.
virtual unsigned int size() const override
virtual void disable_out_of_mesh_mode()=0
Manages multiples systems of equations.
const EquationSystems & _eqn_systems
virtual std::unique_ptr< FunctionBase< Number > > clone() const override
const NumericVector< Number > & _vector
const unsigned int invalid_uint
virtual void set_close_to_point_tol(Real close_to_point_tol)
std::unique_ptr< PointLocatorBase > sub_point_locator() const
PointLocatorBase * _point_locator
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
void add_scaled(const TypeTensor< T2 > &, const T)
void add_scaled(const TypeVector< T2 > &, const T)
Helper class used with FEInterface::compute_data().
MeshFunction(const EquationSystems &eqn_systems, const NumericVector< Number > &vec, const DofMap &dof_map, const std::vector< unsigned int > &vars, const FunctionBase< Number > *master=nullptr)
void resize(const unsigned int n)
const Elem * find_element(const Point &p, const std::set< subdomain_id_type > *subdomain_ids=nullptr) const
const FEType & variable_type(const unsigned int c) const
The base class for all geometric element types.
const FunctionBase * _master
Gradient gradient(const Point &p, const Real time=0.)
void disable_out_of_mesh_mode(void)
Manages the degrees of freedom (DOFs) in a simulation.
DenseVector< Number > _out_of_mesh_value
void enable_out_of_mesh_mode(const DenseVector< Number > &value)
virtual void clear() override
std::set< const Elem * > find_elements(const Point &p, const std::set< subdomain_id_type > *subdomain_ids=nullptr) const
std::map< const Elem *, Number > discontinuous_value(const Point &p, const Real time=0.)
void find_point_neighbors(const Point &p, std::set< const Elem *> &neighbor_set) const
static void compute_data(const unsigned int dim, const FEType &fe_t, const Elem *elem, FEComputeData &data)
NumberVectorValue Gradient
void unset_point_locator_tolerance()
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
static Point inverse_map(const unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
An object whose state is distributed along a set of processors.
ParallelType type() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const PointLocatorBase & get_point_locator(void) const
virtual unsigned short dim() const =0
Number operator()(const Point &p, const Real time=0.) override
const MeshBase & get_mesh() const
BuildType
Base class for different Tree types.
virtual void unset_close_to_point_tol()
void set_point_locator_tolerance(Real tol)
virtual void enable_out_of_mesh_mode()=0
processor_id_type processor_id() const
processor_id_type processor_id() const
std::map< const Elem *, Gradient > discontinuous_gradient(const Point &p, const Real time=0.)
A geometric point in (x,y,z) space.
Tensor hessian(const Point &p, const Real time=0.)
virtual void init() override
const std::vector< unsigned int > _system_vars