MercuryCG.cpp File Reference

Functions

template<template< class, template< class > class, class > class CGType, template< class > class BaseFunction, class Fields >
void addObject (CGHandler &cg, std::string coordinate)
 
template<template< class > class BaseFunction, class Fields >
void addObject (CGHandler &cg, std::string typeOrig, std::string coordinate)
 
template<class Fields >
void addObject (CGHandler &cg, std::string type, std::string coordinate, std::string function)
 
BaseCGaddObject (CGHandler &cg, std::string type, std::string coordinate, std::string function, std::string fieldsOrig)
 
void commandLineCG (Mercury3D &dpm, int argc, char **argv)
 
int main (int argc, char *argv[])
 MercuryCG is the postprocessing tool for extracting coarse-grained fields from particle data. See MercuryCG: Post-processing discrete particle data using the coarse-graining formulation (in development) for details. More...
 

Function Documentation

◆ addObject() [1/4]

template<template< class, template< class > class, class > class CGType, template< class > class BaseFunction, class Fields >
void addObject ( CGHandler cg,
std::string  coordinate 
)
40  {
41  if (coordinate == "O") {
42  cg.copyAndAddObject(CGType<CGCoordinates::O, BaseFunction, Fields>());
43  } else if (coordinate == "X") {
44  cg.copyAndAddObject(CGType<CGCoordinates::X, BaseFunction, Fields>());
45  } else if (coordinate == "Y") {
46  cg.copyAndAddObject(CGType<CGCoordinates::Y, BaseFunction, Fields>());
47  } else if (coordinate == "Z") {
48  cg.copyAndAddObject(CGType<CGCoordinates::Z, BaseFunction, Fields>());
49  } else if (coordinate == "XY") {
50  cg.copyAndAddObject(CGType<CGCoordinates::XY, BaseFunction, Fields>());
51  } else if (coordinate == "XZ") {
52  cg.copyAndAddObject(CGType<CGCoordinates::XZ, BaseFunction, Fields>());
53  } else if (coordinate == "YZ") {
54  cg.copyAndAddObject(CGType<CGCoordinates::YZ, BaseFunction, Fields>());
55  } else if (coordinate == "XYZ") {
56  cg.copyAndAddObject(CGType<CGCoordinates::XYZ, BaseFunction, Fields>());
57  } else {
58  logger(ERROR, "CGCoordinate % not understood; options are O,X,Y,Z,XY,XZ,YZ,XYZ", coordinate);
59  }
60 }
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
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:379

References ERROR, and logger.

Referenced by commandLineCG(), BaseHandler< T >::copyAndAddObject(), BaseHandler< T >::copyContentsFromOtherHandler(), and RotatingDrum::setupInitialConditions().

◆ addObject() [2/4]

template<class Fields >
void addObject ( CGHandler cg,
std::string  type,
std::string  coordinate,
std::string  function 
)
78  {
79  if (function == "Gauss") {
80  addObject<CGFunctions::Gauss, Fields>(cg, type, coordinate);
81  } else if (function == "Lucy") {
82  addObject<CGFunctions::Lucy, Fields>(cg, type, coordinate);
83  } else if (function == "Linear") {
84  addObject<CGFunctions::Linear, Fields>(cg, type, coordinate);
85  } else if (function == "Heaviside") {
86  addObject<CGFunctions::Heaviside, Fields>(cg, type, coordinate);
87  } else {
88  logger(ERROR, "CGFunction % not understood; options are Gauss, Lucy, Linear, Heaviside", function);
89  }
90 }

References ERROR, and logger.

◆ addObject() [3/4]

BaseCG* addObject ( CGHandler cg,
std::string  type,
std::string  coordinate,
std::string  function,
std::string  fieldsOrig 
)

Creates a CG-object with the template parameters and parent class specified by string arguments. The object is added to the cgHandler and a BaseCG pointer to it is returned. To obtain the right template parameters from the string arguments, a cascade of 4 functions is used (see above). Each function expresses one of the strings to a tempate parameter.

