MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
HopFunc.cpp File Reference
#include "header.h"
#include "HopFunc.h"
#include "../mpi/PostMaster.h"
#include "../shell/Shell.h"
+ Include dependency graph for HopFunc.cpp:

Go to the source code of this file.

Functions

double * addToBuf (const Eref &er, HopIndex hopIndex, unsigned int size)
 
static double * addToTestBuf (const Eref &e, unsigned int i, unsigned int size)
 
const double * checkHopFuncTestBuffer ()
 
void dispatchBuffers (const Eref &e, HopIndex hopIndex)
 
unsigned int mooseMyNode ()
 
unsigned int mooseNumNodes ()
 
void remoteFieldGetVec (const Eref &e, unsigned int bindIndex, vector< double > &getRecvBuf)
 
double * remoteGet (const Eref &e, unsigned int bindIndex)
 
void remoteGetVec (const Eref &e, unsigned int bindIndex, vector< vector< double > > &getRecvBuf, vector< unsigned int > &numOnNode)
 

Variables

static double testBuf [4096]
 

Function Documentation

double* addToBuf ( const Eref er,
HopIndex  hopIndex,
unsigned int  size 
)

Definition at line 29 of file HopFunc.cpp.

References PostMaster::addToSendBuf(), PostMaster::addToSetBuf(), addToTestBuf(), HopIndex::bindIndex(), PostMaster::clearPendingSetGet(), ObjId::data(), HopIndex::hopType(), MooseSendHop, MooseSetHop, MooseSetVecHop, and MooseTestHop.

Referenced by HopFunc0::op(), HopFunc1< A >::op(), HopFunc2< A1, A2 >::op(), HopFunc3< A1, A2, A3 >::op(), HopFunc4< A1, A2, A3, A4 >::op(), HopFunc5< A1, A2, A3, A4, A5 >::op(), HopFunc6< A1, A2, A3, A4, A5, A6 >::op(), HopFunc2< A1, A2 >::opVec(), and HopFunc1< A >::remoteOpVec().

30 {
31  static ObjId oi( 3 );
32  static PostMaster* p = reinterpret_cast< PostMaster* >( oi.data() );
33  if ( hopIndex.hopType() == MooseSendHop ) {
34  return p->addToSendBuf( er, hopIndex.bindIndex(), size );
35  } else if ( hopIndex.hopType() == MooseSetHop ||
36  hopIndex.hopType() == MooseSetVecHop ) {
37  p->clearPendingSetGet(); // Cannot touch set buffer if pending.
38  return p->addToSetBuf( er, hopIndex.bindIndex(),
39  size, hopIndex.hopType() );
40  } else if ( hopIndex.hopType() == MooseTestHop ) {
41  return addToTestBuf( er, hopIndex.bindIndex(), size );
42  }
43  assert( 0 ); // Should not get here.
44  return 0;
45 }
static double * addToTestBuf(const Eref &e, unsigned int i, unsigned int size)
Definition: HopFunc.cpp:15
const unsigned char MooseSendHop
Definition: OpFuncBase.cpp:12
unsigned short bindIndex() const
Definition: OpFuncBase.h:32
double * addToSendBuf(const Eref &e, unsigned int bindIndex, unsigned int size)
Returns pointer to Send buffer for filling in arguments.
Definition: PostMaster.cpp:442
Definition: ObjId.h:20
void clearPendingSetGet()
Clears arrived set and get calls.
Definition: PostMaster.cpp:299
unsigned char hopType() const
Definition: OpFuncBase.h:36
const unsigned char MooseSetVecHop
Definition: OpFuncBase.cpp:14
const unsigned char MooseSetHop
Definition: OpFuncBase.cpp:13
double * addToSetBuf(const Eref &e, unsigned int opIndex, unsigned int size, unsigned int hopType)
Returns pointer to Set buffer for filling in arguments.
Definition: PostMaster.cpp:463
const unsigned char MooseTestHop
Definition: OpFuncBase.cpp:18

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static double* addToTestBuf ( const Eref e,
unsigned int  i,
unsigned int  size 
)
static

Definition at line 15 of file HopFunc.cpp.

References TgtInfo::headerSize, Eref::objId(), TgtInfo::set(), and testBuf.

Referenced by addToBuf().

17 {
18  TgtInfo* tgt = reinterpret_cast< TgtInfo* >( &testBuf[0] );
19  tgt->set( e.objId(), i, size );
20  return &testBuf[ TgtInfo::headerSize ];
21 }
static double testBuf[4096]
Definition: HopFunc.cpp:14
static const unsigned int headerSize
Definition: PostMaster.h:97
ObjId objId() const
Definition: Eref.cpp:57
void set(ObjId id, unsigned int bindIndex, unsigned int size)
Definition: PostMaster.h:83

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const double* checkHopFuncTestBuffer ( )

Definition at line 23 of file HopFunc.cpp.

References testBuf.

Referenced by testHopFunc().

24 {
25  return &testBuf[0];
26 }
static double testBuf[4096]
Definition: HopFunc.cpp:14

+ Here is the caller graph for this function:

void dispatchBuffers ( const Eref e,
HopIndex  hopIndex 
)

