Commit 64fe2d8a authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Make use of mtl dense matrizes for parts of the assembling process.

parent b538f51c
...@@ -54,6 +54,7 @@ namespace AMDiS { ...@@ -54,6 +54,7 @@ namespace AMDiS {
class Operator; class Operator;
class ProblemInstat; class ProblemInstat;
class ProblemIterationInterface; class ProblemIterationInterface;
class ProblemTimeInterface;
class ProblemVec; class ProblemVec;
class Projection; class Projection;
class PreconditionerScal; class PreconditionerScal;
...@@ -65,17 +66,20 @@ namespace AMDiS { ...@@ -65,17 +66,20 @@ namespace AMDiS {
class VertexVector; class VertexVector;
template<typename ReturnType, typename ArgumentType> class AbstractFunction; template<typename ReturnType, typename ArgumentType> class AbstractFunction;
template<typename T> class DOFIndexed;
template<typename T> class DOFVectorBase; template<typename T> class DOFVectorBase;
template<typename T> class DOFVector; template<typename T> class DOFVector;
template<typename T> class DimVec;
template<typename T> class DimMat;
template<typename ITLSolver> class ITL_OEMSolver;
template<typename T> class ITL_Preconditioner; template<typename T> class ITL_Preconditioner;
template<typename T> class Matrix; template<typename T> class Matrix;
template<typename T> class MatVecMultiplier; template<typename T> class MatVecMultiplier;
template<typename T> class SolverMatrix; template<typename T> class SolverMatrix;
template<typename T> class Vector; template<typename T> class Vector;
template<typename T> class WorldVector; template<typename T> class WorldVector;
template<typename T> class WorldMatrix;
template <typename ITLSolver> class ITL_OEMSolver; template<typename T> class VectorOfFixVecs;
} // namespace AMDiS } // namespace AMDiS
#endif // AMDIS_AMDIS_FWD_INCLUDE #endif // AMDIS_AMDIS_FWD_INCLUDE
...@@ -27,10 +27,6 @@ ...@@ -27,10 +27,6 @@
namespace AMDiS { namespace AMDiS {
// ============================================================================
// ===== class AbstractFunction ===============================================
// ============================================================================
/** /**
* \ingroup Common * \ingroup Common
* *
...@@ -46,35 +42,25 @@ namespace AMDiS { ...@@ -46,35 +42,25 @@ namespace AMDiS {
class AbstractFunction class AbstractFunction
{ {
public: public:
/** \brief /// Constructor.
* Constructor.
*/
AbstractFunction(int degree = 0) : AbstractFunction(int degree = 0) :
degree_(degree) degree_(degree)
{} {}
virtual ~AbstractFunction() {} virtual ~AbstractFunction() {}
/** \brief /// Returns \ref degree_.
* Returns \ref degree_.
*/
inline int getDegree() const { inline int getDegree() const {
return degree_; return degree_;
} }
/** \brief /// Deligates the evaluation to overriden method f.
* Deligates the evaluation to overriden method f.
*/
virtual ReturnType operator()(const ArgumentType& x) const = 0; virtual ReturnType operator()(const ArgumentType& x) const = 0;
protected: protected:
int degree_; int degree_;
}; };
// ============================================================================
// ===== class BinaryAbstractFunction =========================================
// ============================================================================
/** /**
* \ingroup Common * \ingroup Common
* *
...@@ -87,25 +73,19 @@ namespace AMDiS { ...@@ -87,25 +73,19 @@ namespace AMDiS {
class BinaryAbstractFunction class BinaryAbstractFunction
{ {
public: public:
/** \brief /// Constructor.
* Constructor.
*/
BinaryAbstractFunction(int degree = 0) : BinaryAbstractFunction(int degree = 0) :
degree_(degree) degree_(degree)
{}; {}
virtual ~BinaryAbstractFunction() {}; virtual ~BinaryAbstractFunction() {}
/** \brief /// Returns \ref degree_.
* Returns \ref degree_.
*/
inline int getDegree() const { inline int getDegree() const {
return degree_; return degree_;
}; }
/** \brief /// Deligates the evaluation to overriden method f.
* Deligates the evaluation to overriden method f.
*/
virtual ReturnType operator()(const ArgumentType1& x, virtual ReturnType operator()(const ArgumentType1& x,
const ArgumentType2& y) const = 0; const ArgumentType2& y) const = 0;
...@@ -113,10 +93,6 @@ namespace AMDiS { ...@@ -113,10 +93,6 @@ namespace AMDiS {
int degree_; int degree_;
}; };
// ============================================================================
// ===== class TertiaryAbstractFunction =======================================
// ============================================================================
/** /**
* \ingroup Common * \ingroup Common
* *
...@@ -130,25 +106,19 @@ namespace AMDiS { ...@@ -130,25 +106,19 @@ namespace AMDiS {
class TertiaryAbstractFunction class TertiaryAbstractFunction
{ {
public: public:
/** \brief /// Constructor.
* Constructor.
*/
TertiaryAbstractFunction(int degree = 0) : TertiaryAbstractFunction(int degree = 0) :
degree_(degree) degree_(degree)
{}; {}
virtual ~TertiaryAbstractFunction() {}; virtual ~TertiaryAbstractFunction() {}
/** \brief /// Returns \ref degree_.
* Returns \ref degree_.
*/
inline int getDegree() const { inline int getDegree() const {
return degree_; return degree_;
}; }
/** \brief /// function evaluation.
* function evaluation.
*/
virtual ReturnType operator()(const ArgumentType1& x, virtual ReturnType operator()(const ArgumentType1& x,
const ArgumentType2& y, const ArgumentType2& y,
const ArgumentType3& z) const = 0; const ArgumentType3& z) const = 0;
...@@ -157,11 +127,6 @@ namespace AMDiS { ...@@ -157,11 +127,6 @@ namespace AMDiS {
int degree_; int degree_;
}; };
// ============================================================================
// ===== class QuartAbstractFunction =======================================
// ============================================================================
/** /**
* \ingroup Common * \ingroup Common
* *
...@@ -176,25 +141,19 @@ namespace AMDiS { ...@@ -176,25 +141,19 @@ namespace AMDiS {
class QuartAbstractFunction class QuartAbstractFunction
{ {
public: public:
/** \brief /// Constructor.
* Constructor.
*/
QuartAbstractFunction(int degree = 0) : QuartAbstractFunction(int degree = 0) :
degree_(degree) degree_(degree)
{}; {}
virtual ~QuartAbstractFunction() {}; virtual ~QuartAbstractFunction() {}
/** \brief /// Returns \ref degree_.
* Returns \ref degree_.
*/
inline int getDegree() const { inline int getDegree() const {
return degree_; return degree_;
}; }
/** \brief /// function evaluation.
* function evaluation.
*/
virtual ReturnType operator()(const ArgumentType1& x, virtual ReturnType operator()(const ArgumentType1& x,
const ArgumentType2& y, const ArgumentType2& y,
const ArgumentType3& z, const ArgumentType3& z,
......
...@@ -23,17 +23,10 @@ ...@@ -23,17 +23,10 @@
#define AMDIS_ADAPTBASE_H #define AMDIS_ADAPTBASE_H
#include <string> #include <string>
#include "AMDiS_fwd.h"
namespace AMDiS { namespace AMDiS {
class ProblemIterationInterface;
class ProblemTimeInterface;
class AdaptInfo;
// ============================================================================
// ===== class AdaptBase ======================================================
// ============================================================================
/// Interface for adaption loops. /// Interface for adaption loops.
class AdaptBase class AdaptBase
{ {
......
...@@ -29,10 +29,6 @@ ...@@ -29,10 +29,6 @@
namespace AMDiS { namespace AMDiS {
// ===========================================================================
// ===== class AdaptInfo =====================================================
// ===========================================================================
/** /**
* \ingroup Adaption * \ingroup Adaption
* *
...@@ -49,9 +45,7 @@ namespace AMDiS { ...@@ -49,9 +45,7 @@ namespace AMDiS {
*/ */
class ScalContent { class ScalContent {
public: public:
/** \brief /// Constructor.
* Constructor.
*/
ScalContent(std::string prefix) ScalContent(std::string prefix)
: est_sum(0.0), : est_sum(0.0),
est_t_sum(0.0), est_t_sum(0.0),
...@@ -86,49 +80,31 @@ namespace AMDiS { ...@@ -86,49 +80,31 @@ namespace AMDiS {
timeErrLow = totalTol * relTimeErr * timeTheta2; timeErrLow = totalTol * relTimeErr * timeTheta2;
} }
/** \brief /// Sum of all error estimates
* Sum of all error estimates
*/
double est_sum; double est_sum;
/** \brief /// Sum of all time error estimates
* Sum of all time error estimates
*/
double est_t_sum; double est_t_sum;
/** \brief /// maximal local error estimate.
* maximal local error estimate.
*/
double est_max; double est_max;
/** \brief /// Maximum of all time error estimates
* Maximum of all time error estimates
*/
double est_t_max; double est_t_max;
/** \brief /// Tolerance for the (absolute or relative) error
* Tolerance for the (absolute or relative) error
*/
double spaceTolerance; double spaceTolerance;
/** \brief /// Time tolerance.
* Time tolerance.
*/
double timeTolerance; double timeTolerance;
/** \brief /// Lower bound for the time error.
* Lower bound for the time error.
*/
double timeErrLow; double timeErrLow;
/** \brief /// true if coarsening is allowed, false otherwise.
* true if coarsening is allowed, false otherwise.
*/
int coarsenAllowed; int coarsenAllowed;
/** \brief /// true if refinement is allowed, false otherwise.
* true if refinement is allowed, false otherwise.
*/
int refinementAllowed; int refinementAllowed;
/** \brief /** \brief
...@@ -136,20 +112,18 @@ namespace AMDiS { ...@@ -136,20 +112,18 @@ namespace AMDiS {
* performed when an element is marked for refinement; usually the value is * performed when an element is marked for refinement; usually the value is
* 1 or DIM * 1 or DIM
*/ */
int refineBisections; int refineBisections;
/** \brief /** \brief
* parameter to tell the marking strategy how many bisections should * parameter to tell the marking strategy how many bisections should
* be undone when an element is marked for coarsening; usually the value is * be undone when an element is marked for coarsening; usually the value is
* 1 or DIM * 1 or DIM
*/ */
int coarseBisections; int coarseBisections;
}; };
public: public:
/** \brief /// Constructor.
* Constructor.
*/
AdaptInfo(std::string name_, int size = 1) AdaptInfo(std::string name_, int size = 1)
: name(name_), : name(name_),
spaceIteration(-1), spaceIteration(-1),
...@@ -197,13 +171,10 @@ namespace AMDiS { ...@@ -197,13 +171,10 @@ namespace AMDiS {
} }
} }
/** \brief /// Destructor.
* Destructor.
*/
virtual ~AdaptInfo() { virtual ~AdaptInfo() {
for (int i = 0; i < scalContents.getSize(); i++) { for (int i = 0; i < scalContents.getSize(); i++)
delete scalContents[i]; delete scalContents[i];
}
} }
inline void reset() inline void reset()
...@@ -220,185 +191,135 @@ namespace AMDiS { ...@@ -220,185 +191,135 @@ namespace AMDiS {
GET_PARAMETER(0, name + "->timestep", "%f", &timestep); GET_PARAMETER(0, name + "->timestep", "%f", &timestep);
} }
/** \brief /// Returns whether space tolerance is reached.
* Returns whether space tolerance is reached.
*/
virtual bool spaceToleranceReached() { virtual bool spaceToleranceReached() {
int size = scalContents.getSize(); int size = scalContents.getSize();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++)
if (!(scalContents[i]->est_sum < scalContents[i]->spaceTolerance)) { if (!(scalContents[i]->est_sum < scalContents[i]->spaceTolerance))
return false; return false;
}
}
return true; return true;
} }
/** \brief /// Returns whether space tolerance of component i is reached.
* Returns whether space tolerance of component i is reached.
*/
virtual bool spaceToleranceReached(int i) { virtual bool spaceToleranceReached(int i) {
if (!(scalContents[i]->est_sum < scalContents[i]->spaceTolerance)) { if (!(scalContents[i]->est_sum < scalContents[i]->spaceTolerance))
return false; return false;
} else { else
return true; return true;
}
} }
/** \brief /// Returns whether time tolerance is reached.
* Returns whether time tolerance is reached.
*/
virtual bool timeToleranceReached() { virtual bool timeToleranceReached() {
int size = scalContents.getSize(); int size = scalContents.getSize();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++)
if (!(scalContents[i]->est_t_sum < scalContents[i]->timeTolerance)) { if (!(scalContents[i]->est_t_sum < scalContents[i]->timeTolerance))
return false; return false;
}
}
return true; return true;
} }
/** \brief /// Returns whether time tolerance of component i is reached.
* Returns whether time tolerance of component i is reached.
*/
virtual bool timeToleranceReached(int i) { virtual bool timeToleranceReached(int i) {
if (!(scalContents[i]->est_t_sum < scalContents[i]->timeTolerance)) { if (!(scalContents[i]->est_t_sum < scalContents[i]->timeTolerance))
return false; return false;
} else { else
return true; return true;
}
} }
/** \brief /// Returns whether time error is under its lower bound.
* Returns whether time error is under its lower bound.
*/
virtual bool timeErrorLow() { virtual bool timeErrorLow() {
int size = scalContents.getSize(); int size = scalContents.getSize();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++)
if (!(scalContents[i]->est_t_sum < scalContents[i]->timeErrLow)) { if (!(scalContents[i]->est_t_sum < scalContents[i]->timeErrLow))
return false; return false;
}
}
return true; return true;
} }
/** \brief /// Print debug information about time error and its bound.
* Print debug information about time error and its bound.
*/
void printTimeErrorLowInfo() { void printTimeErrorLowInfo() {
for (int i = 0; i < scalContents.getSize(); i++) { for (int i = 0; i < scalContents.getSize(); i++)
std::cout << " Time error estimate = " << scalContents[i]->est_t_sum std::cout << " Time error estimate = " << scalContents[i]->est_t_sum
<< " Time error bound = " << scalContents[i]->timeErrLow << "\n"; << " Time error bound = " << scalContents[i]->timeErrLow << "\n";
}
} }
/** \brief /// Returns \ref spaceIteration.
* Returns \ref spaceIteration.
*/
inline int getSpaceIteration() { inline int getSpaceIteration() {
return spaceIteration; return spaceIteration;
} }
/** \brief /// Sets \ref spaceIteration.
* Sets \ref spaceIteration.
*/
inline void setSpaceIteration(int it) { inline void setSpaceIteration(int it) {
spaceIteration = it; spaceIteration = it;
} }
/** \brief /// Returns \ref maxSpaceIteration.
* Returns \ref maxSpaceIteration.
*/
inline int getMaxSpaceIteration() { inline int getMaxSpaceIteration() {
return maxSpaceIteration; return maxSpaceIteration;
} }
/** \brief /// Sets \ref maxSpaceIteration.
* Sets \ref maxSpaceIteration.
*/
inline void setMaxSpaceIteration(int it) { inline void setMaxSpaceIteration(int it) {
maxSpaceIteration = it; maxSpaceIteration = it;
} }
/** \brief /// Increments \ref spaceIteration by 1;
* Increments \ref spaceIteration by 1;
*/
inline void incSpaceIteration() { inline void incSpaceIteration() {
spaceIteration++;