98  {
99  //change strings to lower case
100  std::string fields = fieldsOrig;
101  std::transform(fields.begin(), fields.end(), fields.begin(), ::tolower);
102  if (fields == "standardfields" || fields == "standard") {
103  addObject<CGFields::StandardFields>(cg, type, coordinate, function);
104  } else if (fields == "gradvelocityfield" || fields == "gradvelocity") {
105  addObject<CGFields::GradVelocityField>(cg, type, coordinate, function);
106  } else if (fields == "liquidmigrationfields" || fields == "liquidmigration") {
107  addObject<CGFields::LiquidMigrationFields>(cg, type, coordinate, function);
108  } else {
109  logger(ERROR, "CGFields % not understood; options are standard, gradVelocity, liquidMigration ", fieldsOrig);
110  }
111  return cg.getLastObject();
112 }
T * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:634

References ERROR, BaseHandler< T >::getLastObject(), and logger.

◆ addObject() [4/4]

template<template< class > class BaseFunction, class Fields >
void addObject ( CGHandler cg,
std::string  typeOrig,
std::string  coordinate 
)
63  {
64  std::string type = typeOrig;
65  std::transform(type.begin(), type.end(), type.begin(), ::tolower);
66  if (type == "cg") {
67  addObject<CG, BaseFunction, Fields>(cg, coordinate);
68  } else if (type == "timesmoothedcg") {
69  addObject<TimeSmoothedCG, BaseFunction, Fields>(cg, coordinate);
70  } else if (type == "timeaveragedcg") {
71  addObject<TimeAveragedCG, BaseFunction, Fields>(cg, coordinate);
72  } else {
73  logger(ERROR, "CGType % not understood; options are CG, TimeSmoothedCG, TimeAveragedCG", typeOrig);
74  }
75 }

References ERROR, and logger.

◆ commandLineCG()

void commandLineCG ( Mercury3D dpm,
int  argc,
char **  argv 
)

Creates an object in the cgHandler of the dpm class that satisfies the options specified by the command line arguments.

First, it checks if -help was specified. In this case, the help file is displayed, and the program exits.

Second, the correct type of CG object is determined, based on the following command line arguments: name, -coordinate, -function, -fields, -timeaverage, -timesmooth

Third, all other command line arguments are read and passed into the CG object.

