MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
GetOpFunc1< T, L, A > Class Template Reference

#include <OpFunc.h>

+ Inheritance diagram for GetOpFunc1< T, L, A >:
+ Collaboration diagram for GetOpFunc1< T, L, A >:

Public Member Functions

 GetOpFunc1 (A(T::*func)(L) const )
 
void op (const Eref &e, L index, ObjId recipient, FuncId fid) const
 
returnOp (const Eref &e, const L &index) const
 Distinct reduceOp with the index. More...
 
- Public Member Functions inherited from LookupGetOpFuncBase< L, A >
bool checkFinfo (const Finfo *s) const
 
const OpFuncmakeHopFunc (HopIndex hopIndex) const
 
const OpFuncmakeHopFunc (HopIndex hopIndex, const L &index) const
 
void opBuffer (const Eref &e, double *buf) const
 Executes the OpFunc by converting args. More...
 
string rttiType () const
 
- Public Member Functions inherited from OpFunc
 OpFunc ()
 
unsigned int opIndex () const
 
virtual void opVecBuffer (const Eref &e, double *buf) const
 Executes the OpFunc for all data by converting a vector of args. More...
 
bool setIndex (unsigned int i)
 Used when rebuilding the Fid->OpFunc mapping. More...
 
virtual ~OpFunc ()
 

Private Attributes

A(T::* func_ )(L) const
 

Additional Inherited Members

- Static Public Member Functions inherited from OpFunc
static const OpFunclookop (unsigned int opIndex)
 
static unsigned int rebuildOpIndex ()
 cleans out the entire Ops vector. Returns size of orig vector. More...
 

Detailed Description

template<class T, class L, class A>
class GetOpFunc1< T, L, A >

This specialized OpFunc is for looking up a single field value using a single argument. It generates an opFunc that takes two arguments:

  1. FuncId of the function on the object that requested the value.
  2. Index or other identifier to do the look up. The OpFunc then sends back a message with the info. Here T is the class that owns the function. A is the return type L is the lookup index.

Definition at line 164 of file OpFunc.h.

Constructor & Destructor Documentation

template<class T , class L , class A >
GetOpFunc1< T, L, A >::GetOpFunc1 ( A(T::*)(L) const  func)
inline

Definition at line 168 of file OpFunc.h.

169  : func_( func )
170  {;}
A(T::* func_)(L) const
Definition: OpFunc.h:198

Member Function Documentation

template<class T , class L , class A >
void GetOpFunc1< T, L, A >::op ( const Eref e,
index,
ObjId  recipient,
FuncId  fid 
) const
inlinevirtual

The buf just contains the funcid on the src element that is ready to receive the returned data. Also we are returning the data along the Msg that brought in the request, so we don't need to scan through all Msgs in the Element to find the right one. So we bypass the usual SrcFinfo::sendTo, and instead go right to the Qinfo::addToQ to send off data. Finally, the data is copied back-and-forth about 3 times. Wasteful, but the 'get' function is not to be heavily used.

Implements LookupGetOpFuncBase< L, A >.

Definition at line 183 of file OpFunc.h.

References Element::cinfo(), ObjId::element(), ObjId::eref(), Cinfo::getOpFunc(), OpFunc1Base< A >::op(), and GetOpFunc1< T, L, A >::returnOp().

184  {
185  const OpFunc *f = recipient.element()->cinfo()->getOpFunc( fid);
186  const OpFunc1Base< A >* recvOpFunc =
187  dynamic_cast< const OpFunc1Base< A >* >( f );
188  assert( recvOpFunc );
189  recvOpFunc->op( recipient.eref(), returnOp( e, index ) );
190  }
const OpFunc * getOpFunc(FuncId fid) const
Definition: Cinfo.cpp:240
virtual void op(const Eref &e, A arg) const =0
const Cinfo * cinfo() const
Definition: Element.cpp:66
Element * element() const
Definition: ObjId.cpp:124
Eref eref() const
Definition: ObjId.cpp:66
A returnOp(const Eref &e, const L &index) const
Distinct reduceOp with the index.
Definition: OpFunc.h:193

+ Here is the call graph for this function:

template<class T , class L , class A >
A GetOpFunc1< T, L, A >::returnOp ( const Eref e,
const L &  index 
) const
inlinevirtual

Distinct reduceOp with the index.

Implements LookupGetOpFuncBase< L, A >.

Definition at line 193 of file OpFunc.h.

References Eref::data(), and GetOpFunc1< T, L, A >::func_.

Referenced by GetOpFunc1< T, L, A >::op().

193  {
194  return ( reinterpret_cast< T* >( e.data() )->*func_)( index );
195  }
char * data() const
Definition: Eref.cpp:41
A(T::* func_)(L) const
Definition: OpFunc.h:198

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

template<class T , class L , class A >
A( T::* GetOpFunc1< T, L, A >::func_)(L) const
private

Definition at line 198 of file OpFunc.h.

Referenced by GetOpFunc1< T, L, A >::returnOp().


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