/usr/include/deal.II/numerics/theta_timestepping.templates.h is in libdeal.ii-dev 6.3.1-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | //---------------------------------------------------------------------------
// $Id: theta_timestepping.templates.h 21089 2010-05-07 03:43:11Z bangerth $
//
// Copyright (C) 2006, 2007, 2008, 2009, 2010 by Guido Kanschat
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
// to the file deal.II/doc/license.html for the text and
// further information on this license.
//
//---------------------------------------------------------------------------
#include <numerics/theta_timestepping.h>
#include <base/parameter_handler.h>
#include <lac/vector_memory.h>
DEAL_II_NAMESPACE_OPEN
namespace Algorithms
{
template <class VECTOR>
ThetaTimestepping<VECTOR>::ThetaTimestepping (Operator<VECTOR>& e, Operator<VECTOR>& i)
: op_explicit(&e), op_implicit(&i)
{}
template <class VECTOR>
void
ThetaTimestepping<VECTOR>::notify(const Event& e)
{
op_explicit->notify(e);
op_implicit->notify(e);
}
template <class VECTOR>
void
ThetaTimestepping<VECTOR>::declare_parameters(ParameterHandler& param)
{
param.enter_subsection("ThetaTimestepping");
TimestepControl::declare_parameters (param);
param.declare_entry("Theta", ".5", Patterns::Double());
param.declare_entry("Adaptive", "false", Patterns::Bool());
param.leave_subsection();
}
template <class VECTOR>
void
ThetaTimestepping<VECTOR>::initialize (ParameterHandler& param)
{
param.enter_subsection("ThetaTimestepping");
control.parse_parameters (param);
vtheta = param.get_double("Theta");
adaptive = param.get_bool("Adaptive");
param.leave_subsection ();
}
template <class VECTOR>
void
ThetaTimestepping<VECTOR>::operator() (NamedData<VECTOR*>& out, const NamedData<VECTOR*>& in)
{
Assert(!adaptive, ExcNotImplemented());
deallog.push ("Theta");
GrowingVectorMemory<VECTOR> mem;
typename VectorMemory<VECTOR>::Pointer aux(mem);
aux->reinit(*out(0));
control.restart();
d_explicit.time = control.now();
// The data used to compute the
// vector associated with the old
// timestep
VECTOR* p = out(0);
NamedData<VECTOR*> src1;
src1.add(p, "Previous time");
src1.merge(in);
p = aux;
NamedData<VECTOR*> out1;
out1.add(p, "Result");
// The data provided to the inner
// solver
NamedData<VECTOR*> src2;
src2.add(p, "Previous time data");
src2.merge(in);
if (output != 0)
(*output) << 0U << out;
for (unsigned int count = 1; d_explicit.time < control.final(); ++count)
{
const bool step_change = control.advance();
d_implicit.time = control.now();
d_explicit.step = (1.-vtheta)*control.step();
d_implicit.step = vtheta*control.step();
deallog << "Time step:" << d_implicit.time << std::endl;
op_explicit->notify(Events::new_time);
op_implicit->notify(Events::new_time);
if (step_change)
{
op_explicit->notify(Events::new_timestep_size);
op_implicit->notify(Events::new_timestep_size);
}
// Compute
// (I + (1-theta)dt A) u
(*op_explicit)(out1, src1);
(*op_implicit)(out, src2);
if (output != 0 && control.print())
(*output) << count << out;
d_explicit.time = control.now();
}
deallog.pop();
}
}
DEAL_II_NAMESPACE_CLOSE
|