125 {
126  //change options to lower case
127  for (unsigned i = 2; i < argc; i++) {
128  if (argv[i][0] == '-')
129  for (unsigned j = 1; j < strlen(argv[i]); ++j) {
130  argv[i][j] = tolower(argv[i][j]);
131  }
132  }
133 
134  //checks if if -help option was requested
135  for (unsigned i = 1; i < argc; i++)
136  if (!strcmp(argv[i], "-help")) {
137  helpers::more(std::string(argv[0]) + ".txt");
138  exit(-1);
139  }
140 
141  //coordinate
142  //Stores the CGCoordinate type.
143  //This variable is a template parameter of CG and needs to be specified by the argument -stattype
144  //If unspecified, it is set to default value O.
145  std::string coordinate = "O";
146  for (unsigned i = 1; i < argc; i++)
147  if (!strcmp(argv[i], "-coordinates") || !strcmp(argv[i], "-stattype")) {
148  coordinate = argv[i + 1];
149  logger(INFO, "Set CGCoordinates to %", coordinate);
150  }
151 
152  //function
153  //Stores the CGFunction type.
154  //This variable is a template parameter of CG and needs to be specified by the argument -cgtype
155  //If unspecified, it is set to default value Lucy.
156  std::string function = "Lucy";
157  for (unsigned i = 1; i < argc; i++)
158  if (!strcmp(argv[i], "-function") || !strcmp(argv[i], "-cgtype")) {
159  function = argv[i + 1];
160  logger(INFO, "Set CGFunction to %", function);
161  }
162 
163  //fields
164  //Stores the CGField type.
165  //This variable is a template parameter of CG and needs to be specified by the argument -function
166  //If unspecified, it is set to default value Standard.
167  std::string fields = "StandardFields";
168  for (unsigned i = 1; i < argc; i++)
169  if (!strcmp(argv[i], "-fields")) {
170  fields = argv[i + 1];
171  logger(INFO, "Set CGFields to %", fields);
172  }
173 
174  //type
175  //Determines the CG type (CG or TimeAveragedCG)
176  //It needs to be specified by the argument -timeAverage
177  //If unspecified, it is set to default value 'false'.
178  // take the 'T' off the coordinate name if time averaged
179  std::string type = "CG";
180  if (coordinate[0] == 'T') {
181  type = "TimeSmoothedCG";
182  coordinate = coordinate.substr(1);
183  }
184  for (unsigned i = 1; i < argc; i++)
185  if (!strcmp(argv[i], "-timeaverage")) {
186  type = "TimeAveragedCG";
187  logger(INFO, "Creating time-averaged CG");
188  } else if (!strcmp(argv[i], "-timeaveraging")) {
189  logger(ERROR, "% is not a valid argument; use -timeaverage instead",argv[i]);
190  }
191  for (unsigned i = 1; i < argc; i++)
192  if (!strcmp(argv[i], "-timesmooth")) {
193  type = "TimeSmoothedCG";
194  logger(INFO, "Activating time smoothing");
195  }
196 
197  //Now create the right CG object and a pointer to it
198  BaseCG *cg = addObject(dpm.cgHandler, type, coordinate, function, fields);
199 
200  //Reads the name of the file name to be restarted.
201  //This variable needs to be specified as the second argument ("./MercuryCG name ...")
202  //If unspecified, it is set to default value "Chain".
203  std::string name;
204  if (argc > 1 && argv[1][0] != '-') {
205  name = argv[1];
206  //logger(INFO, "Evaluating files %.*", name);
207  }
208  if (name.empty()) {
209  logger(ERROR, "Please enter a base name base name of the files to be analysed.\n"
210  "For more information, enter './MercuryCG -help'");
211  }
212 
213  //restarting from file
214  dpm.cgHandler.restart(name);
215 
216  //make sure no data is written; if data is written (e.g. using the -writedata option, the files will be overwritten, not appended)
217  //dpm.setFileType(FileType::NO_FILE);
218  dpm.setAppend(false);
219 
220  //set a default stat file name
221  cg->statFile.setName(dpm.getName() + ".stat");
222 
223  //set min/max, so h can be set
224  cg->setMin(dpm.getMin());
225  cg->setMax(dpm.getMax());
226 
227  // Now all other arguments are read
228  // find first argument that begins with '-'
229  unsigned i = 1;
230  while (i < argc && argv[i][0] != '-') i++;
231  //logger(INFO, "Reading argument % of %", i, argc);
232  // interpret arguments
233  for (; i < argc; i += 2) {
234  if (!strcmp(argv[i], "-w") || !strcmp(argv[i], "-width")) {
235  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
236  cg->setWidth(atof(argv[i + 1]));
237  logger(INFO, "Set cg width to %", cg->getWidth());
238 // } else if (!strcmp(argv[i], "-wt") || !strcmp(argv[i], "-widthTime")) {
239 // logger.assert_always(i+1<argc,"% requires argument",argv[i]);
240 // auto cgs = dynamic_cast<TimeSmoothedCG>(cg);
241 // cgs->setWidthTime(atof(argv[i + 1]));
242 // logger(INFO, "Set cg width to %", cg->getWidth());
243  } else if (!strcmp(argv[i], "-std")) {
244  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
245  cg->setStandardDeviation(atof(argv[i + 1]));
246  logger(INFO, "Set cg width to % (std %)", cg->getWidth(),atof(argv[i + 1]));
247  } else if (!strcmp(argv[i], "-verbose")) {
248  cg->setVerbose(true);
249  logger(INFO, "Verbose output");
250  ++i;
251  } else if (!strcmp(argv[i], "-averagebeyonddomain")) {
252  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
253  cg->setAverageBeyondDomain(atoi(argv[i + 1]));
254  logger(INFO, "Set averageBeyondDomain to %", argv[i + 1]);
255  } else if (!strcmp(argv[i], "-n")) {
256  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
257  cg->setN(atoi(argv[i + 1]));
258  logger(INFO, "Set n to %", argv[i + 1]);
259  } else if (!strcmp(argv[i], "-nx")) {
260  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
261  cg->setNX(atoi(argv[i + 1]));
262  logger(INFO, "Set nx to %", argv[i + 1]);
263  } else if (!strcmp(argv[i], "-ny")) {
264  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
265  cg->setNY(atoi(argv[i + 1]));
266  logger(INFO, "Set ny to %", argv[i + 1]);
267  } else if (!strcmp(argv[i], "-nz")) {
268  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
269  cg->setNZ(atoi(argv[i + 1]));
270  logger(INFO, "Set nz to %", argv[i + 1]);
271  } else if (!strcmp(argv[i], "-h")) {
272  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
273  cg->setH(atof(argv[i + 1]));
274  logger(INFO, "Set n to %x%x% for h=%", cg->getNX(), cg->getNY(), cg->getNZ(), argv[i + 1]);
275  } else if (!strcmp(argv[i], "-hx")) {
276  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
277  cg->setHX(atof(argv[i + 1]));
278  logger(INFO, "Set nx to % to satisfy hx=%", cg->getNX(), argv[i + 1]);
279  } else if (!strcmp(argv[i], "-hy")) {
280  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
281  cg->setHY(atof(argv[i + 1]));
282  logger(INFO, "Set ny to % to satisfy hy=%", cg->getNY(), argv[i + 1]);
283  } else if (!strcmp(argv[i], "-hz")) {
284  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
285  cg->setHZ(atof(argv[i + 1]));
286  logger(INFO, "Set nz to % to satisfy hz=%", cg->getNZ(), argv[i + 1]);
287  } else if (!strcmp(argv[i], "-x")) {
288  logger.assert_debug(i+2<argc,"% requires two arguments",argv[i]);
289  cg->setX(atof(argv[i + 1]), atof(argv[i + 2]));
290  logger(INFO, "Set x to (%,%)", argv[i + 1], argv[i + 2]);
291  ++i;
292  } else if (!strcmp(argv[i], "-y")) {
293  logger.assert_debug(i+2<argc,"% requires two arguments",argv[i]);
294  cg->setY(atof(argv[i + 1]), atof(argv[i + 2]));
295  logger(INFO, "Set y to (%,%)", argv[i + 1], argv[i + 2]);
296  ++i;
297  } else if (!strcmp(argv[i], "-z")) {
298  logger.assert_debug(i+2<argc,"% requires two arguments",argv[i]);
299  cg->setZ(atof(argv[i + 1]), atof(argv[i + 2]));
300  logger(INFO, "Set z to (%,%)", argv[i + 1], argv[i + 2]);
301  ++i;
302  } else if (!strcmp(argv[i], "-t")) {
303  logger.assert_debug(i+2<argc,"% requires two arguments",argv[i]);
304  cg->setTimeMin(atof(argv[i + 1]));
305  cg->setTimeMax(atof(argv[i + 2]));
306  logger(INFO, "Set t to (%,%)", argv[i + 1], argv[i + 2]);
307  i++;
308  } else if (!strcmp(argv[i], "-savecount")) {
309  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
310  cg->statFile.setSaveCount(atof(argv[i + 1]));
311  logger(INFO, "Set savecount to %", argv[i + 1]);
312  } else if (!strcmp(argv[i], "-writedata")) {
314  logger(INFO, "Turn on data file output. Execute %.xballs to visualise output", dpm.getName());
315  --i;
316  } else if (!strcmp(argv[i], "-tmin")) {
317  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
318  cg->setTimeMin(atof(argv[i + 1]));
319  logger(INFO, "Set tMin to %", argv[i + 1]);
320  } else if (!strcmp(argv[i], "-timemin")) {
321  logger(ERROR, "% is not a valid argument; use -tMin instead",argv[i]);
322  } else if (!strcmp(argv[i], "-tmax")) {
323  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
324  cg->setTimeMax(atof(argv[i + 1]));
325  logger(INFO, "Set tMax to %", argv[i + 1]);
326  } else if (!strcmp(argv[i], "-dt")) {
327  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
328  dpm.setTimeMax(dpm.getTime()+atof(argv[i + 1]));
329  logger(INFO, "Set evaluation time interval to %", argv[i + 1]);
330  } else if (!strcmp(argv[i], "-initialfilecounter")) {
331  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
332  dpm.cgHandler.setInitialFileCounter(atoi(argv[i+1]));
333  logger(INFO, "Initial file counter set to %", argv[i + 1]);
334  } else if (!strcmp(argv[i], "-timemax")) {
335  logger(ERROR, "% is not a valid argument; use -tMax instead",argv[i]);
336  } else if (!strcmp(argv[i], "-species")) {
337  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
338  cg->selectSpecies(atoi(argv[i + 1]));
339  logger(INFO, "Evaluating species #%", atoi(argv[i + 1]));
340  } else if (!strcmp(argv[i], "-o")) {
341  logger.assert_always(i+1<argc,"% requires argument",argv[i]);
342  cg->statFile.setName(argv[i + 1]);
343  logger(INFO, "Set output file name to %", argv[i + 1]);
344  } else if (!strcmp(argv[i], "-coordinates") || !strcmp(argv[i], "-stattype") || !strcmp(argv[i], "-cgtype") || !strcmp(argv[i], "-function") || !strcmp(argv[i], "-fields") || !strcmp(argv[i], "-restartandanalyse")) {
345  //these are commands with one argument that should be ignored here because they are read somewhere else
346  } else if (!strcmp(argv[i], "-help") || !strcmp(argv[i], "-readfromrestart") || !strcmp(argv[i], "-timeaverage") || !strcmp(argv[i], "-timesmooth")) {
347  //these are commands with no argument that should be ignored here because they are read somewhere else
348  --i;
349  } else if (!strcmp(argv[i], "-timeaveragereset")) {
350  //these are commands with no argument that should be ignored here because they are read somewhere else
351  logger(WARN, "This fstatistics command has no equivalent yet in MercuryCG and will be ignored: %", argv[i]);
352  } else {
353  logger(ERROR, "Could not read argument %", argv[i]);
354  }
355  }
356 
357  logger(INFO, "Created object of type %", cg->getName());
358 
360 
361  //Determine what kind of input to read from (data files, restart files, or live cg)
362  //Variable that stores the type of data source
363  enum class DataSource {
364  readFromData,
365  readFromRestart,
366  restartAndAnalyse
367  } dataSource = DataSource::readFromData;
368  //read command line arguments to determine dataSource
369  for (unsigned i = 1; i < argc; i++) {
370  if (!strcmp(argv[i], "-readfromrestart")) {
371  dataSource = DataSource::readFromRestart;
372  } else if (!strcmp(argv[i], "-restartandanalyse")) {
373  dataSource = DataSource::restartAndAnalyse;
374  dpm.setTimeMax(dpm.getTime()+atof(argv[i+1]));
375  }
376  }
377  //Evaluate based on dataSource
378  if (dataSource == DataSource::readFromData) {
379  logger(INFO, "Reading from data files.");
380  if (!dpm.cgHandler.evaluateDataFiles()) {
381  logger(ERROR,"Evaluation of data files has failed. Check input files.");
382  }
383  } else if (dataSource == DataSource::readFromRestart){
384  logger(INFO, "Reading from restart files.");
387  logger(ERROR,"Evaluation of restart files requires multiple restart files. Check input.");
388  }
390  } else {
391  logger(INFO,"Restarting simulation for live analysis");
392  //dpm.write(std::cout,false);
393  //dpm.setSaveCount(25);
394  dpm.solve();
395  }
396  logger(INFO, "\n"
397  "MercuryCG has finished.\n"
398  "Coarse-grained output is written to %\n"
399  "To load output into Matlab, use data=readMercuryCG('%')",
401 }
@ MULTIPLE_FILES
each time-step will be written into/read from separate files numbered consecutively: name_....
@ MULTIPLE_FILES_PADDED
each time-step will be written into/read from separate files numbered consecutively,...
@ ONE_FILE
all data will be written into/ read from a single file called name_
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
LL< Log::WARN > WARN
Warning log level.
Definition: Logger.cc:54
void addObject(CGHandler &cg, std::string coordinate)
Definition: MercuryCG.cpp:40
Base class of all CG objects, needed to store the various CG objects in the CGHandler.
Definition: BaseCG.h:57
virtual Mdouble getWidth() const =0
Returns width_, the coarse-graining width.
void setHX(Mdouble h)
Sets nX_ the number of spatial mesh points in the X-direction. Instead of explicitly defining nX,...
Definition: BaseCG.cc:250
void setNY(std::size_t nY)
Sets nY_, the number of spatial mesh points in the y-direction.
Definition: BaseCG.cc:112
void setMax(Vec3D max)
Sets max_, the upper limit of the spatial domain.
Definition: BaseCG.cc:171
void setVerbose(const bool verbose)
Definition: BaseCG.h:279
void setZ(Mdouble min, Mdouble max)
Sets min_.Z, max_.Z, the limits of the spatial domain in Z.
Definition: BaseCG.cc:198
File statFile
File class to handle the output into a .stat file.
Definition: BaseCG.h:376
void setNX(std::size_t nX)
Sets nX_, the number of spatial mesh points in the x-direction.
Definition: BaseCG.cc:122
std::size_t getNY() const
Returns nY_, the number of spatial mesh points in the y-direction.
Definition: BaseCG.cc:117
void setHY(Mdouble h)
Sets nX_ the number of spatial mesh points in the X-direction. Instead of explicitly defining nX,...
Definition: BaseCG.cc:259
virtual void setWidth(Mdouble width)=0
Sets width_, the coarse-graining width.
void setTimeMin(Mdouble timeMin)
Sets timeMin_, the lower limit of the temporal domain.
Definition: BaseCG.cc:146
void setX(Mdouble min, Mdouble max)
Sets min_.X, max_.X, the limits of the spatial domain in X.
Definition: BaseCG.cc:186
void setH(Mdouble h)
Sets nX_, nY_, nZ_, the number of spatial mesh points in each cartesian direction....
Definition: BaseCG.cc:242
void setAverageBeyondDomain(const bool val)
Definition: BaseCG.h:275
void setMin(Vec3D min)
Sets max_, the lower limit of the spatial domain.
Definition: BaseCG.cc:166
void selectSpecies(unsigned speciesIndex)
Definition: BaseCG.cc:229
void setNZ(std::size_t nZ)
Sets nZ_, the number of spatial mesh points in the z-direction.
Definition: BaseCG.cc:102
std::size_t getNZ() const
Returns nZ_, the number of spatial mesh points in the z-direction.
Definition: BaseCG.cc:107
void setTimeMax(Mdouble timeMax)
Sets timeMax_, the upper limit of the temporal domain.
Definition: BaseCG.cc:151
void setN(std::size_t n)
Sets nX_, nY_, nZ_, the number of spatial mesh points in each cartesian direction.
Definition: BaseCG.cc:132
std::size_t getNX() const
Returns nX_, the number of spatial mesh points in the x-direction.
Definition: BaseCG.cc:127
void setHZ(Mdouble h)
Sets nX_ the number of spatial mesh points in the X-direction. Instead of explicitly defining nX,...
Definition: BaseCG.cc:268
virtual void setStandardDeviation(Mdouble std)=0
void setY(Mdouble min, Mdouble max)
Sets min_.Y, max_.Y, the limits of the spatial domain in Y.
Definition: BaseCG.cc:192
virtual std::string getName() const =0
A purely virtual function.
bool evaluateDataFiles(bool evaluateFStatFiles=true)
does the same as StatisticsVector::statistics_from_fstat_and_data: loads a restart file (if existing)...
Definition: CGHandler.cc:315
bool evaluateRestartFiles()
Definition: CGHandler.cc:247
void setInitialFileCounter(unsigned initialFileCounter)
Definition: CGHandler.h:141
void restart(std::string name)
loads restart file, before evaluateDataFiles is run
Definition: CGHandler.cc:127
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Definition: DPMBase.cc:399
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:808
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: DPMBase.h:1478
Vec3D getMax() const
Definition: DPMBase.h:670
CGHandler cgHandler
Object of the class cgHandler.
Definition: DPMBase.h:1473
File restartFile
An instance of class File to handle in- and output into a .restart file.
Definition: DPMBase.h:1493
Vec3D getMin() const
Definition: DPMBase.h:664
void readSpeciesFromDataFile(bool read=true)
Definition: DPMBase.h:352
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:873
void solve()
The work horse of the code.
Definition: DPMBase.cc:4270
void setAppend(bool newAppendFlag)
Sets whether the "append" option is on or off.
Definition: DPMBase.cc:1522
const std::string & getName() const
Allows to access the file name, e.g., "problem.data".
Definition: File.cc:165
void setName(const std::string &name)
Sets the file name, e.g. "Name.data".
Definition: File.cc:198
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_.
Definition: File.cc:273
void setFileType(FileType fileType)
Sets the type of file needed to write into or read from. File::fileType_.
Definition: File.cc:215
FileType getFileType() const
Gets the file type e.g. NOFILE, ONEFILE and MULTIPLE FILES. File::fileType_.
Definition: File.cc:207
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
void more(std::string filename, unsigned nLines=constants::unsignedMax)
Definition: FileIOHelpers.cc:181
std::string name
Definition: MercuryProb.h:48

