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 std::ostringstream oss;
77 oss << "prob_" << simulator.episodeIndex()
78 << "_time_" << std::setprecision(15) << std::setw(12) << std::setfill( '0') << simulator.time()
79 << "_nit_" << simulator.model().newtonMethod().numIterations()
80 << '_' << objName << "_istl";
82 const auto filename = (output_dir / oss.str()).generic_string();
85 if (comm != nullptr) {
86 Dune::storeMatrixMarket(linalgObject, filename, *comm);
91 Dune::storeMatrixMarket(linalgObject, filename + ".mm");
120 template < class SimulatorType, class VectorType, class Communicator>
122 const VectorType& rhs,
123 const std::string& sysName,
124 const Communicator* comm)
153 template < class SimulatorType, class MatrixType, class Communicator>
155 const MatrixType& matrix,
156 const std::string& sysName,
157 const Communicator* comm)
195 template < class SimulatorType, class MatrixType, class VectorType, class Communicator>
197 const MatrixType& matrix,
198 const VectorType& rhs,
199 const std::string& sysName,
200 const Communicator* comm)
237 template < class SimulatorType, class MatrixType, class VectorType, class Communicator>
239 const MatrixType& matrix,
240 const VectorType& rhs,
241 const Communicator* comm)
243 writeSystem(simulator, matrix, rhs, "flow_", comm);
277 template < class SimulatorType, class MatrixType, class VectorType, class Communicator>
279 const MatrixType& matrix,
280 const VectorType& rhs,
281 const Communicator* comm)
283 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:196
void writeMechSystem(const SimulatorType &simulator, const MatrixType &matrix, const VectorType &rhs, const Communicator *comm) Definition: WriteSystemMatrixHelper.hpp:278
void writeVector(const SimulatorType &simulator, const VectorType &rhs, const std::string &sysName, const Communicator *comm) Definition: WriteSystemMatrixHelper.hpp:121
void writeMatrix(const SimulatorType &simulator, const MatrixType &matrix, const std::string &sysName, const Communicator *comm) Definition: WriteSystemMatrixHelper.hpp:154
|