MercuryDPM  Alpha
 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-2014, 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 #include "StatisticsVector.h"
29 
34 void Statistics(unsigned int argc, char *argv[])
35 {
36 
37  if (argc > 1 && strcmp(argv[1], "-help"))
38  std::cout << std::endl << "Get statistics for " << argv[1] << std::endl;
39 
40  //check for '-stattype' option
41  StatType T = XYZ;
42  for (unsigned int i = 2; i < argc; i++)
43  {
44  if (!strcmp(argv[i], "-stattype")||!strcmp(argv[i], "-statType"))
45  {
46  if (!strcmp(argv[i + 1], "XYZ"))
47  T = XYZ;
48  else if (!strcmp(argv[i + 1], "RAZ"))
49  T = RAZ;
50  else if (!strcmp(argv[i + 1], "RA"))
51  T = RA;
52  else if (!strcmp(argv[i + 1], "RZ"))
53  T = RZ;
54  else if (!strcmp(argv[i + 1], "AZ"))
55  T = AZ;
56  else if (!strcmp(argv[i + 1], "R"))
57  T = R;
58  else if (!strcmp(argv[i + 1], "A"))
59  T = A;
60  else if (!strcmp(argv[i + 1], "XY"))
61  T = XY;
62  else if (!strcmp(argv[i + 1], "XZ"))
63  T = XZ;
64  else if (!strcmp(argv[i + 1], "YZ"))
65  T = YZ;
66  else if (!strcmp(argv[i + 1], "X"))
67  T = X;
68  else if (!strcmp(argv[i + 1], "Y"))
69  T = Y;
70  else if (!strcmp(argv[i + 1], "Z"))
71  T = Z;
72  else if (!strcmp(argv[i + 1], "O"))
73  T = O;
74  else
75  {
76  std::cerr << "stattype unknown" << std::endl;
77  exit(-1);
78  }
79  }
80  }
81  if (T == XY)
82  { // averaging in z-direction
83  std::cout << "averaging in z-direction" << std::endl;
84  StatisticsVector<XY> stats(argc, argv);
85  stats.setDoPeriodicWalls(false);
87  }
88  else if (T == XZ)
89  { // averaging in y-direction
90  std::cout << "averaging in y-direction" << std::endl;
91  StatisticsVector<XZ> stats(argc, argv);
92  //std::cout << "Hello" << std::endl;
93  stats.setDoPeriodicWalls(false);
95  }
96  else if (T == YZ)
97  { // averaging in x-direction
98  std::cout << "averaging in x-direction" << std::endl;
99  StatisticsVector<YZ> stats(argc, argv);
100  stats.setDoPeriodicWalls(false);
102  }
103  else if (T == X)
104  { // averaging in yz-direction
105  std::cout << "averaging in yz-direction" << std::endl;
106  StatisticsVector<X> stats(argc, argv);
107  stats.setDoPeriodicWalls(false);
109  }
110  else if (T == Y)
111  { // averaging in yz-direction
112  std::cout << "averaging in xz-direction" << std::endl;
113  StatisticsVector<Y> stats(argc, argv);
114  stats.setDoPeriodicWalls(false);
116  }
117  else if (T == Z)
118  { // averaging in yz-direction
119  std::cout << "averaging in xy-direction" << std::endl;
120  StatisticsVector<Z> stats(argc, argv);
121  stats.setDoPeriodicWalls(false);
123  }
124  else if (T == O)
125  { // averaging in all directions
126  std::cout << "averaging in xyz-direction" << std::endl;
127  StatisticsVector<O> stats(argc, argv);
128  stats.setDoPeriodicWalls(false);
130  }
131  else if (T == RAZ)
132  { //no averaging
133  std::cout << "cylindrical, no averaging" << std::endl;
134  StatisticsVector<RAZ> stats(argc, argv);
136  }
137  else if (T == RA)
138  { //no averaging
139  std::cout << "cylindrical, Z averaging" << std::endl;
140  StatisticsVector<RA> stats(argc, argv);
142  }
143  else if (T == RZ)
144  { //no averaging
145  std::cout << "cylindrical, A averaging" << std::endl;
146  StatisticsVector<RZ> stats(argc, argv);
148  }
149  else if (T == AZ)
150  { //no averaging
151  std::cout << "cylindrical, R averaging" << std::endl;
152  StatisticsVector<AZ> stats(argc, argv);
154  }
155  else if (T == A)
156  { //no averaging
157  std::cout << "cylindrical, RZ averaging" << std::endl;
158  StatisticsVector<A> stats(argc, argv);
160  }
161  else if (T == R)
162  { //no averaging
163  std::cout << "cylindrical, AZ averaging" << std::endl;
164  StatisticsVector<R> stats(argc, argv);
166  }
167  else if (T == XYZ)
168  { //no averaging
169  std::cout << "no averaging" << std::endl;
170  StatisticsVector<XYZ> stats(argc, argv);
172  }
173 
174 }
175 
176 #endif
177 
StatType
Creates averaged statistics (only valid if density field is homogenous along averaged direction) ...
void setDoPeriodicWalls(bool new_)
void statistics_from_fstat_and_data()
get StatisticsPoint
This class is used to extract statistical data from MD simulations.
void Statistics(unsigned int argc, char *argv[])
this is the function the user should call
Definition: Statistics.h:34