@@ -115,52 +115,9 @@ public:
115
115
typedef Dune::Fem::ISTLBlockVectorDiscreteFunction<DiscreteFunctionSpace, PrimaryVariables> type;
116
116
};
117
117
118
- SET_PROP (FemSolverBackend, SparseMatrixAdapter)
119
- {
120
- private:
121
- typedef typename GET_PROP_TYPE (TypeTag, DiscreteFunctionSpace) DiscreteFunctionSpace;
122
- typedef typename GET_PROP_TYPE (TypeTag, Scalar) Scalar;
123
- // discrete function storing solution data
124
- typedef Dune::Fem::ISTLBlockVectorDiscreteFunction<DiscreteFunctionSpace> DiscreteFunction;
125
-
126
- #if USE_DUNE_FEM_PETSC_SOLVERS
127
- #warning "Using Dune-Fem PETSc solvers"
128
- typedef Dune::Fem::PetscLinearOperator<DiscreteFunction, DiscreteFunction> LinearOperator;
129
- #elif USE_DUNE_FEM_VIENNACL_SOLVERS
130
- #warning "Using Dune-Fem ViennaCL solvers"
131
- typedef Dune::Fem::SparseRowLinearOperator <DiscreteFunction, DiscreteFunction> LinearOperator;
132
- #else
133
- #warning "Using Dune-Fem ISTL solvers"
134
- typedef Dune::Fem::ISTLLinearOperator <DiscreteFunction, DiscreteFunction> LinearOperator;
135
- #endif
136
-
137
- struct FemMatrixBackend : public LinearOperator
138
- {
139
- typedef LinearOperator ParentType;
140
- typedef typename LinearOperator::MatrixType Matrix;
141
- typedef typename ParentType::MatrixBlockType MatrixBlock;
142
- template <class Simulator >
143
- FemMatrixBackend (Simulator& simulator)
144
- : LinearOperator(" eWoms::Jacobian" , space_, space_)
145
- , space_(simulator.vanguard().gridPart())
146
- {}
147
-
148
- void commit ()
149
- { this ->flushAssembly (); }
150
-
151
- template <class LocalBlock >
152
- void addToBlock (const size_t row, const size_t col, const LocalBlock& block)
153
- { this ->addBlock (row, col, block); }
154
-
155
- void clearRow (const size_t row, const Scalar diag = 1.0 )
156
- { this ->unitRow (row); }
157
-
158
- DiscreteFunctionSpace space_;
159
- };
160
-
161
- public:
162
- typedef FemMatrixBackend type;
163
- };
118
+ // todo
119
+ SET_PROP_TYPE (FemSolverBackend, SparseMatrixAdapter, GET_PROP_TYPE( TypeTag,
120
+ FemSolverBackend:: ));
164
121
165
122
166
123
END_PROPERTIES
@@ -180,7 +137,6 @@ protected:
180
137
181
138
typedef typename GET_PROP_TYPE (TypeTag, Simulator) Simulator;
182
139
typedef typename GET_PROP_TYPE (TypeTag, Scalar) Scalar;
183
- typedef typename GET_PROP_TYPE (TypeTag, SparseMatrixAdapter) LinearOperator;
184
140
typedef typename GET_PROP_TYPE (TypeTag, SparseMatrixAdapter) SparseMatrixAdapter;
185
141
typedef typename GET_PROP_TYPE (TypeTag, GlobalEqVector) Vector;
186
142
typedef typename GET_PROP_TYPE (TypeTag, GridView) GridView;
@@ -192,37 +148,31 @@ protected:
192
148
typedef Dune::Fem::ISTLBlockVectorDiscreteFunction<DiscreteFunctionSpace>
193
149
VectorWrapperDiscreteFunction;
194
150
195
- template <int d, class LinOp >
196
- struct SolverSelector
197
- {
198
- typedef Dune::Fem::KrylovInverseOperator<VectorWrapperDiscreteFunction> type;
199
- };
151
+ template <int d, class SparseMatBackend >
152
+ struct SolverSelector ;
200
153
201
- #if HAVE_PETSC
202
154
template <int d>
203
- struct SolverSelector <d, Dune::Fem::PetscLinearOperator<VectorWrapperDiscreteFunction, VectorWrapperDiscreteFunction> >
155
+ struct SolverSelector < d, FemSparseRowMatrixAdapter >
204
156
{
205
- typedef Dune::Fem::PetscInverseOperator <VectorWrapperDiscreteFunction, LinearOperator > type;
157
+ typedef Dune::Fem::KrylovInverseOperator <VectorWrapperDiscreteFunction> type;
206
158
};
207
- #endif
208
159
209
- #if HAVE_VIENNACL
210
- template <int d>
211
- struct SolverSelector <d, Dune::Fem::SparseRowLinearOperator<VectorWrapperDiscreteFunction, VectorWrapperDiscreteFunction> >
160
+ #if HAVE_PETSC
161
+ template <int d >
162
+ struct SolverSelector <d, FemPetscMatrixAdapter >
212
163
{
213
- typedef Dune::Fem::ViennaCLInverseOperator <VectorWrapperDiscreteFunction> type;
164
+ typedef Dune::Fem::PetscInverseOperator <VectorWrapperDiscreteFunction> type;
214
165
};
215
166
#endif
216
167
217
168
template <int d>
218
- struct SolverSelector <d, Dune::Fem::ISTLLinearOperator<VectorWrapperDiscreteFunction, VectorWrapperDiscreteFunction> >
169
+ struct SolverSelector <d, FemISTLMatrixAdapter >
219
170
{
220
- typedef Dune::Fem::ISTLBICGSTABOp<VectorWrapperDiscreteFunction, LinearOperator > type;
171
+ typedef Dune::Fem::ISTLBICGSTABOp<VectorWrapperDiscreteFunction > type;
221
172
};
222
173
223
174
// select solver type depending on linear operator type
224
- typedef typename LinearOperator::ParentType Bla;
225
- typedef typename SolverSelector<0 , Bla>::type InverseLinearOperator;
175
+ typedef typename SolverSelector<0 , SparseMatrixAdapter>::type InverseLinearOperator;
226
176
227
177
enum { dimWorld = GridView::dimensionworld };
228
178
0 commit comments