MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

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.

Definition at line 38 of file Statistics.h.

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

39 {
40  if (argc > 1 && strcmp(argv[1], "-help"))
41  std::cout << std::endl << "Get statistics for " << argv[1] << std::endl;
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  std::cerr << "stattype unknown" << std::endl;
80  exit(-1);
81  }
82  }
83  }
84  if (T == XY)
85  { // averaging in z-direction
86  std::cout << "averaging in z-direction" << std::endl;
87  StatisticsVector<XY> stats(argc, argv);
88  stats.setDoPeriodicWalls(false);
89  stats.statistics_from_fstat_and_data();
90  }
91  else if (T == XZ)
92  { // averaging in y-direction
93  std::cout << "averaging in y-direction" << std::endl;
94  StatisticsVector<XZ> stats(argc, argv);
95  stats.setDoPeriodicWalls(false);
96  stats.statistics_from_fstat_and_data();
97  }
98  else if (T == YZ)
99  { // averaging in x-direction
100  std::cout << "averaging in x-direction" << std::endl;
101  StatisticsVector<YZ> stats(argc, argv);
102  stats.setDoPeriodicWalls(false);
103  stats.statistics_from_fstat_and_data();
104  }
105  else if (T == X)
106  { // averaging in yz-direction
107  std::cout << "averaging in yz-direction" << std::endl;
108  StatisticsVector<X> stats(argc, argv);
109  stats.setDoPeriodicWalls(false);
110  stats.statistics_from_fstat_and_data();
111  }
112  else if (T == Y)
113  { // averaging in yz-direction
114  std::cout << "averaging in xz-direction" << std::endl;
115  StatisticsVector<Y> stats(argc, argv);
116  stats.setDoPeriodicWalls(false);
117  stats.statistics_from_fstat_and_data();
118  }
119  else if (T == Z)
120  { // averaging in yz-direction
121  std::cout << "averaging in xy-direction" << std::endl;
122  StatisticsVector<Z> stats(argc, argv);
123  stats.setDoPeriodicWalls(false);
124  stats.statistics_from_fstat_and_data();
125  }
126  else if (T == O)
127  { // averaging in all directions
128  std::cout << "averaging in xyz-direction" << std::endl;
129  StatisticsVector<O> stats(argc, argv);
130  stats.setDoPeriodicWalls(false);
131  stats.statistics_from_fstat_and_data();
132  }
133  else if (T == RAZ)
134  { //no averaging
135  std::cout << "cylindrical, no averaging" << std::endl;
136  StatisticsVector<RAZ> stats(argc, argv);
137  stats.statistics_from_fstat_and_data();
138  }
139  else if (T == RA)
140  { //no averaging
141  std::cout << "cylindrical, Z averaging" << std::endl;
142  StatisticsVector<RA> stats(argc, argv);
143  stats.statistics_from_fstat_and_data();
144  }
145  else if (T == RZ)
146  { //no averaging
147  std::cout << "cylindrical, A averaging" << std::endl;
148  StatisticsVector<RZ> stats(argc, argv);
149  stats.statistics_from_fstat_and_data();
150  }
151  else if (T == AZ)
152  { //no averaging
153  std::cout << "cylindrical, R averaging" << std::endl;
154  StatisticsVector<AZ> stats(argc, argv);
155  stats.statistics_from_fstat_and_data();
156  }
157  else if (T == A)
158  { //no averaging
159  std::cout << "cylindrical, RZ averaging" << std::endl;
160  StatisticsVector<A> stats(argc, argv);
161  stats.statistics_from_fstat_and_data();
162  }
163  else if (T == R)
164  { //no averaging
165  std::cout << "cylindrical, AZ averaging" << std::endl;
166  StatisticsVector<R> stats(argc, argv);
167  stats.statistics_from_fstat_and_data();
168  }
169  else if (T == XYZ)
170  { //no averaging
171  std::cout << "no spatial averaging" << std::endl;
172  StatisticsVector<XYZ> stats(argc, argv);
173  stats.statistics_from_fstat_and_data();
174  }
175 
176 }
StatType
Creates averaged statistics (only valid if density field is homogenous along averaged direction) ...
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
This class is used to extract statistical data from MD simulations.