Statistics.h File Reference
#include "StatisticsVector.h"

Go to the source code of this file.

Functions

void Statistics (int argc, char *argv[])
 This is the function that the user should call for statistics (CG). More...
 

Function Documentation

◆ Statistics()

void Statistics ( int  argc,
char argv[] 
)

This is the function that the user should call for statistics (CG).

This function offers an interface to the templated class StatisticsVector. It picks the correct StatType template from the user-specified flag. The other flags are processed by StatisticsVector.

39 {
40  if (argc > 1 && strcmp(argv[1], "-help"))
41  logger(INFO, "\nGet statistics for %", argv[1]);
42 
43  /* Check for the '-stattype' flag */
44  StatType T = O; //default value
45  for (unsigned int i = 2; i < argc; i++)
46  {
47  if (!strcmp(argv[i], "-stattype") || !strcmp(argv[i], "-statType"))
48  {
49  if (!strcmp(argv[i + 1], "XYZ"))
50  T = XYZ;
51  else if (!strcmp(argv[i + 1], "RAZ"))
52  T = RAZ;
53  else if (!strcmp(argv[i + 1], "RA"))
54  T = RA;
55  else if (!strcmp(argv[i + 1], "RZ"))
56  T = RZ;
57  else if (!strcmp(argv[i + 1], "AZ"))
58  T = AZ;
59  else if (!strcmp(argv[i + 1], "R"))
60  T = R;
61  else if (!strcmp(argv[i + 1], "A"))
62  T = A;
63  else if (!strcmp(argv[i + 1], "XY"))
64  T = XY;
65  else if (!strcmp(argv[i + 1], "XZ"))
66  T = XZ;
67  else if (!strcmp(argv[i + 1], "YZ"))
68  T = YZ;
69  else if (!strcmp(argv[i + 1], "X"))
70  T = X;
71  else if (!strcmp(argv[i + 1], "Y"))
72  T = Y;
73  else if (!strcmp(argv[i + 1], "Z"))
74  T = Z;
75  else if (!strcmp(argv[i + 1], "O"))
76  T = O;
77  else
78  {
79  logger(ERROR, "stattype unknown");
80  }
81  }
82  }
83  if (T == XY)
84  { // averaging in z-direction
85  logger(INFO, "averaging in z-direction");
86  StatisticsVector<XY> stats(argc, argv);
87  stats.setDoPeriodicWalls(false);
88  stats.statistics_from_fstat_and_data();
89  }
90  else if (T == XZ)
91  { // averaging in y-direction
92  logger(INFO, "averaging in y-direction");
93  StatisticsVector<XZ> stats(argc, argv);
94  stats.setDoPeriodicWalls(false);
95  stats.statistics_from_fstat_and_data();
96  }
97  else if (T == YZ)
98  { // averaging in x-direction
99  logger(INFO, "averaging in x-direction");
100  StatisticsVector<YZ> stats(argc, argv);
101  stats.setDoPeriodicWalls(false);
102  stats.statistics_from_fstat_and_data();
103  }
104  else if (T == X)
105  { // averaging in yz-direction
106  logger(INFO, "averaging in yz-direction");
107  StatisticsVector<X> stats(argc, argv);
108  stats.setDoPeriodicWalls(false);
109  stats.statistics_from_fstat_and_data();
110  }
111  else if (T == Y)
112  { // averaging in yz-direction
113  logger(INFO, "averaging in xz-direction");
114  StatisticsVector<Y> stats(argc, argv);
115  stats.setDoPeriodicWalls(false);
116  stats.statistics_from_fstat_and_data();
117  }
118  else if (T == Z)
119  { // averaging in yz-direction
120  logger(INFO, "averaging in xy-direction");
121  StatisticsVector<Z> stats(argc, argv);
122  stats.setDoPeriodicWalls(false);
123  stats.statistics_from_fstat_and_data();
124  }
125  else if (T == O)
126  { // averaging in all directions
127  logger(INFO, "averaging in xyz-direction");
128  StatisticsVector<O> stats(argc, argv);
129  stats.setDoPeriodicWalls(false);
130  stats.statistics_from_fstat_and_data();
131  }
132  else if (T == RAZ)
133  { //no averaging
134  logger(INFO, "cylindrical, no averaging");
135  StatisticsVector<RAZ> stats(argc, argv);
136  stats.statistics_from_fstat_and_data();
137  }
138  else if (T == RA)
139  { //no averaging
140  logger(INFO, "cylindrical, Z averaging");
141  StatisticsVector<RA> stats(argc, argv);
142  stats.statistics_from_fstat_and_data();
143  }
144  else if (T == RZ)
145  { //no averaging
146  logger(INFO, "cylindrical, A averaging");
147  StatisticsVector<RZ> stats(argc, argv);
148  stats.statistics_from_fstat_and_data();
149  }
150  else if (T == AZ)
151  { //no averaging
152  logger(INFO, "cylindrical, R averaging");
153  StatisticsVector<AZ> stats(argc, argv);
154  stats.statistics_from_fstat_and_data();
155  }
156  else if (T == A)
157  { //no averaging
158  logger(INFO, "cylindrical, RZ averaging");
159  StatisticsVector<A> stats(argc, argv);
160  stats.statistics_from_fstat_and_data();
161  }
162  else if (T == R)
163  { //no averaging
164  logger(INFO, "cylindrical, AZ averaging");
165  StatisticsVector<R> stats(argc, argv);
166  stats.statistics_from_fstat_and_data();
167  }
168  else if (T == XYZ)
169  { //no averaging
170  logger(INFO, "no spatial averaging");
171  StatisticsVector<XYZ> stats(argc, argv);
172  stats.statistics_from_fstat_and_data();
173  }
174 
175 }
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
LL< Log::ERROR > ERROR
Error log level.
Definition: Logger.cc:53
StatType
Creates averaged statistics (only valid if density field is homogenous along averaged direction)
Definition: StatisticsVector.h:41
@ AZ
Definition: StatisticsVector.h:42
@ XY
Definition: StatisticsVector.h:42
@ XZ
Definition: StatisticsVector.h:42
@ R
Definition: StatisticsVector.h:42
@ RA
Definition: StatisticsVector.h:42
@ YZ
Definition: StatisticsVector.h:42
@ A
Definition: StatisticsVector.h:42
@ Y
Definition: StatisticsVector.h:42
@ X
Definition: StatisticsVector.h:42
@ Z
Definition: StatisticsVector.h:42
@ XYZ
Definition: StatisticsVector.h:42
@ RAZ
Definition: StatisticsVector.h:42
@ RZ
Definition: StatisticsVector.h:42
@ O
Definition: StatisticsVector.h:42
This class is used to extract statistical data from MD simulations.
Definition: StatisticsVector.h:62
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51

References A, AZ, ERROR, constants::i, INFO, logger, O, R, RA, RAZ, RZ, StatisticsVector< T >::setDoPeriodicWalls(), StatisticsVector< T >::statistics_from_fstat_and_data(), X, XY, XYZ, XZ, Y, YZ, and Z.

Referenced by main().