cuIBM
A GPU-based Immersed Boundary Method code
Functions
io Namespace Reference

Contains functions related to I/O tasks. More...

Functions

std::vector< std::string > & split (const std::string &s, char delim, std::vector< std::string > &elems)
 Splits a string given a delimiter. More...
 
std::vector< std::string > split (const std::string &s, char delim)
 Splits a string given a delimiter. More...
 
void readInputs (int argc, char **argv, parameterDB &DB, domain &D)
 Reads data inputs from the command-line and the simulation files. More...
 
void initialiseDefaultDB (parameterDB &DB)
 Initializes the database with default values. More...
 
void commandLineParse1 (int argc, char **argv, parameterDB &DB)
 Parses the command-line to get the case folder name and the device number. More...
 
void commandLineParse2 (int argc, char **argv, parameterDB &DB)
 Overwrites parameters with additional arguments of the command-line. More...
 
std::string stringFromPreconditionerType (preconditionerType s)
 Converts a preconditionerType to a std::string. More...
 
std::string stringFromTimeScheme (timeScheme s)
 Converts a timeScheme to a std::string. More...
 
void printSimulationInfo (parameterDB &DB, domain &D)
 Prints the parameters of the simulation. More...
 
void printTimingInfo (Logger &logger)
 Prints the time spent to execute tasks. More...
 
void writeGrid (std::string &caseFolder, domain &D)
 Writes grid-points coordinates into the file grid. More...
 
template<>
void writeData< vecH > (std::string &caseFolder, int n, vecH &q, vecH &lambda, domain &D)
 Writes numerical data at a given time-step (on the host). More...
 
template<>
void writeData< vecD > (std::string &caseFolder, int n, vecD &q, vecD &lambda, domain &D)
 Writes numerical data at a given time-step (on the device). More...
 
void readData (std::string &caseFolder, int timeStep, real *x, std::string name)
 Reads numerical data at a given time-step. More...
 
void printDeviceMemoryUsage (std::string label)
 Prints device memory usage. More...
 
void parseDomainFile (std::string &domFile, domain &D)
 Parses the domain file and generates the computational grid. More...
 
void parseFlowFile (std::string &flowFile, parameterDB &DB)
 Parses the flow file and stores the parameters in the database. More...
 
void parseSimulationFile (std::string &simFile, parameterDB &DB)
 Parses simParams.yaml and stores the simulation parameters. More...
 
void parseBodiesFile (std::string &bodiesFile, parameterDB &DB)
 Parses the bodies.yaml file and stores information about the immersed bodies. More...
 
template<typename Vector >
void writeData (std::string &caseFolder, int n, Vector &q, Vector &lambda, domain &D)
 
void parseBodiesNode (const YAML::Node &node, body &Body, parameterDB &DB)
 Overloads the operator >>. Stores information about an immersed body. More...
 
void parseDomain (const YAML::Node &node, domain &D)
 Gets information from the parsed domain file. More...
 
boundary boundaryFromString (std::string s)
 Converts a string to a boundary location type. More...
 
bcType bcTypeFromString (std::string s)
 Converts string to a boundary condition type. More...
 
void parseFlow (const YAML::Node &node, parameterDB &DB)
 Fills the database with the flow parameters. More...
 
timeScheme timeSchemeFromString (std::string s)
 Converts a string to a time-integration scheme type. More...
 
preconditionerType preconditionerTypeFromString (std::string s)
 Converts a string to a preconditioner type. More...
 
ibmScheme ibmSchemeFromString (std::string s)
 Converts a string to an IBM scheme. More...
 
interpolationType interpolationTypeFromString (std::string s)
 Converts a string to a interpolation type. More...
 
void parseSimulation (const YAML::Node &node, parameterDB &DB)
 Fills the database with the simulation parameters. More...
 

Detailed Description

Contains functions related to I/O tasks.

Function Documentation

bcType io::bcTypeFromString ( std::string  s)

Converts string to a boundary condition type.

