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 22 of file CompareJacobiansJacobianAssembler.cpp.

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

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 103 of file CompareJacobiansJacobianAssembler.cpp.

105{
106 dump_py(fh, var, val,
107 std::integral_constant<int, Derived::ColsAtCompileTime>{});
108}
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 67 of file CompareJacobiansJacobianAssembler.cpp.

70{
71 dump_py_vec(fh, var, val);
72}
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 76 of file CompareJacobiansJacobianAssembler.cpp.

79{
80 fh << var << " = np.array([\n";
81 for (std::ptrdiff_t r = 0; r < val.rows(); ++r)
82 {
83 if (r != 0)
84 {
85 fh << ",\n";
86 }
87 fh << " [";
88 for (std::ptrdiff_t c = 0; c < val.cols(); ++c)
89 {
90 if (c != 0)
91 {
92 fh << ", ";
93 }
94 fh << val(r, c);
95 }
96 fh << "]";
97 }
98 fh << "])\n";
99}

◆ 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 112 of file CompareJacobiansJacobianAssembler.cpp.

114{
115 dump_py(fh, var, val.array());
116}

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 28 of file CompareJacobiansJacobianAssembler.cpp.

29{
30 fh << var << " = " << val << '\n';
31}

◆ 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 59 of file CompareJacobiansJacobianAssembler.cpp.

61{
62 dump_py_vec(fh, var, val);
63}

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 35 of file CompareJacobiansJacobianAssembler.cpp.

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

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 119 of file CompareJacobiansJacobianAssembler.cpp.