OGS
CompareJacobiansJacobianAssembler.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <fstream>
14#include <limits>
15#include <memory>
16
18
19namespace BaseLib
20{
21class ConfigTree;
22} // namespace BaseLib
23
24namespace ProcessLib
25{
32{
33public:
35 std::unique_ptr<AbstractJacobianAssembler>&& asm1,
36 std::unique_ptr<AbstractJacobianAssembler>&& asm2,
37 double abs_tol,
38 double rel_tol,
39 bool fail_on_error,
40 std::string const& log_file_path)
41 : _asm1(std::move(asm1)),
42 _asm2(std::move(asm2)),
43 _abs_tol(abs_tol),
44 _rel_tol(rel_tol),
45 _fail_on_error(fail_on_error),
46 _log_file(log_file_path)
47 {
48 _log_file.precision(std::numeric_limits<double>::max_digits10);
49 _log_file << "#!/usr/bin/env python\n"
50 "import numpy as np\n"
51 "from numpy import nan\n"
52 << std::endl;
53 }
54
56 double const t, double const dt,
57 std::vector<double> const& local_x,
58 std::vector<double> const& local_x_prev,
59 std::vector<double>& local_b_data,
60 std::vector<double>& local_Jac_data) override;
61
62 std::unique_ptr<AbstractJacobianAssembler> copy() const override;
63
64private:
65 std::unique_ptr<AbstractJacobianAssembler> _asm1;
66 std::unique_ptr<AbstractJacobianAssembler> _asm2;
67
68 // TODO change to matrix
69 double const _abs_tol;
70 double const _rel_tol;
71
73 bool const _fail_on_error;
74
77 std::ofstream _log_file;
78
82 std::size_t _counter = 0;
83};
84
85std::unique_ptr<CompareJacobiansJacobianAssembler>
87
88} // namespace ProcessLib
Base class for Jacobian assemblers.
bool const _fail_on_error
Whether to abort if the tolerances are exceeded.
void assembleWithJacobian(LocalAssemblerInterface &local_assembler, double const t, double const dt, std::vector< double > const &local_x, std::vector< double > const &local_x_prev, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data) override
std::unique_ptr< AbstractJacobianAssembler > _asm2
std::unique_ptr< AbstractJacobianAssembler > copy() const override
CompareJacobiansJacobianAssembler(std::unique_ptr< AbstractJacobianAssembler > &&asm1, std::unique_ptr< AbstractJacobianAssembler > &&asm2, double abs_tol, double rel_tol, bool fail_on_error, std::string const &log_file_path)
std::unique_ptr< AbstractJacobianAssembler > _asm1
std::unique_ptr< CompareJacobiansJacobianAssembler > createCompareJacobiansJacobianAssembler(BaseLib::ConfigTree const &config)