$extrastylesheet
#include <mesh_function.h>

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=NULL) | |
| MeshFunction (const EquationSystems &eqn_systems, const NumericVector< Number > &vec, const DofMap &dof_map, const unsigned int var, const FunctionBase< Number > *master=NULL) | |
| ~MeshFunction () | |
| void | init () |
| virtual void | init (const Trees::BuildType point_locator_build_type) |
| virtual void | clear () |
| virtual UniquePtr < FunctionBase< Number > > | clone () const |
| Number | operator() (const Point &p, const Real time=0.) |
| Gradient | 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) |
| void | operator() (const Point &p, const Real time, DenseVector< Number > &output, const std::set< subdomain_id_type > *subdomain_ids) |
| void | gradient (const Point &p, const Real time, std::vector< Gradient > &output, const std::set< subdomain_id_type > *subdomain_ids=NULL) |
| void | hessian (const Point &p, const Real time, std::vector< Tensor > &output, const std::set< subdomain_id_type > *subdomain_ids=NULL) |
| const PointLocatorBase & | get_point_locator (void) const |
| void | enable_out_of_mesh_mode (const DenseVector< Number > &value) |
| void | enable_out_of_mesh_mode (const Number &value) |
| void | disable_out_of_mesh_mode (void) |
| void | set_point_locator_tolerance (Real tol) |
| void | unset_point_locator_tolerance () |
| void | operator() (const Point &p, DenseVector< Number > &output) |
| virtual Number | component (unsigned int i, const Point &p, Real time=0.) |
| bool | initialized () const |
| const Parallel::Communicator & | comm () const |
| processor_id_type | n_processors () const |
| processor_id_type | processor_id () const |
Protected Member Functions | |
| const Elem * | find_element (const Point &p, const std::set< subdomain_id_type > *subdomain_ids=NULL) const |
Protected Attributes | |
| const EquationSystems & | _eqn_systems |
| const NumericVector< Number > & | _vector |
| const DofMap & | _dof_map |
| const std::vector< unsigned int > | _system_vars |
| PointLocatorBase * | _point_locator |
| bool | _out_of_mesh_mode |
| DenseVector< Number > | _out_of_mesh_value |
| const FunctionBase * | _master |
| bool | _initialized |
| const Parallel::Communicator & | _communicator |
This class provides function-like objects for data distributed over a mesh.
Definition at line 57 of file mesh_function.h.
| 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 = NULL |
||
| ) |
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.
Referenced by clone().
: FunctionBase<Number> (master), ParallelObject (eqn_systems), _eqn_systems (eqn_systems), _vector (vec), _dof_map (dof_map), _system_vars (vars), _point_locator (NULL), _out_of_mesh_mode (false), _out_of_mesh_value () { }
| libMesh::MeshFunction::MeshFunction | ( | const EquationSystems & | eqn_systems, |
| const NumericVector< Number > & | vec, | ||
| const DofMap & | dof_map, | ||
| const unsigned int | var, | ||
| const FunctionBase< Number > * | master = NULL |
||
| ) |
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.
: FunctionBase<Number> (master), ParallelObject (eqn_systems), _eqn_systems (eqn_systems), _vector (vec), _dof_map (dof_map), _system_vars (1,var), _point_locator (NULL), _out_of_mesh_mode (false), _out_of_mesh_value () { // std::vector<unsigned int> buf (1); // buf[0] = var; // _system_vars (buf); }
Destructor.
Definition at line 87 of file mesh_function.C.
References libMesh::FunctionBase< Number >::_master, and _point_locator.
{
// only delete the point locator when we are the master
if (this->_master == NULL)
delete this->_point_locator;
}
| void libMesh::MeshFunction::clear | ( | ) | [virtual] |
Clears the function.
Reimplemented from libMesh::FunctionBase< Number >.
Definition at line 153 of file mesh_function.C.
References libMesh::FunctionBase< Number >::_initialized, libMesh::FunctionBase< Number >::_master, and _point_locator.
{
// only delete the point locator when we are the master
if ((this->_point_locator != NULL) && (this->_master == NULL))
{
delete this->_point_locator;
this->_point_locator = NULL;
}
this->_initialized = false;
}
| UniquePtr< FunctionBase< Number > > libMesh::MeshFunction::clone | ( | ) | const [virtual] |
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 that this implies the copy should not be used after the original is destroyed.
Implements libMesh::FunctionBase< Number >.
Definition at line 166 of file mesh_function.C.
References _dof_map, _eqn_systems, _system_vars, _vector, and MeshFunction().
{
return UniquePtr<FunctionBase<Number> >
(new MeshFunction
(_eqn_systems, _vector, _dof_map, _system_vars, this));
}
| const Parallel::Communicator& libMesh::ParallelObject::comm | ( | ) | const [inline, inherited] |
Parallel::Communicator object used by this mesh. Definition at line 86 of file parallel_object.h.
References libMesh::ParallelObject::_communicator.
Referenced by libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_snes_residual(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::MetisPartitioner::_do_partition(), libMesh::ParmetisPartitioner::_do_repartition(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::ImplicitSystem::add_matrix(), libMesh::System::add_vector(), libMesh::UnstructuredMesh::all_second_order(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::DofMap::attach_matrix(), libMesh::MeshTools::bounding_box(), libMesh::MeshBase::cache_elem_dims(), libMesh::System::calculate_norm(), libMesh::MeshRefinement::coarsen_elements(), 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::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshSetSystem_libMesh(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::EigenSystem::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ParmetisPartitioner::initialize(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_flags(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::FEMSystem::mesh_position_set(), libMesh::MeshSerializer::MeshSerializer(), libMesh::ParallelMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), 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::ParallelMesh::parallel_max_elem_id(), libMesh::ParallelMesh::parallel_max_node_id(), libMesh::ParallelMesh::parallel_n_elem(), libMesh::ParallelMesh::parallel_n_nodes(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::System::project_vector(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs(), 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::MeshBase::recalculate_n_partitions(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Parallel::sync_node_data_by_element_id(), libMesh::MeshRefinement::test_level_one(), libMesh::MeshRefinement::test_unflagged(), libMesh::MeshTools::total_weight(), libMesh::NameBasedIO::write(), libMesh::CheckpointIO::write(), libMesh::XdrIO::write(), libMesh::LegacyXdrIO::write_mesh(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), and libMesh::DivaIO::write_stream().
{ return _communicator; }
| virtual Number libMesh::FunctionBase< Number >::component | ( | unsigned int | i, |
| const Point & | p, | ||
| Real | time = 0. |
||
| ) | [virtual, inherited] |
i at coordinate p and time time. Subclasses aren't required to overload this, since the default implementation is based on the full vector evaluation, which is often correct. Subclasses are recommended to overload this, since the default implementation is based on a vector evaluation, which is usually unnecessarily inefficient. | void libMesh::MeshFunction::disable_out_of_mesh_mode | ( | void | ) |
Disables out-of-mesh mode. This is also the default.
Definition at line 510 of file mesh_function.C.
References _out_of_mesh_mode, _point_locator, libMesh::PointLocatorBase::disable_out_of_mesh_mode(), libMesh::FunctionBase< Number >::initialized(), and libMesh::libmesh_assert().
{
libmesh_assert (this->initialized());
_point_locator->disable_out_of_mesh_mode();
_out_of_mesh_mode = false;
}
| 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 495 of file mesh_function.C.
References _out_of_mesh_mode, _out_of_mesh_value, _point_locator, libMesh::PointLocatorBase::enable_out_of_mesh_mode(), libMesh::FunctionBase< Number >::initialized(), and libMesh::libmesh_assert().
Referenced by enable_out_of_mesh_mode().
{
libmesh_assert (this->initialized());
_point_locator->enable_out_of_mesh_mode();
_out_of_mesh_mode = true;
_out_of_mesh_value = value;
}
| 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 503 of file mesh_function.C.
References enable_out_of_mesh_mode().
{
DenseVector<Number> v(1);
v(0) = value;
this->enable_out_of_mesh_mode(v);
}
| const Elem * libMesh::MeshFunction::find_element | ( | const Point & | p, |
| const std::set< subdomain_id_type > * | subdomain_ids = NULL |
||
| ) | const [protected] |
Helper function to reduce code duplication
Definition at line 440 of file mesh_function.C.
References libMesh::FunctionBase< Number >::_master, _out_of_mesh_mode, _point_locator, _vector, end, 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()().
{
/* Ensure that in the case of a master mesh function, the
out-of-mesh mode is enabled either for both or for none. This is
important because the out-of-mesh mode is also communicated to
the point locator. Since this is time consuming, enable it only
in debug mode. */
#ifdef DEBUG
if (this->_master != NULL)
{
const MeshFunction* master =
cast_ptr<const MeshFunction*>(this->_master);
if(_out_of_mesh_mode!=master->_out_of_mesh_mode)
libmesh_error_msg("ERROR: If you use out-of-mesh-mode in connection with master mesh " \
<< "functions, you must enable out-of-mesh mode for both the master and the slave mesh function.");
}
#endif
// locate the point in the other mesh
const Elem* element = this->_point_locator->operator()(p,subdomain_ids);
// If we have an element, but it's not a local element, then we
// either need to have a serialized vector or we need to find a
// local element sharing the same point.
if (element &&
(element->processor_id() != this->processor_id()) &&
_vector.type() != SERIAL)
{
// look for a local element containing the point
std::set<const Elem*> point_neighbors;
element->find_point_neighbors(p, point_neighbors);
element = NULL;
std::set<const Elem*>::const_iterator it = point_neighbors.begin();
const std::set<const Elem*>::const_iterator end = point_neighbors.end();
for (; it != end; ++it)
{
const Elem* elem = *it;
if (elem->processor_id() == this->processor_id())
{
element = elem;
break;
}
}
}
return element;
}
| const PointLocatorBase & libMesh::MeshFunction::get_point_locator | ( | void | ) | const |
Returns the current PointLocator object, for you might want to use it elsewhere. The MeshFunction object must be initialized before.
Definition at line 489 of file mesh_function.C.
References _point_locator, libMesh::FunctionBase< Number >::initialized(), and libMesh::libmesh_assert().
{
libmesh_assert (this->initialized());
return *_point_locator;
}
| Gradient libMesh::MeshFunction::gradient | ( | const Point & | p, |
| const Real | time = 0. |
||
| ) |
p and for time, which defaults to zero. Definition at line 187 of file mesh_function.C.
References libMesh::FunctionBase< Number >::initialized(), and libMesh::libmesh_assert().
Referenced by libMesh::ExactErrorEstimator::find_squared_element_error().
{
libmesh_assert (this->initialized());
std::vector<Gradient> buf (1);
this->gradient(p, time, buf);
return buf[0];
}
| void libMesh::MeshFunction::gradient | ( | const Point & | p, |
| const Real | time, | ||
| std::vector< Gradient > & | output, | ||
| const std::set< subdomain_id_type > * | subdomain_ids = NULL |
||
| ) |
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 299 of file mesh_function.C.
References _dof_map, _system_vars, libMesh::TypeVector< T >::add_scaled(), libMesh::FEGenericBase< OutputType >::build(), libMesh::Elem::dim(), libMesh::DofMap::dof_indices(), find_element(), libMesh::FunctionBase< Number >::initialized(), libMesh::FEInterface::inverse_map(), libMesh::libmesh_assert(), and libMesh::DofMap::variable_type().
{
libmesh_assert (this->initialized());
const Elem* element = this->find_element(p,subdomain_ids);
if (!element)
{
output.resize(0);
}
else
{
// resize the output vector to the number of output values
// that the user told us
output.resize (this->_system_vars.size());
{
const unsigned int dim = element->dim();
/*
* Get local coordinates to feed these into compute_data().
* Note that the fe_type can safely be used from the 0-variable,
* since the inverse mapping is the same for all FEFamilies
*/
const Point mapped_point (FEInterface::inverse_map (dim,
this->_dof_map.variable_type(0),
element,
p));
std::vector<Point> point_list (1, mapped_point);
// loop over all vars
for (unsigned int index=0; index < this->_system_vars.size(); index++)
{
/*
* the data for this variable
*/
const unsigned int var = _system_vars[index];
const FEType& fe_type = this->_dof_map.variable_type(var);
UniquePtr<FEBase> point_fe (FEBase::build(dim, fe_type));
const std::vector<std::vector<RealGradient> >& dphi = point_fe->get_dphi();
point_fe->reinit(element, &point_list);
// where the solution values for the var-th variable are stored
std::vector<dof_id_type> dof_indices;
this->_dof_map.dof_indices (element, dof_indices, var);
// interpolate the solution
Gradient grad(0.);
for (unsigned int i=0; i<dof_indices.size(); i++)
grad.add_scaled(dphi[i][0], this->_vector(dof_indices[i]));
output[index] = grad;
}
}
}
// all done
return;
}
| Tensor libMesh::MeshFunction::hessian | ( | const Point & | p, |
| const Real | time = 0. |
||
| ) |
p and for time, which defaults to zero. Definition at line 200 of file mesh_function.C.
References libMesh::FunctionBase< Number >::initialized(), and libMesh::libmesh_assert().
Referenced by libMesh::ExactErrorEstimator::find_squared_element_error().
{
libmesh_assert (this->initialized());
std::vector<Tensor> buf (1);
this->hessian(p, time, buf);
return buf[0];
}
| void libMesh::MeshFunction::hessian | ( | const Point & | p, |
| const Real | time, | ||
| std::vector< Tensor > & | output, | ||
| const std::set< subdomain_id_type > * | subdomain_ids = NULL |
||
| ) |
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 370 of file mesh_function.C.
References _dof_map, _system_vars, libMesh::TypeTensor< T >::add_scaled(), libMesh::FEGenericBase< OutputType >::build(), libMesh::Elem::dim(), libMesh::DofMap::dof_indices(), find_element(), libMesh::FunctionBase< Number >::initialized(), libMesh::FEInterface::inverse_map(), libMesh::libmesh_assert(), and libMesh::DofMap::variable_type().
{
libmesh_assert (this->initialized());
const Elem* element = this->find_element(p,subdomain_ids);
if (!element)
{
output.resize(0);
}
else
{
// resize the output vector to the number of output values
// that the user told us
output.resize (this->_system_vars.size());
{
const unsigned int dim = element->dim();
/*
* Get local coordinates to feed these into compute_data().
* Note that the fe_type can safely be used from the 0-variable,
* since the inverse mapping is the same for all FEFamilies
*/
const Point mapped_point (FEInterface::inverse_map (dim,
this->_dof_map.variable_type(0),
element,
p));
std::vector<Point> point_list (1, mapped_point);
// loop over all vars
for (unsigned int index=0; index < this->_system_vars.size(); index++)
{
/*
* the data for this variable
*/
const unsigned int var = _system_vars[index];
const FEType& fe_type = this->_dof_map.variable_type(var);
UniquePtr<FEBase> point_fe (FEBase::build(dim, fe_type));
const std::vector<std::vector<RealTensor> >& d2phi =
point_fe->get_d2phi();
point_fe->reinit(element, &point_list);
// where the solution values for the var-th variable are stored
std::vector<dof_id_type> dof_indices;
this->_dof_map.dof_indices (element, dof_indices, var);
// interpolate the solution
Tensor hess;
for (unsigned int i=0; i<dof_indices.size(); i++)
hess.add_scaled(d2phi[i][0], this->_vector(dof_indices[i]));
output[index] = hess;
}
}
}
// all done
return;
}
| void libMesh::MeshFunction::init | ( | ) | [inline, virtual] |
The actual initialization process. specifies the method to use when building a PointLocator
Reimplemented from libMesh::FunctionBase< Number >.
Definition at line 101 of file mesh_function.h.
References init(), and libMesh::Trees::NODES.
Referenced by init().
{ this->init(Trees::NODES); }
| void libMesh::MeshFunction::init | ( | const Trees::BuildType | point_locator_build_type | ) | [virtual] |
The actual initialization process. Takes an optional argument which specifies the method to use when building a PointLocator
Definition at line 97 of file mesh_function.C.
References _eqn_systems, libMesh::FunctionBase< Number >::_initialized, libMesh::FunctionBase< Number >::_master, _point_locator, _system_vars, libMesh::EquationSystems::get_mesh(), libMesh::libmesh_assert(), mesh, and libMesh::MeshBase::sub_point_locator().
{
// are indices of the desired variable(s) provided?
libmesh_assert_greater (this->_system_vars.size(), 0);
// Don't do twice...
if (this->_initialized)
{
libmesh_assert(this->_point_locator);
return;
}
/*
* set up the PointLocator: either someone else
* is the master (go and get the address of his
* point locator) or this object is the master
* (build the point locator on our own).
*/
if (this->_master != NULL)
{
// we aren't the master
const MeshFunction* master =
cast_ptr<const MeshFunction*>(this->_master);
if (master->_point_locator == NULL)
libmesh_error_msg("ERROR: When the master-servant concept is used, the master has to be initialized first!");
else
{
this->_point_locator = master->_point_locator;
}
}
else
{
// we are the master: build the point locator
// constant reference to the other mesh
const MeshBase& mesh = this->_eqn_systems.get_mesh();
// build the point locator. Only \p TREE version available
//UniquePtr<PointLocatorBase> ap (PointLocatorBase::build (TREE, mesh));
//this->_point_locator = ap.release();
// this->_point_locator = new PointLocatorTree (mesh, point_locator_build_type);
this->_point_locator = mesh.sub_point_locator().release();
// Point locator no longer needs to be initialized.
// this->_point_locator->init();
}
// ready for use
this->_initialized = true;
}
| bool libMesh::FunctionBase< Number >::initialized | ( | ) | const [inherited] |
true when this object is properly initialized and ready for use, false otherwise. Referenced by disable_out_of_mesh_mode(), enable_out_of_mesh_mode(), get_point_locator(), gradient(), hessian(), and operator()().
| processor_id_type libMesh::ParallelObject::n_processors | ( | ) | const [inline, inherited] |
Definition at line 92 of file parallel_object.h.
References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::size().
Referenced by libMesh::ParmetisPartitioner::_do_repartition(), libMesh::ParallelMesh::add_elem(), libMesh::ParallelMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::ParallelMesh::assign_unique_ids(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::ParallelMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshBase::get_info(), libMesh::EquationSystems::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::DofMap::local_variable_indices(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::PetscLinearSolver< T >::PetscLinearSolver(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshTools::processor_bounding_box(), libMesh::System::project_vector(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::Partitioner::repartition(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::BoundaryInfo::sync(), libMesh::ParallelMesh::update_parallel_id_counts(), libMesh::CheckpointIO::write(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().
{ return cast_int<processor_id_type>(_communicator.size()); }
| void libMesh::FunctionBase< Number >::operator() | ( | const Point & | p, |
| DenseVector< Number > & | output | ||
| ) | [inherited] |
Return function for vectors. Returns in output the values of the data at the coordinate p.
p and for time, which defaults to zero. Implements libMesh::FunctionBase< Number >.
Definition at line 175 of file mesh_function.C.
References libMesh::FunctionBase< Number >::initialized(), and libMesh::libmesh_assert().
Referenced by operator()().
{
libmesh_assert (this->initialized());
DenseVector<Number> buf (1);
this->operator() (p, time, buf);
return buf(0);
}
| void libMesh::MeshFunction::operator() | ( | const Point & | p, |
| const Real | time, | ||
| DenseVector< Number > & | output | ||
| ) | [virtual] |
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.
References operator()().
{
this->operator() (p,time,output,NULL);
}
| 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.
References _dof_map, _eqn_systems, _out_of_mesh_value, _system_vars, _vector, libMesh::FEInterface::compute_data(), data, libMesh::Elem::dim(), libMesh::DofMap::dof_indices(), find_element(), libMesh::FunctionBase< Number >::initialized(), libMesh::FEInterface::inverse_map(), libMesh::libmesh_assert(), libMesh::DenseVector< T >::resize(), libMesh::FEComputeData::shape, and libMesh::DofMap::variable_type().
{
libmesh_assert (this->initialized());
const Elem* element = this->find_element(p,subdomain_ids);
if (!element)
{
output = _out_of_mesh_value;
}
else
{
// resize the output vector to the number of output values
// that the user told us
output.resize (cast_int<unsigned int>
(this->_system_vars.size()));
{
const unsigned int dim = element->dim();
/*
* Get local coordinates to feed these into compute_data().
* Note that the fe_type can safely be used from the 0-variable,
* since the inverse mapping is the same for all FEFamilies
*/
const Point mapped_point (FEInterface::inverse_map (dim,
this->_dof_map.variable_type(0),
element,
p));
// loop over all vars
for (unsigned int index=0; index < this->_system_vars.size(); index++)
{
/*
* the data for this variable
*/
const unsigned int var = _system_vars[index];
const FEType& fe_type = this->_dof_map.variable_type(var);
{
FEComputeData data (this->_eqn_systems, mapped_point);
FEInterface::compute_data (dim, fe_type, element, data);
// where the solution values for the var-th variable are stored
std::vector<dof_id_type> dof_indices;
this->_dof_map.dof_indices (element, dof_indices, var);
// interpolate the solution
{
Number value = 0.;
for (unsigned int i=0; i<dof_indices.size(); i++)
value += this->_vector(dof_indices[i]) * data.shape[i];
output(index) = value;
}
}
// next variable
}
}
}
// all done
return;
}
| processor_id_type libMesh::ParallelObject::processor_id | ( | ) | const [inline, inherited] |
Definition at line 98 of file parallel_object.h.
References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::rank().
Referenced by libMesh::MetisPartitioner::_do_partition(), libMesh::EquationSystems::_read_impl(), libMesh::SerialMesh::active_local_elements_begin(), libMesh::ParallelMesh::active_local_elements_begin(), libMesh::SerialMesh::active_local_elements_end(), libMesh::ParallelMesh::active_local_elements_end(), libMesh::SerialMesh::active_local_subdomain_elements_begin(), libMesh::ParallelMesh::active_local_subdomain_elements_begin(), libMesh::SerialMesh::active_local_subdomain_elements_end(), libMesh::ParallelMesh::active_local_subdomain_elements_end(), libMesh::SerialMesh::active_not_local_elements_begin(), libMesh::ParallelMesh::active_not_local_elements_begin(), libMesh::SerialMesh::active_not_local_elements_end(), libMesh::ParallelMesh::active_not_local_elements_end(), libMesh::ParallelMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::ParallelMesh::add_node(), libMesh::UnstructuredMesh::all_second_order(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::ParallelMesh::assign_unique_ids(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::DofMap::build_sparsity(), libMesh::ParallelMesh::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::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_Helper::create(), libMesh::ParallelMesh::delete_elem(), libMesh::ParallelMesh::delete_node(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofMap::end_dof(), libMesh::DofMap::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::SerialMesh::facelocal_elements_begin(), libMesh::ParallelMesh::facelocal_elements_begin(), libMesh::SerialMesh::facelocal_elements_end(), libMesh::ParallelMesh::facelocal_elements_end(), find_element(), 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::MeshBase::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), 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::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), 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::ParallelMesh::insert_elem(), libMesh::SparsityPattern::Build::join(), libMesh::DofMap::last_dof(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::SerialMesh::local_elements_begin(), libMesh::ParallelMesh::local_elements_begin(), libMesh::SerialMesh::local_elements_end(), libMesh::ParallelMesh::local_elements_end(), libMesh::SerialMesh::local_level_elements_begin(), libMesh::ParallelMesh::local_level_elements_begin(), libMesh::SerialMesh::local_level_elements_end(), libMesh::ParallelMesh::local_level_elements_end(), libMesh::SerialMesh::local_nodes_begin(), libMesh::ParallelMesh::local_nodes_begin(), libMesh::SerialMesh::local_nodes_end(), libMesh::ParallelMesh::local_nodes_end(), libMesh::SerialMesh::local_not_level_elements_begin(), libMesh::ParallelMesh::local_not_level_elements_begin(), libMesh::SerialMesh::local_not_level_elements_end(), libMesh::ParallelMesh::local_not_level_elements_end(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), 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::SerialMesh::not_local_elements_begin(), libMesh::ParallelMesh::not_local_elements_begin(), libMesh::SerialMesh::not_local_elements_end(), libMesh::ParallelMesh::not_local_elements_end(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::ParallelMesh::ParallelMesh(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::System::project_vector(), 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::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs(), 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::MeshData::read_xdr(), libMesh::SerialMesh::semilocal_elements_begin(), libMesh::ParallelMesh::semilocal_elements_begin(), libMesh::SerialMesh::semilocal_elements_end(), libMesh::ParallelMesh::semilocal_elements_end(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::BoundaryInfo::sync(), libMesh::MeshTools::total_weight(), libMesh::ParallelMesh::update_parallel_id_counts(), libMesh::MeshTools::weight(), libMesh::NameBasedIO::write(), libMesh::ExodusII_IO::write(), libMesh::CheckpointIO::write(), libMesh::XdrIO::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_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::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::ExodusII_IO_Helper::write_nodesets(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs(), 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_sidesets(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), and libMesh::ExodusII_IO_Helper::write_timestep().
{ return cast_int<processor_id_type>(_communicator.rank()); }
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 517 of file mesh_function.C.
References _point_locator, libMesh::PointLocatorBase::enable_out_of_mesh_mode(), and libMesh::PointLocatorBase::set_close_to_point_tol().
{
// We need to enable out_of_mesh mode in the point_locator
// in order for the point locator tolerance to be used.
_point_locator->enable_out_of_mesh_mode();
// Set the tolerance
_point_locator->set_close_to_point_tol(tol);
}
Turn off the user-specified PointLocator tolerance.
Definition at line 527 of file mesh_function.C.
References _point_locator, and libMesh::PointLocatorBase::unset_close_to_point_tol().
const Parallel::Communicator& libMesh::ParallelObject::_communicator [protected, inherited] |
Definition at line 104 of file parallel_object.h.
Referenced by libMesh::EquationSystems::build_solution_vector(), libMesh::ParallelObject::comm(), libMesh::EquationSystems::get_solution(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::operator=(), and libMesh::ParallelObject::processor_id().
const DofMap& libMesh::MeshFunction::_dof_map [protected] |
Need access to the DofMap of the other system.
Definition at line 261 of file mesh_function.h.
Referenced by clone(), gradient(), hessian(), and operator()().
const EquationSystems& libMesh::MeshFunction::_eqn_systems [protected] |
The equation systems handler, from which the data are gathered.
Definition at line 250 of file mesh_function.h.
Referenced by clone(), init(), and operator()().
bool libMesh::FunctionBase< Number >::_initialized [protected, inherited] |
When init() was called so that everything is ready for calls to operator() (...), then this bool is true.
Definition at line 170 of file function_base.h.
const FunctionBase* libMesh::FunctionBase< Number >::_master [protected, inherited] |
Const pointer to our master, initialized to NULL. There may be cases where multiple functions are required, but to save memory, one master handles some centralized data.
Definition at line 164 of file function_base.h.
Referenced by clear(), find_element(), init(), and ~MeshFunction().
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 279 of file mesh_function.h.
Referenced by disable_out_of_mesh_mode(), enable_out_of_mesh_mode(), and find_element().
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 285 of file mesh_function.h.
Referenced by enable_out_of_mesh_mode(), and operator()().
PointLocatorBase* libMesh::MeshFunction::_point_locator [protected] |
A point locator is needed to locate the points in the mesh.
Definition at line 273 of file mesh_function.h.
Referenced by clear(), disable_out_of_mesh_mode(), enable_out_of_mesh_mode(), find_element(), get_point_locator(), init(), set_point_locator_tolerance(), unset_point_locator_tolerance(), and ~MeshFunction().
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 267 of file mesh_function.h.
Referenced by clone(), gradient(), hessian(), init(), and operator()().
const NumericVector<Number>& libMesh::MeshFunction::_vector [protected] |
A reference to the vector that holds the data that is to be interpolated.
Definition at line 256 of file mesh_function.h.
Referenced by clone(), find_element(), and operator()().