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.

18 {
19  if (argc > 1 && strcmp(argv[1], "-help"))
20  logger(INFO, "\nGet statistics for %", argv[1]);
21 
22  /* Check for the '-stattype' flag */
23  StatType T = O; //default value
24  for (unsigned int i = 2; i < argc; i++)
25  {
26  if (!strcmp(argv[i], "-stattype") || !strcmp(argv[i], "-statType"))
27  {
28  if (!strcmp(argv[i + 1], "XYZ"))
29  T = XYZ;
30  else if (!strcmp(argv[i + 1], "RAZ"))
31  T = RAZ;
32  else if (!strcmp(argv[i + 1], "RA"))
33  T = RA;
34  else if (!strcmp(argv[i + 1], "RZ"))
35  T = RZ;
36  else if (!strcmp(argv[i + 1], "AZ"))
37  T = AZ;
38  else if (!strcmp(argv[i + 1], "R"))
39  T = R;
40  else if (!strcmp(argv[i + 1], "A"))
41  T = A;
42  else if (!strcmp(argv[i + 1], "XY"))
43  T = XY;
44  else if (!strcmp(argv[i + 1], "XZ"))
45  T = XZ;
46  else if (!strcmp(argv[i + 1], "YZ"))
47  T = YZ;
48  else if (!strcmp(argv[i + 1], "X"))
49  T = X;
50  else if (!strcmp(argv[i + 1], "Y"))
51  T = Y;
52  else if (!strcmp(argv[i + 1], "Z"))
53  T = Z;
54  else if (!strcmp(argv[i + 1], "O"))
55  T = O;
56  else
57  {
58  logger(ERROR, "stattype unknown");
59  }
60  }
61  }
62  if (T == XY)
63  { // averaging in z-direction
64  logger(INFO, "averaging in z-direction");
65  StatisticsVector<XY> stats(argc, argv);
66  stats.setDoPeriodicWalls(false);
67  stats.statistics_from_fstat_and_data();
68  }
69  else if (T == XZ)
70  { // averaging in y-direction
71  logger(INFO, "averaging in y-direction");
72  StatisticsVector<XZ> stats(argc, argv);
73  stats.setDoPeriodicWalls(false);
74  stats.statistics_from_fstat_and_data();
75  }
76  else if (T == YZ)
77  { // averaging in x-direction
78  logger(INFO, "averaging in x-direction");
79  StatisticsVector<YZ> stats(argc, argv);
80  stats.setDoPeriodicWalls(false);
81  stats.statistics_from_fstat_and_data();
82  }
83  else if (T == X)
84  { // averaging in yz-direction
85  logger(INFO, "averaging in yz-direction");
86  StatisticsVector<X> stats(argc, argv);
87  stats.setDoPeriodicWalls(false);
88  stats.statistics_from_fstat_and_data();
89  }
90  else if (T == Y)
91  { // averaging in yz-direction
92  logger(INFO, "averaging in xz-direction");
93  StatisticsVector<Y> stats(argc, argv);
94  stats.setDoPeriodicWalls(false);
95  stats.statistics_from_fstat_and_data();
96  }
97  else if (T == Z)
98  { // averaging in yz-direction
99  logger(INFO, "averaging in xy-direction");
100  StatisticsVector<Z> stats(argc, argv);
101  stats.setDoPeriodicWalls(false);
102  stats.statistics_from_fstat_and_data();
103  }
104  else if (T == O)
105  { // averaging in all directions
106  logger(INFO, "averaging in xyz-direction");
107  StatisticsVector<O> stats(argc, argv);
108  stats.setDoPeriodicWalls(false);
109  stats.statistics_from_fstat_and_data();
110  }
111  else if (T == RAZ)
112  { //no averaging
113  logger(INFO, "cylindrical, no averaging");
114  StatisticsVector<RAZ> stats(argc, argv);
115  stats.statistics_from_fstat_and_data();
116  }
117  else if (T == RA)
118  { //no averaging
119  logger(INFO, "cylindrical, Z averaging");
120  StatisticsVector<RA> stats(argc, argv);
121  stats.statistics_from_fstat_and_data();
122  }
123  else if (T == RZ)
124  { //no averaging
125  logger(INFO, "cylindrical, A averaging");
126  StatisticsVector<RZ> stats(argc, argv);
127  stats.statistics_from_fstat_and_data();
128  }
129  else if (T == AZ)
130  { //no averaging
131  logger(INFO, "cylindrical, R averaging");
132  StatisticsVector<AZ> stats(argc, argv);
133  stats.statistics_from_fstat_and_data();
134  }
135  else if (T == A)
136  { //no averaging
137  logger(INFO, "cylindrical, RZ averaging");
138  StatisticsVector<A> stats(argc, argv);
139  stats.statistics_from_fstat_and_data();
140  }
141  else if (T == R)
142  { //no averaging
143  logger(INFO, "cylindrical, AZ averaging");
144  StatisticsVector<R> stats(argc, argv);
145  stats.statistics_from_fstat_and_data();
146  }
147  else if (T == XYZ)
148  { //no averaging
149  logger(INFO, "no spatial averaging");
150  StatisticsVector<XYZ> stats(argc, argv);
151  stats.statistics_from_fstat_and_data();
152  }
153 
154 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
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:32
StatType
Creates averaged statistics (only valid if density field is homogenous along averaged direction)
Definition: StatisticsVector.h:20
@ AZ
Definition: StatisticsVector.h:21
@ XY
Definition: StatisticsVector.h:21
@ XZ
Definition: StatisticsVector.h:21
@ R
Definition: StatisticsVector.h:21
@ RA
Definition: StatisticsVector.h:21
@ YZ
Definition: StatisticsVector.h:21
@ XYZ
Definition: StatisticsVector.h:21
@ RAZ
Definition: StatisticsVector.h:21
@ RZ
Definition: StatisticsVector.h:21
@ O
Definition: StatisticsVector.h:21
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:47
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
This class is used to extract statistical data from MD simulations.
Definition: StatisticsVector.h:41
#define X
Definition: icosphere.cpp:20
#define Z
Definition: icosphere.cpp:21
#define INFO(i)
Definition: mumps_solver.h:54
const char Y
Definition: test/EulerAngles.cpp:32

References AZ, ERROR, 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().