PaCO++  0.05
ParisBasicExample Class Reference

#include <ParisBasicExample.h>

Inheritance diagram for ParisBasicExample:
Collaboration diagram for ParisBasicExample:

List of all members.

Public Member Functions

virtual void clientFree ()
virtual void clientFree (int server_node)
virtual PieceToSendcomputePiecesToSend ()
virtual PieceToSendcomputePiecesToSend (unsigned &size)=0
virtual bool freeComId (long id)
virtual void * getClientData (int server_node, long &size, long &length, bool &end)
virtual void * getClientData (void *pid, int server_node, long &size, long &length, bool &end)=0
virtual void * getDescr ()
virtual PaCO::PacoTopology_t getDestTopology ()
virtual long getNodeRank ()
virtual void * getServerData (long &length)
virtual PaCO::PacoTopology_t getSourceTopology ()
virtual bool insertData (void *rcptBuf)
virtual bool insertData (void *rcptBuf, unsigned long element_nb)=0
 ParisBasicExample ()
virtual void serverFree ()
virtual bool setComId (long id)
virtual void setCommunicator (void *group)
virtual void setDataPtr (void *dataPtr)
virtual void setDescr (void *descr)
virtual void setDestTopology (PaCO::PacoTopology_t topo)
void setEltSize (long size)
void setNbElt (long elt_nb)
virtual void setNodeRank (long Rank)
virtual void setSourceTopology (PaCO::PacoTopology_t topo)
virtual ~ParisBasicExample ()

Private Attributes

long _data_elt_nb
long * _data_rst
long _data_size
PaCO::PacoTopology_t _destTopo
CORBA::Short _length
long _my_rank
long _server_nb_nodes
PaCO::PacoTopology_t _srcTopo
char * _user_data
long * position
char * temp_buffer

Detailed Description

Definition at line 8 of file ParisBasicExample.h.


Constructor & Destructor Documentation

Definition at line 14 of file ParisBasicExample.cc.

References _data_rst, and position.

{
  delete position;
  delete _data_rst;
}

Member Function Documentation

void ParisBasicExample::clientFree ( ) [virtual]

Implements DistributionLibrary.

Definition at line 177 of file ParisBasicExample.cc.

References temp_buffer.

Referenced by getClientData().

{
  free(temp_buffer);
}
void ParisBasicExample::clientFree ( int  server_node) [virtual]

Definition at line 183 of file ParisBasicExample.cc.

References temp_buffer.

{
  free(temp_buffer);
}

Definition at line 98 of file ParisBasicExample.cc.

References _data_elt_nb, _data_size, _my_rank, _server_nb_nodes, PieceToSend::destNode, PieceToSend::size, and PieceToSend::sourceNode.

{
  // Compute total data length
  long total_length = _data_size * _data_elt_nb;
  // We send at each server node the 
  // same data
  PieceToSend * comm_vector = new PieceToSend[_server_nb_nodes];
  for (int i = 0; i < _server_nb_nodes; i++)
    {
      comm_vector[i].sourceNode = _my_rank;
      comm_vector[i].destNode = i;
      if (i == _my_rank)
   {
     comm_vector[i].size = total_length;
   }
      else
   {
     comm_vector[i].size = 0;
   }
    }
  return comm_vector;
}
virtual PieceToSend* DistributionLibrary::computePiecesToSend ( unsigned &  size) [pure virtual, inherited]

Implemented in BasicBC, Controlled, Identity, and GaBro.

virtual bool DistributionLibrary::freeComId ( long  id) [inline, virtual, inherited]

Reimplemented in BasicBC, and GaBro.

Definition at line 41 of file DistributionLibrairie.h.

{ return false;}
void * ParisBasicExample::getClientData ( int  server_node,
long &  size,
long &  length,
bool &  end 
) [virtual]

Definition at line 134 of file ParisBasicExample.cc.

References _data_elt_nb, _data_rst, _data_size, _length, _user_data, clientFree(), position, and temp_buffer.

{
  if (size > 0)
    {
      if (temp_buffer) clientFree(server_node);
      // First get position
      long actual_pos = position[server_node];
      // Test if size > _data_rst
      long real_size = 0;
      if (size > _data_rst[server_node])
   {
     real_size = _data_rst[server_node];
     size = size - _data_rst[server_node];
     _data_rst[server_node] = 0;
   }
      else
   {
     real_size = size;
     _data_rst[server_node] = _data_rst[server_node] - size;
     size = 0;
   }
      length = real_size / _data_size;
      _length  = length;
      end = true;
      position[server_node] = actual_pos + real_size;
      if (_data_rst[server_node] == 0) 
   {
     _data_rst[server_node] = _data_size * _data_elt_nb;
     position[server_node] = 0;
   }
      return &_user_data[actual_pos];
    }
  else
    {
      length = 0;
      _length  = length;
      end = true;
      return NULL;
    }
  return NULL;
}

Here is the call graph for this function:

virtual void* DistributionLibrary::getClientData ( void *  pid,
int  server_node,
long &  size,
long &  length,
bool &  end 
) [pure virtual, inherited]

Implemented in BasicBC, Controlled, Identity, and GaBro.

void * ParisBasicExample::getDescr ( ) [virtual]

Implements DistributionLibrary.

