Diana  0.8.3
ParallelEnv.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 __PARALLELENV_H
00019 #define __PARALLELENV_H
00020 
00021 
00022 #include "DistributedMatrix.hpp"
00023 #include "ParallelSolver.hpp"
00024 #include "Timer.hpp"
00025 #include <Diana.hpp>
00026 
00027 
00028 
00029 typedef struct
00030 {
00031    CapeString sComputerName;
00032    CapeLong lPerformance;
00033 } ProcInfo;
00034 
00035 
00036 
00043 class CParallelEnv : virtual public IParallelEnv
00044 {
00045 private:
00046    CapeBoolean m_bIsInitialized; 
00047    ProcInfo m_ProcInfo; 
00048    int m_nMyRank; 
00049    int m_nProcQuantity; 
00050 
00051    std::vector<CDistributedMatrix*> m_DistributedMatrixes;
00052    std::vector<CParallelSolver*> m_ParallelSolvers;
00053 
00054 private:
00055    CapeBoolean CheckInitializedMPD();
00056 
00057 public:
00058    CParallelEnv(); 
00059    ~CParallelEnv();     
00060 
00063    void Initialize(); 
00064 
00065 
00066    void ShowInfo();
00067 
00068 
00069    CapeLong ProcessID() throw (Common::Error::ECapeUnknown);
00070 
00071 
00072    CapeLong ProcessesNumber()  throw (Common::Error::ECapeUnknown);
00073 
00074    IDistributedMatrix* CreateDistributedMatrix( CapeLong nRows = 0,
00075       CapeLong nCols = 0 );
00076 
00077    void Barrier();
00078 
00079    IParallelSolver* CreateParallelSolver( const Common::Types::CapeString& 
00080       _szConnectionsFileName  )
00081       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00082 };
00083 
00084 #endif