Skip to content

GmshReader: more flexible and robust io-arg-style interface for reading data

Jö Fahlke requested to merge fs1698-new-gmshreader-iface-io-arg-style into master

This allows the user to not pass the data vectors he/she is not interested in. To ignore a vector, pass std::ignore.

In addition, in place of the boundary segment data a bool value may be passed, stating whether or not to insert boundary segments. false is equivalent to std::ignore and no boundary segments are inserted. When a vector to fill is given, boundary segments are always inserted (otherwise the user would be unable to correctly index that vector).

In summary, given

GridFactory<Grid> factory;
std::vector<int> boundaryData, elementData;
using Reader = GmshReader<Grid>;
bool verbose = ...;
bool insertBoundarySegments = ...;

the following uses are now possible:

Reader::read(factory, "file.msh", boundaryData, elementData, verbose);
Reader::read(factory, "file.msh", boundaryData, std::ignore, verbose);
Reader::read(factory, "file.msh", std::ignore, elementData, verbose);
Reader::read(factory, "file.msh", std::ignore, std::ignore, verbose);
Reader::read(factory, "file.msh", insertBoundarySegments, elementData, verbose);
Reader::read(factory, "file.msh", insertBoundarySegments, std::ignore, verbose);

In each of those, the verbose argument is optional.

Addresses: flyspray/FS#1698 (closed)

WIP:

  • Wait until 2020-03-01 for comments.
Edited by Jö Fahlke

Merge request reports

Loading