// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- // vi: set et ts=4 sw=2 sts=2: #include #include #include #include #include #include #include #include "anisotropic.hh" template void testHierarchy(int N) { typedef int LocalId; typedef int GlobalId; typedef Dune::OwnerOverlapCopyCommunication Communication; typedef Communication::ParallelIndexSet ParallelIndexSet; typedef Dune::FieldMatrix MatrixBlock; typedef Dune::BCRSMatrix BCRSMat; typedef Dune::FieldVector VectorBlock; typedef Dune::BlockVector Vector; int n; Communication pinfo(Dune::MPIHelper::getCommunicator()); ParallelIndexSet& indices = pinfo.indexSet(); typedef Dune::RemoteIndices RemoteIndices; RemoteIndices& remoteIndices = pinfo.remoteIndices(); BCRSMat mat = setupAnisotropic2d(N, indices, Dune::MPIHelper::getCommunication(), &n); Vector b(indices.size()); remoteIndices.rebuild(); typedef Dune::NegateSet OverlapFlags; typedef Dune::OverlappingSchwarzOperator Operator; typedef Dune::Amg::MatrixHierarchy Hierarchy; typedef Dune::Amg::Hierarchy VHierarchy; Operator op(mat, pinfo); Hierarchy hierarchy( Dune::stackobject_to_shared_ptr(op), Dune::stackobject_to_shared_ptr(pinfo)); VHierarchy vh( Dune::stackobject_to_shared_ptr(b)); typedef Dune::Amg::CoarsenCriterion > Criterion; Criterion criterion(100,4); Dune::Timer timer; hierarchy.template build(criterion); hierarchy.coarsenVector(vh); std::cout<<"Building hierarchy took "< data; hierarchy.getCoarsestAggregatesOnFinest(data); } int main(int argc, char** argv) { Dune::MPIHelper::instance(argc, argv); constexpr int blockSize = 1; int N=10; if(argc>1) N = atoi(argv[1]); testHierarchy(N); }