| 1 |
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root |
| 2 |
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception |
| 3 |
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 4 |
// vi: set et ts=4 sw=2 sts=2: |
| 5 |
#include <dune/istl/bvector.hh> |
| 6 |
#include <dune/common/fvector.hh> |
| 7 |
#include <dune/istl/paamg/aggregates.hh> |
| 8 |
#include <dune/istl/paamg/pinfo.hh> |
| 9 |
#include <dune/istl/paamg/transfer.hh> |
| 10 |
|
| 11 |
template<class Vertex> |
| 12 |
int createAggregates(Dune::Amg::AggregatesMap<Vertex>& aggregates, int size) |
| 13 |
{ |
| 14 |
int index=0; |
| 15 |
int i=0; |
| 16 |
|
| 17 |
for(i=1; index<size; ++i) |
| 18 |
for(int j=0; j < i && index < size; ++j, ++index) |
| 19 |
aggregates[index]=i-1; |
| 20 |
|
| 21 |
return i-1; |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
int main() |
| 26 |
{ |
| 27 |
const int BS=1; |
| 28 |
typedef Dune::FieldVector<int,BS> VectorBlock; |
| 29 |
typedef Dune::BlockVector<VectorBlock> Vector; |
| 30 |
|
| 31 |
Vector b(20); |
| 32 |
Dune::Amg::AggregatesMap<int> amap(20); |
| 33 |
int aggregates = createAggregates(amap, 20); |
| 34 |
|
| 35 |
Vector c(aggregates); |
| 36 |
b=100; |
| 37 |
typedef Dune::Amg::SequentialInformation SequentialInformation; |
| 38 |
|
| 39 |
SequentialInformation info; |
| 40 |
|
| 41 |
Dune::Amg::Transfer<int,Vector,SequentialInformation>::restrictVector(amap, c, b, info); |
| 42 |
|
| 43 |
Dune::Amg::Transfer<int,Vector,SequentialInformation>::prolongateVector(amap, c, b, 1); |
| 44 |
return 0; |
| 45 |
} |