Skip to content
Snippets Groups Projects
Commit 3dca7331 authored by Tobias Leibner's avatar Tobias Leibner
Browse files

[spaces.continuouslagrange.pdelab and...

[spaces.continuouslagrange.pdelab and playground.spaces.discontinuouslagrange.pdelab] move CommunicationChooser to its own header
parent 650adfc1
No related branches found
No related tags found
No related merge requests found
......@@ -6,39 +6,28 @@
#ifndef DUNE_GDT_SPACES_DISCONTINUOUSLAGRANGE_PDELAB_HH
#define DUNE_GDT_SPACES_DISCONTINUOUSLAGRANGE_PDELAB_HH
#include "config.h"
#include <memory>
#include <dune/common/typetraits.hh>
#include <dune/stuff/common/disable_warnings.hh>
#include <dune/common/fvector.hh>
#include <dune/common/parallel/communicator.hh>
#include <dune/stuff/common/parallel/helper.hh>
#include <dune/stuff/common/reenable_warnings.hh>
#include <dune/geometry/genericgeometry/topologytypes.hh>
#include <dune/grid/common/capabilities.hh>
#if HAVE_DUNE_ISTL
#include <dune/stuff/common/disable_warnings.hh>
#include <dune/istl/owneroverlapcopy.hh>
#include <dune/stuff/common/reenable_warnings.hh>
#endif
#if HAVE_DUNE_PDELAB
#include <dune/stuff/common/disable_warnings.hh>
#include <dune/pdelab/finiteelementmap/qkdg.hh>
#include <dune/pdelab/gridfunctionspace/gridfunctionspace.hh>
#include <dune/pdelab/constraints/conforming.hh>
#include <dune/pdelab/backend/istl/parallelhelper.hh>
#include <dune/stuff/common/reenable_warnings.hh>
#endif // HAVE_DUNE_PDELAB
#include <dune/stuff/la/container/istl.hh>
#include <dune/gdt/spaces/parallel.hh>
#include "../../../mapper/pdelab.hh"
#include "../../../basefunctionset/pdelab.hh"
......@@ -52,52 +41,6 @@ namespace DiscontinuousLagrange {
#if HAVE_DUNE_PDELAB
template <class ViewImp,
bool is_parallel = DS::UseParallelCommunication<typename ViewImp::Grid::CollectiveCommunication>::value>
struct CommunicationChooser
{
typedef DS::SequentialCommunication Type;
static std::shared_ptr<Type> create(const ViewImp& /*gridView*/)
{
return std::make_shared<Type>();
}
template <class SpaceBackend>
static bool prepare(const SpaceBackend& /*space_backend*/, Type& /*communicator*/)
{
return false;
}
}; // struct CommunicationChooser
#if HAVE_MPI
template <class ViewImp>
struct CommunicationChooser<ViewImp, true>
{
typedef OwnerOverlapCopyCommunication<bigunsignedint<96>, int> Type;
static std::shared_ptr<Type> create(const ViewImp& gridView)
{
return std::make_shared<Type>(gridView.comm());
}
template <class Space>
static bool prepare(const Space& space, Type& communicator)
{
Stuff::LA::IstlRowMajorSparseMatrix<typename Space::RangeFieldType> matrix;
PDELab::istl::ParallelHelper<typename Space::BackendType>(space.backend(), 0)
.createIndexSetAndProjectForAMG(matrix.backend(), communicator);
return true;
}
}; // struct CommunicationChooser< ..., true >
#endif // HAVE_MPI
// forward, to be used in the traits and to allow for specialization
template <class GridViewImp, int polynomialOrder, class RangeFieldImp, int rangeDim, int rangeDimCols = 1>
class PdelabBased
......
......@@ -11,19 +11,14 @@
#include <dune/geometry/genericgeometry/topologytypes.hh>
#include <dune/grid/common/capabilities.hh>
#include <dune/common/typetraits.hh>
#include <dune/stuff/common/disable_warnings.hh>
#include <dune/common/fvector.hh>
#include <dune/common/parallel/communicator.hh>
#include <dune/stuff/common/parallel/helper.hh>
#include <dune/stuff/common/reenable_warnings.hh>
#if HAVE_DUNE_ISTL
#include <dune/stuff/common/disable_warnings.hh>
#include <dune/istl/owneroverlapcopy.hh>
#include <dune/istl/paamg/pinfo.hh>
#include <dune/stuff/common/reenable_warnings.hh>
#include <dune/stuff/la/solver/istl_amg.hh>
......@@ -35,11 +30,10 @@
#include <dune/pdelab/finiteelementmap/qkfem.hh>
#include <dune/pdelab/gridfunctionspace/gridfunctionspace.hh>
#include <dune/pdelab/constraints/conforming.hh>
#include <dune/pdelab/backend/istl/parallelhelper.hh>
#include <dune/stuff/common/reenable_warnings.hh>
#endif // HAVE_DUNE_PDELAB
#include <dune/stuff/la/container/istl.hh>
#include <dune/gdt/spaces/parallel.hh>
#include "../../mapper/pdelab.hh"
#include "../../basefunctionset/pdelab.hh"
......@@ -55,52 +49,6 @@ namespace ContinuousLagrange {
#if HAVE_DUNE_PDELAB
template <class ViewImp,
bool is_parallel = DS::UseParallelCommunication<typename ViewImp::Grid::CollectiveCommunication>::value>
struct CommunicationChooser
{
typedef DS::SequentialCommunication Type;
static std::shared_ptr<Type> create(const ViewImp& /*gridView*/)
{
return std::make_shared<Type>();
}
template <class SpaceBackend>
static bool prepare(const SpaceBackend& /*space_backend*/, Type& /*communicator*/)
{
return false;
}
}; // struct CommunicationChooser
#if HAVE_MPI
template <class ViewImp>
struct CommunicationChooser<ViewImp, true>
{
typedef OwnerOverlapCopyCommunication<bigunsignedint<96>, int> Type;
static std::shared_ptr<Type> create(const ViewImp& gridView)
{
return std::make_shared<Type>(gridView.comm());
}
template <class Space>
static bool prepare(const Space& space, Type& communicator)
{
Stuff::LA::IstlRowMajorSparseMatrix<typename Space::RangeFieldType> matrix;
PDELab::istl::ParallelHelper<typename Space::BackendType>(space.backend(), 0)
.createIndexSetAndProjectForAMG(matrix.backend(), communicator);
return true;
}
}; // struct CommunicationChooser< ..., true >
#endif // HAVE_MPI
// forward, to be used in the traits and to allow for specialization
template <class GridViewImp, int polynomialOrder, class RangeFieldImp, int rangeDim, int rangeDimCols = 1>
class PdelabBased
......
// This file is part of the dune-gdt project:
// http://users.dune-project.org/projects/dune-gdt
// Copyright holders: Felix Schindler
// License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
#ifndef DUNE_GDT_SPACES_PARALLEL_HH
#define DUNE_GDT_SPACES_PARALLEL_HH
#include <dune/stuff/common/disable_warnings.hh>
#include <dune/common/parallel/communicator.hh>
#include <dune/stuff/common/reenable_warnings.hh>
#if HAVE_DUNE_ISTL
#include <dune/stuff/common/disable_warnings.hh>
#include <dune/istl/owneroverlapcopy.hh>
#include <dune/stuff/common/reenable_warnings.hh>
#endif
#if HAVE_DUNE_PDELAB
#include <dune/stuff/common/disable_warnings.hh>
#include <dune/pdelab/backend/istl/parallelhelper.hh>
#include <dune/stuff/common/reenable_warnings.hh>
#endif
#include <dune/stuff/la/container/istl.hh>
#include <dune/stuff/common/parallel/helper.hh>
namespace Dune {
namespace GDT {
namespace Spaces {
template <class ViewImp,
bool is_parallel =
Dune::Stuff::UseParallelCommunication<typename ViewImp::Grid::CollectiveCommunication>::value>
struct CommunicationChooser
{
typedef Dune::Stuff::SequentialCommunication Type;
static std::shared_ptr<Type> create(const ViewImp& /*gridView*/)
{
return std::make_shared<Type>();
}
template <class SpaceBackend>
static bool prepare(const SpaceBackend& /*space_backend*/, Type& /*communicator*/)
{
return false;
}
}; // struct CommunicationChooser
#if HAVE_MPI
template <class ViewImp>
struct CommunicationChooser<ViewImp, true>
{
typedef OwnerOverlapCopyCommunication<bigunsignedint<96>, int> Type;
static std::shared_ptr<Type> create(const ViewImp& gridView)
{
return std::make_shared<Type>(gridView.comm());
}
template <class Space>
static bool prepare(const Space& space, Type& communicator)
{
Stuff::LA::IstlRowMajorSparseMatrix<typename Space::RangeFieldType> matrix;
PDELab::istl::ParallelHelper<typename Space::BackendType>(space.backend(), 0)
.createIndexSetAndProjectForAMG(matrix.backend(), communicator);
return true;
}
}; // struct CommunicationChooser< ..., true >
#endif // HAVE_MPI
} // namespace Spaces
} // namespace GDT
} // namespace Dune
#endif // DUNE_GDT_SPACES_PARALLEL_HH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment