cuIBM
A GPU-based Immersed Boundary Method code
io.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include <vector>
10 
11 #include "utilities/types.h"
12 #include "utilities/domain.h"
13 #include "utilities/parameterDB.h"
14 #include "utilities/bodies.h"
15 
16 
21 namespace io
22 {
23  // split a string given a delimiter
24  std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems);
25 
26  // split a string given a delimiter
27  std::vector<std::string> split(const std::string &s, char delim);
28 
29  // read data inputs from the command-line and the simulation files
30  void readInputs(int argc, char **argv, parameterDB &DB, domain &D);
31 
32  // parse the \a domain file and generate the computational grid
33  void parseDomainFile(std::string &domFile, domain &D);
34 
35  // parse the \a flow file and store the parameters in the database
36  void parseFlowFile(std::string &flowFile, parameterDB &DB);
37 
38  // parse the \a simulation file and store the parameters in the database
39  void parseSimulationFile(std::string &simFile, parameterDB &DB);
40 
41  // parse the \a bodies file and store information about the immersed bodies
42  void parseBodiesFile(std::string &bodiesFile, parameterDB &DB);
43 
44  // initialize the database with default values
46 
47  // parse command-line to get simulation directory and device number
48  void commandLineParse1(int argc, char **argv, parameterDB &DB);
49 
50  // overwrite parameters with additional arguments of the command-line
51  void commandLineParse2(int argc, char **argv, parameterDB &DB);
52 
53  // print the parameters of the simulation
55 
56  // print the time spent to execute tasks
57  void printTimingInfo(Logger &logger);
58 
59  // write grid-points coordinates into the file grid
60  void writeGrid(std::string &caseFolder, domain &D);
61 
62  // write numerical data at a given time-step
63  template <typename Vector>
64  void writeData(std::string &caseFolder, int n, Vector &q, Vector &lambda, domain &D);//, bodies &B);
65 
66  // read numerical data at a given time-step
67  void readData(std::string &caseFolder, int timeStep, real *x, std::string name);
68 
69  // print device memory usage
70  void printDeviceMemoryUsage(std::string label);
71 
72 } // End of namespace io
Monitors the time spent to achieve a certain task.
Definition: logger.h:33
void readInputs(int argc, char **argv, parameterDB &DB, domain &D)
Reads data inputs from the command-line and the simulation files.
Definition: io.cu:83
Definition of custom types required by the code.
void parseFlowFile(std::string &flowFile, parameterDB &DB)
Parses the flow file and stores the parameters in the database.
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
Splits a string given a delimiter.
Definition: io.cu:47
double real
Is a float or a double depending on the machine precision.
Definition: types.h:116
void readData(std::string &caseFolder, int timeStep, real *x, std::string name)
Reads numerical data at a given time-step.
Definition: io.cu:571
Declaration of the class bodies.
void commandLineParse1(int argc, char **argv, parameterDB &DB)
Parses the command-line to get the case folder name and the device number.
Definition: io.cu:186
void parseSimulationFile(std::string &simFile, parameterDB &DB)
Parses simParams.yaml and stores the simulation parameters.
std::map< std::string, componentParameter > parameterDB
Map from a string to a componentParameter.
Definition: parameterDB.h:64
void printTimingInfo(Logger &logger)
Prints the time spent to execute tasks.
Definition: io.cu:469
Contains functions related to I/O tasks.
Stores information about the computational grid.
Definition: domain.h:16
Declaration of the class property.
void writeGrid(std::string &caseFolder, domain &D)
Writes grid-points coordinates into the file grid.
Definition: io.cu:482
void initialiseDefaultDB(parameterDB &DB)
Initializes the database with default values.
Definition: io.cu:121
void parseBodiesFile(std::string &bodiesFile, parameterDB &DB)
Parses the bodies.yaml file and stores information about the immersed bodies.
void printSimulationInfo(parameterDB &DB, domain &D)
Prints the parameters of the simulation.
Definition: io.cu:385
void printDeviceMemoryUsage(std::string label)
Prints device memory usage.
Definition: io.cu:593
Definition of the class domain.
void parseDomainFile(std::string &domFile, domain &D)
Parses the domain file and generates the computational grid.
void commandLineParse2(int argc, char **argv, parameterDB &DB)
Overwrites parameters with additional arguments of the command-line.
Definition: io.cu:214
void writeData(std::string &caseFolder, int n, Vector &q, Vector &lambda, domain &D)