Parameters
sthe string that describes the condition to impose on the boundary
Returns
a boundary condition type

Definition at line 53 of file parseFlowFile.cu.

References CONVECTIVE, DIRICHLET, NEUMANN, PERIODIC, and SPECIAL.

Referenced by parseFlow().

boundary io::boundaryFromString ( std::string  s)

Converts a string to a boundary location type.

Parameters
sthe string that describes the location of the boundary
Returns
a boundary location type

Definition at line 28 of file parseFlowFile.cu.

References XMINUS, XPLUS, YMINUS, and YPLUS.

Referenced by parseFlow().

void io::commandLineParse1 ( int  argc,
char **  argv,
parameterDB DB 
)

Parses the command-line to get the case folder name and the device number.

Parameters
argcnumber of arguments in the command-line
argvarguments of the command-line
DBdatabase that contains all the simulation parameters

Definition at line 186 of file io.cu.

Referenced by readInputs().

void io::commandLineParse2 ( int  argc,
char **  argv,
parameterDB DB 
)

Overwrites parameters with additional arguments of the command-line.

Parameters
argcnumber of arguments in the command-line
argvarguments of the command-line
DBdatabase that contains all the simulation parameters

Definition at line 214 of file io.cu.

References CONSTANT, DF_IMPROVED, DF_MODIFIED, DIFFUSION, DIRECT_FORCING, FADLUN_ET_AL, FEA_MODIFIED, LINEAR, NAVIER_STOKES, QUADRATIC, and TAIRA_COLONIUS.

Referenced by readInputs().

ibmScheme io::ibmSchemeFromString ( std::string  s)

Converts a string to an IBM scheme.

Parameters
sthe string that describes the IBM scheme
Returns
an IBM-scheme type

Definition at line 81 of file parseSimulationFile.cu.

References DF_IMPROVED, DF_MODIFIED, DIFFUSION, DIRECT_FORCING, FADLUN_ET_AL, FEA_MODIFIED, NAVIER_STOKES, SAIKI_BIRINGEN, and TAIRA_COLONIUS.

Referenced by parseSimulation().

void io::initialiseDefaultDB ( parameterDB DB)

Initializes the database with default values.

Parameters
DBdatabase that contains all the simulation parameters

Definition at line 121 of file io.cu.

References DIAGONAL, EULER_EXPLICIT, EULER_IMPLICIT, LINEAR, and TAIRA_COLONIUS.

Referenced by readInputs().

interpolationType io::interpolationTypeFromString ( std::string  s)

Converts a string to a interpolation type.

Parameters
sthe string that describes the type of interpolation
Returns
an interpolation type

Definition at line 116 of file parseSimulationFile.cu.

References CONSTANT, LINEAR, and QUADRATIC.

Referenced by parseSimulation().

void io::parseBodiesFile ( std::string &  bodiesFile,
parameterDB DB 
)

Parses the bodies.yaml file and stores information about the immersed bodies.

Parameters
DBthe database that contains the simulation parameters

Definition at line 117 of file parseBodiesFile.cu.

References NAVIER_STOKES, parseBodiesNode(), and body::reset().

Referenced by readInputs().

void io::parseBodiesNode ( const YAML::Node &  node,
body Body,
parameterDB DB 
)

Overloads the operator >>. Stores information about an immersed body.

Parameters
nodethe parsed file
Bodyinstance of the class body to be filled
DBdatabase with parameters of the simulation

Definition at line 29 of file parseBodiesFile.cu.

References body::moving, body::numPoints, body::omega, body::pitchOscillation, body::Theta, body::Theta0, body::velocity, body::X, body::X0, body::Xc, body::Xc0, body::xOscillation, body::Y, and body::yOscillation.

Referenced by parseBodiesFile().

void io::parseDomain ( const YAML::Node &  node,
domain D 
)

Gets information from the parsed domain file.

Parameters
nodethe parsed file
Dinstance of the class domain to be filled

