p3statistics.cpp File Reference
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <sstream>
#include "StatisticsVector.h"

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

This code (p3dstatistics.cpp) can be used to create statistics from p3d files. It is a modified version of fstatistics.cpp

14  {
15 
16  // if no argument is provided
17  if (argc==1) {
18  logger(ERROR,"No arguments; use p3statistics.exe filename [-options]");
19  }
20  else {
21  // if you don't use the -help argument and if at least one argument is given
22  if (strcmp(argv[1],"-help") != 0)
23  logger(INFO,"Getting statistics from %.p3* (or .p4*) files ...",argv[1]);
24  }
25 
26 
27 
28  //check for '-stattype' option
29  StatType T = XYZ;
30  for (int i = 2; i<argc; i++) {
31  if (!strcmp(argv[i],"-stattype")) {
32  if (!strcmp(argv[i+1],"XYZ")) T = XYZ;
33  else if (!strcmp(argv[i+1],"RAZ")) T = RAZ;
34  else if (!strcmp(argv[i+1],"RA")) T = RA;
35  else if (!strcmp(argv[i+1],"RZ")) T = RZ;
36  else if (!strcmp(argv[i+1],"AZ")) T = AZ;
37  else if (!strcmp(argv[i+1],"R")) T = R;
38  else if (!strcmp(argv[i+1],"A")) T = A;
39  else if (!strcmp(argv[i+1],"YZ")) T = YZ;
40  else if (!strcmp(argv[i+1],"XZ")) T = XZ;
41  else if (!strcmp(argv[i+1],"XY")) T = XY;
42  else if (!strcmp(argv[i+1],"X")) T = X;
43  else if (!strcmp(argv[i+1],"Y")) T = Y;
44  else if (!strcmp(argv[i+1],"Z")) T = Z;
45  else if (!strcmp(argv[i+1],"O")) T = O;
46  else {
47  logger(ERROR,"Stattype unknown");
48  }
49  }
50  }
51  logger(INFO,"stattype %",T);
52 
53  if (T==XY) { // averaging in z-direction
54  StatisticsVector<XY> stats(argc, argv);
55  } else if (T==XZ) { // averaging in y-direction
56  StatisticsVector<XZ> stats(argc, argv);
57  stats.setDoPeriodicWalls(false);
58  stats.statistics_from_p3();
59  } else if (T==YZ) { // averaging in x-direction
60  StatisticsVector<YZ> stats(argc, argv);
61  stats.setDoPeriodicWalls(false);
62  stats.statistics_from_p3();
63  } else if (T==X) { // averaging in yz-direction
64  StatisticsVector<X> stats(argc, argv);
65  stats.setDoPeriodicWalls(false);
66  stats.statistics_from_p3();
67  } else if (T==Y) { // averaging in yz-direction
68  StatisticsVector<Y> stats(argc, argv);
69  stats.setDoPeriodicWalls(false);
70  stats.statistics_from_p3();
71  } else if (T==Z) { // averaging in yz-direction
72  StatisticsVector<Z> stats(argc, argv);
73  stats.setDoPeriodicWalls(false);
74  stats.statistics_from_p3();
75  } else if (T==O) { // averaging in all directions
76  StatisticsVector<O> stats(argc, argv);
77  stats.setDoPeriodicWalls(false);
78  stats.statistics_from_p3();
79  } else if (T==XYZ) { //no averaging
80  StatisticsVector<XYZ> stats(argc, argv);
81  stats.statistics_from_p3();
82  } else {
83  logger(ERROR,"stattype not found");
84  }
85 
86  return 0;
87 }
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
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_p3(), X, XY, XYZ, XZ, Y, YZ, and Z.