Definition at line 210 of file ParisBasicExample.cc.

References _length.

{
  return &_length;
}

Implements DistributionLibrary.

Definition at line 80 of file ParisBasicExample.cc.

References _destTopo.

{
  return _destTopo;
}
long ParisBasicExample::getNodeRank ( ) [virtual]

Implements DistributionLibrary.

Definition at line 92 of file ParisBasicExample.cc.

References _my_rank.

{
  return _my_rank;
}
void * ParisBasicExample::getServerData ( long &  length) [virtual]

Implements DistributionLibrary.

Definition at line 196 of file ParisBasicExample.cc.

References _length, and _user_data.

{
  length = _length;
  return _user_data;
}

Implements DistributionLibrary.

Definition at line 53 of file ParisBasicExample.cc.

References _srcTopo.

{
  return _srcTopo;
}
bool ParisBasicExample::insertData ( void *  rcptBuf) [virtual]

Definition at line 189 of file ParisBasicExample.cc.

References _user_data.

{
  _user_data = (char *) rcptBuf;
  return true;
}
virtual bool DistributionLibrary::insertData ( void *  rcptBuf,
unsigned long  element_nb 
) [pure virtual, inherited]

Implemented in BasicBC, Controlled, Identity, and GaBro.

virtual void ParisBasicExample::serverFree ( ) [inline, virtual]

Implements DistributionLibrary.

Definition at line 36 of file ParisBasicExample.h.

{}
virtual bool DistributionLibrary::setComId ( long  id) [inline, virtual, inherited]

Reimplemented in BasicBC, and GaBro.

Definition at line 40 of file DistributionLibrairie.h.

{ return false;}
virtual void ParisBasicExample::setCommunicator ( void *  group) [inline, virtual]

Implements DistributionLibrary.

Definition at line 21 of file ParisBasicExample.h.

{}
void ParisBasicExample::setDataPtr ( void *  dataPtr) [virtual]

Implements DistributionLibrary.

Definition at line 122 of file ParisBasicExample.cc.

References _data_elt_nb, _data_rst, _data_size, _my_rank, _server_nb_nodes, _user_data, and position.

{
  _user_data = (char*) dataPtr;
  cerr << "_data_size " <<_data_size << endl;
  cerr << "_data_elt_nb " <<_data_elt_nb << endl;
  cerr << "_my_rank " <<_my_rank << endl;
  cerr << "_server_nb_nodes " <<_server_nb_nodes << endl;
  cerr << "_data_rst " <<_data_rst << endl;
  cerr << " position" <<  position << endl;
}
void ParisBasicExample::setDescr ( void *  descr) [virtual]

Implements DistributionLibrary.

Definition at line 203 of file ParisBasicExample.cc.

References _length.

{
  _length = *((CORBA::Short*) descr);
  cerr << " Set Descr  : "<< _length << endl;
}

Implements DistributionLibrary.

Definition at line 59 of file ParisBasicExample.cc.

References _data_elt_nb, _data_rst, _data_size, _destTopo, _server_nb_nodes, position, and PaCO::PacoTopology_s::total.

{
  _destTopo = topo;
  _server_nb_nodes = _destTopo.total;
  position  = new long[_server_nb_nodes];
  _data_rst = new long[_server_nb_nodes];
  for (int i = 0; i < _server_nb_nodes; i++)
    {
      position[i]  = 0;
      _data_rst[i] = 0;
    }
  if (_data_size && _data_elt_nb)
    {
      for (int i = 0; i < _server_nb_nodes; i++)
   {
     _data_rst[i] = _data_size * _data_elt_nb;
   }
    }
}
void ParisBasicExample::setEltSize ( long  size)

Definition at line 21 of file ParisBasicExample.cc.

References _data_elt_nb, _data_rst, _data_size, and _server_nb_nodes.

{
  _data_size = size;
  if (_data_elt_nb && _server_nb_nodes)
    {
      for (int i = 0; i < _server_nb_nodes; i++)
   {
     _data_rst[i] = _data_size * _data_elt_nb;
   }
    }
}
void ParisBasicExample::setNbElt ( long  elt_nb)

Definition at line 34 of file ParisBasicExample.cc.

References _data_elt_nb, _data_rst, _data_size, and _server_nb_nodes.

{
  _data_elt_nb = elt_nb;
  if (_data_size && _server_nb_nodes)
    {
      for (int i = 0; i < _server_nb_nodes; i++)
   {
     _data_rst[i] = _data_size * _data_elt_nb;
   }
    }
}
void ParisBasicExample::setNodeRank ( long  Rank) [virtual]

Implements DistributionLibrary.

Definition at line 86 of file ParisBasicExample.cc.

References _my_rank.

{
  _my_rank = Rank;
}

Implements DistributionLibrary.

Definition at line 47 of file ParisBasicExample.cc.

References _srcTopo.

{
  _srcTopo = topo;
}

Member Data Documentation

CORBA::Short ParisBasicExample::_length [private]

Definition at line 49 of file ParisBasicExample.h.

Referenced by computePiecesToSend(), getNodeRank(), setDataPtr(), and setNodeRank().

Definition at line 55 of file ParisBasicExample.h.

Referenced by clientFree(), getClientData(), and ParisBasicExample().


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