11 #include "yaml-cpp/yaml.h" 30 real start, end, stretchRatio, h;
33 dir = node[
"direction"].as<std::string>();
34 start = node[
"start"].as<
real>();
41 const YAML::Node &subDomains = node[
"subDomains"];
43 for (
unsigned int i=0; i<subDomains.size(); i++)
45 numCells = subDomains[i][
"cells"].as<
int>();
72 for (
unsigned int i=0; i<subDomains.size(); i++)
74 end = subDomains[i][
"end"].as<
real>();
75 numCells = subDomains[i][
"cells"].as<
int>();
76 stretchRatio = subDomains[i][
"stretchRatio"].as<
real>();
78 if(fabs(stretchRatio-1.0) < 1.0e-6)
80 h = (end - start)/numCells;
81 for(
int j=beg; j<beg+numCells; j++)
86 D.
x[j+1] = D.
x[j] + D.
dx[j];
91 D.
y[j+1] = D.
y[j] + D.
dy[j];
97 h = (end - start)*(stretchRatio-1)/(pow(stretchRatio, numCells)-1);
98 for(
int j=beg; j<beg+numCells; j++)
102 D.
dx[j] = h*pow(stretchRatio, j-beg);
103 D.
x[j+1] = D.
x[j] + D.
dx[j];
107 D.
dy[j] = h*pow(stretchRatio, j-beg);
108 D.
y[j+1] = D.
y[j] + D.
dy[j];
137 printf(
"Parsing YAML file with grid info ...\n");
138 YAML::Node nodes = YAML::LoadFile(domFile);
139 for (
unsigned int i=0; i<nodes.size(); i++)
148 for(i=0; i<D.
nx-1; i++)
151 D.
xv[i] = (D.
x[i]+D.
x[i+1])/2.0;
153 D.
xv[i] = (D.
x[i]+D.
x[i+1])/2.0;
155 for(j=0; j<D.
ny-1; j++)
157 D.
yu[j] = (D.
y[j]+D.
y[j+1])/2.0;
160 D.
yu[j] = (D.
y[j]+D.
y[j+1])/2.0;
vecH x
x-coordinates of the nodes
void parseDomain(const YAML::Node &node, domain &D)
Gets information from the parsed domain file.
vecH dx
cell-widths in the x-direction
double real
Is a float or a double depending on the machine precision.
vecH yv
y-coordinates where the y-components of velocity are evaluated
vecH dy
cell-widths in the y-direction
vecD xD
x-coordinates of the nodes stored on the device
Declaration of the functions of the namespace io.
vecD yD
y-coordinates of the nodes stored on the device
vecH yu
y-coordinates where the x-components of velocity are evaluated
Contains functions related to I/O tasks.
Stores information about the computational grid.
vecH xu
x-coordinates where the x-components of velocity are evaluated
vecH xv
x-coordinates where the y-components of velocity are evaluated
vecD dxD
x- cell widths stored on the device
int ny
number of cells in the y-direction
int nx
number of cells in the x-direction
void parseDomainFile(std::string &domFile, domain &D)
Parses the domain file and generates the computational grid.
vecD dyD
y- cell widths stored on the device
vecH y
y-coordinates of the nodes