diff --git a/AMDiS/src/BasisFunction.h b/AMDiS/src/BasisFunction.h index 132c9435e8b8344ef9022f9d707bd1ea5623bb60..62283a6a82249fbdfe0214674c5f83f9e755162a 100644 --- a/AMDiS/src/BasisFunction.h +++ b/AMDiS/src/BasisFunction.h @@ -168,54 +168,38 @@ namespace AMDiS { */ virtual void getBound(const ElInfo*, BoundaryType *) const {}; - /** \brief - * Returns \ref degree of BasisFunction - */ + /// Returns \ref degree of BasisFunction inline const int getDegree() const { return degree; } - /** \brief - * Returns \ref dim of BasisFunction - */ + /// Returns \ref dim of BasisFunction inline const int getDim() const { return dim; } - /** \brief - * Returns \ref nBasFcts which is the number of local basis functions - */ + /// Returns \ref nBasFcts which is the number of local basis functions inline const int getNumber() const { return nBasFcts; } - /** \brief - * Returns \ref name of BasisFunction - */ + /// Returns \ref name of BasisFunction inline const std::string& getName() const { return name; } - /** \brief - * Returns \ref nDOF[i] - */ + /// Returns \ref nDOF[i] int getNumberOfDOFs(int i) const; - /** \brief - * Returns \ref nDOF - */ + /// Returns \ref nDOF inline DimVec<int>* getNumberOfDOFs() const { return nDOF; } - /** \brief - * Initialisation of the \ref nDOF vector. Must be implemented by sub classes - */ + /// Initialisation of the \ref nDOF vector. Must be implemented by sub classes virtual void setNDOF() = 0; - /** \brief - * Returns the barycentric coordinates of the i-th basis function. - */ + /// Returns the barycentric coordinates of the i-th basis function. virtual DimVec<double> *getCoords(int i) const = 0; /** \brief diff --git a/AMDiS/src/ElInfo1d.cc b/AMDiS/src/ElInfo1d.cc index 8f8cd4b497a130a446896b7d825c3e7d4cf58f7f..b2a2eb8cd847b66312d042ef7d918562de121a11 100644 --- a/AMDiS/src/ElInfo1d.cc +++ b/AMDiS/src/ElInfo1d.cc @@ -271,23 +271,44 @@ namespace AMDiS { void ElInfo1d::getRefSimplexCoords(const BasisFunction *basisFcts, DimMat<double> *coords) const { - (*coords)[0][0] = 1.0; - (*coords)[1][0] = 0.0; + FUNCNAME("ElInfo1d::getRefSimplexCoords()"); - (*coords)[0][1] = 0.0; - (*coords)[1][1] = 1.0; + switch (basisFcts->getDegree()) { + case 1: + (*coords)[0][0] = 1.0; + (*coords)[1][0] = 0.0; + + (*coords)[0][1] = 0.0; + (*coords)[1][1] = 1.0; + break; + case 2: + ERROR_EXIT("DDA\n"); + break; + default: + ERROR_EXIT("Not yet implemented!\n"); + } } void ElInfo1d::getSubElementCoords(const BasisFunction *basisFcts, int iChild, DimMat<double> *coords) const { - if (iChild == 0) { - (*coords)[0][1] = ((*coords)[0][0] + (*coords)[0][1]) * 0.5; - (*coords)[1][1] = ((*coords)[1][0] + (*coords)[1][1]) * 0.5; - } else { - (*coords)[0][0] = ((*coords)[0][0] + (*coords)[0][1]) * 0.5; - (*coords)[1][0] = ((*coords)[1][0] + (*coords)[1][1]) * 0.5; + FUNCNAME("ElInfo1d::getSubElementCoords()"); + + switch (basisFcts->getDegree()) { + case 1: + if (iChild == 0) { + (*coords)[0][1] = ((*coords)[0][0] + (*coords)[0][1]) * 0.5; + (*coords)[1][1] = ((*coords)[1][0] + (*coords)[1][1]) * 0.5; + } else { + (*coords)[0][0] = ((*coords)[0][0] + (*coords)[0][1]) * 0.5; + (*coords)[1][0] = ((*coords)[1][0] + (*coords)[1][1]) * 0.5; + } + break; + case 2: + break; + default: + ERROR_EXIT("Not yet implemented!\n"); } } diff --git a/AMDiS/src/FixVec.h b/AMDiS/src/FixVec.h index 0d0ed8cabf78e4ca4944713fe4f662becf59c85b..95d42d695a22b0f5e74701e255c32c980872dc8c 100644 --- a/AMDiS/src/FixVec.h +++ b/AMDiS/src/FixVec.h @@ -22,10 +22,6 @@ #ifndef AMDIS_FIXVEC_H #define AMDIS_FIXVEC_H -// =========================================================================== -// ===== includes ============================================================ -// =========================================================================== - #include "Global.h" #include "MemoryManager.h" #include <iostream> @@ -33,20 +29,11 @@ namespace AMDiS { - // =========================================================================== - // ===== forward declarations ================================================ - // =========================================================================== - class Mesh; template<typename T> class DimMat; template<typename T> class WorldVector; template<typename T> class WorldMatrix; - - // =========================================================================== - // ===== definitions ========================================================= - // =========================================================================== - /** determines how to initialize a FixVec when constructed */ enum InitType { @@ -57,10 +44,6 @@ namespace AMDiS { UNIT_MATRIX = 4 /**< values at the diagonal of a matrix are set to one */ }; - // =========================================================================== - // ===== class FixVec ======================================================== - // =========================================================================== - /** \ingroup Common * \brief * A FixVec is a template vector of a fixed size. @@ -361,10 +344,6 @@ namespace AMDiS { }; - // =========================================================================== - // ===== class DimVec ======================================================== - // =========================================================================== - /** \ingroup Common * \brief * A DimVec is a FixVec with dim + 1 entries. It can be used for storing @@ -397,9 +376,6 @@ namespace AMDiS { void multMatrixVec(DimMat<T> &m, DimVec<T> &v); }; - // =========================================================================== - // ===== class DimMat ======================================================== - // =========================================================================== /** \ingroup Common * \brief @@ -411,16 +387,12 @@ namespace AMDiS { public: MEMORY_MANAGED(DimMat<T>); - /** \brief - * Calls the corresponding constructor of VectorOfFixVecs - */ + /// Calls the corresponding constructor of VectorOfFixVecs DimMat(int dim, InitType initType = NO_INIT) : Matrix<T>(dim + 1, dim + 1) {} - /** \brief - * Calls the corresponding constructor of VectorOfFixVecs - */ + /// Calls the corresponding constructor of VectorOfFixVecs DimMat(int dim, InitType initType, const T& ini) : Matrix<T>(dim + 1, dim + 1) { @@ -429,9 +401,7 @@ namespace AMDiS { this->set(ini); } - /** \brief - * Calls the corresponding constructor of VectorOfFixVecs - */ + /// Calls the corresponding constructor of VectorOfFixVecs DimMat(int dim, InitType initType, T* ini) : Matrix<T>(dim + 1, dim + 1) { diff --git a/AMDiS/src/MatrixVector.h b/AMDiS/src/MatrixVector.h index a2a04d23a08c51190dd6f489cb955109dd41470f..2c3326a51670efc1c8339dd6dab4ac13f0e1d079 100644 --- a/AMDiS/src/MatrixVector.h +++ b/AMDiS/src/MatrixVector.h @@ -31,22 +31,14 @@ namespace AMDiS { template<typename T> class DOFVector; - // ============================================================================ - // ===== class Vector ========================================================= - // ============================================================================ - - /** \brief - * Class for efficient vector operations of fixed size numerical vectors. - */ + /// Class for efficient vector operations of fixed size numerical vectors. template<typename T> class Vector : public Serializable { public: MEMORY_MANAGED(Vector<T>); - /** \brief - * Constructor. - */ + /// Constructor. Vector(int i = 0) : size(i) { @@ -60,9 +52,7 @@ namespace AMDiS { return (valArray != NULL); } - /** \brief - * Change the size of the vector to newSize. - */ + /// Change the size of the vector to newSize. inline void resize(int newSize) { if (size != newSize) { if (valArray) @@ -72,9 +62,7 @@ namespace AMDiS { } } - /** \brief - * Copy constructor. - */ + /// Copy constructor. Vector(const Vector<T>& rhs) : Serializable(),size(rhs.size) { @@ -82,16 +70,12 @@ namespace AMDiS { *this = rhs; // uses operator=() } - /** \brief - * Destructor. - */ + /// Destructor. virtual ~Vector() { delete [] valArray; } - /** \brief - * Assignement operator - */ + /// Assignement operator inline const Vector<T>& operator=(const Vector<T>& rhs) { TEST_EXIT_DBG(rhs.size == size)("invalid size\n"); T *rhsIt, *thisIt; @@ -104,9 +88,7 @@ namespace AMDiS { return *this; } - /** \brief - * Assignement operator - */ + /// Assignement operator inline const Vector<T>& operator=(const T& scal) { T *thisIt; for(thisIt = this->begin(); @@ -118,9 +100,7 @@ namespace AMDiS { return *this; } - /** \brief - * Assignement operator - */ + /// Assignement operator inline const Vector<T>& operator=(const T* vec) { T *thisIt; const T *vecIt; @@ -133,16 +113,12 @@ namespace AMDiS { return *this; } - /** \brief - * Sets all entries to scal. - */ + /// Sets all entries to scal. inline const Vector<T>& set(const T& scal) { return *this = scal; } - /** \brief - * Sets all entries. - */ + /// Sets all entries. inline const Vector<T>& setValues(const T* values) { T *thisIt; const T *valuesIt; @@ -155,18 +131,14 @@ namespace AMDiS { return *this; } - /** \brief - * Sets all entries. - */ + /// Sets all entries. inline void fill(const T value) { for (T *thisIt = this->begin(); thisIt != this->end(); thisIt++) { *thisIt = value; } } - /** \brief - * Comparison operator. - */ + /// Comparison operator. inline bool operator==(const Vector<T>& rhs) const { if(size != rhs.size) return false; T *rhsIt, *thisIt; @@ -179,53 +151,39 @@ namespace AMDiS { return true; } - /** \brief - * Comparison operator. - */ + /// Comparison operator. inline bool operator!=(const Vector<T>& rhs) const { return !(*this==rhs); } - /** \brief - * Access to the i-th vector element. - */ + /// Access to the i-th vector element. inline T& operator[](int i) { TEST_EXIT_DBG(i < size && i >= 0)("invalid index\n"); return valArray[i]; } - /** \brief - * Access to the i-th vector element for const vectors. - */ + /// Access to the i-th vector element for const vectors. inline const T& operator[] (int i) const { TEST_EXIT_DBG(i < size && i >= 0)("invalid index\n"); return valArray[i]; } - /** \brief - * Returns pointer to the first vector element. - */ + /// Returns pointer to the first vector element. inline T *begin() const { return valArray; } - /** \brief - * Returns pointer after the last vector element. - */ + /// Returns pointer after the last vector element. inline T *end() const { return valArray + size; } - /** \brief - * Returns \ref size. - */ + /// Returns \ref size. virtual int getSize() const { return size; } - /** \brief - * Returns \ref valArray as T-array - */ + /// Returns \ref valArray as T-array inline T *getValArray() { return valArray; } @@ -238,8 +196,6 @@ namespace AMDiS { std::cout << std::endl; } - // ===== Serializable implementation ===== - void serialize(std::ostream &out) { out.write(reinterpret_cast<const char*>(&size), sizeof(int)); out.write(reinterpret_cast<const char*>(valArray), size * sizeof(T)); @@ -255,44 +211,29 @@ namespace AMDiS { } protected: - /** \brief - * Size of the vector. - */ + /// Size of the vector. int size; - /** \brief - * Internal storage pointer. - */ + /// Internal storage pointer. T *valArray; }; - - // ============================================================================ - // ===== class Matrix ========================================================= - // ============================================================================ - - /** \brief - * Class for efficient matrix operations of fixed size numerical matrices. - */ + /// Class for efficient matrix operations of fixed size numerical matrices. template<typename T> class Matrix : public Vector<T> { public: MEMORY_MANAGED(Matrix<T>); - /** \brief - * Constructor. - */ + /// Constructor. Matrix(int r, int c) - : Vector<T>(r*c), + : Vector<T>(r * c), rows(r), cols(c) {} - /** \brief - * Changes the size of the matrix to newRows x newCols. - */ + /// Changes the size of the matrix to newRows x newCols. inline void resize(int newRows, int newCols) { if ((newRows != rows) || (newCols != cols)) { Vector<T>::resize(newRows * newCols); @@ -301,64 +242,49 @@ namespace AMDiS { } } - /** \brief - * Assignement operator. - */ + /// Assignement operator. inline const Matrix<T>& operator=(const T& scal) { return static_cast<const Matrix<T>&>(Vector<T>::operator=(scal)); } + /// inline bool operator==(const Matrix<T>& rhs) const { if (rows != rhs.getNumRows()) return false; if (cols != rhs.getNumCols()) return false; return Vector<T>::operator == (rhs); } - /** \brief - * Comparison operator. - */ + /// Comparison operator. inline bool operator!=(const Matrix<T>& rhs) const { return !(*this == rhs); } - /** \brief - * Acces to i-th matrix row. - */ + /// Acces to i-th matrix row. inline T *operator[](int i) { return this->valArray + cols * i; } - /** \brief - * Acces to i-th matrix row for constant matrices. - */ + /// Acces to i-th matrix row for constant matrices. inline const T *operator[](int i) const { return this->valArray + cols * i; } - /** \brief - * Returns \ref rows. - */ + /// Returns \ref rows. inline int getNumRows() const { return rows; } - /** \brief - * Return \ref cols. - */ + /// Return \ref cols. inline int getNumCols() const { return cols; - }; + } - /** \brief - * Returns \ref rows. - */ + /// Returns \ref rows. inline int getSize() const { return rows; - }; + } - /** \brief - * Returns pointer after the last vector element. - */ + /// Returns pointer after the last vector element. inline T *end() const { return this->valArray + (cols * rows); } @@ -376,20 +302,14 @@ namespace AMDiS { void invert2x2(); protected: - /** \brief - * Number of matrix rows. - */ + /// Number of matrix rows. int rows; - /** \brief - * Number of matrix columns. - */ + /// Number of matrix columns. int cols; }; - /** \brief - * Matrix vector multiplication. - */ + /// Matrix vector multiplication. template<typename T> inline const Vector<T>& mv(const Matrix<T>& m, const Vector<T>& v, Vector<T>& result) {