38 template <
typename TAlgebra>
42 for (
size_t i = 0; i < m_vTimeDisc.size(); ++i)
43 m_vTimeDisc[i]->prepare_step(prevSol, dt);
46 template <
typename TAlgebra>
54 for (
size_t i = 0; i < m_vTimeDisc.size(); ++i)
55 m_vTimeDisc[i]->prepare_step_elem(prevSol, dt, gl);
58 template <
typename TAlgebra>
62 for (
size_t i = 0; i < m_vTimeDisc.size(); ++i)
63 m_vTimeDisc[i]->finish_step(currSol);
66 template <
typename TAlgebra>
73 for (
size_t i = 0; i < m_vTimeDisc.size(); ++i)
74 m_vTimeDisc[i]->finish_step_elem(currSol, gl);
77 template <
typename TAlgebra>
80 if (m_vTimeDisc.size())
81 return m_vTimeDisc[0]->future_time();
82 UG_THROW(
"At least one time disc must be added to CompositeTimeDiscretization.")
85 template <
typename TAlgebra>
89 for (
size_t i = 0; i < m_vTimeDisc.size(); ++i)
90 nSteps = std::max(nSteps, m_vTimeDisc[i]->num_prev_steps());
95 template <
typename TAlgebra>
99 for (
size_t i = 0; i < m_vTimeDisc.size(); ++i)
100 nStages = std::max(nStages, m_vTimeDisc[i]->num_stages());
105 template <
typename TAlgebra>
108 for (
size_t i = 0; i < m_vTimeDisc.size(); ++i)
109 m_vTimeDisc[i]->set_stage(stage);
113 template <
typename TAlgebra>
122 "At least one time disc must be added to CompositeTimeDiscretization.")
124 m_vTimeDisc[0]->assemble_jacobian(J, u, gl);
125 for (
size_t i = 1; i < m_vTimeDisc.size(); ++i)
128 m_vTimeDisc[i]->domain_disc()->ass_tuner()->disable_clear_on_resize();
130 m_vTimeDisc[i]->assemble_jacobian(J, u, gl);
134 template <
typename TAlgebra>
143 "At least one time disc must be added to CompositeTimeDiscretization.")
145 m_vTimeDisc[0]->assemble_defect(d, u, gl);
146 for (
size_t i = 1; i < m_vTimeDisc.size(); ++i)
149 m_vTimeDisc[i]->domain_disc()->ass_tuner()->disable_clear_on_resize();
151 m_vTimeDisc[i]->assemble_defect(d, u, gl);
155 template <
typename TAlgebra>
164 "At least one time disc must be added to CompositeTimeDiscretization.")
166 m_vTimeDisc[0]->assemble_linear(A, b, gl);
167 for (
size_t i = 1; i < m_vTimeDisc.size(); ++i)
170 m_vTimeDisc[i]->domain_disc()->ass_tuner()->disable_clear_on_resize();
172 m_vTimeDisc[i]->assemble_linear(A, b, gl);
176 template <
typename TAlgebra>
185 "At least one time disc must be added to CompositeTimeDiscretization.")
187 m_vTimeDisc[0]->assemble_rhs(b, u, gl);
188 for (
size_t i = 1; i < m_vTimeDisc.size(); ++i)
191 m_vTimeDisc[i]->domain_disc()->ass_tuner()->disable_clear_on_resize();
193 m_vTimeDisc[i]->assemble_rhs(b, u, gl);
197 template <
typename TAlgebra>
201 "At least one time disc must be added to CompositeTimeDiscretization.")
203 m_vTimeDisc[0]->assemble_rhs(b, gl);
204 for (
size_t i = 1; i < m_vTimeDisc.size(); ++i)
207 m_vTimeDisc[i]->domain_disc()->ass_tuner()->disable_clear_on_resize();
209 m_vTimeDisc[i]->assemble_rhs(b, gl);
213 template <
typename TAlgebra>
216 for (
size_t i = 0; i < m_vTimeDisc.size(); ++i)
217 m_vTimeDisc[i]->adjust_solution(u, gl);
220 template <
typename TAlgebra>
224 for (
size_t i = 0; i < m_vTimeDisc.size(); ++i)
230 template <
typename TAlgebra>
233 UG_THROW(
"Unique const AssemblingTuner cannot be provided by CompositeTimeDiscretization.")
236 template <
typename TAlgebra>
240 for (
size_t i = 0; i < m_vTimeDisc.size(); ++i)
241 n += m_vTimeDisc[i]->num_constraints();
246 template <
typename TAlgebra>
249 UG_COND_THROW(i >= num_constraints(),
"Requested constraint " << i <<
", but only "
250 << num_constraints() <<
" constraints available.");
255 while ((n += m_vTimeDisc[k]->num_constraints()) <= i)
258 const size_t indInCurTD = i - (n - m_vTimeDisc[k]->num_constraints());
260 return m_vTimeDisc[k]->constraint(indInCurTD);
Definition: smart_pointer.h:296
Definition: smart_pointer.h:108
Definition: composite_time_disc.h:70
virtual void prepare_step(SmartPtr< VectorTimeSeries< vector_type > > prevSol, number dt)
prepares the assembling of Defect/Jacobian for a time step
Definition: composite_time_disc_impl.h:40
virtual number future_time() const
returns the future time point (i.e. the one that will be computed)
Definition: composite_time_disc_impl.h:78
virtual size_t num_constraints() const
returns the number of constraints
Definition: composite_time_disc_impl.h:237
virtual SmartPtr< IConstraint< TAlgebra > > constraint(size_t i)
returns the i'th constraint
Definition: composite_time_disc_impl.h:247
void assemble_rhs(vector_type &b, const vector_type &u, const GridLevel &gl)
Definition: composite_time_disc_impl.h:178
virtual size_t num_stages() const
returns the number of stages
Definition: composite_time_disc_impl.h:96
virtual void finish_step(SmartPtr< VectorTimeSeries< vector_type > > currSol)
Definition: composite_time_disc_impl.h:60
void assemble_jacobian(matrix_type &J, const vector_type &u, const GridLevel &gl)
assembles Jacobian (or Approximation of Jacobian)
Definition: composite_time_disc_impl.h:115
virtual void finish_step_elem(SmartPtr< VectorTimeSeries< vector_type > > currSol, const GridLevel &gl)
Definition: composite_time_disc_impl.h:68
void assemble_defect(vector_type &d, const vector_type &u, const GridLevel &gl)
assembles Defect
Definition: composite_time_disc_impl.h:136
void assemble_linear(matrix_type &A, vector_type &b, const GridLevel &gl)
Assembles Matrix and Right-Hand-Side for a linear problem.
Definition: composite_time_disc_impl.h:157
virtual size_t num_prev_steps() const
returns number of previous time steps needed
Definition: composite_time_disc_impl.h:86
virtual SmartPtr< AssemblingTuner< TAlgebra > > ass_tuner()
Definition: composite_time_disc_impl.h:221
void adjust_solution(vector_type &u, const GridLevel &gl)
sets dirichlet values in solution vector
Definition: composite_time_disc_impl.h:214
virtual void prepare_step_elem(SmartPtr< VectorTimeSeries< vector_type > > prevSol, number dt, const GridLevel &gl)
prepares the assembling of Defect/Jacobian for a time step
Definition: composite_time_disc_impl.h:48
virtual void set_stage(size_t stage)
sets the stage
Definition: composite_time_disc_impl.h:106
Definition: grid_level.h:42
Interface providing Jacobian and Defect of a discretization.
Definition: assemble_interface.h:110
TAlgebra::vector_type vector_type
Type of algebra vector.
Definition: assemble_interface.h:119
TAlgebra::matrix_type matrix_type
Type of algebra matrix.
Definition: assemble_interface.h:116
time series of solutions and corresponding time point
Definition: solution_time_series.h:59
#define UG_THROW(msg)
Definition: error.h:57
#define UG_COND_THROW(cond, msg)
UG_COND_THROW(cond, msg) : performs a UG_THROW(msg) if cond == true.
Definition: error.h:61
double number
Definition: types.h:124
SmartPtr< T, FreePolicy > make_sp(T *inst)
returns a SmartPtr for the passed raw pointer
Definition: smart_pointer.h:836