OpenAtom  Version1.5a
orthoMap.h
1 #include "load_balance/IntMap.h"
2 #include "charm++.h"
3 
4 #ifndef ORTHO_MAP_H
5 #define ORTHO_MAP_H
6 /** @addtogroup mapping
7  @{
8 */
9 
10 /// Centroid based ortho map (actual map creation in MapTable.C)
11 class OrthoMap : public CkArrayMap
12 {
13  private:
14  MapType2 *maptable;
15 
16  public:
17  OrthoMap(MapType2 map)
18  {
19  maptable = new MapType2(map);
20  }
21 
22  ~OrthoMap() { }
23 
24  void pup(PUP::er &p)
25  {
26  CkArrayMap::pup(p);
27  p|*maptable;
28  }
29 
30  inline int procNum(int, const CkArrayIndex &iIndex)
31  {
32  int *index=(int *) iIndex.data();
33  int proc;
34  proc=maptable->get(index[0],index[1]);
35  CkAssert(proc>=0);
36  if(numPes != CkNumPes())
37  return(proc%CkNumPes());
38  else
39  return(proc);
40  }
41 };
42 
43 
44 
45 extern bool fakeTorus; ///< readonly defined in cpaimd.C
46 
47 /// Map group for placing OrthoHelper chares
48 class OrthoHelperMap : public CkArrayMap
49 {
50  private:
51  MapType2 *maptable;
52 
53  public:
55  {
56  maptable = new MapType2(map);
57  }
58 
59  ~OrthoHelperMap() { }
60 
61  void pup(PUP::er &p)
62  {
63  CkArrayMap::pup(p);
64  p|*maptable;
65  }
66 
67  inline int procNum(int, const CkArrayIndex &iIndex)
68  {
69  int *index=(int *) iIndex.data();
70  int proc;
71  proc=maptable->get(index[0],index[1]);
72  if(fakeTorus)
73  return(proc%CkNumPes());
74  else
75  return(proc);
76  }
77 };
78 /*@}*/
79 #endif // ORTHO_MAP_H
80 
Centroid based ortho map (actual map creation in MapTable.C)
Definition: orthoMap.h:11
Author: Eric J Bohm Date Created: June 4th, 2006.
Map group for placing OrthoHelper chares.
Definition: orthoMap.h:48
bool fakeTorus
readonly defined in cpaimd.C
Definition: cpaimd.C:172