Skip to content
Snippets Groups Projects
Commit d113416e authored by Oliver Sander's avatar Oliver Sander
Browse files

adapted to new function spaces

[[Imported from SVN: r1213]]
parent 0386a9b3
Branches
Tags
No related merge requests found
......@@ -5,18 +5,19 @@
#include <dune/common/functionspace.hh>
template<class DiscFuncType>
void Dune::MGTransfer<DiscFuncType>::setup(const FunctionSpaceType& fS, int cL, int fL)
template<class FunctionSpaceType>
void Dune::MGTransfer<DiscFuncType>::setup(const FunctionSpaceType& cS, const FunctionSpaceType& fS)
{
coarseLevel = cL;
fineLevel = fL;
coarseLevel = cS.level();
fineLevel = fS.level();
assert(fL == cL+1);
//assert(fL == cL+1);
//assert(level<grid_->maxlevel());
typedef typename FunctionSpaceType::GridType GridType;
int rows = fS.size(fineLevel);
int cols = fS.size(coarseLevel);
int rows = fS.size();
int cols = cS.size();
GridType& grid = fS.getGrid();
......@@ -94,14 +95,14 @@ void Dune::MGTransfer<DiscFuncType>::setup(const FunctionSpaceType& fS, int cL,
template<class DiscFuncType>
void Dune::MGTransfer<DiscFuncType>::prolong(const DiscFuncType& f, DiscFuncType& t) const
{
assert(t.getFunctionSpace().size(fineLevel) == matrix_.rows());
assert(f.getFunctionSpace().size(coarseLevel) == matrix_.cols());
assert(t.getFunctionSpace().size() == matrix_.rows());
assert(f.getFunctionSpace().size() == matrix_.cols());
typedef typename DiscFuncType::DofIteratorType DofIteratorType;
typedef typename SparseRowMatrix<double>::ColumnIterator ColumnIterator;
DofIteratorType tIt = t.dbegin( fineLevel );
DofIteratorType fIt = f.dbegin( coarseLevel );
DofIteratorType tIt = t.dbegin();
DofIteratorType fIt = f.dbegin();
for(int row=0; row<matrix_.rows(); row++) {
......@@ -121,16 +122,16 @@ void Dune::MGTransfer<DiscFuncType>::prolong(const DiscFuncType& f, DiscFuncType
template<class DiscFuncType>
void Dune::MGTransfer<DiscFuncType>::restrict (const DiscFuncType & f, DiscFuncType& t) const
{
assert(f.getFunctionSpace().size(fineLevel) == matrix_.rows());
assert(t.getFunctionSpace().size(coarseLevel) == matrix_.cols());
assert(f.getFunctionSpace().size() == matrix_.rows());
assert(t.getFunctionSpace().size() == matrix_.cols());
typedef typename DiscFuncType::DofIteratorType DofIteratorType;
typedef typename SparseRowMatrix<double>::ColumnIterator ColumnIterator;
t.clearLevel(coarseLevel);
t.clear();
DofIteratorType tIt = t.dbegin( coarseLevel );
DofIteratorType fIt = f.dbegin( fineLevel );
DofIteratorType tIt = t.dbegin();
DofIteratorType fIt = f.dbegin();
for (int row=0; row<matrix_.rows(); row++) {
......
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef __DUNE_MG_TRANSFER_HH__
#define __DUNE_MG_TRANSFER_HH__
#ifndef DUNE_MG_TRANSFER_HH
#define DUNE_MG_TRANSFER_HH_
#include <dune/fem/feop/spmatrix.hh>
......@@ -14,17 +14,16 @@ namespace Dune {
template<class DiscFuncType>
class MGTransfer {
typedef typename DiscFuncType::FunctionSpaceType FunctionSpaceType;
//typedef typename DiscFuncType::FunctionSpaceType FunctionSpaceType;
public:
/** \brief Sets up the operator between levels cL and fL
*
* \param fS The function space hierarchy between levels of which we're mapping
* \param cL The coarse level
* \param fL The fine level
*/
void setup(const FunctionSpaceType& fS, int cL, int fL);
template <class FunctionSpaceType>
void setup(const FunctionSpaceType& cS, const FunctionSpaceType& fS);
/** \brief Restrict level fL of f and store the result in level cL of t
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment