snl_fei_RecordMsgHandler.hpp

00001 /*--------------------------------------------------------------------*/
00002 /*    Copyright 2005 Sandia Corporation.                              */
00003 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00004 /*    non-exclusive license for use of this work by or on behalf      */
00005 /*    of the U.S. Government.  Export of this program may require     */
00006 /*    a license from the United States Government.                    */
00007 /*--------------------------------------------------------------------*/
00008 
00009 #ifndef _snl_fei_RecordMsgHandler_hpp_
00010 #define _snl_fei_RecordMsgHandler_hpp_
00011 
00012 #include <fei_macros.hpp>
00013 #include <fei_CommUtils.hpp>
00014 #include <fei_fwd.hpp>
00015 
00016 namespace fei {
00017   class FieldMask;
00018 }
00019 
00020 namespace snl_fei {
00022   class RecordMsgHandler : public fei::MessageHandler<int> {
00023   public:
00025     RecordMsgHandler(int localProc,
00026          RecordCollection* recordCollection,
00027          snl_fei::PointBlockMap& ptBlkMap,
00028          std::vector<fei::FieldMask*>& fieldMasks,
00029          std::vector<int>& eqnNumbers);
00030 
00032     virtual ~RecordMsgHandler();
00033 
00035     enum {_FieldMasks_ = 0, _MaskIDs_ = 1,
00036           _EqnNumbers_};
00037 
00039     std::vector<int>& getSendProcs();
00040 
00042     std::vector<int>& getRecvProcs();
00043 
00045     int getSendMessageLength(int destProc, int& messageLength);
00046 
00048     int getSendMessage(int destProc, std::vector<int>& message);
00049 
00051     int processRecvMessage(int srcProc, std::vector<int>& message);
00052 
00054     void setTask(int task) { whichTask_ = task; }
00055 
00057     void setSendPattern(fei::comm_map* pattern)
00058       { sendPattern_ = pattern; }
00059 
00061     void setRecvPattern(fei::comm_map* pattern)
00062       { recvPattern_ = pattern; }
00063 
00064   private:
00065     int localFieldMaskMessageSize(std::vector<fei::FieldMask*>& fieldMasks);
00066 
00067     int packLocalFieldMasks(std::vector<fei::FieldMask*>& fieldMasks,
00068                             std::vector<int>& localFieldMasks);
00069 
00070     int addFieldMasks(std::vector<int>& msg, std::vector<fei::FieldMask*>& fieldMasks);
00071 
00072     int packMaskIDs(int destProc, std::vector<int>& msg);
00073 
00074     int mergeMaskIDs(int srcProc, std::vector<int>& msg);
00075 
00076     int eqnNumbersMsgLength(int destProc);
00077 
00078     int packEqnNumbersMsg(int destProc, std::vector<int>& msg);
00079 
00080     int storeEqnNumbers(int srcProc, std::vector<int>& msg);
00081 
00082     fei::comm_map* sendPattern_;
00083     fei::comm_map* recvPattern_;
00084     RecordCollection* recordCollection_;
00085     snl_fei::PointBlockMap& ptBlkMap_;
00086     std::vector<fei::FieldMask*>& fieldMasks_;
00087 
00088     int whichTask_;
00089 
00090     std::vector<int> sendProcs_;
00091     std::vector<int> recvProcs_;
00092 
00093     std::vector<int>& eqnNumbers_;
00094 
00095     int localProc_;
00096   };//class RecordMsgHandler
00097 }//namespace snl_fei
00098 
00099 #endif // _snl_fei_RecordMsgHandler_hpp_
00100 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends
Generated on Wed Apr 13 10:08:24 2011 for FEI by  doxygen 1.6.3