FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fei_NodeCommMgr.hpp
Go to the documentation of this file.
1 #ifndef _NodeCommMgr_hpp_
2 #define _NodeCommMgr_hpp_
3 
4 /*--------------------------------------------------------------------*/
5 /* Copyright 2005 Sandia Corporation. */
6 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
7 /* non-exclusive license for use of this work by or on behalf */
8 /* of the U.S. Government. Export of this program may require */
9 /* a license from the United States Government. */
10 /*--------------------------------------------------------------------*/
11 
12 #include <fei_fwd.hpp>
13 
14 #include <fei_CommUtils.hpp>
15 
37 class NodeCommMgr : public fei::MessageHandler<int> {
38  public:
40 
41  NodeCommMgr(MPI_Comm comm, const SNL_FEI_Structure& problemStructure, int sharedNodeOwnership=STRICTLY_LOW_PROC);
42  virtual ~NodeCommMgr();
43 
44  size_t getNumSharedNodes() {return(sharedNodeIDs.size());}
45  std::vector<GlobalID>& getLocalNodeIDs() {return(localNodeIDs);}
46  std::vector<GlobalID>& getSharedNodeIDs() {return(sharedNodeIDs);}
47  std::vector<int>& getSharedNodeNumbers() {return(sharedNodeNumbers);}
48 
49  int getSharedNodeIndex_num(int nodeNumber);
50 
51  int addSharedNodes(const GlobalID* nodeIDs, int numNodes,
52  const int* const* procs, const int* numProcs);
53 
54  int initComplete(NodeDatabase& nodeDB, bool safetyCheck);
55 
56  int informLocal(const NodeDescriptor& node);
57 
58  int exchangeEqnInfo();
59 
60  int getSharedNodeIndex(GlobalID nodeID);
61 
63  std::vector<int>* getSharedNodeSubdomainList(GlobalID nodeID);
64 
66  {return(*(sharedNodes_[index]));}
67 
68  std::vector<int>& getSharedNodeProcs(int index)
69  {return(*(sharingProcs_[index]));};
70 
71  void setSharedOwnershipRule(int ownershipRule)
72  { sharedNodeOwnership_ = ownershipRule; }
73 
74  std::vector<int>& getSendProcs();
75  std::vector<int>& getRecvProcs();
76 
77  int getSendMessageLength(int destProc, int& messageLength);
78  int getSendMessage(int destProc, std::vector<int>& message);
79  int processRecvMessage(int srcProc, std::vector<int>& message);
80 
81  private:
82  NodeCommMgr(const NodeCommMgr& src);
83  NodeCommMgr& operator=(const NodeCommMgr& src);
84 
86 
87  int storeNodeProcs(int index, std::vector<std::vector<int>*>& procTable,
88  const int* procs, int numProcs);
89 
90  int checkSharedNodeInfo();
91 
92  int checkCommArrays(const char* whichCheck,
93  std::vector<int>& globalRemoteProcs,
94  std::vector<int>& globalNodesPerRemoteProc,
95  std::vector<int>& globalRemoteProcLengths,
96  std::vector<int>& nodesPerRemoteProc,
97  std::vector<int>& remoteProcs);
98 
99  void setNodeNumbersArray();
100 
101  void packLocalNodesAndData(int* data, int proc,
102  int numNodes, int len);
103  void packRemoteNodesAndData(GlobalID* data, int proc,
104  int numNodes, int len);
105 
106  int adjustSharedOwnership();
107 
108  int createProcLists();
109 
110  int createProcList(std::vector<int>& itemsPerProc,
111  std::vector<int>& procs);
112 
114 
115  int getGlobalMaxFieldsBlocks(int& maxFields, int& maxBlocks);
116 
118 
121 
123 
124  std::vector<GlobalID> localNodeIDs;
125  std::vector<GlobalID> remoteNodeIDs;
126 
127  std::vector<GlobalID> sharedNodeIDs; //global node identifiers
128 
129  std::vector<std::vector<int> > sharedNodeSubdomains;
130  //subdomains each shared node
131  //appears in.
132  std::vector<int> trivialSubdomainList;
133 
134  std::vector<std::vector<int>*> sharingProcs_;//table, i-th row is a list of procs
135  //associated with i-th shared node
136 
137  std::vector<int> sharedNodeNumbers;
138 
141 
144 
148 
151 };
152 
153 #endif
154 
NodeDescriptor ** sharedNodes_
int createProcList(std::vector< int > &itemsPerProc, std::vector< int > &procs)
std::vector< int > & getSharedNodeProcs(int index)
std::vector< int > trivialSubdomainList
std::vector< GlobalID > sharedNodeIDs
int adjustSharedOwnership()
int addSharedNodes(const GlobalID *nodeIDs, int numNodes, const int *const *procs, const int *numProcs)
int GlobalID
Definition: fei_defs.h:60
std::vector< int > nodesPerOwnerProc_
std::vector< GlobalID > localNodeIDs
std::vector< int > & getSendProcs()
std::vector< int > sharedNodeNumbers
virtual ~NodeCommMgr()
int getSharedNodeIndex(GlobalID nodeID)
#define MPI_Comm
Definition: fei_mpi.h:56
int allocateNodeDescriptorPtrs(NodeDatabase &nodeDB)
const SNL_FEI_Structure & probStruc
NodeDescriptor & getSharedNodeAtIndex(int index)
int initComplete(NodeDatabase &nodeDB, bool safetyCheck)
std::vector< GlobalID > & getLocalNodeIDs()
std::vector< int > nodesPerSharingProc_
std::vector< GlobalID > remoteNodeIDs
int getSharedNodeIndex_num(int nodeNumber)
NodeCommMgr(MPI_Comm comm, const SNL_FEI_Structure &problemStructure, int sharedNodeOwnership=STRICTLY_LOW_PROC)
int checkSharedNodeInfo()
int getGlobalMaxFieldsBlocksSubdomains()
std::vector< int > remoteOwnerProcs_
std::vector< std::vector< int > > sharedNodeSubdomains
void setNodeNumbersArray()
int storeNodeProcs(int index, std::vector< std::vector< int > * > &procTable, const int *procs, int numProcs)
std::vector< int > remoteSharingProcs_
int getSendMessage(int destProc, std::vector< int > &message)
std::vector< std::vector< int > * > sharingProcs_
void setSharedOwnershipRule(int ownershipRule)
int informLocal(const NodeDescriptor &node)
void packLocalNodesAndData(int *data, int proc, int numNodes, int len)
void packRemoteNodesAndData(GlobalID *data, int proc, int numNodes, int len)
int getSharedNodeNumSubdomains(GlobalID nodeID)
std::vector< int > & getRecvProcs()
bool sharedNodesAllocated_
int getGlobalMaxFieldsBlocks(int &maxFields, int &maxBlocks)
int checkCommArrays(const char *whichCheck, std::vector< int > &globalRemoteProcs, std::vector< int > &globalNodesPerRemoteProc, std::vector< int > &globalRemoteProcLengths, std::vector< int > &nodesPerRemoteProc, std::vector< int > &remoteProcs)
int exchangeSharedRemoteFieldsBlks()
int getSendMessageLength(int destProc, int &messageLength)
size_t getNumSharedNodes()
std::vector< int > & getSharedNodeNumbers()
int processRecvMessage(int srcProc, std::vector< int > &message)
NodeCommMgr & operator=(const NodeCommMgr &src)
std::vector< GlobalID > & getSharedNodeIDs()
int numProcs(MPI_Comm comm)
std::vector< int > * getSharedNodeSubdomainList(GlobalID nodeID)