Skip to content
Snippets Groups Projects
Commit b4f3274b authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler
Browse files

improve logging

parent ed07cb95
No related branches found
No related tags found
Loading
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
const SourceSpaceType& src_space, const SourceSpaceType& src_space,
const RangeSpaceType& rng_space, const RangeSpaceType& rng_space,
const std::string& logging_prefix = "", const std::string& logging_prefix = "",
const std::array<bool, 3>& logging_enabled = {{false, false, true}}) const std::array<bool, 3>& logging_enabled = XT::Common::default_logger_state())
: BaseType({}, logging_prefix.empty() ? "ConstLincombOperator" : logging_prefix, logging_enabled) : BaseType({}, logging_prefix.empty() ? "ConstLincombOperator" : logging_prefix, logging_enabled)
, assembly_grid_view_(assembly_grid_vw) , assembly_grid_view_(assembly_grid_vw)
, source_space_(src_space) , source_space_(src_space)
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
const XT::Common::Parameter& param = {}) const override final const XT::Common::Parameter& param = {}) const override final
{ {
LOG_(debug) << "apply(source_function=" << &source_function LOG_(debug) << "apply(source_function=" << &source_function
<< ", range_vector.sup_norm()=" << range_vector.sup_norm() << ", param=" << param << ")" << std::endl; << ", range_vector.sup_norm()=" << range_vector.sup_norm() << ", param=" << print(param) << ")" << std::endl;
this->assert_matching_range(range_vector); this->assert_matching_range(range_vector);
LOG_(info) << "applying " << this->num_ops() << " operators ..." << std::endl; LOG_(info) << "applying " << this->num_ops() << " operators ..." << std::endl;
range_vector.set_all(0); range_vector.set_all(0);
...@@ -127,7 +127,7 @@ public: ...@@ -127,7 +127,7 @@ public:
const XT::Common::Parameter& param = {}) const override final const XT::Common::Parameter& param = {}) const override final
{ {
LOG_(debug) << "apply(source_vector.sup_norm()=" << source_vector.sup_norm() LOG_(debug) << "apply(source_vector.sup_norm()=" << source_vector.sup_norm()
<< ", range_vector.sup_norm()=" << range_vector.sup_norm() << ", param=" << param << ")" << std::endl; << ", range_vector.sup_norm()=" << range_vector.sup_norm() << ", param=" << print(param) << ")" << std::endl;
this->assert_matching_source(source_vector); this->assert_matching_source(source_vector);
this->assert_matching_range(range_vector); this->assert_matching_range(range_vector);
LOG_(info) << "applying " << this->num_ops() << " operators ..." << std::endl; LOG_(info) << "applying " << this->num_ops() << " operators ..." << std::endl;
...@@ -166,7 +166,7 @@ public: ...@@ -166,7 +166,7 @@ public:
LOG_(debug) << "jacobian(source_vector.sup_norm()=" << source_vector.sup_norm() LOG_(debug) << "jacobian(source_vector.sup_norm()=" << source_vector.sup_norm()
<< ", jacobian_op.matrix().sup_norm()=" << jacobian_op.matrix().sup_norm() << ", jacobian_op.matrix().sup_norm()=" << jacobian_op.matrix().sup_norm()
<< ",\n opts=" << print(opts, {{"oneline", "true"}}) << ",\n param=" << param << ")" << std::endl; << ",\n opts=" << print(opts, {{"oneline", "true"}}) << ",\n param=" << print(param) << ")" << std::endl;
this->assert_matching_source(source_vector); this->assert_matching_source(source_vector);
this->assert_jacobian_opts(opts); // ensures that "lincomb" is requested this->assert_jacobian_opts(opts); // ensures that "lincomb" is requested
using XT::Common::to_string; using XT::Common::to_string;
...@@ -192,7 +192,7 @@ public: ...@@ -192,7 +192,7 @@ public:
const auto scaling = jacobian_op.scaling; const auto scaling = jacobian_op.scaling;
// add op // add op
jacobian_op.scaling *= this->coeff(ii); jacobian_op.scaling *= this->coeff(ii);
LOG_(debug) << " backing up scaling = " << scaling << ",\n this->coeff(ii) = " << this->coeff(ii) LOG_(debug) << " backing up scaling = " << scaling << "\n this->coeff(ii) = " << this->coeff(ii)
<< "\n jacobian_op.scaling = " << jacobian_op.scaling << std::endl; << "\n jacobian_op.scaling = " << jacobian_op.scaling << std::endl;
this->op(ii).jacobian(source_vector, jacobian_op, op_opts, param); this->op(ii).jacobian(source_vector, jacobian_op, op_opts, param);
// restore scaling // restore scaling
...@@ -260,7 +260,7 @@ public: ...@@ -260,7 +260,7 @@ public:
const_ops_.emplace_back(op.const_ops_[ii]); const_ops_.emplace_back(op.const_ops_[ii]);
coeffs_.emplace_back(coeff * op.coeffs_[ii]); coeffs_.emplace_back(coeff * op.coeffs_[ii]);
} }
} } // ... add(...)
// we need this, otherwise add(OperatorType*&&) would be used // we need this, otherwise add(OperatorType*&&) would be used
void add(ThisType*&& op, const FieldType& coeff = 1.) void add(ThisType*&& op, const FieldType& coeff = 1.)
...@@ -401,7 +401,7 @@ auto make_const_lincomb_operator(const AssemblyGridViewType& assembly_grid_view, ...@@ -401,7 +401,7 @@ auto make_const_lincomb_operator(const AssemblyGridViewType& assembly_grid_view,
const SpaceInterface<SGV, s_r, s_rC, F>& source_space, const SpaceInterface<SGV, s_r, s_rC, F>& source_space,
const SpaceInterface<RGV, r_r, r_rC, F>& range_space, const SpaceInterface<RGV, r_r, r_rC, F>& range_space,
const std::string& logging_prefix = "", const std::string& logging_prefix = "",
const std::array<bool, 3>& logging_state = {{false, false, true}}) const std::array<bool, 3>& logging_state = XT::Common::default_logger_state())
{ {
static_assert(XT::Grid::is_view<AssemblyGridViewType>::value, ""); static_assert(XT::Grid::is_view<AssemblyGridViewType>::value, "");
static_assert(XT::LA::is_matrix<MatrixType>::value, ""); static_assert(XT::LA::is_matrix<MatrixType>::value, "");
...@@ -414,7 +414,7 @@ auto make_const_lincomb_operator(const AssemblyGridViewType& assembly_grid_view, ...@@ -414,7 +414,7 @@ auto make_const_lincomb_operator(const AssemblyGridViewType& assembly_grid_view,
const SpaceInterface<SGV, s_r, s_rC, F>& source_space, const SpaceInterface<SGV, s_r, s_rC, F>& source_space,
const SpaceInterface<RGV, r_r, r_rC, F>& range_space, const SpaceInterface<RGV, r_r, r_rC, F>& range_space,
const std::string& logging_prefix = "", const std::string& logging_prefix = "",
const std::array<bool, 3>& logging_state = {{false, false, true}}) const std::array<bool, 3>& logging_state = XT::Common::default_logger_state())
{ {
return make_const_lincomb_operator<XT::LA::IstlRowMajorSparseMatrix<F>>( return make_const_lincomb_operator<XT::LA::IstlRowMajorSparseMatrix<F>>(
assembly_grid_view, source_space, range_space, logging_prefix, logging_state); assembly_grid_view, source_space, range_space, logging_prefix, logging_state);
...@@ -428,7 +428,7 @@ template <class MatrixType, // <- needs to be manually specified ...@@ -428,7 +428,7 @@ template <class MatrixType, // <- needs to be manually specified
class F> class F>
auto make_const_lincomb_operator(const SpaceInterface<GV, r, r, F>& space, auto make_const_lincomb_operator(const SpaceInterface<GV, r, r, F>& space,
const std::string& logging_prefix = "", const std::string& logging_prefix = "",
const std::array<bool, 3>& logging_state = {{false, false, true}}) const std::array<bool, 3>& logging_state = XT::Common::default_logger_state())
{ {
static_assert(XT::LA::is_matrix<MatrixType>::value, ""); static_assert(XT::LA::is_matrix<MatrixType>::value, "");
return ConstLincombOperator<GV, r, rC, r, rC, F, MatrixType, GV, GV>( return ConstLincombOperator<GV, r, rC, r, rC, F, MatrixType, GV, GV>(
...@@ -438,7 +438,7 @@ auto make_const_lincomb_operator(const SpaceInterface<GV, r, r, F>& space, ...@@ -438,7 +438,7 @@ auto make_const_lincomb_operator(const SpaceInterface<GV, r, r, F>& space,
template <class GV, size_t r, size_t rC, class F> template <class GV, size_t r, size_t rC, class F>
auto make_const_lincomb_operator(const SpaceInterface<GV, r, r, F>& space, auto make_const_lincomb_operator(const SpaceInterface<GV, r, r, F>& space,
const std::string& logging_prefix = "", const std::string& logging_prefix = "",
const std::array<bool, 3>& logging_state = {{false, false, true}}) const std::array<bool, 3>& logging_state = XT::Common::default_logger_state())
{ {
return make_const_lincomb_operator<XT::LA::IstlRowMajorSparseMatrix<F>>(space, logging_prefix, logging_state); return make_const_lincomb_operator<XT::LA::IstlRowMajorSparseMatrix<F>>(space, logging_prefix, logging_state);
} }
...@@ -472,7 +472,7 @@ public: ...@@ -472,7 +472,7 @@ public:
const SourceSpaceType& src_space, const SourceSpaceType& src_space,
const RangeSpaceType& rng_space, const RangeSpaceType& rng_space,
const std::string& logging_prefix = "", const std::string& logging_prefix = "",
const std::array<bool, 3>& logging_enabled = {{false, false, true}}) const std::array<bool, 3>& logging_enabled = XT::Common::default_logger_state())
: BaseType(assembly_grid_vw, : BaseType(assembly_grid_vw,
src_space, src_space,
rng_space, rng_space,
...@@ -658,7 +658,7 @@ auto make_lincomb_operator(const AssemblyGridViewType& assembly_grid_view, ...@@ -658,7 +658,7 @@ auto make_lincomb_operator(const AssemblyGridViewType& assembly_grid_view,
const SpaceInterface<SGV, s_r, s_rC, F>& source_space, const SpaceInterface<SGV, s_r, s_rC, F>& source_space,
const SpaceInterface<RGV, r_r, r_rC, F>& range_space, const SpaceInterface<RGV, r_r, r_rC, F>& range_space,
const std::string& logging_prefix = "", const std::string& logging_prefix = "",
const std::array<bool, 3>& logging_state = {{false, false, true}}) const std::array<bool, 3>& logging_state = XT::Common::default_logger_state())
{ {
static_assert(XT::Grid::is_view<AssemblyGridViewType>::value, ""); static_assert(XT::Grid::is_view<AssemblyGridViewType>::value, "");
static_assert(XT::LA::is_matrix<MatrixType>::value, ""); static_assert(XT::LA::is_matrix<MatrixType>::value, "");
...@@ -671,7 +671,7 @@ auto make_lincomb_operator(const AssemblyGridViewType& assembly_grid_view, ...@@ -671,7 +671,7 @@ auto make_lincomb_operator(const AssemblyGridViewType& assembly_grid_view,
const SpaceInterface<SGV, s_r, s_rC, F>& source_space, const SpaceInterface<SGV, s_r, s_rC, F>& source_space,
const SpaceInterface<RGV, r_r, r_rC, F>& range_space, const SpaceInterface<RGV, r_r, r_rC, F>& range_space,
const std::string& logging_prefix = "", const std::string& logging_prefix = "",
const std::array<bool, 3>& logging_state = {{false, false, true}}) const std::array<bool, 3>& logging_state = XT::Common::default_logger_state())
{ {
return make_lincomb_operator<XT::LA::IstlRowMajorSparseMatrix<F>>( return make_lincomb_operator<XT::LA::IstlRowMajorSparseMatrix<F>>(
assembly_grid_view, source_space, range_space, logging_prefix, logging_state); assembly_grid_view, source_space, range_space, logging_prefix, logging_state);
...@@ -685,7 +685,7 @@ template <class MatrixType, // <- needs to be manually specified ...@@ -685,7 +685,7 @@ template <class MatrixType, // <- needs to be manually specified
class F> class F>
auto make_lincomb_operator(const SpaceInterface<GV, r, rC, F>& space, auto make_lincomb_operator(const SpaceInterface<GV, r, rC, F>& space,
const std::string& logging_prefix = "", const std::string& logging_prefix = "",
const std::array<bool, 3>& logging_state = {{false, false, true}}) const std::array<bool, 3>& logging_state = XT::Common::default_logger_state())
{ {
static_assert(XT::LA::is_matrix<MatrixType>::value, ""); static_assert(XT::LA::is_matrix<MatrixType>::value, "");
return LincombOperator<GV, r, rC, r, rC, F, MatrixType, GV, GV>( return LincombOperator<GV, r, rC, r, rC, F, MatrixType, GV, GV>(
...@@ -695,7 +695,7 @@ auto make_lincomb_operator(const SpaceInterface<GV, r, rC, F>& space, ...@@ -695,7 +695,7 @@ auto make_lincomb_operator(const SpaceInterface<GV, r, rC, F>& space,
template <class GV, size_t r, size_t rC, class F> template <class GV, size_t r, size_t rC, class F>
auto make_lincomb_operator(const SpaceInterface<GV, r, rC, F>& space, auto make_lincomb_operator(const SpaceInterface<GV, r, rC, F>& space,
const std::string& logging_prefix = "", const std::string& logging_prefix = "",
const std::array<bool, 3>& logging_state = {{false, false, true}}) const std::array<bool, 3>& logging_state = XT::Common::default_logger_state())
{ {
return make_lincomb_operator<XT::LA::IstlRowMajorSparseMatrix<F>>(space, logging_prefix, logging_state); return make_lincomb_operator<XT::LA::IstlRowMajorSparseMatrix<F>>(space, logging_prefix, logging_state);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment