dune-pdelab 2.7-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. | |
GridFunctionProbe (std::shared_ptr< const GF > gf, const Domain &xg) | |
GridFunctionProbe (const GV &gv, const Domain &xg) | |
void | setGridFunction (const GF &gf) |
Set a new GridFunction. | |
void | setGridFunction (const GF *gf) |
Set a new GridFunction. | |
void | setGridFunction (const std::shared_ptr< const GF > &gf) |
Set a new GridFunction. | |
void | eval_all (Range &val) const |
evaluate the GridFunction and broadcast result to all ranks | |
void | eval (Range &val, int rank=0) const |
evaluate the GridFunction and communicate result to the given rank | |
int | getEvalRank () |
MPI rank of coordinate. | |
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.
GF | Type of the GridFunction to evaluate. |
|
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.
gf | The GridFunction to probe, either as a reference, a pointer, or a shared_ptr. |
xg | The global coordinate the evaluate at. |
|
inline |
|
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.
xg | The global coordinate the evaluate at. |
|
inline |
evaluate the GridFunction and communicate result to the given rank
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. |
rank
parameter ignored.
|
inline |
evaluate the GridFunction and broadcast result to all ranks
val | Store the result here. |
|
inline |
MPI rank of coordinate.
|
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.
|
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.
|
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.