libMesh
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
libMesh::MeshFunction Class Reference

This class provides function-like objects for data distributed over a mesh. More...

#include <mesh_function.h>

Inheritance diagram for libMesh::MeshFunction:
[legend]

Public Member Functions

 MeshFunction (const EquationSystems &eqn_systems, const NumericVector< Number > &vec, const DofMap &dof_map, const std::vector< unsigned int > &vars, const FunctionBase< Number > *master=nullptr)
 Constructor for mesh based functions with vectors as return value. More...
 
 MeshFunction (const EquationSystems &eqn_systems, const NumericVector< Number > &vec, const DofMap &dof_map, const unsigned int var, const FunctionBase< Number > *master=nullptr)
 Constructor for mesh based functions with a number as return value. More...
 
 MeshFunction (MeshFunction &&)=delete
 This class is sometimes responsible for cleaning up the _point_locator, so it can't be default (shallow) copy constructed or move constructed. More...
 
 MeshFunction (const MeshFunction &)=delete
 
MeshFunctionoperator= (const MeshFunction &)=delete
 This class contains const references so it can't be assigned. More...
 
MeshFunctionoperator= (MeshFunction &&)=delete
 
 ~MeshFunction ()
 Destructor. More...
 
virtual void init () override
 Override the FunctionBase::init() member function by calling our own and specifying the Trees::NODES method. More...
 
void init (const Trees::BuildType point_locator_build_type)
 The actual initialization process. More...
 
virtual void clear () override
 Clears the function. More...
 
virtual std::unique_ptr< FunctionBase< Number > > clone () const override
 
Number operator() (const Point &p, const Real time=0.) override
 
std::map< const Elem *, Numberdiscontinuous_value (const Point &p, const Real time=0.)
 
Gradient gradient (const Point &p, const Real time=0.)
 
std::map< const Elem *, Gradientdiscontinuous_gradient (const Point &p, const Real time=0.)
 
Tensor hessian (const Point &p, const Real time=0.)
 
void operator() (const Point &p, const Real time, DenseVector< Number > &output) override
 Computes values at coordinate p and for time time, which defaults to zero, optionally restricting the point to the passed subdomain_ids. More...
 
void operator() (const Point &p, const Real time, DenseVector< Number > &output, const std::set< subdomain_id_type > *subdomain_ids)
 Computes values at coordinate p and for time time, restricting the point to the passed subdomain_ids. More...
 
void discontinuous_value (const Point &p, const Real time, std::map< const Elem *, DenseVector< Number >> &output)
 Similar to operator() with the same parameter list, but with the difference that multiple values on faces are explicitly permitted. More...
 
void discontinuous_value (const Point &p, const Real time, std::map< const Elem *, DenseVector< Number >> &output, const std::set< subdomain_id_type > *subdomain_ids)
 Similar to operator() with the same parameter list, but with the difference that multiple values on faces are explicitly permitted. More...
 
void gradient (const Point &p, const Real time, std::vector< Gradient > &output, const std::set< subdomain_id_type > *subdomain_ids=nullptr)
 Computes gradients at coordinate p and for time time, which defaults to zero, optionally restricting the point to the passed subdomain_ids. More...
 
void discontinuous_gradient (const Point &p, const Real time, std::map< const Elem *, std::vector< Gradient >> &output)
 Similar to gradient, but with the difference that multiple values on faces are explicitly permitted. More...
 
void discontinuous_gradient (const Point &p, const Real time, std::map< const Elem *, std::vector< Gradient >> &output, const std::set< subdomain_id_type > *subdomain_ids)
 Similar to gradient, but with the difference that multiple values on faces are explicitly permitted. More...
 
void hessian (const Point &p, const Real time, std::vector< Tensor > &output, const std::set< subdomain_id_type > *subdomain_ids=nullptr)
 Computes gradients at coordinate p and for time time, which defaults to zero, optionally restricting the point to the passed subdomain_ids. More...
 
const PointLocatorBaseget_point_locator (void) const
 
void enable_out_of_mesh_mode (const DenseVector< Number > &value)
 Enables out-of-mesh mode. More...
 
void enable_out_of_mesh_mode (const Number &value)
 Enables out-of-mesh mode. More...
 
void disable_out_of_mesh_mode (void)
 Disables out-of-mesh mode. More...
 
void set_point_locator_tolerance (Real tol)
 We may want to specify a tolerance for the PointLocator to use, since in some cases the point we want to evaluate at might be slightly outside the mesh (due to numerical rounding issues, for example). More...
 
void unset_point_locator_tolerance ()
 Turn off the user-specified PointLocator tolerance. More...
 
void operator() (const Point &p, DenseVector< Number > &output)
 Evaluation function for time-independent vector-valued functions. More...
 
virtual Number component (unsigned int i, const Point &p, Real time=0.)
 
bool initialized () const
 
void set_is_time_dependent (bool is_time_dependent)
 Function to set whether this is a time-dependent function or not. More...
 
bool is_time_dependent () const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Protected Member Functions

const Elemfind_element (const Point &p, const std::set< subdomain_id_type > *subdomain_ids=nullptr) const
 Helper function to reduce code duplication. More...
 
std::set< const Elem * > find_elements (const Point &p, const std::set< subdomain_id_type > *subdomain_ids=nullptr) const
 

Protected Attributes

const EquationSystems_eqn_systems
 The equation systems handler, from which the data are gathered. More...
 
const NumericVector< Number > & _vector
 A reference to the vector that holds the data that is to be interpolated. More...
 
const DofMap_dof_map
 Need access to the DofMap of the other system. More...
 
const std::vector< unsigned int_system_vars
 The indices of the variables within the other system for which data are to be gathered. More...
 
PointLocatorBase_point_locator
 A point locator is needed to locate the points in the mesh. More...
 
bool _out_of_mesh_mode
 true if out-of-mesh mode is enabled. More...
 
DenseVector< Number_out_of_mesh_value
 Value to return outside the mesh if out-of-mesh mode is enabled. More...
 
const FunctionBase_master
 Const pointer to our master, initialized to nullptr. More...
 
bool _initialized
 When init() was called so that everything is ready for calls to operator() (...), then this bool is true. More...
 
bool _is_time_dependent
 Cache whether or not this function is actually time-dependent. More...
 
const Parallel::Communicator & _communicator
 

Detailed Description

This class provides function-like objects for data distributed over a mesh.

Author
Daniel Dreyer
Date
2003

Definition at line 53 of file mesh_function.h.

Constructor & Destructor Documentation

◆ MeshFunction() [1/4]

libMesh::MeshFunction::MeshFunction ( const EquationSystems eqn_systems,
const NumericVector< Number > &  vec,
const DofMap dof_map,
const std::vector< unsigned int > &  vars,
const FunctionBase< Number > *  master = nullptr 
)

Constructor for mesh based functions with vectors as return value.

Optionally takes a master function. If the MeshFunction is to be evaluated outside of the local partition of the mesh, then both the mesh in eqn_systems and the coefficient vector vec should be serialized.

Definition at line 42 of file mesh_function.C.

46  :
47  FunctionBase<Number> (master),
48  ParallelObject (eqn_systems),
49  _eqn_systems (eqn_systems),
50  _vector (vec),
51  _dof_map (dof_map),
52  _system_vars (vars),
53  _point_locator (nullptr),
54  _out_of_mesh_mode (false),
56 {
57 }

Referenced by clone().

◆ MeshFunction() [2/4]

libMesh::MeshFunction::MeshFunction ( const EquationSystems eqn_systems,
const NumericVector< Number > &  vec,
const DofMap dof_map,
const unsigned int  var,
const FunctionBase< Number > *  master = nullptr 
)

Constructor for mesh based functions with a number as return value.

