OpenAtom  Version1.5a
ENL_EKE_Collector.C
1 #include "charm++.h"
2 //#include "util.h"
3 #include "ENL_EKE_Collector.h"
4 
5 /// this stuff is in a C file because multiple includes of .def will
6 /// give you too many implementations of this tiny thing for linktime joy
7 extern FILE *openScreenfWrite(const char *dirnameBase, const char *fname, int temper, int bead, bool beadfile);
8 ENL_EKE_Collector::ENL_EKE_Collector(int _numEnergyInputs, int _numInstance)
9 {
10  if(_numInstance>1)
11  temperScreenFile=openScreenfWrite("TEMPER_OUT", "screen", thisIndex, 0, false);
12  else
13  temperScreenFile=stdout;
14  enlIteration=0; // having two of these is silly, but simple
15  ekeIteration=0;
16  energyExpected=_numEnergyInputs;
17  ENL=EKE=0.0;
18  countENL=countEKE=0;
19 }
20 void ENL_EKE_Collector::printENL()
21 {
22 
23  fprintf(temperScreenFile,"[%d] ENL = %5.8lf\n", enlIteration++, ENL/(double) energyExpected); // tell the world
24  ENL=0;
25  countENL=0;
26 }
27 void ENL_EKE_Collector::printEKE()
28 {
29  fprintf(temperScreenFile,"Iter [%d] EKE = %5.8lf\n", ekeIteration++, EKE/(double) energyExpected);
30  countEKE=0;
31  EKE=0;
32 }
33 
34 void ENL_EKE_Collector::acceptENL(double _enl)
35 {
36  countENL++;
37  ENL+=_enl;
38  if(countENL==energyExpected) printENL();
39 }
40 void ENL_EKE_Collector::acceptEKE(double _eke)
41 {
42  countEKE++;
43  EKE+=_eke;
44  if(countEKE==energyExpected) printEKE();
45 }
46 
47 
48 #include "ENL_EKE_Collector.def.h"
FILE * openScreenfWrite(const char *dirnameBase, const char *fname, int temper, int bead, bool beadfile)
this stuff is in a C file because multiple includes of .def will give you too many implementations of...
Definition: util.C:2479