GridPtr can also read gmsh files and then handle the load balance of user data.
This MR adds the ability of reading gmsh files to the GridPtr class. This needs testing by some gmsh users.
Merge request reports
Activity
@andreas.dedner @tkoch @bernd.flemisch
I think this is the most practical approach to the unification for reading a grid with different parsers. Please take a look and let me know what you think.
Edited by Robert KI get an error when trying make build_tests:
dune-grid/dune/grid/io/file/gmshreader.hh:613:13: error: no matching function for call to ‘Dune::GridFactory<Dune::YaspGrid<3> >::insertBoundarySegment(std::vector&, std::shared_ptr<Dune::BoundarySegment<3> >)’ factory.insertBoundarySegment(vertices,
I guess this could be seen as a mistake in the GridFactory implementation of YaspGrid or we need some SFINAE to avoid compiling in the GMestReader in cases like yaspgrid
If you want to add a vtk writer then you'll need to add a few lines for capturing that case, naturally. Of course it's possible to define an abstract interface for that, but my opinions is that it's not necessary. On the other hand, nobody is forced to use a specific format and reader. GridPtr is just a convenience implementation for dealing with the load balancing of the parameters etc. All of that needs to be reimplemented in the general interface concept that you are envisioning. I thinks it's simpler to just fill GridPtr from a given reader/grid factory. And for that, you may want to define an interface.
@andreas.dedner: Should compile now. It was a bug in the default gridfactory implementation.
added 3 commits
-
0a8c7b07...7e9a6828 - 2 commits from branch
master
- 3cedf86d - [feature][GridPtr] GridPtr can also read gmsh files and then handle
-
0a8c7b07...7e9a6828 - 2 commits from branch
I would say it's a bit alternative to !90, because the interface is hidden inside GridPtr. At the end of the say one wants something that translates a filename or input stream into a grid and some data. GridPtr does exactly that, and with this PR you can pass either gmsh or dgf files. Adding the other readers is more or less straight forward. As @tkoch pointed out, it is however not extendible in the way that someone derives a class and overloads a method. You would have to add an if statement with the file format/reader specifications. That kind of if statement has to be done somewhere, either in a main routine of, for example, in the GridPtr. That's just a matter of taste. And, as pointed out earlier, when adding a couple of lines to the GridPtr, the load balancing of the user data comes for free.