Dune Core Modules (2.8.0)

construction.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_AMGCONSTRUCTION_HH
4#define DUNE_AMGCONSTRUCTION_HH
5
9#include <dune/istl/solvercategory.hh>
10#include "pinfo.hh"
11
12namespace Dune
13{
14 namespace Amg
15 {
16
35 template<typename T>
37 {
42 typedef const void* Arguments;
43
50 static inline std::shared_ptr<T> construct(Arguments& args)
51 {
52 return std::make_shared<T>();
53 }
54 };
55
56 template<class T, class A>
57 struct ConstructionTraits<BlockVector<T,A> >
58 {
59 typedef const int Arguments;
60 static inline std::shared_ptr<BlockVector<T,A>> construct(Arguments& n)
61 {
62 return std::make_shared<BlockVector<T,A>>(n);
63 }
64 };
65
66 template<class M, class C>
67 struct ParallelOperatorArgs
68 {
69 ParallelOperatorArgs(std::shared_ptr<M> matrix, const C& comm)
70 : matrix_(matrix), comm_(comm)
71 {}
72
73 std::shared_ptr<M> matrix_;
74 const C& comm_;
75 };
76
77#if HAVE_MPI
78 struct OwnerOverlapCopyCommunicationArgs
79 {
80 OwnerOverlapCopyCommunicationArgs(MPI_Comm comm, SolverCategory::Category cat)
81 : comm_(comm), cat_(cat)
82 {}
83
84 MPI_Comm comm_;
86 };
87#endif
88
89 struct SequentialCommunicationArgs
90 {
91 SequentialCommunicationArgs(CollectiveCommunication<void*> comm, [[maybe_unused]] int cat)
92 : comm_(comm)
93 {}
94
95 CollectiveCommunication<void*> comm_;
96 };
97
98 } // end Amg namspace
99
100 // forward declaration
101 template<class M, class X, class Y, class C>
102 class OverlappingSchwarzOperator;
103
104 template<class M, class X, class Y, class C>
105 class NonoverlappingSchwarzOperator;
106
107 namespace Amg
108 {
109 template<class M, class X, class Y, class C>
110 struct ConstructionTraits<OverlappingSchwarzOperator<M,X,Y,C> >
111 {
112 typedef ParallelOperatorArgs<M,C> Arguments;
113
114 static inline std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C>> construct(const Arguments& args)
115 {
116 return std::make_shared<OverlappingSchwarzOperator<M,X,Y,C>>
117 (args.matrix_, args.comm_);
118 }
119 };
120
121 template<class M, class X, class Y, class C>
122 struct ConstructionTraits<NonoverlappingSchwarzOperator<M,X,Y,C> >
123 {
124 typedef ParallelOperatorArgs<M,C> Arguments;
125
126 static inline std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C>> construct(const Arguments& args)
127 {
128 return std::make_shared<NonoverlappingSchwarzOperator<M,X,Y,C>>
129 (args.matrix_, args.comm_);
130 }
131 };
132
133 template<class M, class X, class Y>
134 struct MatrixAdapterArgs
135 {
136 MatrixAdapterArgs(std::shared_ptr<M> matrix, const SequentialInformation)
137 : matrix_(matrix)
138 {}
139
140 std::shared_ptr<M> matrix_;
141 };
142
143 template<class M, class X, class Y>
144 struct ConstructionTraits<MatrixAdapter<M,X,Y> >
145 {
146 typedef const MatrixAdapterArgs<M,X,Y> Arguments;
147
148 static inline std::shared_ptr<MatrixAdapter<M,X,Y>> construct(Arguments& args)
149 {
150 return std::make_shared<MatrixAdapter<M,X,Y>>(args.matrix_);
151 }
152 };
153
154 template<>
155 struct ConstructionTraits<SequentialInformation>
156 {
157 typedef const SequentialCommunicationArgs Arguments;
158 static inline std::shared_ptr<SequentialInformation> construct(Arguments& args)
159 {
160 return std::make_shared<SequentialInformation>(args.comm_);
161 }
162 };
163
164
165#if HAVE_MPI
166
167 template<class T1, class T2>
168 struct ConstructionTraits<OwnerOverlapCopyCommunication<T1,T2> >
169 {
170 typedef const OwnerOverlapCopyCommunicationArgs Arguments;
171
172 static inline std::shared_ptr<OwnerOverlapCopyCommunication<T1,T2>> construct(Arguments& args)
173 {
174 return std::make_shared<OwnerOverlapCopyCommunication<T1,T2>>(args.comm_, args.cat_);
175 }
176 };
177
178#endif
179
181 } // namespace Amg
182} // namespace Dune
183#endif
This file implements a vector space as a tensor product of a given vector space. The number of compon...
A vector of blocks with memory management.
Definition: bvector.hh:393
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition: construction.hh:42
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition: construction.hh:50
Dune namespace.
Definition: alignedallocator.hh:11
Define general, extensible interface for operators. The available implementation wraps a matrix.
Classes providing communication interfaces for overlapping Schwarz methods.
Traits class for generically constructing non default constructable types.
Definition: construction.hh:37
Category
Definition: solvercategory.hh:21
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)