Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

eqn_cruncher Namespace Reference


Compounds

class  arg_stream
struct  data_passer
 This struct is used to propagate the data between the various levels of abstraction in the determinant calculation module. More...

struct  file_error
 file_error is an exception object thrown whenever there is an error in opening the input file data.dat. More...

class  host_error
 This exception is thrown whenever there is a host name lookup error. More...

class  Mutex
class  node_manager
 The Node manager is responsible for effectively and correctly maintaining the list of all clients currently connected to the master after the server has recognized such clients and has accepted their connections. More...

class  packet_error
 packet_error is an exception object thrown whenever there is an error in sending/receiving a packet across the network. This is an irrecoverable error presently. More...

struct  parse_error
 parse_error is an exception object thrown whenever there is an error in parsing the input file suggesting that there is an error in the input file data.dat More...

struct  pkt_header
 This represents the data type for the packet header, which is the first piece of data whenever any packet is sent across the network between the client and server. More...

class  port_error
 This exception is thrown whenever a socket fails to bind to particular port either because that port does not exist, or it's already being bound by someone else, or for some other reason. More...

class  pthr_lock
 This is a thin wrapper around the pthread mutex API. More...

struct  server_data
 This struct is used to propagate the data between the various levels of abstraction in the server's threaded mechanism. More...

class  socket
 This class is a thin wrapper around the standard UNIX socket interface. More...

class  socket_error
 This exception is the base class for 2 other socket errors: host_error, and port_error. More...

class  timer
 This is a thin wrapper around the UNIX timer API. More...


Typedefs

typedef std::vector< std::vector<
double > > 
matrix_t
 The matrix data type.


Functions

void atomic_make_zero (int *_flag)
void atomic_wait_till_not_zero (int *_flag)
void * client (void *remote_ip)
 The client starts whenever we start a client which tries to connect to a serever listening on a specified port number.

void replace_column (eqn_cruncher::matrix_t &mat, std::vector< double > const &rhs, int col_no)
 Replace the column number specified by the parameter col_no in the matrix mat with the column matrix rhs.

void * store_result (double *dptr, eqn_cruncher::socket s)
 This procedure basically waits until the client on the other side of the socket 's' has sent the result back to the caller, and then stores this computed result back into the result buffer.

void * eval_determinant_remote (void *vptr)
 This procedure evaluates the determinant of a square matrix remotely, and places the result(value of the determinant) in the buffer provided.

double determinant (eqn_cruncher::matrix_t const &_m)
 Look ma! I don't know how to calculate the determinant for a matrix, but I can still find the determinant for an nXn Matrix.

void * replace_and_remote_eval (void *vptr)
 Responsible for replacing a column in the matrix, and calling the remote determinant evaluation procedure.

void * replace_and_local_eval (void *vptr)
 Responsible for replacing a column in the matrix, and calling the remote determinant evaluation procedure.

void eval_variables (eqn_cruncher::matrix_t const &mat, std::vector< double > const &rhs, std::vector< double > &result)
 The mother procedure! This actually uses the other procedures to calculate the values of the individial variables.

void eat_ws (std::istream &in)
 Eats upto the next non-whitespace character in the input stream(in) passed.

std::string suffix_from_number (unsigned int num)
 Returns the suffix of the number when written in english.

void parse_file (std::string const &file_name, std::vector< std::string > &var_list, matrix_t &mat, std::vector< double > &rhs_list)
 This function is used to parse the input file, and extract the equations and the various coefficients, variable names, and constants from the equations, so that the later stages can properly act on them.

void process_args (eqn_cruncher::arg_stream &as)
void * start_nms (void *vptr)
 This function starts the Node mamager's server, which is responsible for listening continuouslty for new connections from new clients that log on to the network, and wish to connect to the server on the specified port number.

void server (pthread_t *pthr, eqn_cruncher::server_data *psd)
 This is the function that is called from the main() function, and is responsible for setting up the server thread.


Variables

eqn_cruncher::node_manager nm
 The globally shared Node manager object. This is the object used by every module in this application.

std::ofstream rlog
 The global logger object output stream to which the data is written.

unsigned int client_port
 The client port number.

unsigned int server_port
 The server port number.


Typedef Documentation

typedef std::vector<std::vector<double> > eqn_cruncher::matrix_t
 

The matrix data type.


Function Documentation

void atomic_make_zero int *    _flag
 

void atomic_wait_till_not_zero int *    _flag
 

void* client void *    remote_ip
 

The client starts whenever we start a client which tries to connect to a serever listening on a specified port number.

Parameters:
remote_ip  Pointer to a NULL terminated character array, which holds the name of the server.
Returns:
void* This does not signify anything meaningful, and is currently unused.

double determinant eqn_cruncher::matrix_t const &    _m
 

Look ma! I don't know how to calculate the determinant for a matrix, but I can still find the determinant for an nXn Matrix.

