ug4
std_injection.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__OPERATOR__LINEAR_OPERATOR__STD_INJECTION__
34 #define __H__UG__LIB_DISC__OPERATOR__LINEAR_OPERATOR__STD_INJECTION__
35 
36 // extern headers
37 #include <iostream>
38 
39 // other ug4 modules
40 #include "common/common.h"
41 #include "transfer_interface.h"
42 
43 #ifdef UG_PARALLEL
45 #endif
46 
47 namespace ug{
48 
58 template <typename TDomain, typename TAlgebra>
59 class StdInjection :
60  virtual public ITransferOperator<TDomain, TAlgebra>
61 {
62  public:
65 
67  typedef TAlgebra algebra_type;
68 
70  typedef typename TAlgebra::vector_type vector_type;
71 
73  typedef typename TAlgebra::matrix_type matrix_type;
74 
76  typedef TDomain domain_type;
77 
78  public:
80  StdInjection() : m_bInit(false) {}
81 
84  m_spApproxSpace(approxSpace), m_bInit(false)
85  {}
86 
89 
91  virtual ~StdInjection(){};
92  public:
94  void set_levels(GridLevel coarseLevel, GridLevel fineLevel);
95 
96  protected:
97  template <typename TElem>
99  const DoFDistribution& coarseDD, const DoFDistribution& fineDD);
100 
102  const DoFDistribution& coarseDD, const DoFDistribution& fineDD);
103 
104  public:
106  virtual void init();
107 
109  virtual void prolongate(vector_type& uFine, const vector_type& uCoarse);
110 
112  virtual void do_restrict(vector_type& uCoarse, const vector_type& uFine);
113 
116 
117  protected:
120 
123 
126 
129 
131  bool m_bInit;
132 };
133 
134 }
135 
136 #include "std_injection_impl.h"
137 
138 #endif /* __H__UG__LIB_DISC__OPERATOR__LINEAR_OPERATOR__STD_INJECTION__ */
Definition: smart_pointer.h:108
base class for approximation spaces without type of algebra or dof distribution
Definition: approximation_space.h:279
Definition: dof_distribution.h:51
Definition: grid_level.h:42
interface for transfer routines
Definition: transfer_interface.h:50
Wrapper for sequential matrices to handle them in parallel.
Definition: parallel_matrix.h:65
Definition: std_injection.h:61
virtual SmartPtr< ITransferOperator< TDomain, TAlgebra > > clone()
clones the operator
Definition: std_injection_impl.h:342
void set_identity_on_pure_surface(matrix_type &mat, const DoFDistribution &coarseDD, const DoFDistribution &fineDD)
Definition: std_injection_impl.h:169
SmartPtr< ApproximationSpace< TDomain > > m_spApproxSpace
the underlying approximation space
Definition: std_injection.h:122
TDomain domain_type
Type of Domain.
Definition: std_injection.h:76
matrix_type m_matrix
matrix used for projection
Definition: std_injection.h:119
virtual void prolongate(vector_type &uFine, const vector_type &uCoarse)
Project uFine to uCoarse; uCoarse = P(uFine);.
Definition: std_injection_impl.h:292
StdInjection()
Constructor.
Definition: std_injection.h:80
virtual void init()
Init operator.
Definition: std_injection_impl.h:246
bool m_bInit
init flag
Definition: std_injection.h:131
ITransferOperator< TDomain, TAlgebra > base_type
Type of base class.
Definition: std_injection.h:64
virtual void do_restrict(vector_type &uCoarse, const vector_type &uFine)
Apply Transposed Operator u = L^T*f.
Definition: std_injection_impl.h:315
GridLevel m_fineLevel
fine level of approximation space
Definition: std_injection.h:125
StdInjection(SmartPtr< ApproximationSpace< TDomain > > approxSpace)
Constructor.
Definition: std_injection.h:83
TAlgebra algebra_type
Type of algebra.
Definition: std_injection.h:67
virtual ~StdInjection()
virtual Destructor
Definition: std_injection.h:91
TAlgebra::vector_type vector_type
Type of Vector.
Definition: std_injection.h:70
GridLevel m_coarseLevel
coarse level of approximation space
Definition: std_injection.h:128
void set_approximation_space(SmartPtr< ApproximationSpace< TDomain > > approxSpace)
Set Approximation Space.
Definition: std_injection_impl.h:228
TAlgebra::matrix_type matrix_type
Type of Vector.
Definition: std_injection.h:73
void set_levels(GridLevel coarseLevel, GridLevel fineLevel)
Set approximation level.
Definition: std_injection_impl.h:235
CPUAlgebra::vector_type vector_type
the ug namespace