OGS
anonymous_namespace{CompareJacobiansJacobianAssembler.cpp} Namespace Reference

Functions

void dump_py (std::ostream &fh, std::string const &var, double const val)
 Dumps a double value as a Python script snippet.
void dump_py (std::ostream &fh, std::string const &var, std::size_t const val)
 Dumps a std::size_t value as a Python script snippet.
template<typename Vec>
void dump_py_vec (std::ostream &fh, std::string const &var, Vec const &val)
 Dumps an arbitrary vector as a Python script snippet.
void dump_py (std::ostream &fh, std::string const &var, std::vector< double > const &val)
 Dumps a std::vector<double> as a Python script snippet.
template<typename Derived>
void dump_py (std::ostream &fh, std::string const &var, Eigen::ArrayBase< Derived > const &val, std::integral_constant< int, 1 >)
 Dumps an Eigen vector (array with 1 column) as a Python script snippet.
template<typename Derived, int ColsAtCompileTime>
void dump_py (std::ostream &fh, std::string const &var, Eigen::ArrayBase< Derived > const &val, std::integral_constant< int, ColsAtCompileTime >)
 Dumps an Eigen array as a Python script snippet.
template<typename Derived>
void dump_py (std::ostream &fh, std::string const &var, Eigen::ArrayBase< Derived > const &val)
 Dumps an Eigen array as a Python script snippet.
template<typename Derived>
void dump_py (std::ostream &fh, std::string const &var, Eigen::MatrixBase< Derived > const &val)
 Dumps an Eigen matrix as a Python script snippet.

Variables

const std::string msg_fatal
 Will be printed if some consistency error is detected.

Function Documentation

◆ dump_py() [1/7]

void anonymous_namespace{CompareJacobiansJacobianAssembler.cpp}::dump_py ( std::ostream & fh,
std::string const & var,
double const val )

Dumps a double value as a Python script snippet.

Definition at line 15 of file CompareJacobiansJacobianAssembler.cpp.

16{
17 fh << var << " = " << val << '\n';
18}

Referenced by dump_py(), and dump_py().

◆ dump_py() [2/7]

template<typename Derived>
void anonymous_namespace{CompareJacobiansJacobianAssembler.cpp}::dump_py ( std::ostream & fh,
std::string const & var,
Eigen::ArrayBase< Derived > const & val )

Dumps an Eigen array as a Python script snippet.

Definition at line 96 of file CompareJacobiansJacobianAssembler.cpp.

98{
99 dump_py(fh, var, val,
100 std::integral_constant<int, Derived::ColsAtCompileTime>{});
101}
void dump_py(std::ostream &fh, std::string const &var, double const val)
Dumps a double value as a Python script snippet.

References dump_py().

◆ dump_py() [3/7]

template<typename Derived>
void anonymous_namespace{CompareJacobiansJacobianAssembler.cpp}::dump_py ( std::ostream & fh,
std::string const & var,
Eigen::ArrayBase< Derived > const & val,
std::integral_constant< int, 1 >  )

Dumps an Eigen vector (array with 1 column) as a Python script snippet.

Definition at line 60 of file CompareJacobiansJacobianAssembler.cpp.

63{
64 dump_py_vec(fh, var, val);
65}
void dump_py_vec(std::ostream &fh, std::string const &var, Vec const &val)
Dumps an arbitrary vector as a Python script snippet.

References dump_py_vec().

◆ dump_py() [4/7]

template<typename Derived, int ColsAtCompileTime>
void anonymous_namespace{CompareJacobiansJacobianAssembler.cpp}::dump_py ( std::ostream & fh,
std::string const & var,
Eigen::ArrayBase< Derived > const & val,
std::integral_constant< int, ColsAtCompileTime >  )

Dumps an Eigen array as a Python script snippet.

Definition at line 69 of file CompareJacobiansJacobianAssembler.cpp.

72{
73 fh << var << " = np.array([\n";
74 for (std::ptrdiff_t r = 0; r < val.rows(); ++r)
75 {
76 if (r != 0)
77 {
78 fh << ",\n";
79 }
80 fh << " [";
81 for (std::ptrdiff_t c = 0; c < val.cols(); ++c)
82 {
83 if (c != 0)
84 {
85 fh << ", ";
86 }
87 fh << val(r, c);
88 }
89 fh << "]";
90 }
91 fh << "])\n";
92}

◆ dump_py() [5/7]

template<typename Derived>
void anonymous_namespace{CompareJacobiansJacobianAssembler.cpp}::dump_py ( std::ostream & fh,
std::string const & var,
Eigen::MatrixBase< Derived > const & val )

Dumps an Eigen matrix as a Python script snippet.

Definition at line 105 of file CompareJacobiansJacobianAssembler.cpp.

107{
108 dump_py(fh, var, val.array());
109}

References dump_py().

◆ dump_py() [6/7]

void anonymous_namespace{CompareJacobiansJacobianAssembler.cpp}::dump_py ( std::ostream & fh,
std::string const & var,
std::size_t const val )

Dumps a std::size_t value as a Python script snippet.

Definition at line 21 of file CompareJacobiansJacobianAssembler.cpp.

22{
23 fh << var << " = " << val << '\n';
24}

◆ dump_py() [7/7]

void anonymous_namespace{CompareJacobiansJacobianAssembler.cpp}::dump_py ( std::ostream & fh,
std::string const & var,
std::vector< double > const & val )

Dumps a std::vector<double> as a Python script snippet.

Definition at line 52 of file CompareJacobiansJacobianAssembler.cpp.

54{
55 dump_py_vec(fh, var, val);
56}

References dump_py_vec().

◆ dump_py_vec()

template<typename Vec>
void anonymous_namespace{CompareJacobiansJacobianAssembler.cpp}::dump_py_vec ( std::ostream & fh,
std::string const & var,
Vec const & val )

Dumps an arbitrary vector as a Python script snippet.

Definition at line 28 of file CompareJacobiansJacobianAssembler.cpp.

29{
30 fh << var << " = np.array([";
31 for (decltype(val.size()) i = 0; i < val.size(); ++i)
32 {
33 if (i != 0)
34 {
35 if (i % 8 == 0)
36 {
37 // Print at most eight entries on one line,
38 // indent with four spaces.
39 fh << ",\n ";
40 }
41 else
42 {
43 fh << ", ";
44 }
45 }
46 fh << val[i];
47 }
48 fh << "])\n";
49}

Referenced by dump_py(), and dump_py().

Variable Documentation

◆ msg_fatal

const std::string anonymous_namespace{CompareJacobiansJacobianAssembler.cpp}::msg_fatal
Initial value:
=
"The local matrices M or K or the local vectors b assembled with the two "
"different Jacobian assemblers differ."

Will be printed if some consistency error is detected.

Definition at line 112 of file CompareJacobiansJacobianAssembler.cpp.