OGS
MatrixOutput.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <fstream>
14#include <functional>
15#include <mutex>
16#include <unordered_set>
17
19
21{
24{
26
27 void operator()(double const t, int const process_id, GlobalMatrix const& M,
28 GlobalMatrix const& K, GlobalVector const& b);
29
30 void operator()(double const t, int const process_id, GlobalVector const& b,
31 GlobalMatrix const& Jac);
32
33private:
34 std::string filenamePrefix_;
35
38 std::size_t counter_ = 0;
39
40 bool do_output_ = false;
41};
42
45{
47
48 void operator()(double const t, int const process_id,
49 std::size_t const element_id,
50 std::vector<double> const& local_M_data,
51 std::vector<double> const& local_K_data,
52 std::vector<double> const& local_b_data);
53
54 void operator()(double const t, int const process_id,
55 std::size_t const element_id,
56 std::vector<double> const& local_b_data,
57 std::vector<double> const& local_Jac_data);
58
60
61private:
62 bool isOutputRequested(std::size_t const element_id) const;
63
64 std::mutex mutex_;
65 std::ofstream outputFile_;
66 std::function<bool(std::size_t)> output_element_predicate_;
67};
68
69namespace detail
70{
71// helper function, exposed for unit testing, only
72std::function<bool(std::size_t)> createLocalMatrixOutputElementPredicate(
73 std::string const& element_ids_str);
74
75// helper function, exposed for unit testing, only
76std::unordered_set<std::size_t> parseSetOfSizeT(std::string const& str,
77 std::string const& warn_msg);
78} // namespace detail
79} // namespace ProcessLib::Assembly
Global vector based on Eigen vector.
Definition EigenVector.h:25
std::unordered_set< std::size_t > parseSetOfSizeT(std::string const &str, std::string const &warn_msg)
std::function< bool(std::size_t)> createLocalMatrixOutputElementPredicate(std::string const &element_ids_str)
Writes global matrices to disk for debugging purposes.
void operator()(double const t, int const process_id, GlobalMatrix const &M, GlobalMatrix const &K, GlobalVector const &b)
Writes local matrices to disk for debugging purposes.
bool isOutputRequested(std::size_t const element_id) const
std::function< bool(std::size_t)> output_element_predicate_
void operator()(double const t, int const process_id, std::size_t const element_id, std::vector< double > const &local_M_data, std::vector< double > const &local_K_data, std::vector< double > const &local_b_data)