Definition at line 47 of file HopFunc.cpp.

References ObjId::data(), PostMaster::dispatchSetBuf(), HopIndex::hopType(), MooseGetHop, MooseSetHop, MooseSetVecHop, and Shell::numNodes().

Referenced by HopFunc0::op(), HopFunc1< A >::op(), HopFunc2< A1, A2 >::op(), HopFunc3< A1, A2, A3 >::op(), HopFunc4< A1, A2, A3, A4 >::op(), HopFunc5< A1, A2, A3, A4, A5 >::op(), HopFunc6< A1, A2, A3, A4, A5, A6 >::op(), HopFunc2< A1, A2 >::opVec(), and HopFunc1< A >::remoteOpVec().

48 {
49  static ObjId oi( 3 );
50  static PostMaster* p = reinterpret_cast< PostMaster* >( oi.data() );
51  if ( Shell::numNodes() == 1 )
52  return;
53  if ( hopIndex.hopType() == MooseSetHop ||
54  hopIndex.hopType() == MooseGetHop ) {
55  p->dispatchSetBuf( e );
56  }
57  if ( hopIndex.hopType() == MooseSetVecHop ) {
58  p->dispatchSetBuf( e );
59  }
60  // More complicated stuff for get operations.
61 }
void dispatchSetBuf(const Eref &e)
Sends off contets of Set buffer.
Definition: PostMaster.cpp:487
Definition: ObjId.h:20
const unsigned char MooseGetHop
Definition: OpFuncBase.cpp:15
unsigned char hopType() const
Definition: OpFuncBase.h:36
const unsigned char MooseSetVecHop
Definition: OpFuncBase.cpp:14
const unsigned char MooseSetHop
Definition: OpFuncBase.cpp:13
static unsigned int numNodes()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int mooseMyNode ( )

Definition at line 92 of file HopFunc.cpp.

References Shell::myNode().

Referenced by HopFunc1< A >::dataOpVec(), GetHopFunc< A >::getMultiNodeVec(), HopFunc1< A >::localFieldOpVec(), GetHopFunc< A >::opGetVec(), HopFunc1< A >::opVec(), and HopFunc2< A1, A2 >::opVec().

93 {
94  return Shell::myNode();
95 }
static unsigned int myNode()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int mooseNumNodes ( )

Definition at line 87 of file HopFunc.cpp.

References Shell::numNodes().

Referenced by HopFunc1< A >::dataOpVec(), GetHopFunc< A >::getMultiNodeVec(), GetHopFunc< A >::opGetVec(), HopFunc2< A1, A2 >::opVec(), and HopFunc1< A >::remoteOpVec().

88 {
89  return Shell::numNodes();
90 }
static unsigned int numNodes()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void remoteFieldGetVec ( const Eref e,
unsigned int  bindIndex,
vector< double > &  getRecvBuf 
)

Definition at line 79 of file HopFunc.cpp.

References ObjId::data(), and PostMaster::remoteFieldGetVec().

Referenced by GetHopFunc< A >::getRemoteFieldVec().

81 {
82  static ObjId oi( 3 );
83  static PostMaster* p = reinterpret_cast< PostMaster* >( oi.data() );
84  p->remoteFieldGetVec( e, bindIndex, getRecvBuf );
85 }
Definition: ObjId.h:20
void remoteFieldGetVec(const Eref &e, unsigned int bindIndex, vector< double > &getRecvBuf)
This is a blocking call. However, it must still handle other.
Definition: PostMaster.cpp:568

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double* remoteGet ( const Eref e,
unsigned int  bindIndex 
)

Definition at line 63 of file HopFunc.cpp.

References ObjId::data(), and PostMaster::remoteGet().

Referenced by GetHopFunc< A >::op().

64 {
65  static ObjId oi( 3 );
66  static PostMaster* p = reinterpret_cast< PostMaster* >( oi.data() );
67  return p->remoteGet( e, bindIndex );
68 }
Definition: ObjId.h:20
double * remoteGet(const Eref &e, unsigned int bindIndex)
Blocking call to get a value from a remote node.
Definition: PostMaster.cpp:520

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void remoteGetVec ( const Eref e,
unsigned int  bindIndex,
vector< vector< double > > &  getRecvBuf,
vector< unsigned int > &  numOnNode 
)

Definition at line 70 of file HopFunc.cpp.

References ObjId::data(), and PostMaster::remoteGetVec().

73 {
74  static ObjId oi( 3 );
75  static PostMaster* p = reinterpret_cast< PostMaster* >( oi.data() );
76  p->remoteGetVec( e, bindIndex, getRecvBuf, numOnNode );
77 }
void remoteGetVec(const Eref &e, unsigned int bindIndex, vector< vector< double > > &getRecvBuf, vector< unsigned int > &size)
This is a blocking call. However, it must still handle other.
Definition: PostMaster.cpp:623
Definition: ObjId.h:20

+ Here is the call graph for this function:

Variable Documentation

double testBuf[4096]
static

Definition at line 14 of file HopFunc.cpp.

Referenced by addToTestBuf(), and checkHopFuncTestBuffer().