123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- /**
- *
- *
- */
- #ifndef NODECENTRICREPMATRIXINCLUDE
- #define NODECENTRICREPMATRIXINCLUDE
- /* System - includes */
- #include <sys/types.h>
- /* std - includes */
- #include <stdexcept>
- #include <iostream>
- #include <valarray>
- #include <cmath>
- /* omp - includes */
- #ifdef NICE_USELIB_OPENMP
- #include <omp.h>
- #endif
- namespace OBJREC
- {
- class NodeCentricRepMatrix : public std::valarray<double>
- {
- 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
|