OpenAtom  Version1.5a
TemperController.C
1 #include "charm++.h"
2 #include "utility/util.h"
3 #include "cpaimd.h"
4 #include "energyGroup.h"
5 #include "InstanceController.h"
6 #include "TemperController.h"
7 
8 
9 extern CProxy_InstanceController instControllerProxy;
10 
11 TemperController::TemperController()
12 {
13  /* insert initialization here */
14  reportedIn=0;
15  numTempers=config.UberKmax;
16  numBeads=config.UberImax;
17  CkPrintf("TemperController for Tempers %d and beads %d\n",numTempers,numBeads);
18  temperEnergy=new EnergyStruct[numTempers];
19  temperatures=new double[numTempers];
20  for(int i=0;i<numTempers;i++) temperatures[i]=.0; //placeholder
21 }
22 
23 void TemperController::acceptData(int temper, EnergyStruct &energies)
24 {
25  reportedIn++;
26  //temperEnergy[temper]+=energies; // note += not defined on this
27  //struct, but that is the notional operation
28 
29  /* we should be summing the energies here, as you will get one per
30  bead, but which ones we actually care about summing is for Glenn
31  to figure out. */
32  if(reportedIn == numTempers*numBeads)
33  acceptData();
34 
35 }
36 
37 void TemperController::acceptData()
38 {
39  reportedIn=0;
40  CkPrintf("Hey Glenn, this is where the Temper controller could do its job\n");
41  /* insert temperature manipulation code here*/
42 
43  /* putting this in a for loop because we expect this to be personalized */
44  UberCollection index;
45  // average out the
46  for(int i=0; i < numTempers; i++)
47  {
48  index.idxU.x=i;
49  index.setPO();
50  // CkPrintf("sending temp to %d,%d,%d,%d\n",index.idxU.x, index.idxU.y, index.idxU.z, index.idxU.s);
51  instControllerProxy[i].acceptNewTemperature(temperatures[i]);
52  }
53 }
54 
55 TemperController::~TemperController()
56 {
57  delete [] temperEnergy;
58  delete [] temperatures;
59 }
60 #include "temperController.def.h"
holds the UberIndex and the offset for proxies
Definition: Uber.h:68
CProxy_InstanceController instControllerProxy
Definition: cpaimd.ci:236
Some basic data structures and the array map classes are defined here.