Definition at line 27 of file parseDomainFile.cu.

References domain::dx, domain::dxD, domain::dy, domain::dyD, domain::nx, domain::ny, domain::x, domain::xD, domain::y, and domain::yD.

Referenced by parseDomainFile().

void io::parseDomainFile ( std::string &  domFile,
domain D 
)

Parses the domain file and generates the computational grid.

Parameters
domFilethe file that contains information about the computational grid
Dinstance of the class domain that will be filled with information about the computational grid

Definition at line 135 of file parseDomainFile.cu.

References domain::nx, domain::ny, parseDomain(), domain::x, domain::xu, domain::xv, domain::y, domain::yu, and domain::yv.

Referenced by readInputs().

void io::parseFlow ( const YAML::Node &  node,
parameterDB DB 
)

Fills the database with the flow parameters.

Parameters
nodethe parsed file
DBthe database to be filled

Definition at line 79 of file parseFlowFile.cu.

References bcTypeFromString(), and boundaryFromString().

Referenced by parseFlowFile().

void io::parseFlowFile ( std::string &  flowFile,
parameterDB DB 
)

Parses the flow file and stores the parameters in the database.

Parameters
flowFilethe file that contains information about the flow
DBthe database that will be filled

Definition at line 113 of file parseFlowFile.cu.

References parseFlow().

Referenced by readInputs().

void io::parseSimulation ( const YAML::Node &  node,
parameterDB DB 
)

Fills the database with the simulation parameters.

Parameters
nodethe parsed file
DBdatabase that contains the simulation parameters

Definition at line 138 of file parseSimulationFile.cu.

References ibmSchemeFromString(), interpolationTypeFromString(), preconditionerTypeFromString(), and timeSchemeFromString().

Referenced by parseSimulationFile().

void io::parseSimulationFile ( std::string &  simFile,
parameterDB DB 
)

Parses simParams.yaml and stores the simulation parameters.

Parameters
simFilethe file that contains the simulation parameters
DBthe database that will be filled

Definition at line 180 of file parseSimulationFile.cu.

References parseSimulation().

Referenced by readInputs().

preconditionerType io::preconditionerTypeFromString ( std::string  s)

Converts a string to a preconditioner type.

Parameters
sthe string that describes the preconditioner
Returns
a preconditioner type

Definition at line 56 of file parseSimulationFile.cu.

References AINV, DIAGONAL, NONE, and SMOOTHED_AGGREGATION.

Referenced by parseSimulation().

void io::printDeviceMemoryUsage ( std::string  label)

Prints device memory usage.

Parameters
labelthe label of the device

Definition at line 593 of file io.cu.

Referenced by main().

void io::printSimulationInfo ( parameterDB DB,
domain D 
)

Prints the parameters of the simulation.

Parameters
DBdatabase that contains all the simulation parameters
Dinformation about the computational grid

Definition at line 385 of file io.cu.

References CONSTANT, DF_IMPROVED, DF_MODIFIED, DIFFUSION, DIRECT_FORCING, FADLUN_ET_AL, FEA_MODIFIED, LINEAR, domain::nx, domain::ny, QUADRATIC, stringFromPreconditionerType(), and stringFromTimeScheme().

Referenced by main().

void io::printTimingInfo ( Logger logger)

Prints the time spent to execute tasks.

Parameters
loggerobject that contains the name and time spent of tasks

Definition at line 469 of file io.cu.

References Logger::printAllTime().

Referenced by NSWithBody< memoryType >::shutDown(), and NavierStokesSolver< memoryType >::shutDown().

void io::readData ( std::string &  caseFolder,
int  timeStep,
real x,
std::string  name 
)

Reads numerical data at a given time-step.

Parameters
caseFolderdirectory of the simulation
timeStepthe time-step number
xarray that to fill
namename of the file containing the variable

Definition at line 571 of file io.cu.

Referenced by NavierStokesSolver< memoryType >::initialiseFluxes().

