Diana  0.8.3
Router.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 __ROUTER_HPP
00019 #define __ROUTER_HPP
00020 
00021 #include <mpi.h>
00022 #include "File.hpp"
00023 #include "Parallel_defines.hpp"
00024 #include <CapeOpen.hpp>
00025 #include <Diana.hpp>
00026 
00027 
00031 typedef struct
00032 { 
00033    CapeString szModelName;
00034    CapeString szESOName;
00035 } ModelInfoType;
00036 
00037 class CRouter 
00038 {
00039 private:
00040    int m_nMyRank; 
00041    int m_nProcQuantity;  
00042    CapeArrayLong m_DisplacementArray;
00043    CapeArrayString m_ProcessorsNames;
00044    CapeBoolean m_bNeedToUpdateRoutes;
00045    CapeArrayLong MyModelsIndexes; 
00046    std::vector<ModelInfoType> ModelsList; 
00047 
00048 private: 
00049    void CollectProcessorsInfo();
00050 
00052    void GenerateRoutes(); 
00053 
00054 public:
00055    CRouter();
00056       
00058    void AddModel( CapeLong _lModelIndex ); 
00059    
00060    
00062    void RemoveModel( CapeLong _lModelIndex );
00063 
00064 
00066    void ReadConnectionsFile( const CapeString& _szConnectionsFileName )
00067       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00068 
00069 
00071    const CapeArrayLong& GetModelsDisplacement(); 
00072 
00074    const CapeArrayString& GetProcessorsNames();
00075 
00078    CapeLong GetGlobalIndex( const CapeString& _ModelName )
00079       throw (Common::Error::ECapeInvalidArgument);
00080 
00081 
00083    CapeLong GetRank( CapeLong _Index );
00084 
00085    CapeArrayString GetAllModelNames();
00086    CapeArrayString GetAllESONames();
00087 
00088 };
00089 
00090 
00091 #endif