Statistics.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2023, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef STATISTICS_H
27 #define STATISTICS_H
28 
29 #include "StatisticsVector.h"
30 
38 void Statistics(int argc, char* argv[])
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);
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);
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);
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);
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);
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);
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);
131  }
132  else if (T == RAZ)
133  { //no averaging
134  logger(INFO, "cylindrical, no averaging");
135  StatisticsVector<RAZ> stats(argc, argv);
137  }
138  else if (T == RA)
139  { //no averaging
140  logger(INFO, "cylindrical, Z averaging");
141  StatisticsVector<RA> stats(argc, argv);
143  }
144  else if (T == RZ)
145  { //no averaging
146  logger(INFO, "cylindrical, A averaging");
147  StatisticsVector<RZ> stats(argc, argv);
149  }
150  else if (T == AZ)
151  { //no averaging
152  logger(INFO, "cylindrical, R averaging");
153  StatisticsVector<AZ> stats(argc, argv);
155  }
156  else if (T == A)
157  { //no averaging
158  logger(INFO, "cylindrical, RZ averaging");
159  StatisticsVector<A> stats(argc, argv);
161  }
162  else if (T == R)
163  { //no averaging
164  logger(INFO, "cylindrical, AZ averaging");
165  StatisticsVector<R> stats(argc, argv);
167  }
168  else if (T == XYZ)
169  { //no averaging
170  logger(INFO, "no spatial averaging");
171  StatisticsVector<XYZ> stats(argc, argv);
173  }
174 
175 }
176 
177 #endif
178 
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
void Statistics(int argc, char *argv[])
This is the function that the user should call for statistics (CG).
Definition: Statistics.h:38
This class is used to extract statistical data from MD simulations.
Definition: StatisticsVector.h:62
void setDoPeriodicWalls(bool new_)
Definition: StatisticsVector.h:563
void statistics_from_fstat_and_data()
get StatisticsPoint
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51