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

#include <HopFunc.h>

+ Inheritance diagram for GetHopFunc< A >:
+ Collaboration diagram for GetHopFunc< A >:

Public Member Functions

 GetHopFunc (HopIndex hopIndex)
 
void getLocalFieldVec (const Eref &er, vector< A > &ret, const GetOpFuncBase< A > *op) const
 
void getLocalVec (Element *elm, vector< A > &ret, const GetOpFuncBase< A > *op) const
 
void getMultiNodeVec (const Eref &e, vector< A > &ret, const GetOpFuncBase< A > *op) const
 
void getRemoteFieldVec (const Eref &e, vector< A > &ret, const GetOpFuncBase< A > *op) const
 
void op (const Eref &e, A *ret) const
 
void opGetVec (const Eref &e, vector< A > &ret, const GetOpFuncBase< A > *op) const
 
- Public Member Functions inherited from OpFunc1Base< A * >
bool checkFinfo (const Finfo *s) const
 
const OpFunc * makeHopFunc (HopIndex hopIndex) const
 
void opBuffer (const Eref &e, double *buf) const
 Executes the OpFunc by converting args. More...
 
virtual void opVec (const Eref &e, const vector< A * > &arg, const OpFunc1Base< A * > *op) const
 
void opVecBuffer (const Eref &e, double *buf) const
 Executes the OpFunc for all data by converting a vector of args. More...
 
string rttiType () const
 
- Public Member Functions inherited from OpFunc
 OpFunc ()
 
unsigned int opIndex () const
 
bool setIndex (unsigned int i)
 Used when rebuilding the Fid->OpFunc mapping. More...
 
virtual ~OpFunc ()
 

Private Attributes

HopIndex hopIndex_
 

Additional Inherited Members

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

Detailed Description

template<class A>
class GetHopFunc< A >

Definition at line 407 of file HopFunc.h.

Constructor & Destructor Documentation

template<class A>
GetHopFunc< A >::GetHopFunc ( HopIndex  hopIndex)
inline

Definition at line 410 of file HopFunc.h.

411  : hopIndex_( hopIndex )
412  {;}
HopIndex hopIndex_
Definition: HopFunc.h:505

Member Function Documentation

template<class A>
void GetHopFunc< A >::getLocalFieldVec ( const Eref &  er,
vector< A > &  ret,
const GetOpFuncBase< A > *  op 
) const
inline

Definition at line 420 of file HopFunc.h.

References Eref::dataIndex(), Eref::element(), Element::localDataStart(), Element::numField(), and GetOpFuncBase< A >::returnOp().

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

422  {
423  unsigned int p = er.dataIndex();
424  Element* elm = er.element();
425  unsigned int numField = elm->numField(
426  p - elm->localDataStart() );
427  for ( unsigned int q = 0; q < numField; ++q ) {
428  Eref temp( elm, p, q );
429  ret.push_back( op->returnOp( temp ) );
430  }
431  }
virtual A returnOp(const Eref &e) const =0
unsigned int dataIndex() const
Definition: Eref.h:50
Element * element() const
Definition: Eref.h:42
virtual unsigned int numField(unsigned int rawIndex) const =0
Returns number of field entries for specified data.
Definition: Eref.h:26
virtual unsigned int localDataStart() const =0
Returns index of first data entry on this node.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class A>
void GetHopFunc< A >::getLocalVec ( Element *  elm,
vector< A > &  ret,
const GetOpFuncBase< A > *  op 
) const
inline

Definition at line 446 of file HopFunc.h.

References Element::localDataStart(), Element::numLocalData(), and GetOpFuncBase< A >::returnOp().

Referenced by GetHopFunc< A >::getMultiNodeVec(), and GetHopFunc< A >::opGetVec().

448  {
449  unsigned int start = elm->localDataStart();
450  unsigned int end = start + elm->numLocalData();
451  for ( unsigned int p = start; p < end; ++p ) {
452  Eref er( elm, p, 0 );
453  ret.push_back( op->returnOp( er ) );
454  }
455  }
virtual A returnOp(const Eref &e) const =0
Definition: Eref.h:26
virtual unsigned int localDataStart() const =0
Returns index of first data entry on this node.
virtual unsigned int numLocalData() const =0
Returns number of local data entries on this node.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class A>
void GetHopFunc< A >::getMultiNodeVec ( const Eref &  e,
vector< A > &  ret,
const GetOpFuncBase< A > *  op 
) const
inline

Definition at line 457 of file HopFunc.h.

References HopIndex::bindIndex(), Eref::element(), GetHopFunc< A >::getLocalVec(), GetHopFunc< A >::hopIndex_, mooseMyNode(), mooseNumNodes(), and remoteGetVec().

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

459  {
460  Element* elm = e.element();
461  vector< vector< double > > buf;
462  vector< unsigned int > numOnNode;
463  remoteGetVec( e, hopIndex_.bindIndex(), buf, numOnNode );
464  assert( numOnNode.size() == mooseNumNodes() );
465  assert( buf.size() == mooseNumNodes() );
466  assert( buf.size() == numOnNode.size() );
467  for ( unsigned int i = 0; i < mooseNumNodes(); ++i ) {
468  if ( i == mooseMyNode() ) {
469  getLocalVec( elm, ret, op );
470  } else {
471  vector< double >& temp = buf[i];
472  assert( static_cast< unsigned int >( temp[0] ) ==
473  numOnNode[i] );
474  double* val = &temp[1]; // zeroth entry is numOnNode.
475  for ( unsigned int j = 0; j < numOnNode[i]; ++j ) {
476  // val++; // Skip the index.
477  // ret.push_back( Conv< A >::buf2val( &temp[k + 1] ) );
478  ret.push_back( Conv< A >::buf2val( &val ) );
479  }
480  }
481  }
482  }
unsigned short bindIndex() const
Definition: OpFuncBase.h:32
HopIndex hopIndex_
Definition: HopFunc.h:505
Element * element() const
Definition: Eref.h:42
void getLocalVec(Element *elm, vector< A > &ret, const GetOpFuncBase< A > *op) const
Definition: HopFunc.h:446
Definition: Conv.h:30
unsigned int mooseNumNodes()
Definition: HopFunc.cpp:87
void remoteGetVec(const Eref &e, unsigned int bindIndex, vector< vector< double > > &getRecvBuf, vector< unsigned int > &numOnNode)
unsigned int mooseMyNode()
Definition: HopFunc.cpp:92

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class A>
void GetHopFunc< A >::getRemoteFieldVec ( const Eref &  e,
vector< A > &  ret,
const GetOpFuncBase< A > *  op 
) const
inline

Definition at line 433 of file HopFunc.h.

References HopIndex::bindIndex(), GetHopFunc< A >::hopIndex_, and remoteFieldGetVec().

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

435  {
436  vector< double > buf;
438  assert( buf.size() > 0 );
439  unsigned int numField = buf[0];
440  double* val = &buf[1]; // zeroth entry is numField.
441  for ( unsigned int j = 0; j < numField; ++j ) {
442  ret.push_back( Conv< A >::buf2val( &val ) );
443  }
444  }
unsigned short bindIndex() const
Definition: OpFuncBase.h:32
HopIndex hopIndex_
Definition: HopFunc.h:505
void remoteFieldGetVec(const Eref &e, unsigned int bindIndex, vector< double > &getRecvBuf)
Definition: HopFunc.cpp:79
Definition: Conv.h:30

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class A>
void GetHopFunc< A >::op ( const Eref &  e,
A *  ret 
) const
inlinevirtual

Implements OpFunc1Base< A * >.

Definition at line 414 of file HopFunc.h.

References HopIndex::bindIndex(), Conv< T >::buf2val(), GetHopFunc< A >::hopIndex_, and remoteGet().

415  {
416  double* buf = remoteGet( e, hopIndex_.bindIndex() );
417  *ret = Conv< A >::buf2val( &buf );
418  }
unsigned short bindIndex() const
Definition: OpFuncBase.h:32
HopIndex hopIndex_
Definition: HopFunc.h:505
double * remoteGet(const Eref &e, unsigned int bindIndex)
Definition: HopFunc.cpp:63
static const T & buf2val(double **buf)
Definition: Conv.h:44

+ Here is the call graph for this function:

template<class A>
void GetHopFunc< A >::opGetVec ( const Eref &  e,
vector< A > &  ret,
const GetOpFuncBase< A > *  op 
) const
inline

Definition at line 484 of file HopFunc.h.

References Eref::element(), GetHopFunc< A >::getLocalFieldVec(), GetHopFunc< A >::getLocalVec(), GetHopFunc< A >::getMultiNodeVec(), Eref::getNode(), GetHopFunc< A >::getRemoteFieldVec(), Element::hasFields(), Element::isGlobal(), mooseMyNode(), mooseNumNodes(), and Element::numData().

Referenced by Field< A >::getVec().

486  {
487  Element* elm = e.element();
488  ret.clear();
489  ret.reserve( elm->numData() );
490  if ( elm->hasFields() ) {
491  if ( e.getNode() == mooseMyNode() ) {
492  getLocalFieldVec( e, ret, op );
493  } else {
494  getRemoteFieldVec( e, ret, op );
495  }
496  } else {
497  if ( mooseNumNodes() == 1 || elm->isGlobal() ) {
498  getLocalVec( elm, ret, op );
499  } else {
500  getMultiNodeVec( e, ret, op );
501  }
502  }
503  }
unsigned int getNode() const
Definition: Eref.cpp:52
Element * element() const
Definition: Eref.h:42
void getLocalVec(Element *elm, vector< A > &ret, const GetOpFuncBase< A > *op) const
Definition: HopFunc.h:446
unsigned int mooseNumNodes()
Definition: HopFunc.cpp:87
virtual bool hasFields() const =0
unsigned int mooseMyNode()
Definition: HopFunc.cpp:92
virtual unsigned int numData() const =0
Returns number of data entries across all nodes.
virtual bool isGlobal() const =0
True if there is a copy of every dataEntry on all nodes.
void getRemoteFieldVec(const Eref &e, vector< A > &ret, const GetOpFuncBase< A > *op) const
Definition: HopFunc.h:433
void getLocalFieldVec(const Eref &er, vector< A > &ret, const GetOpFuncBase< A > *op) const
Definition: HopFunc.h:420
void getMultiNodeVec(const Eref &e, vector< A > &ret, const GetOpFuncBase< A > *op) const
Definition: HopFunc.h:457

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

template<class A>
HopIndex GetHopFunc< A >::hopIndex_
private

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