DUNE PDELab (git)

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

 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

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

◆ GridFunctionProbe() [1/2]

template<typename GF >
Dune::PDELab::GridFunctionProbe< GF >::GridFunctionProbe ( const GF &  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.

◆ GridFunctionProbe() [2/2]

template<typename GF >
Dune::PDELab::GridFunctionProbe< GF >::GridFunctionProbe ( const GV &  gv,
const Domain &  xg 
)
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
xgThe global coordinate the evaluate at.

Member Function Documentation

◆ eval()

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
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()

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().

◆ getEvalRank()

template<typename GF >
int Dune::PDELab::GridFunctionProbe< GF >::getEvalRank ( )
inline

MPI rank of coordinate.

Returns
The MPI rank on whose subgrid the evaluated coordinate lies

◆ setGridFunction() [1/3]

template<typename GF >
void Dune::PDELab::GridFunctionProbe< GF >::setGridFunction ( const GF &  gf)
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]

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.

◆ setGridFunction() [3/3]

template<typename GF >
void Dune::PDELab::GridFunctionProbe< GF >::setGridFunction ( const std::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:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 2, 22:35, 2024)