p4statistics.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 (argc>1&&strcmp(argv[1],"-help") != 0)
17  logger(INFO, "Get statistics from %.* files", argv[1]);
18 
19  //check for '-stattype' option
20  StatType T = XYZ;
21  for (int i = 2; i<argc; i++) {
22  if (!strcmp(argv[i],"-stattype")) {
23  if (!strcmp(argv[i+1],"XYZ")) T = XYZ;
24  else if (!strcmp(argv[i+1],"RAZ")) T = RAZ;
25  else if (!strcmp(argv[i+1],"RA")) T = RA;
26  else if (!strcmp(argv[i+1],"RZ")) T = RZ;
27  else if (!strcmp(argv[i+1],"AZ")) T = AZ;
28  else if (!strcmp(argv[i+1],"R")) T = R;
29  else if (!strcmp(argv[i+1],"A")) T = A;
30  else if (!strcmp(argv[i+1],"YZ")) T = YZ;
31  else if (!strcmp(argv[i+1],"XZ")) T = XZ;
32  else if (!strcmp(argv[i+1],"XY")) T = XY;
33  else if (!strcmp(argv[i+1],"X")) T = X;
34  else if (!strcmp(argv[i+1],"Y")) T = Y;
35  else if (!strcmp(argv[i + 1], "Z")) T = Z;
36  else if (!strcmp(argv[i + 1], "O")) T = O;
37  else
38  {
39  logger(ERROR, "stattype unknown");
40  }
41  }
42  }
43  if (T==XY) { // averaging in z-direction
44  logger(INFO, "Creating xy-statistics, averaged in z");
45  StatisticsVector<XY> stats(argc, argv);
46  stats.setDoPeriodicWalls(false);
47  stats.statistics_from_p3();
48  } else if (T==XZ) { // averaging in y-direction
49  logger(INFO, "Creating xz-statistics, averaged in y");
50  StatisticsVector<XZ> stats(argc, argv);
51  stats.setDoPeriodicWalls(false);
52  stats.statistics_from_p3();
53  } else if (T==YZ) { // averaging in x-direction
54  logger(INFO, "Creating yz-statistics, averaged in x");
55  StatisticsVector<YZ> stats(argc, argv);
56  stats.setDoPeriodicWalls(false);
57  stats.statistics_from_p3();
58  } else if (T==X) { // averaging in yz-direction
59  logger(INFO, "Creating x-statistics, averaged in yz");
60  StatisticsVector<X> stats(argc, argv);
61  stats.setDoPeriodicWalls(false);
62  stats.statistics_from_p3();
63  } else if (T==Y) { // averaging in yz-direction
64  logger(INFO, "Creating y-statistics, averaged in xz");
65  StatisticsVector<Y> stats(argc, argv);
66  stats.setDoPeriodicWalls(false);
67  stats.statistics_from_p3();
68  } else if (T==Z) { // averaging in yz-direction
69  logger(INFO, "Creating z-statistics, averaged in xy");
70  StatisticsVector<Z> stats(argc, argv);
71  stats.setDoPeriodicWalls(false);
72  stats.statistics_from_p3();
73  } else if (T==O) { // averaging in all directions
74  logger(INFO, "Creating global statistics, averaged in xyz");
75  StatisticsVector<O> stats(argc, argv);
76  stats.setDoPeriodicWalls(false);
77  stats.statistics_from_p3();
78 // } else if (T==RAZ) { //no averaging
79 // std::cout << "cylindrical, no averaging" << std::endl;
80 // StatisticsVector<RAZ> stats(argc, argv);
81 // stats.statistics_from_p3();
82 // } else if (T==RA) { //no averaging
83 // std::cout << "cylindrical, Z averaging" << std::endl;
84 // StatisticsVector<RA> stats(argc, argv);
85 // stats.statistics_from_p3();
86 // } else if (T==RZ) { //no averaging
87 // std::cout << "cylindrical, A averaging" << std::endl;
88 // StatisticsVector<RZ> stats(argc, argv);
89 // stats.statistics_from_p3();
90 // } else if (T==AZ) { //no averaging
91 // std::cout << "cylindrical, R averaging" << std::endl;
92 // StatisticsVector<AZ> stats(argc, argv);
93 // stats.statistics_from_p3();
94 // } else if (T==A) { //no averaging
95 // std::cout << "cylindrical, RZ averaging" << std::endl;
96 // StatisticsVector<A> stats(argc, argv);
97 // stats.statistics_from_p3();
98 // } else if (T==R) { //no averaging
99 // std::cout << "cylindrical, AZ averaging" << std::endl;
100 // StatisticsVector<R> stats(argc, argv);
101 // stats.statistics_from_p3();
102  }
103  else if (T == XYZ)
104  { //no averaging
105  logger(INFO, "Creating non-averaged statistics");
106  StatisticsVector<XYZ> stats(argc, argv);
107  //std::cout << "stats" << std::endl;
108  stats.statistics_from_p3();
109  }
110  else
111  {
112  logger(ERROR, "stattype not found");
113  }
114  return 0;
115 }
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.