Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
transfer_interface.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-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__TRANSFER_INTERFACE__
34#define __H__UG__LIB_DISC__OPERATOR__LINEAR_OPERATOR__TRANSFER_INTERFACE__
35
40
41namespace ug{
42
44// Transfer Operator
46
48template <typename TDomain, typename TAlgebra>
50{
51 public:
53 typedef typename TAlgebra::vector_type vector_type;
54
56 typedef typename TAlgebra::matrix_type matrix_type;
57
59 typedef TDomain domain_type;
60
61 public:
64
66 virtual void clear_constraints(){m_vConstraint.clear();};
67
70 // add only once
71 if(std::find(m_vConstraint.begin(), m_vConstraint.end(), pp) !=
72 m_vConstraint.end()) return;
73 m_vConstraint.push_back(pp);
74 };
75
78 m_vConstraint.erase(m_vConstraint.begin(),
79 std::remove(m_vConstraint.begin(), m_vConstraint.end(), pp));
80 }
81
82 public:
84 virtual void init() = 0;
85
87 virtual void set_levels(GridLevel coarseLevel, GridLevel fineLevel) = 0;
88
90 virtual void prolongate(vector_type& uFine, const vector_type& uCoarse) = 0;
91
93 virtual void do_restrict(vector_type& uCoarse, const vector_type& uFine) = 0;
94
97 prolongation(const GridLevel& fineGL, const GridLevel& coarseGL,
99 UG_THROW("ITransferOperator: Matrix-prolongation not implemented.")
100 }
101
104 restriction(const GridLevel& coarseGL, const GridLevel& fineGL,
106 UG_THROW("ITransferOperator: Matrix-restriction not implemented.")
107 }
108
111
114
115 protected:
117 std::vector<SmartPtr<IConstraint<TAlgebra> > > m_vConstraint;
118
119};
120
122// Transfer Post Process
124
126template <typename TDomain, typename TAlgebra>
128{
129 public:
131 typedef typename TAlgebra::vector_type vector_type;
132
134 typedef TDomain domain_type;
135
138
139 public:
141 virtual void post_process(SmartPtr<GF> spGF) = 0;
142
145};
146
147} // end namespace ug
148
149#endif /* __H__UG__LIB_DISC__OPERATOR__LINEAR_OPERATOR__TRANSFER_INTERFACE__ */
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
represents numerical solutions on a grid using an algebraic vector
Definition grid_function.h:121
Definition grid_level.h:42
interface for adjustment of constraints
Definition constraint_interface.h:63
interface for transfer routines
Definition transfer_interface.h:50
virtual void remove_constraint(SmartPtr< IConstraint< TAlgebra > > pp)
removes a post process
Definition transfer_interface.h:77
virtual ~ITransferOperator()
virtual destructor
Definition transfer_interface.h:113
ITransferOperator()
constructor
Definition transfer_interface.h:63
TAlgebra::matrix_type matrix_type
Matrix type.
Definition transfer_interface.h:56
virtual void prolongate(vector_type &uFine, const vector_type &uCoarse)=0
Prolongates vector, i.e. moves data from coarse to fine level.
TDomain domain_type
Domain type.
Definition transfer_interface.h:59
std::vector< SmartPtr< IConstraint< TAlgebra > > > m_vConstraint
list of post processes
Definition transfer_interface.h:117
virtual void init()=0
initialize the operator
virtual void do_restrict(vector_type &uCoarse, const vector_type &uFine)=0
Restricts vector, i.e. moves data from fine to coarse level.
virtual void add_constraint(SmartPtr< IConstraint< TAlgebra > > pp)
adds a dirichlet post process (not added if already registered)
Definition transfer_interface.h:69
TAlgebra::vector_type vector_type
Vector type.
Definition transfer_interface.h:53
virtual SmartPtr< matrix_type > prolongation(const GridLevel &fineGL, const GridLevel &coarseGL, ConstSmartPtr< ApproximationSpace< TDomain > > spApproxSpace)
returns prolongation as a matrix
Definition transfer_interface.h:97
virtual void set_levels(GridLevel coarseLevel, GridLevel fineLevel)=0
Set Levels for Prolongation coarse -> fine.
virtual void clear_constraints()
clears dirichlet post processes
Definition transfer_interface.h:66
virtual SmartPtr< matrix_type > restriction(const GridLevel &coarseGL, const GridLevel &fineGL, ConstSmartPtr< ApproximationSpace< TDomain > > spApproxSpace)
returns restriction as a matrix
Definition transfer_interface.h:104
virtual SmartPtr< ITransferOperator< TDomain, TAlgebra > > clone()=0
Clone.
interface for transfer routines
Definition transfer_interface.h:128
virtual ~ITransferPostProcess()
virtual destructor
Definition transfer_interface.h:144
virtual void post_process(SmartPtr< GF > spGF)=0
apply post process
TDomain domain_type
Domain type.
Definition transfer_interface.h:134
TAlgebra::vector_type vector_type
Vector type.
Definition transfer_interface.h:131
GridFunction< TDomain, TAlgebra > GF
GridFunction type.
Definition transfer_interface.h:137
#define UG_THROW(msg)
Definition error.h:57
the ug namespace