void io::readInputs ( int  argc,
char **  argv,
parameterDB DB,
domain D 
)

Reads data inputs from the command-line and the simulation files.

Parameters
argcnumber of arguments in the command-line
argvcommand-line arguments
DBdatabase that contains all the simulation parameters
Dobject of the class domain that contains the computational grid

Definition at line 83 of file io.cu.

References commandLineParse1(), commandLineParse2(), initialiseDefaultDB(), parseBodiesFile(), parseDomainFile(), parseFlowFile(), and parseSimulationFile().

Referenced by main().

std::vector< std::string > & io::split ( const std::string &  s,
char  delim,
std::vector< std::string > &  elems 
)

Splits a string given a delimiter.

Parameters
sthe string to split
delimthe delimiter
elemsthe vector that contains the different elements of the string
Returns
a vector that contains the different elements of the string

Definition at line 47 of file io.cu.

Referenced by split().

std::vector< std::string > io::split ( const std::string &  s,
char  delim 
)

Splits a string given a delimiter.

Parameters
sthe string to split
delimthe delimiter
Returns
a vector that contains the different elements of the string

Definition at line 67 of file io.cu.

References split().

std::string io::stringFromPreconditionerType ( preconditionerType  s)

Converts a preconditionerType to a std::string.

Parameters
sa preconditioner
Returns
a string

Definition at line 336 of file io.cu.

References AINV, DIAGONAL, NONE, and SMOOTHED_AGGREGATION.

Referenced by printSimulationInfo().

std::string io::stringFromTimeScheme ( timeScheme  s)

Converts a timeScheme to a std::string.

Parameters
sa time-integration scheme
Returns
a string

Definition at line 361 of file io.cu.

References ADAMS_BASHFORTH_2, CRANK_NICOLSON, EULER_EXPLICIT, and EULER_IMPLICIT.

Referenced by printSimulationInfo().

timeScheme io::timeSchemeFromString ( std::string  s)

Converts a string to a time-integration scheme type.

Parameters
sthe string that describes the time-integration scheme
Returns
a time-integration scheme type

Definition at line 29 of file parseSimulationFile.cu.

References ADAMS_BASHFORTH_2, CRANK_NICOLSON, EULER_EXPLICIT, EULER_IMPLICIT, and RUNGE_KUTTA_3.

Referenced by parseSimulation().

template<typename Vector >
void io::writeData ( std::string &  caseFolder,
int  n,
Vector &  q,
Vector &  lambda,
domain D 
)
template<>
void io::writeData< vecD > ( std::string &  caseFolder,
int  n,
vecD q,
vecD lambda,
domain D 
)

Writes numerical data at a given time-step (on the device).

It creates a directory whose name is the time-step number and writes the flux, the pressure (and eventually the body forces) into the files q, lambda, respectively.

Parameters
caseFolderdirectory of the simulation
nthe time-step number
qarray that contains the fluxes
lambdaarray that contains the pressures (and eventually the body forces)
Dinformation about the computational grid

Definition at line 554 of file io.cu.

References writeData().

template<>
void io::writeData< vecH > ( std::string &  caseFolder,
int  n,
vecH q,
vecH lambda,
domain D 
)

Writes numerical data at a given time-step (on the host).

It creates a directory whose name is the time-step number and writes the flux, the pressure (and eventually the body forces) into the files q, lambda, respectively.

Parameters
caseFolderdirectory of the simulation
nthe time-step number
qarray that contains the fluxes
lambdaarray that contains the pressures (and eventually the body forces)
Dinformation about the computational grid

Definition at line 509 of file io.cu.

void io::writeGrid ( std::string &  caseFolder,
domain D 
)

Writes grid-points coordinates into the file grid.

Parameters
caseFolderthe directory of the simulation
Dinformation about the computational grid

Definition at line 482 of file io.cu.

References domain::nx, domain::ny, domain::x, and domain::y.

Referenced by NavierStokesSolver< memoryType >::initialiseCommon().