Parameters:
_m  A reference to a constant matrix_t object, which represents the square matrix whose determinant we wish to compute.
Returns:
Returns the determinant of the square matrix.

void eat_ws std::istream &    in
 

Eats upto the next non-whitespace character in the input stream(in) passed.

Parameters:
in  Input stream.

void* eval_determinant_remote void *    vptr
 

This procedure evaluates the determinant of a square matrix remotely, and places the result(value of the determinant) in the buffer provided.

Parameters:
vptr  This is a pointer to a data_passer object.
Returns:
void* This does not signify anything meaningful, and is currently unused.

void eval_variables eqn_cruncher::matrix_t const &    mat,
std::vector< double > const &    rhs,
std::vector< double > &    result
 

The mother procedure! This actually uses the other procedures to calculate the values of the individial variables.

Parameters:
mat  Reference to constany matrix containg the list of coefficients.
rhs  Reference to constant array containing the constants appearing on the RHS of the equations.
result  The reference to an array where the results of evaluating the values of the various variables should be placed. This is like a buffer.

void parse_file std::string const &    file_name,
std::vector< std::string > &    var_list,
matrix_t   mat,
std::vector< double > &    rhs_list
 

This function is used to parse the input file, and extract the equations and the various coefficients, variable names, and constants from the equations, so that the later stages can properly act on them.

Parameters:
file_name  The file name containing the equation to be parsed.
var_list  The buffer where the function should place the list of variables encountered.
mat  The buffer where the function should place the various coefficients of the variables in the correct order. The correct order here is the same order in whihc they are placed in the the var_list buffer.
rhs_list  The list of constants appering on the RHS of each of the equations.

void process_args eqn_cruncher::arg_stream   as
 

void* replace_and_local_eval void *    vptr
 

Responsible for replacing a column in the matrix, and calling the remote determinant evaluation procedure.

Parameters:
vptr  Void pointer to the data_passer information to be passed to the subsequently called functions.
Returns:
void* This does not signify anything meaningful, and is currently unused.

void* replace_and_remote_eval void *    vptr
 

Responsible for replacing a column in the matrix, and calling the remote determinant evaluation procedure.

Parameters:
vptr  Void pointer to the data_passer information to be passed to the subsequently called functions.
Returns:
void* This does not signify anything meaningful, and is currently unused.

void replace_column eqn_cruncher::matrix_t   mat,
std::vector< double > const &    rhs,
int    col_no
 

Replace the column number specified by the parameter col_no in the matrix mat with the column matrix rhs.

Parameters:
mat  Reference to matrix which contains the column to be replaced.
rhs  The column matrix which will be replacing a column in the above matrix.
col_no  The column number in mat which will be replaced bt rhs.

void server pthread_t *    pthr,
eqn_cruncher::server_data   psd
 

This is the function that is called from the main() function, and is responsible for setting up the server thread.

It is responsible for: 1. Starting the Node manager's server in a separate thread by creating a new thread and then calling start_nms(). 2. Waiting for about 2 sec for the client's list to get populated. This delay is required because the clients poll every second for a connection, and also the network does not transmit data immediately. Usually, there is some sort of a delay.

Parameters:
pthr  Pointer to a pthread_t structure which represents the memory area where the data related to the server thread must be stored after its creation.
psd  Pointer to an object of type server_data, which contains the information necessary for the correct operation of the server.

void* start_nms void *    vptr
 

This function starts the Node mamager's server, which is responsible for listening continuouslty for new connections from new clients that log on to the network, and wish to connect to the server on the specified port number.

Parameters:
vptr  A pointer to a server_data object having the necessary information to correctly start the server.
Returns:
void* This does not signify anything meaningful, and is currently unused.

void* store_result double *    dptr,
eqn_cruncher::socket    s
 

This procedure basically waits until the client on the other side of the socket 's' has sent the result back to the caller, and then stores this computed result back into the result buffer.

Parameters:
dptr  Pointer tp double, signifying the buffer to store the result of the determinant calculation.
s  Socket connected to the remote client.
Returns:
void* This does not signify anything meaningful, and is currently unused.

std::string suffix_from_number unsigned int    num
 

Returns the suffix of the number when written in english.

eg: 1st, 2nd 3rd, 4th, 5th, etc...
The st, nd, rd, and th are called suffixes.

Parameters:
num  The number whose suffix you want to find.
Returns:
String representing the suffix in english.


Variable Documentation

unsigned int eqn_cruncher::client_port
 

The client port number.

eqn_cruncher::node_manager eqn_cruncher::nm
 

The globally shared Node manager object. This is the object used by every module in this application.

std::ofstream eqn_cruncher::rlog
 

The global logger object output stream to which the data is written.

unsigned int eqn_cruncher::server_port
 

The server port number.


Generated on Mon Oct 11 13:09:26 2004 for Equation Cruncher by doxygen1.2.18