Go to the documentation of this file.
20#ifndef OPM_WRITESYSTEMMATRIXHELPER_HEADER_INCLUDED
21#define OPM_WRITESYSTEMMATRIXHELPER_HEADER_INCLUDED
23#include <dune/istl/matrixmarket.hh>
62 template < class SimulatorType, class LinalgObjectType, class Communicator>
64 const LinalgObjectType& linalgObject,
65 const std::string& objName,
66 [[maybe_unused]] const Communicator* comm)
68 namespace fs = std::filesystem;
70 const auto output_dir = fs::path {simulator.problem().outputDir()} / "reports";
71 if (! fs::exists(output_dir)) {
72 fs::create_directory(output_dir);
76 const auto& iterCtx = simulator.problem().iterationContext();
77 std::ostringstream oss;
78 oss << "prob_" << simulator.episodeIndex()
79 << "_time_" << std::setprecision(15) << std::setw(12) << std::setfill( '0') << simulator.time()
80 << "_nit_" << iterCtx.iteration()
81 << '_' << objName << "_istl";
83 const auto filename = (output_dir / oss.str()).generic_string();
86 if (comm != nullptr) {
87 Dune::storeMatrixMarket(linalgObject, filename, *comm);
92 Dune::storeMatrixMarket(linalgObject, filename + ".mm");
121 template < class SimulatorType, class VectorType, class Communicator>
123 const VectorType& rhs,
124 const std::string& sysName,
125 const Communicator* comm)
154 template < class SimulatorType, class MatrixType, class Communicator>
156 const MatrixType& matrix,
157 const std::string& sysName,
158 const Communicator* comm)
196 template < class SimulatorType, class MatrixType, class VectorType, class Communicator>
198 const MatrixType& matrix,
199 const VectorType& rhs,
200 const std::string& sysName,
201 const Communicator* comm)
238 template < class SimulatorType, class MatrixType, class VectorType, class Communicator>
240 const MatrixType& matrix,
241 const VectorType& rhs,
242 const Communicator* comm)
244 writeSystem(simulator, matrix, rhs, "flow_", comm);
278 template < class SimulatorType, class MatrixType, class VectorType, class Communicator>
280 const MatrixType& matrix,
281 const VectorType& rhs,
282 const Communicator* comm)
284 writeSystem(simulator, matrix, rhs, "mech_", comm);
void writeMatrixMarketObject(const SimulatorType &simulator, const LinalgObjectType &linalgObject, const std::string &objName, const Communicator *comm) Definition: WriteSystemMatrixHelper.hpp:63
Definition: WriteSystemMatrixHelper.hpp:32
void writeSystem(const SimulatorType &simulator, const MatrixType &matrix, const VectorType &rhs, const std::string &sysName, const Communicator *comm) Definition: WriteSystemMatrixHelper.hpp:197
void writeMechSystem(const SimulatorType &simulator, const MatrixType &matrix, const VectorType &rhs, const Communicator *comm) Definition: WriteSystemMatrixHelper.hpp:279
void writeVector(const SimulatorType &simulator, const VectorType &rhs, const std::string &sysName, const Communicator *comm) Definition: WriteSystemMatrixHelper.hpp:122
void writeMatrix(const SimulatorType &simulator, const MatrixType &matrix, const std::string &sysName, const Communicator *comm) Definition: WriteSystemMatrixHelper.hpp:155
|