References addObject(), DPMBase::cgHandler, DPMBase::dataFile, ERROR, CGHandler::evaluateDataFiles(), CGHandler::evaluateRestartFiles(), File::getFileType(), BaseHandler< T >::getLastObject(), DPMBase::getMax(), DPMBase::getMin(), DPMBase::getName(), File::getName(), BaseObject::getName(), BaseCG::getNX(), BaseCG::getNY(), BaseCG::getNZ(), DPMBase::getTime(), BaseCG::getWidth(), constants::i, INFO, logger, helpers::more(), MULTIPLE_FILES, MULTIPLE_FILES_PADDED, units::name, ONE_FILE, DPMBase::readSpeciesFromDataFile(), CGHandler::restart(), DPMBase::restartFile, BaseCG::selectSpecies(), DPMBase::setAppend(), BaseCG::setAverageBeyondDomain(), File::setFileType(), BaseCG::setH(), BaseCG::setHX(), BaseCG::setHY(), BaseCG::setHZ(), CGHandler::setInitialFileCounter(), BaseCG::setMax(), BaseCG::setMin(), BaseCG::setN(), File::setName(), BaseCG::setNX(), BaseCG::setNY(), BaseCG::setNZ(), File::setSaveCount(), BaseCG::setStandardDeviation(), DPMBase::setTimeMax(), BaseCG::setTimeMax(), BaseCG::setTimeMin(), BaseCG::setVerbose(), BaseCG::setWidth(), BaseCG::setX(), BaseCG::setY(), BaseCG::setZ(), DPMBase::solve(), BaseCG::statFile, and WARN.

Referenced by main().

◆ main()

int main ( int argc  ,
char argv[] 
)

MercuryCG is the postprocessing tool for extracting coarse-grained fields from particle data. See MercuryCG: Post-processing discrete particle data using the coarse-graining formulation (in development) for details.

408  {
409  Mercury3D dpm;
410  commandLineCG(dpm, argc, argv);
411  return 0;
412 }
void commandLineCG(Mercury3D &dpm, int argc, char **argv)
Definition: MercuryCG.cpp:124
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:37

References commandLineCG().