Skip to content

Commit 4526060

Browse files
author
Robert Kloefkorn
committed
Cleanup merge fallout.
1 parent 9d2502c commit 4526060

File tree

2 files changed

+17
-101
lines changed

2 files changed

+17
-101
lines changed

ewoms/disc/common/fvbasediscretization.hh

+3-37
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include <ewoms/parallel/gridcommhandles.hh>
5151
#include <ewoms/parallel/threadmanager.hh>
5252
#include <ewoms/linear/nullborderlistmanager.hh>
53+
#include <ewoms/linear/istlsparsematrixadapter.hh>
5354
#include <ewoms/common/simulator.hh>
5455
#include <ewoms/common/alignedallocator.hh>
5556
#include <ewoms/common/timer.hh>
@@ -75,8 +76,7 @@
7576
#include <dune/fem/space/common/restrictprolongtuple.hh>
7677
#include <dune/fem/function/blockvectorfunction.hh>
7778
#include <dune/fem/misc/capabilities.hh>
78-
#include <ewoms/linear/femsparsematrixadapter.hh>
79-
#endif // endif HAVE_DUNE_FEM
79+
#endif
8080

8181
#include <limits>
8282
#include <list>
@@ -130,40 +130,7 @@ SET_TYPE_PROP(FvBaseDiscretization, DiscExtensiveQuantities, Ewoms::FvBaseExtens
130130
//! Calculates the gradient of any quantity given the index of a flux approximation point
131131
SET_TYPE_PROP(FvBaseDiscretization, GradientCalculator, Ewoms::FvBaseGradientCalculator<TypeTag>);
132132

133-
//! Set the type of a global Jacobian matrix from the solution types
134-
#if HAVE_DUNE_FEM
135-
SET_PROP(FvBaseDiscretization, DiscreteFunction)
136-
{
137-
private:
138-
typedef typename GET_PROP_TYPE(TypeTag, DiscreteFunctionSpace) DiscreteFunctionSpace;
139-
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
140-
public:
141-
// discrete function storing solution data
142-
typedef Dune::Fem::ISTLBlockVectorDiscreteFunction<DiscreteFunctionSpace, PrimaryVariables> type;
143-
};
144-
#endif
145-
146-
#if USE_DUNE_FEM_SOLVERS
147-
SET_PROP(FvBaseDiscretization, SparseMatrixAdapter)
148-
{
149-
private:
150-
typedef typename GET_PROP_TYPE(TypeTag, DiscreteFunctionSpace) DiscreteFunctionSpace;
151-
// discrete function storing solution data
152-
typedef Dune::Fem::ISTLBlockVectorDiscreteFunction<DiscreteFunctionSpace> DiscreteFunction;
153-
public:
154-
155-
#if USE_DUNE_FEM_PETSC_SOLVERS
156-
#warning "Using Dune-Fem PETSc solvers"
157-
typedef FemPetscMatrixAdapter< DiscreteFunction > type;
158-
#elif USE_DUNE_FEM_VIENNACL_SOLVERS
159-
#warning "Using Dune-Fem ViennaCL solvers"
160-
typedef FemSparseRowMatrixAdapter< DiscreteFunction > type;
161-
#else
162-
#warning "Using Dune-Fem ISTL solvers"
163-
typedef FemISTLMatrixAdapter< DiscreteFunction > type;
164-
#endif
165-
};
166-
#else
133+
//! Set the type of a global jacobian matrix from the solution types
167134
SET_PROP(FvBaseDiscretization, SparseMatrixAdapter)
168135
{
169136
private:
@@ -174,7 +141,6 @@ private:
174141
public:
175142
typedef typename Ewoms::Linear::IstlSparseMatrixAdapter<Block> type;
176143
};
177-
#endif
178144

179145
//! The maximum allowed number of timestep divisions for the
180146
//! Newton solver

ewoms/linear/femsolverbackend.hh

+14-64
Original file line numberDiff line numberDiff line change
@@ -115,52 +115,9 @@ public:
115115
typedef Dune::Fem::ISTLBlockVectorDiscreteFunction<DiscreteFunctionSpace, PrimaryVariables> type;
116116
};
117117

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:: ));
164121

165122

166123
END_PROPERTIES
@@ -180,7 +137,6 @@ protected:
180137

181138
typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator;
182139
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
183-
typedef typename GET_PROP_TYPE(TypeTag, SparseMatrixAdapter) LinearOperator;
184140
typedef typename GET_PROP_TYPE(TypeTag, SparseMatrixAdapter) SparseMatrixAdapter;
185141
typedef typename GET_PROP_TYPE(TypeTag, GlobalEqVector) Vector;
186142
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
@@ -192,37 +148,31 @@ protected:
192148
typedef Dune::Fem::ISTLBlockVectorDiscreteFunction<DiscreteFunctionSpace>
193149
VectorWrapperDiscreteFunction;
194150

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;
200153

201-
#if HAVE_PETSC
202154
template <int d>
203-
struct SolverSelector<d, Dune::Fem::PetscLinearOperator<VectorWrapperDiscreteFunction, VectorWrapperDiscreteFunction>>
155+
struct SolverSelector< d, FemSparseRowMatrixAdapter >
204156
{
205-
typedef Dune::Fem::PetscInverseOperator<VectorWrapperDiscreteFunction, LinearOperator> type;
157+
typedef Dune::Fem::KrylovInverseOperator<VectorWrapperDiscreteFunction> type;
206158
};
207-
#endif
208159

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 >
212163
{
213-
typedef Dune::Fem::ViennaCLInverseOperator<VectorWrapperDiscreteFunction> type;
164+
typedef Dune::Fem::PetscInverseOperator<VectorWrapperDiscreteFunction> type;
214165
};
215166
#endif
216167

217168
template <int d>
218-
struct SolverSelector<d, Dune::Fem::ISTLLinearOperator<VectorWrapperDiscreteFunction, VectorWrapperDiscreteFunction> >
169+
struct SolverSelector<d, FemISTLMatrixAdapter >
219170
{
220-
typedef Dune::Fem::ISTLBICGSTABOp<VectorWrapperDiscreteFunction, LinearOperator> type;
171+
typedef Dune::Fem::ISTLBICGSTABOp<VectorWrapperDiscreteFunction > type;
221172
};
222173

223174
// 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;
226176

227177
enum { dimWorld = GridView::dimensionworld };
228178

0 commit comments

Comments
 (0)