DUNE PDELab (git)
Evaluate a GridFunction at a certain global coordinate. More...
#include <dune/pdelab/common/functionutilities.hh>
Public Member Functions | |
GridFunctionProbe (const GF &gf, const Domain &xg) | |
Constructor. More... | |
GridFunctionProbe (const GV &gv, const Domain &xg) | |
void | setGridFunction (const GF &gf) |
Set a new GridFunction. More... | |
void | setGridFunction (const GF *gf) |
Set a new GridFunction. More... | |
void | setGridFunction (const std::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... | |
int | getEvalRank () |
MPI rank of coordinate. More... | |
Detailed Description
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
-
GF Type of the GridFunction to evaluate.
Constructor & Destructor Documentation
◆ GridFunctionProbe() [1/2]
|
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
-
gf The GridFunction to probe, either as a reference, a pointer, or a shared_ptr. xg The global coordinate the evaluate at.
◆ GridFunctionProbe() [2/2]
|
inline |
Construct the probe object without an attached grid function object. The grid function must be set through the setGridFunction method before the first evaluation of the probe.
- Parameters
-
xg The global coordinate the evaluate at.
Member Function Documentation
◆ eval()
|
inline |
evaluate the GridFunction and communicate result to the given rank
- Parameters
-
val Store the result here. This variable should be considered undefined on any rank other than the one given in rank
after the function returns.rank Rank of the process to communicate the result to.
- Note
- Communication 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().
◆ eval_all()
|
inline |
evaluate the GridFunction and broadcast result to all ranks
- Parameters
-
val Store the result here.
- Note
- If the GridFunctionProbe is outside the grid NaN will be stored in val.
Referenced by Dune::PDELab::GridFunctionProbe< GF >::eval().
◆ getEvalRank()
|
inline |
MPI rank of coordinate.
- Returns
- The MPI rank on whose subgrid the evaluated coordinate lies
◆ setGridFunction() [1/3]
|
inline |
Set a new GridFunction.
This takes the GridFunction as a reference. The referenced object must be valid for as long a the GridFunctionProbe is evaluated, or until setGridFunction() is called again.
References Dune::stackobject_to_shared_ptr().
◆ setGridFunction() [2/3]
|
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.
◆ setGridFunction() [3/3]
|
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:
- dune/pdelab/common/functionutilities.hh