PaCO++  0.05
CommMatrix Class Reference

#include <CommMatrix.h>

List of all members.

Public Member Functions

void add (unsigned sid, unsigned rid, long val)
 CommMatrix (unsigned ssz=1, unsigned rsz=1)
 CommMatrix (CommMatrix *cm)
void dump () const
long get (unsigned sid, unsigned rid) const
unsigned getReceiverSize () const
unsigned getSenderSize () const
void set (unsigned sid, unsigned rid, long val)
void sub (unsigned sid, unsigned rid, long val)
 ~CommMatrix ()

Private Member Functions

long * _get_mat () const

Private Attributes

long * _mat
unsigned _rsz
unsigned _ssz

Detailed Description

Definition at line 6 of file CommMatrix.h.


Constructor & Destructor Documentation

CommMatrix::CommMatrix ( unsigned  ssz = 1,
unsigned  rsz = 1 
)

Definition at line 6 of file CommMatrix.cc.

References _mat, _rsz, and _ssz.

{
  _ssz=ssz;
  _rsz=rsz;
  _mat=new long[ssz*rsz];

  std::cerr<<"[new] CommMatrix -- ssz: "<<_ssz<<"  rsz:"<<_rsz<<std::endl;
  std::cerr<<"[new] Alloc"<<(void*)_mat<<std::endl;
}

Definition at line 16 of file CommMatrix.cc.

References _get_mat(), _mat, _rsz, _ssz, getReceiverSize(), and getSenderSize().

{
  _ssz=cm->getSenderSize();
  _rsz=cm->getReceiverSize();
  _mat=new long[_ssz*_rsz];

  std::cerr<<"[new/copy] Alloc"<<(void*)_mat<<std::endl;

  long* omat= cm->_get_mat();
  memcpy(_mat, omat, sizeof(long)*_ssz*_rsz);

  std::cerr<<"[new/copy] CommMatrix -- ssz: "<<_ssz<<"  rsz:"<<_rsz<<std::endl;

}

Here is the call graph for this function:

Definition at line 31 of file CommMatrix.cc.

References _mat.

{
  if (_mat) {
    std::cerr<<"[del] free"<<(void*)_mat<<std::endl;
    delete[] _mat;
  }
  _mat=NULL;
  std::cerr<<"[del] CommMatrix"<<std::endl;
}

Member Function Documentation

long* CommMatrix::_get_mat ( ) const [inline, private]

Definition at line 29 of file CommMatrix.h.

References _mat.

Referenced by CommMatrix().

{ return _mat; }
void CommMatrix::add ( unsigned  sid,
unsigned  rid,
long  val 
) [inline]

Definition at line 23 of file CommMatrix.h.

References _mat, and _rsz.

{      _mat[sid*_rsz+rid] += val; }
void CommMatrix::dump ( ) const

Definition at line 43 of file CommMatrix.cc.

References _rsz, and _ssz.

Referenced by Controlled::readFromFile().

{
  std::cerr<<"[dump] CommMatrix -- ssz: "<<_ssz<<"  rsz:"<<_rsz<<std::endl;
  for(unsigned i=0;i<_ssz;i++) {
    for(unsigned j=0;j<_rsz;j++) {
      std::cerr << "[dump] "<<i<<" -> "<<j<<" : "<<this->get(i,j)<<std::endl;
    }
  }
}
long CommMatrix::get ( unsigned  sid,
unsigned  rid 
) const [inline]

Definition at line 22 of file CommMatrix.h.

References _mat, and _rsz.

Referenced by Controlled::computePiecesToSend(), and Controlled::getClientData().

{ return _mat[sid*_rsz+rid]; }
unsigned CommMatrix::getReceiverSize ( ) const [inline]

Definition at line 19 of file CommMatrix.h.

References _rsz.

Referenced by CommMatrix(), and Controlled::computePiecesToSend().

{ return _rsz; }
unsigned CommMatrix::getSenderSize ( ) const [inline]

Definition at line 18 of file CommMatrix.h.

References _ssz.

Referenced by CommMatrix(), Controlled::computePiecesToSend(), and Controlled::getClientData().

{ return _ssz; }
void CommMatrix::set ( unsigned  sid,
unsigned  rid,
long  val 
) [inline]

Definition at line 21 of file CommMatrix.h.

References _mat, and _rsz.

Referenced by Controlled::readFromFile().

{      _mat[sid*_rsz+rid] = val; }
void CommMatrix::sub ( unsigned  sid,
unsigned  rid,
long  val 
) [inline]

Definition at line 24 of file CommMatrix.h.

References _mat, and _rsz.

Referenced by Controlled::getClientData().

{      _mat[sid*_rsz+rid] -= val; }

Member Data Documentation

long* CommMatrix::_mat [private]

Definition at line 10 of file CommMatrix.h.

Referenced by _get_mat(), add(), CommMatrix(), get(), set(), sub(), and ~CommMatrix().

unsigned CommMatrix::_rsz [private]

Definition at line 9 of file CommMatrix.h.

Referenced by add(), CommMatrix(), dump(), get(), getReceiverSize(), set(), and sub().

unsigned CommMatrix::_ssz [private]

Definition at line 8 of file CommMatrix.h.

Referenced by CommMatrix(), dump(), and getSenderSize().


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