/** * * */ #ifndef NODECENTRICREPMATRIXINCLUDE #define NODECENTRICREPMATRIXINCLUDE /* System - includes */ #include /* std - includes */ #include #include #include #include /* omp - includes */ #ifdef NICE_USELIB_OPENMP #include #endif namespace OBJREC { class NodeCentricRepMatrix : public std::valarray { private: //! first dimension (y-axes) uint m; //! second dimension (x-axes) uint n; //! third dimension (number of edges departing from each node) uint e; //! check whether the given value is in the range of the given dim void checkRange ( uint m, uint n, uint e ) const; /** Matrix Access **/ //! returns the value at (y=m, x=n, e=e), without rangecheck double atQuick ( uint m, uint n, uint e ) const; //! returns a non-const referenz to the element at (y=m, x=n, e=e), without rangecheck double& atQuick ( uint m, uint n, uint e ); public: /* Constructor and Destructor */ /** * @brief Simple constructor. * @param uint - first dimension (y) * @param uint - second dimension (x) * @param uint - third dimension (e) */ NodeCentricRepMatrix ( const uint m, const uint n, const uint e ); /** * @brief Copy Constructor. * @param NodeCentricRepMatrix& - matrix, which has to copy into a new Object. Note: Deepcopy! */ NodeCentricRepMatrix ( const NodeCentricRepMatrix& matrix ); /** * @brief Destructor. Free Matrix. */ ~NodeCentricRepMatrix(); /** Getter **/ //! Get the first dimension uint getM() const { return m; }; //! Get the second dimension uint getN() const { return n; }; //! Get the third dimension uint getE() const { return e; }; /** Matrix access **/ //! returns the value at (y=m, x=n, e=e) double at ( uint m, uint n, uint e ) const; //! returns a non-const referenz to the element at (y=m, x=n, e=e) double& at ( uint m, uint n, uint e ); /** Operator **/ //! =+ operator NodeCentricRepMatrix& operator-= ( NodeCentricRepMatrix const& rhs ); //! + operator NodeCentricRepMatrix operator- ( NodeCentricRepMatrix const& rhs ); //! Assignt operator (deep copy) NodeCentricRepMatrix& operator= ( NodeCentricRepMatrix const& matrix ); //! Access operator double operator() ( const uint m, const uint n, const uint e ) const; //! Access operator double& operator() ( const uint m, const uint n, const uint e ); /** static Methodes **/ //! return the max. of matrix static inline double maxValue ( const NodeCentricRepMatrix& matrix ) { return matrix.max(); }; /** * @brief This Function calculates the differenz between Member-Matrix and the given Matrix and check if there is NULL or less then epsilon. * @param NodeCentricRepMatrix& - given matrix * @param double - epsilon * @return true if |M1(j,i,e) - M2(j,i,e)| <= epsilon, false else */ bool changes ( const OBJREC::NodeCentricRepMatrix& matrix, double epsilon ) const; }; } #endif