FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
snl_fei_RecordMsgHandler.hpp
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2005 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #ifndef _snl_fei_RecordMsgHandler_hpp_
10 #define _snl_fei_RecordMsgHandler_hpp_
11 
12 #include <fei_macros.hpp>
13 #include <fei_CommUtils.hpp>
14 #include <fei_fwd.hpp>
15 
16 namespace fei {
17  class FieldMask;
18 }
19 
20 namespace snl_fei {
22  class RecordMsgHandler : public fei::MessageHandler<int> {
23  public:
25  RecordMsgHandler(int localProc,
26  RecordCollection* recordCollection,
27  snl_fei::PointBlockMap& ptBlkMap,
28  std::vector<fei::FieldMask*>& fieldMasks,
29  std::vector<int>& eqnNumbers);
30 
32  virtual ~RecordMsgHandler();
33 
35  enum {_FieldMasks_ = 0, _MaskIDs_ = 1,
36  _EqnNumbers_};
37 
39  std::vector<int>& getSendProcs();
40 
42  std::vector<int>& getRecvProcs();
43 
45  int getSendMessageLength(int destProc, int& messageLength);
46 
48  int getSendMessage(int destProc, std::vector<int>& message);
49 
51  int processRecvMessage(int srcProc, std::vector<int>& message);
52 
54  void setTask(int task) { whichTask_ = task; }
55 
58  { sendPattern_ = pattern; }
59 
62  { recvPattern_ = pattern; }
63 
64  private:
65  int localFieldMaskMessageSize(std::vector<fei::FieldMask*>& fieldMasks);
66 
67  int packLocalFieldMasks(std::vector<fei::FieldMask*>& fieldMasks,
68  std::vector<int>& localFieldMasks);
69 
70  int addFieldMasks(std::vector<int>& msg, std::vector<fei::FieldMask*>& fieldMasks);
71 
72  int packMaskIDs(int destProc, std::vector<int>& msg);
73 
74  int mergeMaskIDs(int srcProc, std::vector<int>& msg);
75 
76  int eqnNumbersMsgLength(int destProc);
77 
78  int packEqnNumbersMsg(int destProc, std::vector<int>& msg);
79 
80  int storeEqnNumbers(int srcProc, std::vector<int>& msg);
81 
82  fei::comm_map* sendPattern_;
83  fei::comm_map* recvPattern_;
84  RecordCollection* recordCollection_;
85  snl_fei::PointBlockMap& ptBlkMap_;
86  std::vector<fei::FieldMask*>& fieldMasks_;
87 
88  int whichTask_;
89 
90  std::vector<int> sendProcs_;
91  std::vector<int> recvProcs_;
92 
93  std::vector<int>& eqnNumbers_;
94 
95  int localProc_;
96  };//class RecordMsgHandler
97 }//namespace snl_fei
98 
99 #endif // _snl_fei_RecordMsgHandler_hpp_
100 
std::vector< int > & getRecvProcs()
int processRecvMessage(int srcProc, std::vector< int > &message)
std::vector< int > & getSendProcs()
void setSendPattern(fei::comm_map *pattern)
RecordMsgHandler(int localProc, RecordCollection *recordCollection, snl_fei::PointBlockMap &ptBlkMap, std::vector< fei::FieldMask * > &fieldMasks, std::vector< int > &eqnNumbers)
int getSendMessage(int destProc, std::vector< int > &message)
int getSendMessageLength(int destProc, int &messageLength)
void setRecvPattern(fei::comm_map *pattern)