Commit 675fa8d5 authored by Praetorius, Simon's avatar Praetorius, Simon

preparation for mtl4-merge

parent dafe4c23
......@@ -12,6 +12,7 @@ namespace AMDiS {
struct CreatorInterface< ITL_BasePreconditioner< Vector > > {
typedef typename AMDiS::Collection< Vector >::PreconditionMatrix PreconditionMatrix;
virtual ITL_BasePreconditioner< Vector >* create(const PreconditionMatrix& )=0 /*{ return NULL; }*/ ;
virtual ~CreatorInterface< ITL_BasePreconditioner< Vector > >() {}
};
template< typename Vector >
......@@ -36,6 +37,7 @@ namespace AMDiS {
{
return true;
}
virtual ~NullCreator< ITL_BasePreconditioner< Vector > >() {}
};
typedef CreatorInterface< ITL_BasePreconditioner< MTLTypes::MTLVector > > PreconditionCreator;
......
......@@ -79,6 +79,8 @@ namespace AMDiS {
return NULL;
}
virtual ~NullCreator() {}
///
virtual bool isNullCreator()
{
......
......@@ -323,6 +323,12 @@ namespace AMDiS {
projection[i] = p;
}
/// Set ElInfo's \ref boundary[i]
inline void setNeighbor(int i, Element* neigh)
{
neighbour[i] = neigh;
}
/// Set \ref det = d
inline void setDet(double d)
{
......
......@@ -30,6 +30,7 @@
#include <boost/numeric/itl/itl.hpp>
#include <boost/numeric/itl/pc/ilu_0.hpp>
#include <boost/numeric/itl/pc/ic_0.hpp>
#include <boost/numeric/mtl/vector/assigner.hpp>
namespace AMDiS {
......@@ -49,23 +50,33 @@ namespace AMDiS {
public:
virtual ~ITL_BasePreconditioner() {}
virtual Vec member_solve(const Vec& vin) const =0 ;
// Old style AMDiS
// virtual Vec member_solve(const Vec& vin) const =0 ;
// virtual Vec member_adjoint_solve(const Vec& vin) const =0 ;
virtual Vec member_adjoint_solve(const Vec& vin) const =0 ;
// New style without copying the result vector
virtual void solve(const Vec& x, Vec& y) const= 0;
virtual void adjoint_solve(const Vec& x, Vec& y) const= 0;
};
template< typename Vec >
inline Vec
inline //Vec
itl::pc::solver<ITL_BasePreconditioner< Vec >, Vec, false>
solve(const ITL_BasePreconditioner< Vec >& P, const Vec& vin)
{
return P.member_solve(vin);
return itl::pc::solver<ITL_BasePreconditioner< Vec >, Vec, false>(P, vin);
//return P.member_solve(vin);
}
template< typename Vec >
inline Vec
inline //Vec
itl::pc::solver<ITL_BasePreconditioner< Vec >, Vec, true>
adjoint_solve(const ITL_BasePreconditioner< Vec >& P, const Vec& vin)
{
return P.member_adjoint_solve(vin);
return itl::pc::solver<ITL_BasePreconditioner< Vec >, Vec, true>(P, vin);
//return P.member_adjoint_solve(vin);
}
/**
......@@ -78,7 +89,7 @@ namespace AMDiS {
{
public:
ITL_Preconditioner(const MTLMatrix& A) : precon(A) {}
#if 0
MTLVector
member_solve(const MTLVector& vin) const
{
......@@ -90,6 +101,18 @@ namespace AMDiS {
{
return adjoint_solve(precon, vin);
}
#else
void solve(const MTLVector& vin, MTLVector& vout) const
{
precon.solve(vin, vout);
}
void adjoint_solve(const MTLVector& vin, MTLVector& vout) const
{
precon.adjoint_solve(vin, vout);
}
#endif
/// Creator class used in the OEMSolverMap.
class Creator : public CreatorInterface< ITL_BasePreconditioner< MTLVector > >
......
......@@ -71,7 +71,7 @@ namespace AMDiS {
unsigned line_length = 512;
char swap[line_length];
in.getline(swap, line_length);
while (in.good()) {
while (in.good() || in.gcount()>0) {
std::string whitespaces = " \t\r\f";
std::string sw(swap);
size_t pos0 = sw.find_first_not_of(whitespaces);
......@@ -92,7 +92,9 @@ namespace AMDiS {
get("parameter information", info, 0);
if (info >= 2)
#endif
{
std::cout << "read [" << paramName << " => " << paramValue << "]" << std::endl;
}
} else if (sw[pos0] == '#'
&& static_cast<size_t>(sw.find("#include")) == pos0) {
// include file by '#include "filename"' or '#include <filename>'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment