17 std::vector<util::Point> *nodes,
18 std::vector<double> *volumes) {
22 io::CSVReader<3> in(filename);
23 in.read_header(io::ignore_extra_column,
"id",
"x",
"volume");
28 while (in.read_row(
id, x, volume)) {
29 volumes->emplace_back(volume);
35 io::CSVReader<4> in(filename);
36 in.read_header(io::ignore_extra_column,
"id",
"x",
"y",
"volume");
40 while (in.read_row(
id, x, y, volume)) {
41 volumes->emplace_back(volume);
47 io::CSVReader<5> in(filename);
48 in.read_header(io::ignore_extra_column,
"id",
"x",
"y",
"z",
"volume");
50 double x, y, z, volume;
52 while (in.read_row(
id, x, y, z, volume)) {
53 volumes->emplace_back(volume);
60 std::vector<util::Point> *nodes,
61 std::vector<double> *rads,
62 std::vector<size_t> *zones) {
68 io::CSVReader<5> in(filename);
69 in.read_header(io::ignore_extra_column,
"i",
"x",
"y",
"z",
"r");
73 while (in.read_row(
id, x, y, z, r)) {
74 rads->emplace_back(r);
76 zones->emplace_back(
id);
81 std::vector<util::Point> *nodes,
82 std::vector<double> *rads,
88 io::CSVReader<5> in(filename);
89 in.read_header(io::ignore_extra_column,
"i",
"x",
"y",
"z",
"r");
93 while (in.read_row(
id, x, y, z, r)) {
95 rads->emplace_back(r);
102 std::vector<util::Point> *nodes,
103 std::vector<double> *rads,
104 std::vector<double> *orients,
105 const size_t &zone) {
111 io::CSVReader<6> in(filename);
112 in.read_header(io::ignore_extra_column,
"i",
"x",
"y",
"z",
"r",
"o");
114 double x, y, z, r, o;
116 while (in.read_row(
id, x, y, z, r, o)) {
118 rads->emplace_back(r);
120 orients->emplace_back(o);
126 std::vector<util::Point> *nodes,
127 size_t &element_type,
size_t &num_elem,
128 std::vector<size_t> *enc,
129 std::vector<std::vector<size_t>> *nec,
130 std::vector<double> *volumes,
bool is_fd) {
133 rdr.readMesh(dim, nodes, element_type, num_elem, enc, nec, volumes, is_fd);
138 std::vector<util::Point> *nodes,
144 rdr.readNodes(nodes);
148 std::vector<util::Point> u;
149 if (rdr.readPointData(
"Displacement", &u)) {
150 std::cerr <<
"Error: Did not find displacement in the vtu file."
155 if (u.size() != nodes->size()) {
156 std::cerr <<
"Error: Displacement data and node data size do not match."
161 for (
size_t i = 0; i < u.size(); i++)
169 size_t &element_type,
size_t &num_elem,
170 std::vector<size_t> *enc,
171 std::vector<std::vector<size_t>> *nec) {
176 rdr.readCells(dim, element_type, num_elem, enc, nec);
182 std::vector<util::Point> *u,
183 std::vector<util::Point> *v,
184 const std::vector<util::Point> *X) {
189 if (!rdr.readPointData(
"Displacement", u)) {
190 std::vector<util::Point> y;
192 if (y.size() != X->size()) {
193 std::cerr <<
"Error: Number of nodes in input file = " << filename
194 <<
" and number nodes in data X are not same.\n";
199 for (
size_t i = 0; i < y.size(); i++)
200 (*u)[i] = y[i] - (*X)[i];
204 rdr.readPointData(
"Velocity", v);
209 const std::string &tag,
210 std::vector<uint8_t> *data) {
214 auto st = rdr.readPointData(tag, data);
220 const std::string &tag,
221 std::vector<size_t> *data) {
225 auto st = rdr.readPointData(tag, data);
231 const std::string &tag,
232 std::vector<int> *data) {
236 auto st = rdr.readPointData(tag, data);
242 const std::string &tag,
243 std::vector<float> *data) {
247 auto st = rdr.readPointData(tag, data);
253 const std::string &tag,
254 std::vector<double> *data) {
258 auto st = rdr.readPointData(tag, data);
264 const std::string &tag,
265 std::vector<util::Point> *data) {
269 auto st = rdr.readPointData(tag, data);
275 const std::string &tag,
276 std::vector<util::SymMatrix3> *data) {
280 auto st = rdr.readPointData(tag, data);
286 const std::string &tag,
287 std::vector<util::Matrix3> *data) {
291 auto st = rdr.readPointData(tag, data);
297 const std::string &tag,
298 std::vector<float> *data) {
302 auto st = rdr.readCellData(tag, data);
308 const std::string &tag,
309 std::vector<double> *data) {
313 auto st = rdr.readCellData(tag, data);
319 const std::string &tag,
320 std::vector<util::Point> *data) {
324 auto st = rdr.readCellData(tag, data);
330 const std::string &tag,
331 std::vector<util::SymMatrix3> *data) {
335 auto st = rdr.readCellData(tag, data);
341 const std::string &tag,
342 std::vector<util::Matrix3> *data) {
346 auto st = rdr.readCellData(tag, data);
352 std::vector<util::Point> *nodes,
353 size_t &element_type,
size_t &num_elem,
354 std::vector<size_t> *enc,
355 std::vector<std::vector<size_t>> *nec,
356 std::vector<double> *volumes,
bool is_fd) {
359 rdr.readMesh(dim, nodes, element_type, num_elem, enc, nec, volumes, is_fd);
364 std::vector<util::Point> *u,
365 std::vector<util::Point> *v,
366 const std::vector<util::Point> *X) {
371 if (!rdr.readPointData(
"Displacement", u)) {
372 std::vector<util::Point> y;
374 if (y.size() != X->size()) {
375 std::cerr <<
"Error: Number of nodes in input file = " << filename
376 <<
" and number nodes in data X are not same.\n";
381 for (
size_t i = 0; i < y.size(); i++)
382 (*u)[i] = y[i] - (*X)[i];
386 rdr.readPointData(
"Velocity", v);
391 const std::string &tag,
392 std::vector<double> *data) {
396 auto st = rdr.readPointData(tag, data);
402 size_t &element_type,
size_t &num_elem,
403 std::vector<size_t> *enc,
404 std::vector<std::vector<size_t>> *nec) {
407 rdr.readCells(dim, element_type, num_elem, enc, nec);
A class to read Gmsh (msh) mesh files.
A class to read VTK (.vtu) mesh files.
bool readMshFilePointData(const std::string &filename, const std::string &tag, std::vector< double > *data)
Reads data of specified tag from the vtu file.
void readMshFileRestart(const std::string &filename, std::vector< util::Point > *u, std::vector< util::Point > *v, const std::vector< util::Point > *X=nullptr)
Reads mesh data into node file and element file.
void readVtuFileRestart(const std::string &filename, std::vector< util::Point > *u, std::vector< util::Point > *v, const std::vector< util::Point > *X=nullptr)
Reads mesh data into node file and element file.
void readVtuFileCells(const std::string &filename, size_t dim, size_t &element_type, size_t &num_elem, std::vector< size_t > *enc, std::vector< std::vector< size_t > > *nec)
Reads cell data, i.e. element-node connectivity and node-element connectivity.
bool readVtuFileCellData(const std::string &filename, const std::string &tag, std::vector< float > *data)
Reads data of specified tag from the vtu file.
void readParticleWithOrientCsvFile(const std::string &filename, size_t dim, std::vector< util::Point > *nodes, std::vector< double > *rads, std::vector< double > *orients, const size_t &zone)
Reads particles center location, radius, and zone id. In this case, file also provides initial orient...
void readParticleCsvFile(const std::string &filename, size_t dim, std::vector< util::Point > *nodes, std::vector< double > *rads, std::vector< size_t > *zones)
Reads particles center location, radius, and zone id.
void readVtuFile(const std::string &filename, size_t dim, std::vector< util::Point > *nodes, size_t &element_type, size_t &num_elem, std::vector< size_t > *enc, std::vector< std::vector< size_t > > *nec, std::vector< double > *volumes, bool is_fd=false)
Reads mesh data into node file and element file.
void readMshFileCells(const std::string &filename, size_t dim, size_t &element_type, size_t &num_elem, std::vector< size_t > *enc, std::vector< std::vector< size_t > > *nec)
Reads cell data, i.e. element-node connectivity and node-element connectivity.
bool readVtuFilePointData(const std::string &filename, const std::string &tag, std::vector< uint8_t > *data)
Reads data of specified tag from the vtu file.
void readVtuFileNodes(const std::string &filename, size_t dim, std::vector< util::Point > *nodes, bool ref_config=false)
Reads nodal coordinates.
void readCsvFile(const std::string &filename, size_t dim, std::vector< util::Point > *nodes, std::vector< double > *volumes)
Reads mesh data into node file and element file.
void readMshFile(const std::string &filename, size_t dim, std::vector< util::Point > *nodes, size_t &element_type, size_t &num_elem, std::vector< size_t > *enc, std::vector< std::vector< size_t > > *nec, std::vector< double > *volumes, bool is_fd=false)
Reads mesh data into node file and element file.
A structure to represent 3d vectors.