MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Statistics.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, 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  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);
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);
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);
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);
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);
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);
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);
132  }
133  else if (T == RAZ)
134  { //no averaging
135  std::cout << "cylindrical, no averaging" << std::endl;
136  StatisticsVector<RAZ> stats(argc, argv);
138  }
139  else if (T == RA)
140  { //no averaging
141  std::cout << "cylindrical, Z averaging" << std::endl;
142  StatisticsVector<RA> stats(argc, argv);
144  }
145  else if (T == RZ)
146  { //no averaging
147  std::cout << "cylindrical, A averaging" << std::endl;
148  StatisticsVector<RZ> stats(argc, argv);
150  }
151  else if (T == AZ)
152  { //no averaging
153  std::cout << "cylindrical, R averaging" << std::endl;
154  StatisticsVector<AZ> stats(argc, argv);
156  }
157  else if (T == A)
158  { //no averaging
159  std::cout << "cylindrical, RZ averaging" << std::endl;
160  StatisticsVector<A> stats(argc, argv);
162  }
163  else if (T == R)
164  { //no averaging
165  std::cout << "cylindrical, AZ averaging" << std::endl;
166  StatisticsVector<R> stats(argc, argv);
168  }
169  else if (T == XYZ)
170  { //no averaging
171  std::cout << "no spatial averaging" << std::endl;
172  StatisticsVector<XYZ> stats(argc, argv);
174  }
175 
176 }
177 
178 #endif
179 
void Statistics(int argc, char *argv[])
This is the function that the user should call for statistics (CG).
Definition: Statistics.h:38
StatType
Creates averaged statistics (only valid if density field is homogenous along averaged direction) ...
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
void setDoPeriodicWalls(bool new_)
void statistics_from_fstat_and_data()
get StatisticsPoint
This class is used to extract statistical data from MD simulations.