Skip to content

Commit

Permalink
Debug output (now only for the one stage case).
Browse files Browse the repository at this point in the history
  • Loading branch information
LogashenkoDL committed Apr 21, 2023
1 parent 03acd1f commit bcc6726
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion limex_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,13 @@ static void DomainAlgebra(TRegistry& reg, string grp)
// SimpleTimeIntegrator
// (e.g., implicit Euler for linear problem)
typedef INonlinearTimeIntegrator<TDomain, TAlgebra> TBase;
typedef DebugWritingObject<TAlgebra> TDebugBase;
typedef SimpleTimeIntegrator<TDomain, TAlgebra> T;
//typedef DomainDiscretization<TDomain, TAlgebra> TDomainDisc;
//typedef MultiStepTimeDiscretization<TAlgebra> TTimeDisc;

string name = string("SimpleTimeIntegrator").append(suffix);
reg.template add_class_<T,TBase>(name, grp)
reg.template add_class_<T,TBase,TDebugBase>(name, grp)
.template add_constructor<void (*)(SmartPtr<TTimeDisc>) >("")
.add_method("apply", (bool (T::*)(SmartPtr<TGridFunction> u, number time, ConstSmartPtr<TGridFunction> u0, number time0) ) &T::apply, "","")
.set_construct_as_smart_pointer(true);
Expand Down
12 changes: 11 additions & 1 deletion time_disc/simple_integrator.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#include "lib_algebra/operator/debug_writer.h"

namespace ug {

/// Integrate (a non-linear problem) over a given time interval
template<class TDomain, class TAlgebra>
class SimpleTimeIntegrator :
public INonlinearTimeIntegrator<TDomain, TAlgebra>,
public ITimeDiscDependentObject<TAlgebra>
public ITimeDiscDependentObject<TAlgebra>,
public DebugWritingObject<TAlgebra>
{
protected:
typedef ITimeDiscDependentObject<TAlgebra> tdisc_dep_type;
Expand Down Expand Up @@ -110,6 +112,13 @@ bool SimpleTimeIntegrator<TDomain, TAlgebra>::apply_single_stage(SmartPtr<grid_f
while(!hasTerminated(t, t0, t1)) {
if(!base_type::m_bNoLogOut)
UG_LOG("+++ Timestep +++" << step << "\n");

if (this->debug_writer_valid())
{
char debug_name_ext[16];
sprintf(debug_name_ext, "%04d", step);
this->enter_debug_writer_section(std::string("SimpleTimeIntegrator_step") + debug_name_ext);
}

// determine step size
UG_COND_THROW(currdt < base_type::get_dt_min(), "Time step size below minimum. ABORTING!")
Expand Down Expand Up @@ -175,6 +184,7 @@ bool SimpleTimeIntegrator<TDomain, TAlgebra>::apply_single_stage(SmartPtr<grid_f
step++;
// tdisc.finish_step_elem(m_spSolTimeSeries, dt);

this->leave_debug_writer_section();
}

if(base_type::m_bNoLogOut)
Expand Down

0 comments on commit bcc6726

Please sign in to comment.