Diana  0.8.3
DistributedMatrix.hpp
00001 /* -----------------------------------------------------------------------------
00002  *  Diana process modelling, simulation and analysis software
00003  *  Copyright (c) 2005, Michael Krasnyk
00004  *  All rights reserved.
00005  *
00006  *  This file is a part of Diana process modelling, simulation and analysis software
00007  *
00008  *  Diana is free software; you can redistribute it and/or modify it
00009  *  under the terms of the GNU General Public License as published
00010  *  by the Free Software Foundation (see accompanying file LICENSE)
00011  * -----------------------------------------------------------------------------
00012  *  $Id$
00013  * -----------------------------------------------------------------------------
00014  *  Description:
00015  */
00016 
00017 
00018 #ifndef __DISTRIBUTED_MATRIX_HPP
00019 #define __DISTRIBUTED_MATRIX_HPP
00020 
00021 #include <mpi.h>
00022 #include "IDistributedMatrix.hpp"
00023 #include <Diana.hpp>
00024 
00027 class CDistributedMatrix : virtual public IDistributedMatrix
00028 {
00029 private:
00030    //the data saved in columns<rows *>
00031    std::vector<CapeArrayDouble*> m_ColumnPointers; 
00032    int m_nProcQuantity, m_nMyRank;
00033    CapeLong m_lRows, m_lCols;
00034 
00035 public:
00036    CDistributedMatrix(CapeLong lRows, CapeLong lCols);
00037 
00038 
00039    ~CDistributedMatrix();
00040 
00041 
00042    void SetValue( CapeLong lRow, CapeLong lCol, CapeDouble dValue )
00043       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00044 
00045 
00046    CapeDouble GetValue( CapeLong lRow, CapeLong lCol )
00047       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00048 
00049 
00050    CapeLong GetNumRows();
00051 
00052 
00053    CapeLong GetNumCols();
00054 
00055 
00056    void BroadcastValue( CapeLong lSourcePE, CapeLong lRow, CapeLong lCol ) 
00057       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00058 
00059 
00060    void BroadcastColumn( CapeLong lSourcePE, CapeLong lCol )
00061       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00062    
00063 
00064    CapeArrayDouble GetColumn( CapeLong lCol )
00065       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00066 
00067 
00069    void Show( CapeLong lProcID );
00070   
00071 
00073    void Clear();
00074 };
00075 
00076 #endif