8#include <dune/grid/io/file/gmshwriter.hh>
10#include <amdis/Initfile.hpp>
11#include <amdis/Output.hpp>
12#include <amdis/common/Filesystem.hpp>
13#include <amdis/io/FileWriterBase.hpp>
26 using Writer = Dune::GmshWriter<GridView>;
30 GmshWriter(std::string
const& name, GridView
const& gridView,
31 std::vector<int>
const& physicalEntities = std::vector<int>(),
32 std::vector<int>
const& physicalBoundaries = std::vector<int>())
34 , physicalEntities_(physicalEntities)
35 , physicalBoundaries_(physicalBoundaries)
41 int precision = (p == 0)
42 ? std::numeric_limits<float>::max_digits10
43 : std::numeric_limits<double>::max_digits10;
45 writer_ = std::make_shared<Writer>(gridView, precision);
51 std::string filename = this->filename();
53 filename +=
"_" + std::to_string(adaptInfo.
time());
55 if (this->
doWrite(adaptInfo) || force) {
57 physicalEntities_, physicalBoundaries_);
59 msg(
"Grid written to file '{}'.",
filesystem::path({this->dir(), filename +
".msh"}).
string());
64 std::vector<int>
const& physicalEntities_;
65 std::vector<int>
const& physicalBoundaries_;
67 std::shared_ptr<Writer> writer_;
70 bool animation_ =
false;
Holds adapt parameters and infos about the problem.
Definition: AdaptInfo.hpp:26
double const & time() const
Gets time_.
Definition: AdaptInfo.hpp:464
Base class for filewriters.
Definition: FileWriterBase.hpp:39
bool doWrite(AdaptInfo &adaptInfo) const
Return whether to write the current timestep or not.
Definition: FileWriterBase.cpp:24
The GmshWriter just writes the grid of a given gridView to a gmsh compatible .msh file.
Definition: GmshWriter.hpp:24
GmshWriter(std::string const &name, GridView const &gridView, std::vector< int > const &physicalEntities=std::vector< int >(), std::vector< int > const &physicalBoundaries=std::vector< int >())
Constructor.
Definition: GmshWriter.hpp:30
void write(AdaptInfo &adaptInfo, bool force) override
Implements FileWriterBase::write.
Definition: GmshWriter.hpp:49
static std::optional< T > get(std::string const &key)
Get parameter-values from parameter-tree.
Definition: Initfile.hpp:25
Definition: Filesystem.hpp:13