dune-pdelab  2.0.0
Public Member Functions | List of all members
Dune::PDELab::GridFunctionProbe< GF > Class Template Reference

Evaluate a GridFunction at a certain global coordinate. More...

#include <dune/pdelab/common/functionutilities.hh>

Public Member Functions

template<class GFHandle >
 GridFunctionProbe (const GFHandle &gf, const Domain &xg)
 Constructor. More...
 
void setGridFunction (const GF &gf)
 Set a new GridFunction. More...
 
void setGridFunction (const GF *gf)
 Set a new GridFunction. More...
 
void setGridFunction (const Dune::shared_ptr< const GF > &gf)
 Set a new GridFunction. More...
 
void eval_all (Range &val) const
 evaluate the GridFunction and broadcast result to all ranks More...
 
void eval (Range &val, int rank=0) const
 evaluate the GridFunction and communicate result to the given rank More...
 

Detailed Description

template<typename GF>
class Dune::PDELab::GridFunctionProbe< GF >

Evaluate a GridFunction at a certain global coordinate.

This class should work correctly even in a parallel setup. We look for the entity on containing the global coordinate on all ranks, then find the rank that actually has the entity. The GridFunction is then evaluated only for that rank, and the result is communicated to all the other ranks.

Template Parameters
GFType of the GridFunction to evaluate.

Constructor & Destructor Documentation

template<typename GF >
template<class GFHandle >
Dune::PDELab::GridFunctionProbe< GF >::GridFunctionProbe ( const GFHandle &  gf,
const Domain &  xg 
)
inline

Constructor.

Construct the object and find the rank and the entity containing the global coordinate xg. The is currently not facility to recompute this information later, e.g. after a loadBalance() on the grid.

Parameters
gfThe GridFunction to probe, either as a reference, a pointer, or a shared_ptr.
xgThe global coordinate the evaluate at.

References Dune::PDELab::GridFunctionProbe< GF >::setGridFunction().

Member Function Documentation

template<typename GF >
void Dune::PDELab::GridFunctionProbe< GF >::eval ( Range &  val,
int  rank = 0 
) const
inline

evaluate the GridFunction and communicate result to the given rank

Parameters
valStore the result here. This variable should be considered undefined on any rank other than the one given in rank after the function returns.
rankRank of the process to communicate the result to.
Note
CollectiveCommunication does not provide any direct process-to-process communication, so currently this function is identical with eval_all(), with the rank parameter ignored.
If the GridFunctionProbe is outside the grid NaN will be stored in val.

References Dune::PDELab::GridFunctionProbe< GF >::eval_all().

template<typename GF >
void Dune::PDELab::GridFunctionProbe< GF >::eval_all ( Range &  val) const
inline

evaluate the GridFunction and broadcast result to all ranks

Parameters
valStore the result here.
Note
If the GridFunctionProbe is outside the grid NaN will be stored in val.

Referenced by Dune::PDELab::GridFunctionProbe< GF >::eval().

template<typename GF >
void Dune::PDELab::GridFunctionProbe< GF >::setGridFunction ( const GF &  gf)
inline

Set a new GridFunction.

This takes the GridFunction as a refence. The referenced object must be valid for as long a the GridFunctionProbe is evaluated, or until setGridFunction() is called again.

Referenced by Dune::PDELab::GridFunctionProbe< GF >::GridFunctionProbe().

template<typename GF >
void Dune::PDELab::GridFunctionProbe< GF >::setGridFunction ( const GF *  gf)
inline

Set a new GridFunction.

This takes the GridFunction as a pointer. Ownership of the GridFunction object is transferred to the GridFunctionProbe. The GridFunction object will be deleted by the GridFunctionProbe on destruction, or the next time setGridFunction is called.

template<typename GF >
void Dune::PDELab::GridFunctionProbe< GF >::setGridFunction ( const Dune::shared_ptr< const GF > &  gf)
inline

Set a new GridFunction.

This takes the GridFunction as a shared_ptr. Ownership of the GridFunction object is shared with other places in the program, that hold a shared_ptr to the same GridFunction object. The GridFunction object will be deleted by the GridFunctionProbe on destruction, or the next time setGridFunction is called, if this GridFunctionProbe holds the last reference at that time.


The documentation for this class was generated from the following file: