Dune Core Modules (2.7.1)

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
10#include <dune/istl/solvercategory.hh>
11#include "pinfo.hh"
12
13namespace Dune
14{
15 namespace Amg
16 {
17
36 template<typename T>
38 {
39 public:
44 typedef const void* Arguments;
45
52 static inline std::shared_ptr<T> construct(Arguments& args)
53 {
54 return std::make_shared<T>();
55 }
56 };
57
58 template<class T, class A>
59 class ConstructionTraits<BlockVector<T,A> >
60 {
61 public:
62 typedef const int Arguments;
63 static inline std::shared_ptr<BlockVector<T,A>> construct(Arguments& n)
64 {
65 return std::make_shared<BlockVector<T,A>>(n);
66 }
67 };
68
69 template<class M, class C>
70 struct ParallelOperatorArgs
71 {
72 ParallelOperatorArgs(std::shared_ptr<M> matrix, const C& comm)
73 : matrix_(matrix), comm_(comm)
74 {}
75
76 std::shared_ptr<M> matrix_;
77 const C& comm_;
78 };
79
80#if HAVE_MPI
81 struct OwnerOverlapCopyCommunicationArgs
82 {
83 OwnerOverlapCopyCommunicationArgs(MPI_Comm comm, SolverCategory::Category cat)
84 : comm_(comm), cat_(cat)
85 {}
86
87 MPI_Comm comm_;
89 };
90#endif
91
92 struct SequentialCommunicationArgs
93 {
94 SequentialCommunicationArgs(CollectiveCommunication<void*> comm, int cat)
95 : comm_(comm)
96 {
98 }
99
100 CollectiveCommunication<void*> comm_;
101 };
102
103 } // end Amg namspace
104
105 // forward declaration
106 template<class M, class X, class Y, class C>
107 class OverlappingSchwarzOperator;
108
109 template<class M, class X, class Y, class C>
110 class NonoverlappingSchwarzOperator;
111
112 namespace Amg
113 {
114 template<class M, class X, class Y, class C>
115 class ConstructionTraits<OverlappingSchwarzOperator<M,X,Y,C> >
116 {
117 public:
118 typedef ParallelOperatorArgs<M,C> Arguments;
119
120 static inline std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C>> construct(const Arguments& args)
121 {
122 return std::make_shared<OverlappingSchwarzOperator<M,X,Y,C>>
123 (args.matrix_, args.comm_);
124 }
125 };
126
127 template<class M, class X, class Y, class C>
128 class ConstructionTraits<NonoverlappingSchwarzOperator<M,X,Y,C> >
129 {
130 public:
131 typedef ParallelOperatorArgs<M,C> Arguments;
132
133 static inline std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C>> construct(const Arguments& args)
134 {
135 return std::make_shared<NonoverlappingSchwarzOperator<M,X,Y,C>>
136 (args.matrix_, args.comm_);
137 }
138 };
139
140 template<class M, class X, class Y>
141 struct MatrixAdapterArgs
142 {
143 MatrixAdapterArgs(std::shared_ptr<M> matrix, const SequentialInformation)
144 : matrix_(matrix)
145 {}
146
147 std::shared_ptr<M> matrix_;
148 };
149
150 template<class M, class X, class Y>
151 class ConstructionTraits<MatrixAdapter<M,X,Y> >
152 {
153 public:
154 typedef const MatrixAdapterArgs<M,X,Y> Arguments;
155
156 static inline std::shared_ptr<MatrixAdapter<M,X,Y>> construct(Arguments& args)
157 {
158 return std::make_shared<MatrixAdapter<M,X,Y>>(args.matrix_);
159 }
160 };
161
162 template<>
163 class ConstructionTraits<SequentialInformation>
164 {
165 public:
166 typedef const SequentialCommunicationArgs Arguments;
167 static inline std::shared_ptr<SequentialInformation> construct(Arguments& args)
168 {
169 return std::make_shared<SequentialInformation>(args.comm_);
170 }
171 };
172
173
174#if HAVE_MPI
175
176 template<class T1, class T2>
177 class ConstructionTraits<OwnerOverlapCopyCommunication<T1,T2> >
178 {
179 public:
180 typedef const OwnerOverlapCopyCommunicationArgs Arguments;
181
182 static inline std::shared_ptr<OwnerOverlapCopyCommunication<T1,T2>> construct(Arguments& args)
183 {
184 return std::make_shared<OwnerOverlapCopyCommunication<T1,T2>>(args.comm_, args.cat_);
185 }
186 };
187
188#endif
189
191 } // namespace Amg
192} // namespace Dune
193#endif
This file implements a vector space as a tensor product of a given vector space. The number of compon...
Traits class for generically constructing non default constructable types.
Definition: construction.hh:38
A vector of blocks with memory management.
Definition: bvector.hh:403
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentionally unused function parameters with.
Definition: unused.hh:25
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition: construction.hh:44
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition: construction.hh:52
Dune namespace.
Definition: alignedallocator.hh:14
Define general, extensible interface for operators. The available implementation wraps a matrix.
Classes providing communication interfaces for overlapping Schwarz methods.
Category
Definition: solvercategory.hh:21
Definition of the DUNE_UNUSED macro for the case that config.h is not available.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)