Optionally takes a master function. If the MeshFunction is to be evaluated outside of the local partition of the mesh, then both the mesh in eqn_systems and the coefficient vector vec should be serialized.

Definition at line 61 of file mesh_function.C.

65  :
66  FunctionBase<Number> (master),
67  ParallelObject (eqn_systems),
68  _eqn_systems (eqn_systems),
69  _vector (vec),
70  _dof_map (dof_map),
71  _system_vars (1,var),
72  _point_locator (nullptr),
73  _out_of_mesh_mode (false),
75 {
76  // std::vector<unsigned int> buf (1);
77  // buf[0] = var;
78  // _system_vars (buf);
79 }

◆ MeshFunction() [3/4]

libMesh::MeshFunction::MeshFunction ( MeshFunction &&  )
delete

This class is sometimes responsible for cleaning up the _point_locator, so it can't be default (shallow) copy constructed or move constructed.

◆ MeshFunction() [4/4]

libMesh::MeshFunction::MeshFunction ( const MeshFunction )
delete

◆ ~MeshFunction()

libMesh::MeshFunction::~MeshFunction ( )

Destructor.

Definition at line 87 of file mesh_function.C.

88 {
89  delete this->_point_locator;
90 }

References _point_locator.

Member Function Documentation

◆ clear()

void libMesh::MeshFunction::clear ( )
overridevirtual

Clears the function.

Reimplemented from libMesh::FunctionBase< Number >.

Definition at line 121 of file mesh_function.C.

122 {
123  // only delete the point locator when we are the master
124  if ((this->_point_locator != nullptr) && (this->_master == nullptr))
125  {
126  delete this->_point_locator;
127  this->_point_locator = nullptr;
128  }
129  this->_initialized = false;
130 }

References libMesh::FunctionBase< Number >::_initialized, libMesh::FunctionBase< Number >::_master, and _point_locator.

◆ clone()

std::unique_ptr< FunctionBase< Number > > libMesh::MeshFunction::clone ( ) const
overridevirtual
Returns
A new copy of the function.

The new copy uses the original as a master function to enable simultaneous evaluations of the copies in different threads.

Note
This implies the copy should not be used after the original is destroyed.

Implements libMesh::FunctionBase< Number >.

Definition at line 134 of file mesh_function.C.

135 {
136  MeshFunction * mf_clone =
138 
139  if (this->initialized())
140  mf_clone->init();
141  mf_clone->set_point_locator_tolerance(
142  this->get_point_locator().get_close_to_point_tol());
143 
144  return std::unique_ptr<FunctionBase<Number>>(mf_clone);
145 }

References _dof_map, _eqn_systems, _system_vars, _vector, get_point_locator(), init(), libMesh::FunctionBase< Number >::initialized(), MeshFunction(), and set_point_locator_tolerance().

◆ comm()

const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inlineinherited
Returns
A reference to the Parallel::Communicator object used by this mesh.

Definition at line 94 of file parallel_object.h.

95  { return _communicator; }

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_tao_equality_constraints(), libMesh::__libmesh_tao_equality_constraints_jacobian(), libMesh::__libmesh_tao_gradient(), libMesh::__libmesh_tao_hessian(), libMesh::__libmesh_tao_inequality_constraints(), libMesh::__libmesh_tao_inequality_constraints_jacobian(), libMesh::__libmesh_tao_objective(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::_smooth_flags(), libMesh::DofMap::add_constraints_to_send_list(), add_cube_convex_hull_to_mesh(), libMesh::PetscDMWrapper::add_dofs_helper(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::ImplicitSystem::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::DynaIO::add_spline_constraints(), libMesh::System::add_vector(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::DofMap::attach_matrix(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::PetscDMWrapper::build_section(), libMesh::PetscDMWrapper::build_sf(), libMesh::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::RBConstruction::compute_Fq_representor_innerprods(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::RBConstruction::compute_residual_dual_norm_slow(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::create_bounding_box(), libMesh::DofMap::create_dof_constraints(), libMesh::MeshTools::create_nodal_bounding_box(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::MeshTools::create_subdomain_bounding_box(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::DTKSolutionTransfer::DTKSolutionTransfer(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::RBConstruction::enrich_RB_space(), libMesh::EpetraVector< T >::EpetraVector(), AssembleOptimization::equality_constraints(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::RBEIMConstruction::evaluate_mesh_function(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_error_tolerance(), libMesh::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::DofMap::gather_constraints(), libMesh::MeshfreeInterpolation::gather_remote_data(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::DofMap::get_info(), libMesh::ImplicitSystem::get_linear_solver(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::EigenSystem::init_matrices(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_rb_construction(), integrate_function(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_flags(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_p_levels(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), libMesh::libmesh_petsc_preconditioner_apply(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_postcheck(), libMesh::libmesh_petsc_snes_residual(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_new_nodes_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_unique_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::FEMSystem::mesh_position_set(), LinearElasticityWithContact::move_mesh(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::DofMap::n_constrained_dofs(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::MeshTools::n_p_levels(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::DistributedMesh::parallel_max_elem_id(), libMesh::DistributedMesh::parallel_max_node_id(), libMesh::ReplicatedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_n_elem(), libMesh::DistributedMesh::parallel_n_nodes(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::MeshTools::paranoid_n_levels(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::print_dof_constraints(), FEMParameters::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::System::read_legacy_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::DistributedMesh::renumber_dof_objects(), LinearElasticityWithContact::residual_and_jacobian(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::RBEIMConstruction::set_explicit_sys_subvector(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::PetscDiffSolver::setup_petsc_data(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::split_mesh(), libMesh::BoundaryInfo::sync(), libMesh::MeshRefinement::test_level_one(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), libMesh::MeshRefinement::test_unflagged(), SystemsTest::testBlockRestrictedVarNDofs(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), SystemsTest::testProjectCubeWithMeshFunction(), CheckpointIOTest::testSplitter(), libMesh::MeshTools::total_weight(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::RBEIMConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::VTKIO::write_nodal_data(), libMesh::RBEvaluation::write_out_vectors(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::RBDataSerialization::RBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::TransientRBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::RBEIMEvaluationSerialization::write_to_file(), and libMesh::RBDataSerialization::RBSCMEvaluationSerialization::write_to_file().

◆ component()

Number libMesh::FunctionBase< Number >::component ( unsigned int  i,
const Point p,
Real  time = 0. 
)
inlinevirtualinherited
Returns
The vector component i at coordinate p and time time.
Note
Subclasses aren't required to override this, since the default implementation is based on the full vector evaluation, which is often correct.
Subclasses are recommended to override this, since the default implementation is based on a vector evaluation, which is usually unnecessarily inefficient.

Reimplemented in TripleFunction, SolutionFunction, SolutionFunction, and SolutionFunction.

Definition at line 227 of file function_base.h.

230 {
231  DenseVector<Output> outvec(i+1);
232  (*this)(p, time, outvec);
233  return outvec(i);
234 }

◆ disable_out_of_mesh_mode()

void libMesh::MeshFunction::disable_out_of_mesh_mode ( void  )

Disables out-of-mesh mode.

This is also the default.

Definition at line 814 of file mesh_function.C.

815 {
816  libmesh_assert (this->initialized());
818  _out_of_mesh_mode = false;
819 }

References _out_of_mesh_mode, _point_locator, libMesh::PointLocatorBase::disable_out_of_mesh_mode(), libMesh::FunctionBase< Number >::initialized(), and libMesh::libmesh_assert().

◆ discontinuous_gradient() [1/3]

void libMesh::MeshFunction::discontinuous_gradient ( const Point p,
const Real  time,
std::map< const Elem *, std::vector< Gradient >> &  output 
)

Similar to gradient, but with the difference that multiple values on faces are explicitly permitted.

This is useful for evaluating gradients on faces where the values to the left and right are different.

Definition at line 501 of file mesh_function.C.

504 {
505  this->discontinuous_gradient (p, time, output, nullptr);
506 }

References discontinuous_gradient().

◆ discontinuous_gradient() [2/3]

void libMesh::MeshFunction::discontinuous_gradient ( const Point p,
const Real  time,
std::map< const Elem *, std::vector< Gradient >> &  output,
const std::set< subdomain_id_type > *  subdomain_ids 
)

Similar to gradient, but with the difference that multiple values on faces are explicitly permitted.

This is useful for evaluating gradients on faces where the values to the left and right are different.

Build an FEComputeData that contains both input and output data for the specific compute_data method.

Definition at line 510 of file mesh_function.C.

514 {
515  libmesh_assert (this->initialized());
516 
517  // clear the output map
518  output.clear();
519 
520  // get the candidate elements
521  std::set<const Elem *> candidate_element = this->find_elements(p,subdomain_ids);
522 
523  // loop through all candidates, if the set is empty this function will return an
524  // empty map
525  for (const auto & element : candidate_element)
526  {
527  const unsigned int dim = element->dim();
528 
529  // define a temporary vector to store all values
530  std::vector<Gradient> temp_output (cast_int<unsigned int>(this->_system_vars.size()));
531 
532  /*
533  * Get local coordinates to feed these into compute_data().
534  * Note that the fe_type can safely be used from the 0-variable,
535  * since the inverse mapping is the same for all FEFamilies
536  */
537  const Point mapped_point (FEMap::inverse_map (dim, element, p));
538 
539 
540  // loop over all vars
541  std::vector<Point> point_list (1, mapped_point);
542  for (auto index : index_range(this->_system_vars))
543  {
544  /*
545  * the data for this variable
546  */
547  const unsigned int var = _system_vars[index];
548 
549  if (var == libMesh::invalid_uint)
550  {
552  index < _out_of_mesh_value.size());
553  temp_output[index] = Gradient(_out_of_mesh_value(index));
554  continue;
555  }
556 
557  const FEType & fe_type = this->_dof_map.variable_type(var);
558 
559  // where the solution values for the var-th variable are stored
560  std::vector<dof_id_type> dof_indices;
561  this->_dof_map.dof_indices (element, dof_indices, var);
562 
563  Gradient grad(0.);
564 
565  // for performance-reasons, we use different algorithms now.
566  // TODO: Check that both give the same result for finite elements.
567  // Otherwive it is wrong...
568 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
569  if (!element->infinite())
570  {
571 #endif
572  std::unique_ptr<FEBase> point_fe (FEBase::build(dim, fe_type));
573  const std::vector<std::vector<RealGradient>> & dphi = point_fe->get_dphi();
574  point_fe->reinit(element, & point_list);
575 
576  for (auto i : index_range(dof_indices))
577  grad.add_scaled(dphi[i][0], this->_vector(dof_indices[i]));
578 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
579  }
580  else
581  {
586  //TODO: enable this for a vector of points as well...
587  FEComputeData data (this->_eqn_systems, mapped_point);
588  data.enable_derivative();
589  FEInterface::compute_data (dim, fe_type, element, data);
590 
591  //grad [x] = data.dshape[i](v) * dv/dx * dof_index [i]
592  // sum over all indices
593  for (auto i : index_range(dof_indices))
594  {
595  // local coordinates.
596  for (std::size_t v=0; v<dim; v++)
597  for (std::size_t xyz=0; xyz<LIBMESH_DIM; xyz++)
598  {
599  // FIXME: this needs better syntax: It is matrix-vector multiplication.
600  grad(xyz) += data.local_transform[v][xyz]
601  * data.dshape[i](v)
602  * this->_vector(dof_indices[i]);
603  }
604  }
605  }
606 #endif
607  temp_output[index] = grad;
608 
609  // next variable
610  }
611 
612  // Insert temp_output into output
613  output[element] = temp_output;
614  }
615 }

References _dof_map, _eqn_systems, _out_of_mesh_mode, _out_of_mesh_value, _system_vars, _vector, libMesh::TypeVector< T >::add_scaled(), libMesh::FEGenericBase< OutputType >::build(), libMesh::FEInterface::compute_data(), data, dim, libMesh::DofMap::dof_indices(), find_elements(), libMesh::index_range(), libMesh::FunctionBase< Number >::initialized(), libMesh::invalid_uint, libMesh::FEMap::inverse_map(), libMesh::libmesh_assert(), libMesh::DenseVector< T >::size(), and libMesh::DofMap::variable_type().

◆ discontinuous_gradient() [3/3]

std::map< const Elem *, Gradient > libMesh::MeshFunction::discontinuous_gradient ( const Point p,
const Real  time = 0. 
)
Returns
A map of first derivatives (gradients) of variable 0 at point p and for time. map is from element to Gradient and accounts for double defined values on faces if the gradient is discontinuous

Definition at line 184 of file mesh_function.C.

186 {
187  libmesh_assert (this->initialized());
188 
189  std::map<const Elem *, std::vector<Gradient>> buffer;
190  this->discontinuous_gradient (p, time, buffer);
191  std::map<const Elem *, Gradient> return_value;
192  for (const auto & pr : buffer)
193  return_value[pr.first] = pr.second[0];
194  // NOTE: If no suitable element is found, then the map return_value is empty. This
195  // puts burden on the user of this function but I don't really see a better way.
196  return return_value;
197 }

References libMesh::FunctionBase< Number >::initialized(), and libMesh::libmesh_assert().

Referenced by discontinuous_gradient().

◆ discontinuous_value() [1/3]

void libMesh::MeshFunction::discontinuous_value ( const Point p,
const Real  time,
std::map< const Elem *, DenseVector< Number >> &  output 
)

Similar to operator() with the same parameter list, but with the difference that multiple values on faces are explicitly permitted.

This is useful for discontinuous shape functions that are evaluated on faces.

Definition at line 304 of file mesh_function.C.

307 {
308  this->discontinuous_value (p, time, output, nullptr);
309 }

References discontinuous_value().

◆ discontinuous_value() [2/3]

void libMesh::MeshFunction::discontinuous_value ( const Point p,
const Real  time,
std::map< const Elem *, DenseVector< Number >> &  output,
const std::set< subdomain_id_type > *  subdomain_ids 
)

Similar to operator() with the same parameter list, but with the difference that multiple values on faces are explicitly permitted.

This is useful for discontinuous shape functions that are evaluated on faces.

Build an FEComputeData that contains both input and output data for the specific compute_data method.

Definition at line 313 of file mesh_function.C.

317 {
318  libmesh_assert (this->initialized());
319 
320  // clear the output map
321  output.clear();
322 
323  // get the candidate elements
324  std::set<const Elem *> candidate_element = this->find_elements(p,subdomain_ids);
325 
326  // loop through all candidates, if the set is empty this function will return an
327  // empty map
328  for (const auto & element : candidate_element)
329  {
330  const unsigned int dim = element->dim();
331 
332  // define a temporary vector to store all values
333  DenseVector<Number> temp_output (cast_int<unsigned int>(this->_system_vars.size()));
334 
335  /*
336  * Get local coordinates to feed these into compute_data().
337  * Note that the fe_type can safely be used from the 0-variable,
338  * since the inverse mapping is the same for all FEFamilies
339  */
340  const Point mapped_point (FEMap::inverse_map (dim, element, p));
341 
342  // loop over all vars
343  for (auto index : index_range(this->_system_vars))
344  {
345  /*
346  * the data for this variable
347  */
348  const unsigned int var = _system_vars[index];
349 
350  if (var == libMesh::invalid_uint)
351  {
353  index < _out_of_mesh_value.size());
354  temp_output(index) = _out_of_mesh_value(index);
355  continue;
356  }
357 
358  const FEType & fe_type = this->_dof_map.variable_type(var);
359 
364  {
365  FEComputeData data (this->_eqn_systems, mapped_point);
366 
367  FEInterface::compute_data (dim, fe_type, element, data);
368 
369  // where the solution values for the var-th variable are stored
370  std::vector<dof_id_type> dof_indices;
371  this->_dof_map.dof_indices (element, dof_indices, var);
372 
373  // interpolate the solution
374  {
375  Number value = 0.;
376 
377  for (auto i : index_range(dof_indices))
378  value += this->_vector(dof_indices[i]) * data.shape[i];
379 
380  temp_output(index) = value;
381  }
382 
383  }
384 
385  // next variable
386  }
387 
388  // Insert temp_output into output
389  output[element] = temp_output;
390  }
391 }

References _dof_map, _eqn_systems, _out_of_mesh_mode, _out_of_mesh_value, _system_vars, _vector, libMesh::FEInterface::compute_data(), data, dim, libMesh::DofMap::dof_indices(), find_elements(), libMesh::index_range(), libMesh::FunctionBase< Number >::initialized(), libMesh::invalid_uint, libMesh::FEMap::inverse_map(), libMesh::libmesh_assert(), libMesh::DenseVector< T >::size(), value, and libMesh::DofMap::variable_type().

◆ discontinuous_value() [3/3]

std::map< const Elem *, Number > libMesh::MeshFunction::discontinuous_value ( const Point p,
const Real  time = 0. 
)
Returns
A map of values of variable 0 at point p and for time.

The std::map is from element to Number and accounts for doubly-defined values on faces if discontinuous variables are used.

Definition at line 159 of file mesh_function.C.

161 {
162  libmesh_assert (this->initialized());
163 
164  std::map<const Elem *, DenseVector<Number>> buffer;
165  this->discontinuous_value (p, time, buffer);
166  std::map<const Elem *, Number> return_value;
167  for (const auto & pr : buffer)
168  return_value[pr.first] = pr.second(0);
169  // NOTE: If no suitable element is found, then the map return_value is empty. This
170  // puts burden on the user of this function but I don't really see a better way.
171  return return_value;
172 }

References libMesh::FunctionBase< Number >::initialized(), and libMesh::libmesh_assert().

Referenced by discontinuous_value().

◆ enable_out_of_mesh_mode() [1/2]

void libMesh::MeshFunction::enable_out_of_mesh_mode ( const DenseVector< Number > &  value)

Enables out-of-mesh mode.

In this mode, if asked for a point that is not contained in any element, the MeshFunction will return the given value instead of crashing. This mode is off per default. If you use a master mesh function and you want to enable this mode, you will have to enable it for the master mesh function as well and for all mesh functions that have the same master mesh function. You may, however, specify different values.

Definition at line 799 of file mesh_function.C.

800 {
801  libmesh_assert (this->initialized());
803  _out_of_mesh_mode = true;
805 }

References _out_of_mesh_mode, _out_of_mesh_value, _point_locator, libMesh::PointLocatorBase::enable_out_of_mesh_mode(), libMesh::FunctionBase< Number >::initialized(), libMesh::libmesh_assert(), and value.

Referenced by enable_out_of_mesh_mode().

◆ enable_out_of_mesh_mode() [2/2]

void libMesh::MeshFunction::enable_out_of_mesh_mode ( const Number value)

Enables out-of-mesh mode.

In this mode, if asked for a point that is not contained in any element, the MeshFunction will return the given value instead of crashing. This mode is off per default. If you use a master mesh function and you want to enable this mode, you will have to enable it for the master mesh function as well and for all mesh functions that have the same master mesh function. You may, however, specify different values.

Definition at line 807 of file mesh_function.C.

808 {
809  DenseVector<Number> v(1);
810  v(0) = value;
811  this->enable_out_of_mesh_mode(v);
812 }

References enable_out_of_mesh_mode(), and value.

◆ find_element()

const Elem * libMesh::MeshFunction::find_element ( const Point p,
const std::set< subdomain_id_type > *  subdomain_ids = nullptr 
) const
protected

Helper function to reduce code duplication.

Definition at line 700 of file mesh_function.C.

702 {
703  /* Ensure that in the case of a master mesh function, the
704  out-of-mesh mode is enabled either for both or for none. This is
705  important because the out-of-mesh mode is also communicated to
706  the point locator. Since this is time consuming, enable it only
707  in debug mode. */
708 #ifdef DEBUG
709  if (this->_master != nullptr)
710  {
711  const MeshFunction * master =
712  cast_ptr<const MeshFunction *>(this->_master);
713  if (_out_of_mesh_mode!=master->_out_of_mesh_mode)
714  libmesh_error_msg("ERROR: If you use out-of-mesh-mode in connection with master mesh " \
715  << "functions, you must enable out-of-mesh mode for both the master and the slave mesh function.");
716  }
717 #endif
718 
719  // locate the point in the other mesh
720  const Elem * element = this->_point_locator->operator()(p,subdomain_ids);
721 
722  // If we have an element, but it's not a local element, then we
723  // either need to have a serialized vector or we need to find a
724  // local element sharing the same point.
725  if (element &&
726  (element->processor_id() != this->processor_id()) &&
727  _vector.type() != SERIAL)
728  {
729  // look for a local element containing the point
730  std::set<const Elem *> point_neighbors;
731  element->find_point_neighbors(p, point_neighbors);
732  element = nullptr;
733  for (const auto & elem : point_neighbors)
734  if (elem->processor_id() == this->processor_id())
735  {
736  element = elem;
737  break;
738  }
739  }
740 
741  return element;
742 }

References libMesh::FunctionBase< Number >::_master, _out_of_mesh_mode, _point_locator, _vector, libMesh::Elem::find_point_neighbors(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::SERIAL, and libMesh::NumericVector< T >::type().

Referenced by gradient(), hessian(), and operator()().

◆ find_elements()

std::set< const Elem * > libMesh::MeshFunction::find_elements ( const Point p,
const std::set< subdomain_id_type > *  subdomain_ids = nullptr 
) const
protected
Returns
All elements that are close to a point p.

This is similar to find_element() but covers cases where p is on the boundary.

Definition at line 744 of file mesh_function.C.

746 {
747  /* Ensure that in the case of a master mesh function, the
748  out-of-mesh mode is enabled either for both or for none. This is
749  important because the out-of-mesh mode is also communicated to
750  the point locator. Since this is time consuming, enable it only
751  in debug mode. */
752 #ifdef DEBUG
753  if (this->_master != nullptr)
754  {
755  const MeshFunction * master =
756  cast_ptr<const MeshFunction *>(this->_master);
757  if (_out_of_mesh_mode!=master->_out_of_mesh_mode)
758  libmesh_error_msg("ERROR: If you use out-of-mesh-mode in connection with master mesh " \
759  << "functions, you must enable out-of-mesh mode for both the master and the slave mesh function.");
760  }
761 #endif
762 
763  // locate the point in the other mesh
764  std::set<const Elem *> candidate_elements;
765  std::set<const Elem *> final_candidate_elements;
766  this->_point_locator->operator()(p,candidate_elements,subdomain_ids);
767  for (const auto & element : candidate_elements)
768  {
769  // If we have an element, but it's not a local element, then we
770  // either need to have a serialized vector or we need to find a
771  // local element sharing the same point.
772  if (element &&
773  (element->processor_id() != this->processor_id()) &&
774  _vector.type() != SERIAL)
775  {
776  // look for a local element containing the point
777  std::set<const Elem *> point_neighbors;
778  element->find_point_neighbors(p, point_neighbors);
779  for (const auto & elem : point_neighbors)
780  if (elem->processor_id() == this->processor_id())
781  {
782  final_candidate_elements.insert(elem);
783  break;
784  }
785  }
786  else
787  final_candidate_elements.insert(element);
788  }
789 
790  return final_candidate_elements;
791 }

References libMesh::FunctionBase< Number >::_master, _out_of_mesh_mode, _point_locator, _vector, libMesh::ParallelObject::processor_id(), libMesh::SERIAL, and libMesh::NumericVector< T >::type().

Referenced by discontinuous_gradient(), and discontinuous_value().

◆ get_point_locator()

const PointLocatorBase & libMesh::MeshFunction::get_point_locator ( void  ) const
Returns
The current PointLocator object, for use elsewhere.
Note
The MeshFunction object must be initialized before this is called.

Definition at line 793 of file mesh_function.C.

794 {
795  libmesh_assert (this->initialized());
796  return *_point_locator;
797 }

References _point_locator, libMesh::FunctionBase< Number >::initialized(), and libMesh::libmesh_assert().

Referenced by clone().

◆ gradient() [1/2]

void libMesh::MeshFunction::gradient ( const Point p,
const Real  time,
std::vector< Gradient > &  output,
const std::set< subdomain_id_type > *  subdomain_ids = nullptr 
)

Computes gradients at coordinate p and for time time, which defaults to zero, optionally restricting the point to the passed subdomain_ids.

This is useful in cases where there are multiple dimensioned elements, for example.

Build an FEComputeData that contains both input and output data for the specific compute_data method.

Definition at line 395 of file mesh_function.C.

399 {
400  libmesh_assert (this->initialized());
401 
402  const Elem * element = this->find_element(p,subdomain_ids);
403 
404  if (!element)
405  {
406  output.resize(0);
407  return;
408  }
409  else
410  {
411  // resize the output vector to the number of output values
412  // that the user told us
413  output.resize (this->_system_vars.size());
414 
415 
416  {
417  const unsigned int dim = element->dim();
418 
419 
420  /*
421  * Get local coordinates to feed these into compute_data().
422  * Note that the fe_type can safely be used from the 0-variable,
423  * since the inverse mapping is the same for all FEFamilies
424  */
425  const Point mapped_point (FEMap::inverse_map (dim, element,
426  p));
427 
428  std::vector<Point> point_list (1, mapped_point);
429 
430  // loop over all vars
431  for (auto index : index_range(this->_system_vars))
432  {
433  /*
434  * the data for this variable
435  */
436  const unsigned int var = _system_vars[index];
437 
438  if (var == libMesh::invalid_uint)
439  {
441  index < _out_of_mesh_value.size());
442  output[index] = Gradient(_out_of_mesh_value(index));
443  continue;
444  }
445 
446  const FEType & fe_type = this->_dof_map.variable_type(var);
447 
448  // where the solution values for the var-th variable are stored
449  std::vector<dof_id_type> dof_indices;
450  this->_dof_map.dof_indices (element, dof_indices, var);
451 
452  // interpolate the solution
453  Gradient grad(0.);
454 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
455  //The other algorithm works in case of finite elements as well,
456  //but this one is faster.
457  if (!element->infinite())
458  {
459 #endif
460  std::unique_ptr<FEBase> point_fe (FEBase::build(dim, fe_type));
461  const std::vector<std::vector<RealGradient>> & dphi = point_fe->get_dphi();
462  point_fe->reinit(element, &point_list);
463 
464  for (auto i : index_range(dof_indices))
465  grad.add_scaled(dphi[i][0], this->_vector(dof_indices[i]));
466 
467 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
468  }
469  else
470  {
475  FEComputeData data (this->_eqn_systems, mapped_point);
476  data.enable_derivative();
477  FEInterface::compute_data (dim, fe_type, element, data);
478  //grad [x] = data.dshape[i](v) * dv/dx * dof_index [i]
479  // sum over all indices
480  for (auto i : index_range(dof_indices))
481  {
482  // local coordinates
483  for (std::size_t v=0; v<dim; v++)
484  for (std::size_t xyz=0; xyz<LIBMESH_DIM; xyz++)
485  {
486  // FIXME: this needs better syntax: It is matrix-vector multiplication.
487  grad(xyz) += data.local_transform[v][xyz]
488  * data.dshape[i](v)
489  * this->_vector(dof_indices[i]);
490  }
491  }
492  }
493 #endif
494  output[index] = grad;
495  }
496  }
497  }
498 }

References _dof_map, _eqn_systems, _out_of_mesh_mode, _out_of_mesh_value, _system_vars, _vector, libMesh::TypeVector< T >::add_scaled(), libMesh::FEGenericBase< OutputType >::build(), libMesh::FEInterface::compute_data(), data, dim, libMesh::Elem::dim(), libMesh::DofMap::dof_indices(), find_element(), libMesh::index_range(), libMesh::Elem::infinite(), libMesh::FunctionBase< Number >::initialized(), libMesh::invalid_uint, libMesh::FEMap::inverse_map(), libMesh::libmesh_assert(), libMesh::DenseVector< T >::size(), and libMesh::DofMap::variable_type().

◆ gradient() [2/2]

Gradient libMesh::MeshFunction::gradient ( const Point p,
const Real  time = 0. 
)
Returns
The first derivatives of variable 0 at point p and for time, which defaults to zero.

Definition at line 174 of file mesh_function.C.

176 {
177  libmesh_assert (this->initialized());
178 
179  std::vector<Gradient> buf (1);
180  this->gradient(p, time, buf);
181  return buf[0];
182 }

References libMesh::FunctionBase< Number >::initialized(), and libMesh::libmesh_assert().

Referenced by libMesh::ExactErrorEstimator::find_squared_element_error(), and gptr().

◆ hessian() [1/2]

void libMesh::MeshFunction::hessian ( const Point p,
const Real  time,
std::vector< Tensor > &  output,
const std::set< subdomain_id_type > *  subdomain_ids = nullptr 
)

Computes gradients at coordinate p and for time time, which defaults to zero, optionally restricting the point to the passed subdomain_ids.

This is useful in cases where there are multiple dimensioned elements, for example.

Definition at line 620 of file mesh_function.C.

624 {
625  libmesh_assert (this->initialized());
626 
627  const Elem * element = this->find_element(p,subdomain_ids);
628 
629  if (!element)
630  {
631  output.resize(0);
632  }
633  else
634  {
635 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
636  if(element->infinite())
637  libmesh_warning("Warning: Requested the Hessian of an Infinite element."
638  << "Second derivatives for Infinite elements"
639  << " are not yet implemented!"
640  << std::endl);
641 #endif
642  // resize the output vector to the number of output values
643  // that the user told us
644  output.resize (this->_system_vars.size());
645 
646 
647  {
648  const unsigned int dim = element->dim();
649 
650 
651  /*
652  * Get local coordinates to feed these into compute_data().
653  * Note that the fe_type can safely be used from the 0-variable,
654  * since the inverse mapping is the same for all FEFamilies
655  */
656  const Point mapped_point (FEMap::inverse_map (dim, element,
657  p));
658 
659  std::vector<Point> point_list (1, mapped_point);
660 
661  // loop over all vars
662  for (auto index : index_range(this->_system_vars))
663  {
664  /*
665  * the data for this variable
666  */
667  const unsigned int var = _system_vars[index];
668 
669  if (var == libMesh::invalid_uint)
670  {
672  index < _out_of_mesh_value.size());
673  output[index] = Tensor(_out_of_mesh_value(index));
674  continue;
675  }
676  const FEType & fe_type = this->_dof_map.variable_type(var);
677 
678  std::unique_ptr<FEBase> point_fe (FEBase::build(dim, fe_type));
679  const std::vector<std::vector<RealTensor>> & d2phi =
680  point_fe->get_d2phi();
681  point_fe->reinit(element, &point_list);
682 
683  // where the solution values for the var-th variable are stored
684  std::vector<dof_id_type> dof_indices;
685  this->_dof_map.dof_indices (element, dof_indices, var);
686 
687  // interpolate the solution
688  Tensor hess;
689 
690  for (auto i : index_range(dof_indices))
691  hess.add_scaled(d2phi[i][0], this->_vector(dof_indices[i]));
692 
693  output[index] = hess;
694  }
695  }
696  }
697 }

References _dof_map, _out_of_mesh_mode, _out_of_mesh_value, _system_vars, _vector, libMesh::TypeTensor< T >::add_scaled(), libMesh::FEGenericBase< OutputType >::build(), dim, libMesh::Elem::dim(), libMesh::DofMap::dof_indices(), find_element(), libMesh::index_range(), libMesh::Elem::infinite(), libMesh::FunctionBase< Number >::initialized(), libMesh::invalid_uint, libMesh::FEMap::inverse_map(), libMesh::libmesh_assert(), libMesh::DenseVector< T >::size(), and libMesh::DofMap::variable_type().

◆ hessian() [2/2]

Tensor libMesh::MeshFunction::hessian ( const Point p,
const Real  time = 0. 
)
Returns
The second derivatives of variable 0 at point p and for time, which defaults to zero.

Definition at line 200 of file mesh_function.C.

202 {
203  libmesh_assert (this->initialized());
204 
205  std::vector<Tensor> buf (1);
206  this->hessian(p, time, buf);
207  return buf[0];
208 }

References libMesh::FunctionBase< Number >::initialized(), and libMesh::libmesh_assert().

Referenced by libMesh::ExactErrorEstimator::find_squared_element_error().

◆ init() [1/2]

virtual void libMesh::MeshFunction::init ( )
inlineoverridevirtual

Override the FunctionBase::init() member function by calling our own and specifying the Trees::NODES method.

specifies the method to use when building a PointLocator

Reimplemented from libMesh::FunctionBase< Number >.

Definition at line 110 of file mesh_function.h.

110 { this->init(Trees::NODES); }

References init(), and libMesh::Trees::NODES.

Referenced by clone(), init(), main(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), SystemsTest::testProjectCubeWithMeshFunction(), and libMesh::MeshFunctionSolutionTransfer::transfer().

◆ init() [2/2]

void libMesh::MeshFunction::init ( const Trees::BuildType  point_locator_build_type)

The actual initialization process.

Takes an optional argument which specifies the method to use when building a PointLocator

Definition at line 95 of file mesh_function.C.

96 {
97  // are indices of the desired variable(s) provided?
98  libmesh_assert_greater (this->_system_vars.size(), 0);
99 
100  // Don't do twice...
101  if (this->_initialized)
102  {
104  return;
105  }
106 
107  /*
108  * set up the PointLocator: currently we always get this from the
109  * MeshBase we're associated with.
110  */
111  const MeshBase & mesh = this->_eqn_systems.get_mesh();
112 
113  this->_point_locator = mesh.sub_point_locator().release();
114 
115  // ready for use
116  this->_initialized = true;
117 }

References _eqn_systems, libMesh::FunctionBase< Number >::_initialized, _point_locator, _system_vars, libMesh::EquationSystems::get_mesh(), libMesh::libmesh_assert(), mesh, and libMesh::MeshBase::sub_point_locator().

◆ initialized()

bool libMesh::FunctionBase< Number >::initialized ( ) const
inlineinherited
Returns
true when this object is properly initialized and ready for use, false otherwise.

Definition at line 205 of file function_base.h.

206 {
207  return (this->_initialized);
208 }

◆ is_time_dependent()

bool libMesh::FunctionBase< Number >::is_time_dependent ( ) const
inlineinherited
Returns
true when the function this object represents is actually time-dependent, false otherwise.

Definition at line 219 of file function_base.h.

220 {
221  return (this->_is_time_dependent);
222 }

◆ n_processors()

processor_id_type libMesh::ParallelObject::n_processors ( ) const
inlineinherited
Returns
The number of processors in the group.

Definition at line 100 of file parallel_object.h.

101  { return cast_int<processor_id_type>(_communicator.size()); }

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::DofMap::add_constraints_to_send_list(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::EnsightIO::EnsightIO(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::partition(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::prepare_send_list(), libMesh::DofMap::print_dof_constraints(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::DistributedMesh::renumber_dof_objects(), OverlappingFunctorTest::run_partitioner_test(), libMesh::DofMap::scatter_constraints(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), CheckpointIOTest::testSplitter(), WriteVecAndScalar::testWrite(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::VTKIO::write_nodal_data(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

◆ operator()() [1/4]

void libMesh::MeshFunction::operator() ( const Point p,
const Real  time,
DenseVector< Number > &  output 
)
overridevirtual

Computes values at coordinate p and for time time, which defaults to zero, optionally restricting the point to the passed subdomain_ids.

This is useful in cases where there are multiple dimensioned elements, for example.

Implements libMesh::FunctionBase< Number >.

Definition at line 211 of file mesh_function.C.

214 {
215  this->operator() (p, time, output, nullptr);
216 }

References operator()().

◆ operator()() [2/4]

void libMesh::MeshFunction::operator() ( const Point p,
const Real  time,
DenseVector< Number > &  output,
const std::set< subdomain_id_type > *  subdomain_ids 
)

Computes values at coordinate p and for time time, restricting the point to the passed subdomain_ids.

This is useful in cases where there are multiple dimensioned elements, for example.

Build an FEComputeData that contains both input and output data for the specific compute_data method.

Definition at line 218 of file mesh_function.C.

222 {
223  libmesh_assert (this->initialized());
224 
225  const Elem * element = this->find_element(p,subdomain_ids);
226 
227  if (!element)
228  {
229  // We'd better be in out_of_mesh_mode if we couldn't find an
230  // element in the mesh
232  output = _out_of_mesh_value;
233  }
234  else
235  {
236  // resize the output vector to the number of output values
237  // that the user told us
238  output.resize (cast_int<unsigned int>
239  (this->_system_vars.size()));
240 
241 
242  {
243  const unsigned int dim = element->dim();
244 
245 
246  /*
247  * Get local coordinates to feed these into compute_data().
248  * Note that the fe_type can safely be used from the 0-variable,
249  * since the inverse mapping is the same for all FEFamilies
250  */
251  const Point mapped_point (FEMap::inverse_map (dim, element,
252  p));
253 
254  // loop over all vars
255  for (auto index : index_range(this->_system_vars))
256  {
257  /*
258  * the data for this variable
259  */
260  const unsigned int var = _system_vars[index];
261 
262  if (var == libMesh::invalid_uint)
263  {
265  index < _out_of_mesh_value.size());
266  output(index) = _out_of_mesh_value(index);
267  continue;
268  }
269 
270  const FEType & fe_type = this->_dof_map.variable_type(var);
271 
276  {
277  FEComputeData data (this->_eqn_systems, mapped_point);
278 
279  FEInterface::compute_data (dim, fe_type, element, data);
280 
281  // where the solution values for the var-th variable are stored
282  std::vector<dof_id_type> dof_indices;
283  this->_dof_map.dof_indices (element, dof_indices, var);
284 
285  // interpolate the solution
286  {
287  Number value = 0.;
288 
289  for (auto i : index_range(dof_indices))
290  value += this->_vector(dof_indices[i]) * data.shape[i];
291 
292  output(index) = value;
293  }
294 
295  }
296 
297  // next variable
298  }
299  }
300  }
301 }

References _dof_map, _eqn_systems, _out_of_mesh_mode, _out_of_mesh_value, _system_vars, _vector, libMesh::FEInterface::compute_data(), data, dim, libMesh::Elem::dim(), libMesh::DofMap::dof_indices(), find_element(), libMesh::index_range(), libMesh::FunctionBase< Number >::initialized(), libMesh::invalid_uint, libMesh::FEMap::inverse_map(), libMesh::libmesh_assert(), libMesh::DenseVector< T >::resize(), libMesh::DenseVector< T >::size(), value, and libMesh::DofMap::variable_type().

◆ operator()() [3/4]

Number libMesh::MeshFunction::operator() ( const Point p,
const Real  time = 0. 
)
overridevirtual
Returns
The value of variable 0 at point p and for time, which defaults to zero.

Implements libMesh::FunctionBase< Number >.

Definition at line 149 of file mesh_function.C.

151 {
152  libmesh_assert (this->initialized());
153 
154  DenseVector<Number> buf (1);
155  this->operator() (p, time, buf);
156  return buf(0);
157 }

References libMesh::FunctionBase< Number >::initialized(), and libMesh::libmesh_assert().

Referenced by operator()().

◆ operator()() [4/4]

void libMesh::FunctionBase< Number >::operator() ( const Point p,
DenseVector< Number > &  output 
)
inlineinherited

Evaluation function for time-independent vector-valued functions.

Sets output values in the passed-in output DenseVector.

Definition at line 240 of file function_base.h.

242 {
243  // Call the time-dependent function with t=0.
244  this->operator()(p, 0., output);
245 }

◆ operator=() [1/2]

MeshFunction& libMesh::MeshFunction::operator= ( const MeshFunction )
delete

This class contains const references so it can't be assigned.

◆ operator=() [2/2]

MeshFunction& libMesh::MeshFunction::operator= ( MeshFunction &&  )
delete

◆ processor_id()

processor_id_type libMesh::ParallelObject::processor_id ( ) const
inlineinherited
Returns
The rank of this processor in the group.

Definition at line 106 of file parallel_object.h.

107  { return cast_int<processor_id_type>(_communicator.rank()); }

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::EquationSystems::_read_impl(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::ExodusII_IO_Helper::close(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::compute_communication_map_parameters(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::DistributedMesh::delete_node(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DistributedMesh::DistributedMesh(), libMesh::DofMap::end_dof(), libMesh::DofMap::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::RBEIMConstruction::evaluate_mesh_function(), find_element(), find_elements(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMap::first_dof(), libMesh::DofMap::first_old_dof(), libMesh::Nemesis_IO_Helper::get_cmap_params(), libMesh::Nemesis_IO_Helper::get_eb_info_global(), libMesh::Nemesis_IO_Helper::get_elem_cmap(), libMesh::Nemesis_IO_Helper::get_elem_map(), libMesh::DofMap::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::DofMap::get_local_constraints(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), HeatSystem::init_data(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::DistributedMesh::insert_elem(), libMesh::DofMap::is_evaluable(), libMesh::SparsityPattern::Build::join(), libMesh::DofMap::last_dof(), libMesh::TransientRBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEIMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEIMEvaluation::legacy_write_out_interpolation_points_elem(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DofMap::local_variable_indices(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMap::n_local_dofs(), libMesh::System::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::SparsityPattern::Build::operator()(), libMesh::DistributedMesh::own_node(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::print_dof_constraints(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_global_values(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::System::read_legacy_data(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::LaplaceMeshSmoother::smooth(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusCopyElementSolution(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), SystemsTest::testProjectMatrix1D(), SystemsTest::testProjectMatrix2D(), SystemsTest::testProjectMatrix3D(), BoundaryInfoTest::testShellFaceConstraints(), CheckpointIOTest::testSplitter(), WriteVecAndScalar::testWrite(), libMesh::MeshTools::total_weight(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::Parallel::Packing< Node * >::unpack(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::VTKIO::write_nodal_data(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::RBEvaluation::write_out_vectors(), write_output_solvedata(), libMesh::System::write_parallel_data(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sideset_data(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), libMesh::ExodusII_IO_Helper::write_timestep(), and libMesh::ExodusII_IO::write_timestep_discontinuous().

◆ set_is_time_dependent()

void libMesh::FunctionBase< Number >::set_is_time_dependent ( bool  is_time_dependent)
inlineinherited

Function to set whether this is a time-dependent function or not.

This is intended to be only used by subclasses who cannot natively determine time-dependence. In such a case, this function should be used immediately following construction.

Definition at line 212 of file function_base.h.

213 {
215 }

◆ set_point_locator_tolerance()

void libMesh::MeshFunction::set_point_locator_tolerance ( Real  tol)

We may want to specify a tolerance for the PointLocator to use, since in some cases the point we want to evaluate at might be slightly outside the mesh (due to numerical rounding issues, for example).

Definition at line 821 of file mesh_function.C.

822 {
824 }

References _point_locator, and libMesh::PointLocatorBase::set_close_to_point_tol().

Referenced by clone().

◆ unset_point_locator_tolerance()

void libMesh::MeshFunction::unset_point_locator_tolerance ( )

Turn off the user-specified PointLocator tolerance.

Definition at line 826 of file mesh_function.C.

827 {
829 }

References _point_locator, and libMesh::PointLocatorBase::unset_close_to_point_tol().

Member Data Documentation

◆ _communicator

const Parallel::Communicator& libMesh::ParallelObject::_communicator
protectedinherited

◆ _dof_map

const DofMap& libMesh::MeshFunction::_dof_map
protected

Need access to the DofMap of the other system.

Definition at line 339 of file mesh_function.h.

Referenced by clone(), discontinuous_gradient(), discontinuous_value(), gradient(), hessian(), and operator()().

◆ _eqn_systems

const EquationSystems& libMesh::MeshFunction::_eqn_systems
protected

The equation systems handler, from which the data are gathered.

Definition at line 328 of file mesh_function.h.

Referenced by clone(), discontinuous_gradient(), discontinuous_value(), gradient(), init(), and operator()().

◆ _initialized

bool libMesh::FunctionBase< Number >::_initialized
protectedinherited

When init() was called so that everything is ready for calls to operator() (...), then this bool is true.

Definition at line 179 of file function_base.h.

◆ _is_time_dependent

bool libMesh::FunctionBase< Number >::_is_time_dependent
protectedinherited

Cache whether or not this function is actually time-dependent.

Definition at line 184 of file function_base.h.

◆ _master

const FunctionBase* libMesh::FunctionBase< Number >::_master
protectedinherited

Const pointer to our master, initialized to nullptr.

There may be cases where multiple functions are required, but to save memory, one master handles some centralized data.

Definition at line 173 of file function_base.h.

◆ _out_of_mesh_mode

bool libMesh::MeshFunction::_out_of_mesh_mode
protected

true if out-of-mesh mode is enabled.

See enable_out_of_mesh_mode() for more details. Default is false.

Definition at line 357 of file mesh_function.h.

Referenced by disable_out_of_mesh_mode(), discontinuous_gradient(), discontinuous_value(), enable_out_of_mesh_mode(), find_element(), find_elements(), gradient(), hessian(), and operator()().

◆ _out_of_mesh_value

DenseVector<Number> libMesh::MeshFunction::_out_of_mesh_value
protected

Value to return outside the mesh if out-of-mesh mode is enabled.

See enable_out_of_mesh_mode() for more details.

Definition at line 363 of file mesh_function.h.

Referenced by discontinuous_gradient(), discontinuous_value(), enable_out_of_mesh_mode(), gradient(), hessian(), and operator()().

◆ _point_locator

PointLocatorBase* libMesh::MeshFunction::_point_locator
protected

◆ _system_vars

const std::vector<unsigned int> libMesh::MeshFunction::_system_vars
protected

The indices of the variables within the other system for which data are to be gathered.

Definition at line 345 of file mesh_function.h.

Referenced by clone(), discontinuous_gradient(), discontinuous_value(), gradient(), hessian(), init(), and operator()().

◆ _vector

const NumericVector<Number>& libMesh::MeshFunction::_vector
protected

A reference to the vector that holds the data that is to be interpolated.

Definition at line 334 of file mesh_function.h.

Referenced by clone(), discontinuous_gradient(), discontinuous_value(), find_element(), find_elements(), gradient(), hessian(), and operator()().


The documentation for this class was generated from the following files:
libMesh::MeshFunction::find_element
const Elem * find_element(const Point &p, const std::set< subdomain_id_type > *subdomain_ids=nullptr) const
Helper function to reduce code duplication.
Definition: mesh_function.C:700
libMesh::Number
Real Number
Definition: libmesh_common.h:195
libMesh::invalid_uint
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
Definition: libmesh.h:249
libMesh::MeshFunction::_out_of_mesh_value
DenseVector< Number > _out_of_mesh_value
Value to return outside the mesh if out-of-mesh mode is enabled.
Definition: mesh_function.h:363
libMesh::EquationSystems::get_mesh
const MeshBase & get_mesh() const
Definition: equation_systems.h:637
libMesh::DofMap::dof_indices
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Fills the vector di with the global degree of freedom indices for the element.
Definition: dof_map.C:1967
libMesh::FunctionBase< Number >::is_time_dependent
bool is_time_dependent() const
Definition: function_base.h:219
libMesh::MeshFunction::init
virtual void init() override
Override the FunctionBase::init() member function by calling our own and specifying the Trees::NODES ...
Definition: mesh_function.h:110
libMesh::MeshFunction::operator()
Number operator()(const Point &p, const Real time=0.) override
Definition: mesh_function.C:149
libMesh::MeshFunction::find_elements
std::set< const Elem * > find_elements(const Point &p, const std::set< subdomain_id_type > *subdomain_ids=nullptr) const
Definition: mesh_function.C:744
libMesh::PointLocatorBase::set_close_to_point_tol
virtual void set_close_to_point_tol(Real close_to_point_tol)
Set a tolerance to use when determining if a point is contained within the mesh.
Definition: point_locator_base.C:92
libMesh::SERIAL
Definition: enum_parallel_type.h:35
libMesh::index_range
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:106
libMesh::MeshFunction::discontinuous_gradient
std::map< const Elem *, Gradient > discontinuous_gradient(const Point &p, const Real time=0.)
Definition: mesh_function.C:184
libMesh::FunctionBase< Number >::_is_time_dependent
bool _is_time_dependent
Cache whether or not this function is actually time-dependent.
Definition: function_base.h:184
libMesh::MeshFunction::discontinuous_value
std::map< const Elem *, Number > discontinuous_value(const Point &p, const Real time=0.)
Definition: mesh_function.C:159
mesh
MeshBase & mesh
Definition: mesh_communication.C:1257
libMesh::PointLocatorBase::disable_out_of_mesh_mode
virtual void disable_out_of_mesh_mode()=0
Disables out-of-mesh mode (default).
libMesh::MeshFunction::hessian
Tensor hessian(const Point &p, const Real time=0.)
Definition: mesh_function.C:200
dim
unsigned int dim
Definition: adaptivity_ex3.C:113
libMesh::MeshFunction::get_point_locator
const PointLocatorBase & get_point_locator(void) const
Definition: mesh_function.C:793
libMesh::FunctionBase< Number >::initialized
bool initialized() const
Definition: function_base.h:205
libMesh::PointLocatorBase::enable_out_of_mesh_mode
virtual void enable_out_of_mesh_mode()=0
Enables out-of-mesh mode.
libMesh::libmesh_assert
libmesh_assert(ctx)
libMesh::ParallelObject::ParallelObject
ParallelObject(const Parallel::Communicator &comm_in)
Constructor.
Definition: parallel_object.h:63
libMesh::MeshFunction::enable_out_of_mesh_mode
void enable_out_of_mesh_mode(const DenseVector< Number > &value)
Enables out-of-mesh mode.
Definition: mesh_function.C:799
libMesh::FEMap::inverse_map
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
Definition: fe_map.C:1622
libMesh::ParallelObject::processor_id
processor_id_type processor_id() const
Definition: parallel_object.h:106
libMesh::FunctionBase< Number >::_initialized
bool _initialized
When init() was called so that everything is ready for calls to operator() (...), then this bool is t...
Definition: function_base.h:179
libMesh::FEGenericBase::build
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
libMesh::ParallelObject::_communicator
const Parallel::Communicator & _communicator
Definition: parallel_object.h:112
libMesh::MeshFunction::_point_locator
PointLocatorBase * _point_locator
A point locator is needed to locate the points in the mesh.
Definition: mesh_function.h:351
libMesh::TypeTensor::add_scaled
void add_scaled(const TypeTensor< T2 > &, const T &)
Add a scaled tensor to this tensor without creating a temporary.
Definition: type_tensor.h:869
libMesh::MeshFunction::_eqn_systems
const EquationSystems & _eqn_systems
The equation systems handler, from which the data are gathered.
Definition: mesh_function.h:328
libMesh::DofMap::variable_type
const FEType & variable_type(const unsigned int c) const
Definition: dof_map.h:1924
libMesh::DenseVector::size
virtual unsigned int size() const override
Definition: dense_vector.h:92
libMesh::MeshFunction::_dof_map
const DofMap & _dof_map
Need access to the DofMap of the other system.
Definition: mesh_function.h:339
libMesh::FunctionBase< Number >::_master
const FunctionBase * _master
Const pointer to our master, initialized to nullptr.
Definition: function_base.h:173
libMesh::MeshFunction::_vector
const NumericVector< Number > & _vector
A reference to the vector that holds the data that is to be interpolated.
Definition: mesh_function.h:334
libMesh::DenseVector::resize
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:355
libMesh::FunctionBase< Number >::operator()
virtual Number operator()(const Point &p, const Real time=0.)=0
libMesh::Gradient
NumberVectorValue Gradient
Definition: exact_solution.h:58
value
static const bool value
Definition: xdr_io.C:56
libMesh::MeshFunction::_out_of_mesh_mode
bool _out_of_mesh_mode
true if out-of-mesh mode is enabled.
Definition: mesh_function.h:357
libMesh::MeshFunction::_system_vars
const std::vector< unsigned int > _system_vars
The indices of the variables within the other system for which data are to be gathered.
Definition: mesh_function.h:345
data
IterBase * data
Ideally this private member data should have protected access.
Definition: variant_filter_iterator.h:337
libMesh::Trees::NODES
Definition: tree_base.h:55
libMesh::Tensor
NumberTensorValue Tensor
Definition: exact_solution.h:56
libMesh::PointLocatorBase::unset_close_to_point_tol
virtual void unset_close_to_point_tol()
Specify that we do not want to use a user-specified tolerance to determine if a point is contained wi...
Definition: point_locator_base.C:99
libMesh::MeshFunction::MeshFunction
MeshFunction(const EquationSystems &eqn_systems, const NumericVector< Number > &vec, const DofMap &dof_map, const std::vector< unsigned int > &vars, const FunctionBase< Number > *master=nullptr)
Constructor for mesh based functions with vectors as return value.
Definition: mesh_function.C:42
libMesh::NumericVector::type
ParallelType type() const
Definition: numeric_vector.h:160
libMesh::MeshFunction::gradient
Gradient gradient(const Point &p, const Real time=0.)
Definition: mesh_function.C:174
libMesh::FEInterface::compute_data
static void compute_data(const unsigned int dim, const FEType &fe_t, const Elem *elem, FEComputeData &data)
Lets the appropriate child of FEBase compute the requested data for the input specified in data,...
Definition: fe_interface.C:1028