ug4
domain_disc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2015: G-CSC, Goethe University Frankfurt
3  * Author: Andreas Vogel
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__UG__LIB_DISC__SPATIAL_DISC__DOMAIN_DISC__
34 #define __H__UG__LIB_DISC__SPATIAL_DISC__DOMAIN_DISC__
35 
36 // other ug4 modules
37 #include "common/common.h"
39 
40 // library intern headers
41 #include "subset_assemble_util.h"
42 #include "domain_disc_interface.h"
47 #include "disc_item.h"
51 
52 namespace ug {
53 
56 
58 
76 template <typename TDomain, typename TAlgebra, typename TGlobAssembler>
78 : public IDomainDiscretization<TAlgebra>,
79  public IDomainMarker<TDomain>,
80  protected TGlobAssembler
81 {
83  typedef TGlobAssembler gass_type;
84 
85  public:
87  typedef TDomain domain_type;
88 
90  typedef TAlgebra algebra_type;
91 
93  typedef typename algebra_type::matrix_type matrix_type;
94 
96  typedef typename algebra_type::vector_type vector_type;
97 
100 
103 
105  static const int dim = TDomain::dim;
106 
107  public:
110  m_bErrorCalculated(false),
111  m_spApproxSpace(pApproxSpace), m_spAssTuner(new AssemblingTuner<TAlgebra>)
112  {};
113 
116 
118  // Time independent part
120 
123  virtual void assemble_jacobian(matrix_type& J, const vector_type& u, const GridLevel& gl)
124  {assemble_jacobian(J, u, dd(gl));}
125 
128  virtual void assemble_defect(vector_type& d, const vector_type& u, const GridLevel& gl)
129  {assemble_defect(d, u, dd(gl));}
130 
133  virtual void assemble_linear(matrix_type& mat, vector_type& rhs, const GridLevel& gl)
134  {assemble_linear(mat, rhs, dd(gl));}
135 
138  virtual void assemble_rhs(vector_type& rhs, const vector_type& u, const GridLevel& gl)
139  {assemble_rhs(rhs, u, dd(gl));}
140 
143  {assemble_rhs(rhs, rhs, dd);}
144  virtual void assemble_rhs(vector_type& rhs, const GridLevel& gl)
145  {assemble_rhs(rhs, dd(gl));}
146 
149  virtual void adjust_solution(vector_type& u, const GridLevel& gl)
150  {adjust_solution(u, dd(gl));}
151 
155  {assemble_jacobian(J, u, u.dof_distribution());}
156 
158  {assemble_defect(d, u, u.dof_distribution());}
159 
161  {assemble_linear(A, rhs, rhs.dof_distribution());}
162 
164  {assemble_rhs(rhs, u, u.dof_distribution());}
165 
167  {assemble_rhs(b, b.dof_distribution());}
168 
172 
174  // Time dependent part
178  virtual void prepare_timestep(ConstSmartPtr<VectorTimeSeries<vector_type> > vSol, number future_time, const GridLevel& gl)
179  {prepare_timestep(vSol, future_time, dd(gl));}
180 
181 
186  {prepare_timestep_elem(vSol, dd(gl));}
187 
189  virtual void assemble_jacobian(matrix_type& J,
191  const number s_a0,
195  const number s_a, const GridLevel& gl)
196  {assemble_jacobian(J, vSol, s_a, dd(gl));}
197 
199  virtual void assemble_defect(vector_type& d,
201  const std::vector<number>& vScaleMass,
202  const std::vector<number>& vScaleStiff,
204  virtual void assemble_defect(vector_type& d,
206  const std::vector<number>& vScaleMass,
207  const std::vector<number>& vScaleStiff,
208  const GridLevel& gl)
209  {assemble_defect(d, vSol, vScaleMass, vScaleStiff, dd(gl));}
210 
212  virtual void assemble_linear(matrix_type& A, vector_type& b,
214  const std::vector<number>& vScaleMass,
215  const std::vector<number>& vScaleStiff,
219  const std::vector<number>& vScaleMass,
220  const std::vector<number>& vScaleStiff,
221  const GridLevel& gl)
222  {assemble_linear(A, b, vSol, vScaleMass, vScaleStiff, dd(gl));}
223 
225  virtual void assemble_rhs( vector_type& b,
227  const std::vector<number>& vScaleMass,
228  const std::vector<number>& vScaleStiff,
230  virtual void assemble_rhs( vector_type& b,
232  const std::vector<number>& vScaleMass,
233  const std::vector<number>& vScaleStiff,
234  const GridLevel& gl)
235  {assemble_rhs(b, vSol, vScaleMass, vScaleStiff, dd(gl));}
236 
239  virtual void adjust_solution(vector_type& u, number time, const GridLevel& gl)
240  {adjust_solution(u, time, dd(gl));}
241 
245  {finish_timestep(vSol, dd(gl));}
246 
250  {finish_timestep_elem(vSol, dd(gl));}
251 
253  // Mass and Stiffness Matrix
255  virtual void init_all_exports(ConstSmartPtr<DoFDistribution> dd, bool bAsTimeDependent);
256  virtual void init_all_exports(const GridLevel& gl, bool bAsTimeDependent)
257  {init_all_exports(dd(gl), bAsTimeDependent);}
258  void init_all_exports(bool bAsTimeDependent)
259  {init_all_exports(GridLevel(GridLevel::TOP), bAsTimeDependent);}
260 
262  virtual void assemble_mass_matrix(matrix_type& M, const vector_type& u,
264  virtual void assemble_mass_matrix(matrix_type& M, const vector_type& u,
265  const GridLevel& gl)
266  {assemble_mass_matrix(M, u, dd(gl));}
267 
269  virtual void assemble_stiffness_matrix(matrix_type& A, const vector_type& u,
272  const GridLevel& gl)
273  {assemble_stiffness_matrix(A, u, dd(gl));}
274 
276  // Init. all exports (an optional operation, to use the exports for plotting etc.)
278 
280  // Error estimator ///
281 public:
283  // stationary
284  virtual void calc_error(const vector_type& u, ConstSmartPtr<DoFDistribution> dd, error_vector_type* u_vtk = NULL);
285  virtual void calc_error(const vector_type& u, const GridLevel& gl, error_vector_type* u_vtk = NULL)
286  {calc_error(u, dd(gl));}
287 
289  {calc_error(u, u.dd(), NULL);}
291  {calc_error(u, u.dd(), u_vtk);}
292 
293  // instationary
296  const std::vector<number>& vScaleMass,
297  const std::vector<number>& vScaleStiff,
298  error_vector_type* u_vtk);
300  const std::vector<number>& vScaleMass,
301  const std::vector<number>& vScaleStiff,
302  const GridLevel& gl,
303  error_vector_type* u_vtk)
304  {
306  vScaleMass, vScaleStiff, u_vtk);
307  }
308 
309  virtual void mark_with_strategy(IRefiner& refiner, SmartPtr <IElementMarkingStrategy<TDomain> > strategy);
310 
313  virtual void invalidate_error();
314 
316  virtual bool is_error_valid();
317 
318  protected:
321 
322  // Error estimator //
324 
325  public:
330 
331  public:
333 
343  {
344  // check that not already registered
345  for(size_t i = 0; i < m_vDomainElemDisc.size(); ++i)
346  if(m_vDomainElemDisc[i] == elem)
347  return;
348 
349  // set approximation space
350  elem->set_approximation_space(m_spApproxSpace);
351 
352  // add it
353  m_vDomainElemDisc.push_back(elem);
354  }
355 
357 
364  {
365  // check that already registered
366  for (size_t i = 0; i < m_vDomainElemDisc.size(); i++)
367  {
368  if (m_vDomainElemDisc[i] == elem)
369  {
370  // remove constraint
371  m_vDomainElemDisc.erase(m_vDomainElemDisc.begin()+i);
372  return;
373  }
374  }
375 
376  UG_LOG("Tried to remove ElemDisc from DomainDisc"
377  ", but could not find it there.");
378  }
379 
381 
391  {
392  // check that not already registered
393  for(size_t i = 0; i < m_vDomainElemError.size(); ++i)
394  if(m_vDomainElemError[i] == elem) return;
395 
396  // set approximation space
397  elem->set_approximation_space(m_spApproxSpace);
398 
399  // add it
400  m_vDomainElemError.push_back(elem);
401  }
402 
404 
411  {
412  // check that 'elem' already registered
413  for (size_t i = 0; i < m_vDomainElemError.size(); i++)
414  {
415  if (m_vDomainElemError[i] == elem)
416  {
417  // remove constraint
418  m_vDomainElemError.erase(m_vDomainElemError.begin()+i);
419  return;
420  }
421  }
422 
423  UG_LOG("Tried to remove ElemError from DomainDisc"
424  ", but could not find it there.");
425  }
426 
427 
429 
436  {
437  // check that not already registered
438  for(size_t i = 0; i < m_vConstraint.size(); ++i)
439  if(m_vConstraint[i] == pp)
440  return;
441 
442  // set approximation space
443  pp->set_approximation_space(m_spApproxSpace);
444 
445  // add constraint
446  m_vConstraint.push_back(pp);
447  }
448 
450 
457  {
458  // check that already registered
459  for (size_t i = 0; i < m_vConstraint.size(); i++)
460  {
461  if (m_vConstraint[i] == pp)
462  {
463  // remove constraint
464  m_vConstraint.erase(m_vConstraint.begin()+i);
465  return;
466  }
467  }
468 
469  UG_LOG("Tried to remove DomainConstraint from DomainDisc"
470  ", but could not find it there.");
471  }
472 
474 
481  {
482  // add elem discs
483  for(size_t i = 0; i < di->num_elem_disc(); ++i)
484  add(di->elem_disc(i));
485 
486  // add constraints
487  for(size_t i = 0; i < di->num_constraint(); ++i)
488  add(di->constraint(i));
489  }
490 
492  virtual size_t num_constraints() const {return m_vConstraint.size();}
493 
495  virtual SmartPtr<IConstraint<TAlgebra> > constraint(size_t i) {return m_vConstraint[i];}
496 
499 
500  protected:
502  void update_elem_discs();
503  void update_elem_errors();
504  void update_constraints();
505  void update_disc_items();
506  void update_error_items();
507 
508  protected:
510  ConstSmartPtr<DoFDistribution> dd(const GridLevel& gl) const{return m_spApproxSpace->dof_distribution(gl);}
511 
512  protected:
514  std::vector<SmartPtr<IElemDisc<TDomain> > > m_vDomainElemDisc;
515 
517  std::vector<IElemDisc<TDomain>*> m_vElemDisc;
518 
520  std::vector<SmartPtr<IElemError<TDomain> > > m_vDomainElemError;
521 
523  std::vector<IElemError<TDomain>*> m_vElemError;
524 
526  std::vector<SmartPtr<IDomainConstraint<TDomain, TAlgebra> > > m_vConstraint;
527 
530 
533 
534  private:
535  //---- Auxiliary function templates for the assembling ----//
536  // These functions call the corresponding functions from the global assembler for a composed list of elements:
537  //-- for stationary problems --//
538  template <typename TElem>
539  void AssembleMassMatrix( const std::vector<IElemDisc<domain_type>*>& vElemDisc,
541  int si, bool bNonRegularGrid,
542  matrix_type& M,
543  const vector_type& u);
544  template <typename TElem>
545  void AssembleStiffnessMatrix( const std::vector<IElemDisc<domain_type>*>& vElemDisc,
547  int si, bool bNonRegularGrid,
548  matrix_type& A,
549  const vector_type& u);
550  template <typename TElem>
551  void AssembleJacobian( const std::vector<IElemDisc<domain_type>*>& vElemDisc,
553  int si, bool bNonRegularGrid,
554  matrix_type& J,
555  const vector_type& u);
556  template <typename TElem>
557  void AssembleDefect( const std::vector<IElemDisc<domain_type>*>& vElemDisc,
559  int si, bool bNonRegularGrid,
560  vector_type& d,
561  const vector_type& u);
562  template <typename TElem>
563  void AssembleLinear( const std::vector<IElemDisc<domain_type>*>& vElemDisc,
565  int si, bool bNonRegularGrid,
566  matrix_type& A,
567  vector_type& rhs);
568  template <typename TElem>
569  void AssembleRhs( const std::vector<IElemDisc<domain_type>*>& vElemDisc,
571  int si, bool bNonRegularGrid,
572  vector_type& rhs,
573  const vector_type& u);
574  template <typename TElem>
575  void AssembleErrorEstimator( const std::vector<IElemError<domain_type>*>& vElemDisc,
577  int si, bool bNonRegularGrid,
578  const vector_type& u);
579  //-- for time-dependent problems --//
580  template <typename TElem>
581  void PrepareTimestepElem( const std::vector<IElemDisc<domain_type>*>& vElemDisc,
583  int si, bool bNonRegularGrid,
585  template <typename TElem>
586  void AssembleJacobian( const std::vector<IElemDisc<domain_type>*>& vElemDisc,
588  int si, bool bNonRegularGrid,
589  matrix_type& J,
591  number s_a0);
592  template <typename TElem>
593  void AssembleDefect( const std::vector<IElemDisc<domain_type>*>& vElemDisc,
595  int si, bool bNonRegularGrid,
596  vector_type& d,
598  const std::vector<number>& vScaleMass,
599  const std::vector<number>& vScaleStiff);
600  template <typename TElem>
601  void AssembleLinear( const std::vector<IElemDisc<domain_type>*>& vElemDisc,
603  int si, bool bNonRegularGrid,
604  matrix_type& A,
605  vector_type& rhs,
607  const std::vector<number>& vScaleMass,
608  const std::vector<number>& vScaleStiff);
609  template <typename TElem>
610  void AssembleRhs( const std::vector<IElemDisc<domain_type>*>& vElemDisc,
612  int si, bool bNonRegularGrid,
613  vector_type& rhs,
615  const std::vector<number>& vScaleMass,
616  const std::vector<number>& vScaleStiff);
617  template <typename TElem>
618  void FinishTimestepElem( const std::vector<IElemDisc<domain_type>*>& vElemDisc,
620  int si, bool bNonRegularGrid,
622  template <typename TElem>
623  void AssembleErrorEstimator( const std::vector<IElemError<domain_type>*>& vElemDisc,
625  int si, bool bNonRegularGrid,
626  const std::vector<number>& vScaleMass,
627  const std::vector<number>& vScaleStiff,
629  template <typename TElem>
630  void InitAllExports( const std::vector<IElemDisc<domain_type>*>& vElemDisc,
632  int si, bool bNonRegularGrid, bool bAsTimeDependent);
633 };
634 
636 
648 template <typename TDomain, typename TAlgebra>
650 : public DomainDiscretizationBase<TDomain, TAlgebra, StdGlobAssembler<TDomain, TAlgebra> >
651 {
654 
655  public:
657  typedef TDomain domain_type;
658 
660  typedef TAlgebra algebra_type;
661 
663  typedef typename algebra_type::matrix_type matrix_type;
664 
666  typedef typename algebra_type::vector_type vector_type;
667 
670 
672  static const int dim = TDomain::dim;
673 
674  public:
678  {};
679 
681  virtual ~DomainDiscretization() {};
682 };
683 
685 
686 } // end namespace ug
687 
688 // include documentation
689 #include "domain_disc_impl.h"
690 
691 #endif /* __H__UG__LIB_DISC__SPATIAL_DISC__DOMAIN_DISC__ */
Definition: smart_pointer.h:296
Definition: smart_pointer.h:108
base class for approximation spaces without type of algebra or dof distribution
Definition: approximation_space.h:279
The AssemblingTuner class combines tools to adapt the assembling routine.
Definition: ass_tuner.h:90
generic domain discretization implementing the interface
Definition: domain_disc.h:81
void update_constraints()
Definition: domain_disc_impl.h:112
void add_elem_error_indicator(SmartPtr< IElemError< TDomain > > elem)
adds an element error indicator to the assembling process
Definition: domain_disc.h:390
virtual void calc_error(const vector_type &u, ConstSmartPtr< DoFDistribution > dd, error_vector_type *u_vtk=NULL)
Definition: domain_disc_impl.h:2270
virtual void init_all_exports(ConstSmartPtr< DoFDistribution > dd, bool bAsTimeDependent)
Definition: domain_disc_impl.h:2112
void remove(SmartPtr< IElemDisc< TDomain > > elem)
removes a element discretization from the assembling process
Definition: domain_disc.h:363
SmartPtr< AssemblingTuner< TAlgebra > > m_spAssTuner
this object provides tools to adapt the assemble routine
Definition: domain_disc.h:532
std::vector< SmartPtr< IElemDisc< TDomain > > > m_vDomainElemDisc
vector holding all registered elem discs
Definition: domain_disc.h:514
void add(SmartPtr< IDiscretizationItem< TDomain, TAlgebra > > di)
adds a disc item to the assembling process
Definition: domain_disc.h:480
void InitAllExports(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, bool bAsTimeDependent)
Definition: domain_disc_impl.h:2217
void update_elem_discs()
set the approximation space in the elem discs and extract IElemDiscs
Definition: domain_disc_impl.h:68
virtual bool is_error_valid()
returns whether current error values are valid
Definition: domain_disc_impl.h:2841
virtual void calc_error(const vector_type &u, const GridLevel &gl, error_vector_type *u_vtk=NULL)
Definition: domain_disc.h:285
virtual size_t num_constraints() const
returns number of registered constraints
Definition: domain_disc.h:492
TDomain domain_type
Type of Domain.
Definition: domain_disc.h:87
void assemble_defect(vector_type &d, GridFunction< TDomain, TAlgebra > &u)
Definition: domain_disc.h:157
bool m_bErrorCalculated
Definition: domain_disc.h:320
virtual void invalidate_error()
Definition: domain_disc_impl.h:2826
void AssembleJacobian(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, matrix_type &J, const vector_type &u)
Definition: domain_disc_impl.h:615
void AssembleErrorEstimator(const std::vector< IElemError< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, const vector_type &u)
Definition: domain_disc_impl.h:2533
std::vector< IElemDisc< TDomain > * > m_vElemDisc
vector holding all registered elem discs
Definition: domain_disc.h:517
ApproximationSpace< TDomain > approx_space_type
Type of approximation space.
Definition: domain_disc.h:102
void remove_elem_error_indicator(SmartPtr< IElemError< TDomain > > elem)
removes a element discretization from the assembling process
Definition: domain_disc.h:410
virtual void finish_timestep(ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, ConstSmartPtr< DoFDistribution > dd)
finishes time step
Definition: domain_disc_impl.h:2853
TAlgebra algebra_type
Type of algebra.
Definition: domain_disc.h:90
algebra_type::matrix_type matrix_type
Type of algebra matrix.
Definition: domain_disc.h:93
virtual void assemble_rhs(vector_type &rhs, const GridLevel &gl)
assembles the rhs
Definition: domain_disc.h:144
virtual void prepare_timestep_elem(ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, ConstSmartPtr< DoFDistribution > dd)
prepares time step element-wise
Definition: domain_disc_impl.h:1241
static const int dim
world dimension
Definition: domain_disc.h:105
void adjust_solution(GridFunction< TDomain, TAlgebra > &u)
Definition: domain_disc.h:169
virtual void adjust_solution(vector_type &u, number time, const GridLevel &gl)
sets dirichlet values in solution vector
Definition: domain_disc.h:239
virtual void calc_error(const GridFunction< TDomain, TAlgebra > &u)
Definition: domain_disc.h:288
virtual void prepare_timestep(ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, number future_time, ConstSmartPtr< DoFDistribution > dd)
prepares time step
Definition: domain_disc_impl.h:1204
virtual void assemble_rhs(vector_type &rhs, const vector_type &u, const GridLevel &gl)
assembles the rhs
Definition: domain_disc.h:138
virtual void assemble_jacobian(matrix_type &J, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, const number s_a, const GridLevel &gl)
assembles Jacobian (or Approximation of Jacobian)
Definition: domain_disc.h:193
void update_disc_items()
Definition: domain_disc_impl.h:127
void AssembleMassMatrix(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, matrix_type &M, const vector_type &u)
Definition: domain_disc_impl.h:271
virtual void assemble_defect(vector_type &d, const vector_type &u, ConstSmartPtr< DoFDistribution > dd)
assembles Defect
Definition: domain_disc_impl.h:648
virtual void mark_with_strategy(IRefiner &refiner, SmartPtr< IElementMarkingStrategy< TDomain > > strategy)
Definition: domain_disc_impl.h:2807
void assemble_linear(matrix_type &A, GridFunction< TDomain, TAlgebra > &rhs)
Definition: domain_disc.h:160
void remove(SmartPtr< IDomainConstraint< TDomain, TAlgebra > > pp)
removes a constraint from the assembling process
Definition: domain_disc.h:456
virtual void prepare_timestep(ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, number future_time, const GridLevel &gl)
Definition: domain_disc.h:178
void AssembleRhs(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, vector_type &rhs, const vector_type &u)
Definition: domain_disc_impl.h:1124
virtual void assemble_mass_matrix(matrix_type &M, const vector_type &u, const GridLevel &gl)
assembles the mass matrix
Definition: domain_disc.h:264
virtual void adjust_solution(vector_type &u, const GridLevel &gl)
sets dirichlet values in solution vector
Definition: domain_disc.h:149
virtual void assemble_mass_matrix(matrix_type &M, const vector_type &u, ConstSmartPtr< DoFDistribution > dd)
assembles the mass matrix
Definition: domain_disc_impl.h:145
DomainDiscretizationBase(SmartPtr< approx_space_type > pApproxSpace)
default Constructor
Definition: domain_disc.h:109
virtual void assemble_linear(matrix_type &mat, vector_type &rhs, const GridLevel &gl)
Assembles Matrix and Right-Hand-Side for a linear problem.
Definition: domain_disc.h:133
virtual void assemble_stiffness_matrix(matrix_type &A, const vector_type &u, const GridLevel &gl)
assembles the stiffness matrix
Definition: domain_disc.h:271
virtual void assemble_defect(vector_type &d, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, const std::vector< number > &vScaleMass, const std::vector< number > &vScaleStiff, const GridLevel &gl)
assembles Defect
Definition: domain_disc.h:204
IMultigridElementIndicators< TDomain > m_mgElemErrors
Definition: domain_disc.h:319
void assemble_rhs(vector_type &rhs, GridFunction< TDomain, TAlgebra > &u)
Definition: domain_disc.h:163
void AssembleDefect(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, vector_type &d, const vector_type &u)
Definition: domain_disc_impl.h:804
void add(SmartPtr< IElemDisc< TDomain > > elem)
adds an element discretization to the assembling process
Definition: domain_disc.h:342
std::vector< SmartPtr< IElemError< TDomain > > > m_vDomainElemError
vector holding all registered elem discs
Definition: domain_disc.h:520
void add(SmartPtr< IDomainConstraint< TDomain, TAlgebra > > pp)
adds a constraint to the assembling process
Definition: domain_disc.h:435
CPUAlgebra::vector_type error_vector_type
Type of error vector.
Definition: domain_disc.h:99
virtual void assemble_linear(matrix_type &A, vector_type &b, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, const std::vector< number > &vScaleMass, const std::vector< number > &vScaleStiff, const GridLevel &gl)
Assembles matrix_type and Right-Hand-Side for a linear problem.
Definition: domain_disc.h:217
ConstSmartPtr< DoFDistribution > dd(const GridLevel &gl) const
returns the level dof distribution
Definition: domain_disc.h:510
virtual ~DomainDiscretizationBase()
virtual destructor
Definition: domain_disc.h:115
void AssembleLinear(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, matrix_type &A, vector_type &rhs)
Definition: domain_disc_impl.h:965
std::vector< IElemError< TDomain > * > m_vElemError
vector holding all registered elem discs
Definition: domain_disc.h:523
virtual void assemble_stiffness_matrix(matrix_type &A, const vector_type &u, ConstSmartPtr< DoFDistribution > dd)
assembles the stiffness matrix
Definition: domain_disc_impl.h:305
virtual void assemble_rhs(vector_type &b, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, const std::vector< number > &vScaleMass, const std::vector< number > &vScaleStiff, const GridLevel &gl)
Assembles Right-Hand-Side for a linear problem.
Definition: domain_disc.h:230
virtual void assemble_rhs(vector_type &rhs, const vector_type &u, ConstSmartPtr< DoFDistribution > dd)
assembles rhs
Definition: domain_disc_impl.h:998
virtual void assemble_linear(matrix_type &A, vector_type &b, ConstSmartPtr< DoFDistribution > dd)
Assembles Matrix and Right-Hand-Side for a linear problem.
Definition: domain_disc_impl.h:837
TGlobAssembler gass_type
Type of the global assembler.
Definition: domain_disc.h:83
virtual ConstSmartPtr< AssemblingTuner< TAlgebra > > ass_tuner() const
Definition: domain_disc.h:328
std::vector< SmartPtr< IDomainConstraint< TDomain, TAlgebra > > > m_vConstraint
vector holding all registered constraints
Definition: domain_disc.h:526
void FinishTimestepElem(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol)
Definition: domain_disc_impl.h:2991
void assemble_jacobian(matrix_type &J, GridFunction< TDomain, TAlgebra > &u)
Definition: domain_disc.h:154
virtual void finish_timestep_elem(ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, const GridLevel &gl)
finishes timestep
Definition: domain_disc.h:249
algebra_type::vector_type vector_type
Type of algebra vector.
Definition: domain_disc.h:96
SmartPtr< approx_space_type > approximation_space()
Definition: domain_disc.h:497
virtual void finish_timestep_elem(ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, ConstSmartPtr< DoFDistribution > dd)
finishes timestep
Definition: domain_disc_impl.h:2889
void AssembleStiffnessMatrix(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, matrix_type &A, const vector_type &u)
Definition: domain_disc_impl.h:431
ConstSmartPtr< approx_space_type > approximation_space() const
Definition: domain_disc.h:498
void assemble_rhs(GridFunction< TDomain, TAlgebra > &b)
Definition: domain_disc.h:166
void init_all_exports(bool bAsTimeDependent)
Definition: domain_disc.h:258
virtual void assemble_jacobian(matrix_type &J, const vector_type &u, const GridLevel &gl)
assembles Jacobian (or Approximation of Jacobian)
Definition: domain_disc.h:123
SmartPtr< approx_space_type > m_spApproxSpace
current approximation space
Definition: domain_disc.h:529
virtual void calc_error(ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, const std::vector< number > &vScaleMass, const std::vector< number > &vScaleStiff, const GridLevel &gl, error_vector_type *u_vtk)
Transient version.
Definition: domain_disc.h:299
virtual void calc_error(const GridFunction< TDomain, TAlgebra > &u, error_vector_type *u_vtk)
Definition: domain_disc.h:290
virtual void prepare_timestep_elem(ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, const GridLevel &gl)
Definition: domain_disc.h:185
void PrepareTimestepElem(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, int si, bool bNonRegularGrid, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol)
Definition: domain_disc_impl.h:1344
virtual SmartPtr< AssemblingTuner< TAlgebra > > ass_tuner()
Definition: domain_disc.h:327
virtual SmartPtr< IConstraint< TAlgebra > > constraint(size_t i)
returns the i'th constraint
Definition: domain_disc.h:495
virtual void assemble_jacobian(matrix_type &J, const vector_type &u, ConstSmartPtr< DoFDistribution > dd)
assembles Jacobian (or Approximation of Jacobian)
Definition: domain_disc_impl.h:471
void update_error_items()
Definition: domain_disc_impl.h:134
virtual void init_all_exports(const GridLevel &gl, bool bAsTimeDependent)
Definition: domain_disc.h:256
void update_elem_errors()
Definition: domain_disc_impl.h:89
virtual void adjust_solution(vector_type &u, ConstSmartPtr< DoFDistribution > dd)
sets dirichlet values in solution vector
Definition: domain_disc_impl.h:1156
virtual void assemble_rhs(vector_type &rhs, ConstSmartPtr< DoFDistribution > dd)
assembles rhs
Definition: domain_disc.h:142
virtual void assemble_defect(vector_type &d, const vector_type &u, const GridLevel &gl)
assembles Defect
Definition: domain_disc.h:128
virtual void finish_timestep(ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, const GridLevel &gl)
Definition: domain_disc.h:244
domain discretization implementing the interface
Definition: domain_disc.h:651
virtual ~DomainDiscretization()
virtual destructor
Definition: domain_disc.h:681
TDomain domain_type
Type of Domain.
Definition: domain_disc.h:657
TAlgebra algebra_type
Type of algebra.
Definition: domain_disc.h:660
static const int dim
world dimension
Definition: domain_disc.h:672
algebra_type::vector_type vector_type
Type of algebra vector.
Definition: domain_disc.h:666
StdGlobAssembler< TDomain, TAlgebra > gass_type
Type of the global assembler.
Definition: domain_disc.h:653
algebra_type::matrix_type matrix_type
Type of algebra matrix.
Definition: domain_disc.h:663
DomainDiscretization(SmartPtr< approx_space_type > pApproxSpace)
default Constructor
Definition: domain_disc.h:676
ApproximationSpace< TDomain > approx_space_type
Type of approximation space.
Definition: domain_disc.h:669
represents numerical solutions on a grid using an algebraic vector
Definition: grid_function.h:121
SmartPtr< DoFDistribution > dof_distribution()
Definition: grid_function.h:236
SmartPtr< DoFDistribution > dd()
Definition: grid_function.h:237
Definition: grid_level.h:42
@ TOP
Definition: grid_level.h:45
TAlgebra algebra_type
Algebra type.
Definition: assemble_interface.h:113
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
Definition: disc_item.h:43
Definition: constraint_interface.h:162
Interface for domain discretization.
Definition: domain_disc_interface.h:136
Interface for an object that can mark elements based on a strategy.
Definition: domain_disc_interface.h:107
Definition: elem_disc_interface.h:800
Definition: elem_disc_interface.h:760
Abstract base class for element marking (in adaptive refinement)
Definition: error_elem_marking_strategy.h:125
This class encapsulates the multi-grid attachments for error estimation.
Definition: error_elem_marking_strategy.h:54
The refiner interface allows to mark elements for refinement and to call refine.
Definition: refiner_interface.h:67
Wrapper for sequential matrices to handle them in parallel.
Definition: parallel_matrix.h:65
Global assembler based on the straightforward application of the local discretizations.
Definition: elem_disc_assemble_util.h:78
time series of solutions and corresponding time point
Definition: solution_time_series.h:59
static const int dim
#define UG_LOG(msg)
Definition: log.h:367
double number
Definition: types.h:124
CPUAlgebra::vector_type vector_type
the ug namespace
function ProblemDisc new(problemDesc, dom)