QuOc

 

Public Types | Public Member Functions

aol::Matrix33< _DataType > Class Template Reference
[Matrix]

#include <smallMat.h>

Inheritance diagram for aol::Matrix33< _DataType >:
aol::Mat< 3, 3, _DataType >

List of all members.

Public Types

typedef _DataType DataType

Public Member Functions

 Matrix33 ()
 Constructor.
 Matrix33 (const _DataType a, const _DataType b, const _DataType c, const _DataType d, const _DataType e, const _DataType f, const _DataType g, const _DataType h, const _DataType i)
 Matrix33 (const Matrix33< _DataType > &rhs)
 Copy-constructor.
 Matrix33 (const Mat< 3, 3, _DataType > &rhs)
 Copy-constructor.
 Matrix33 (const Matrix33Symm< _DataType > &mat)
 Copy from symmetric matrix.
void fill (const _DataType a, const _DataType b, const _DataType c, const _DataType d, const _DataType e, const _DataType f, const _DataType g, const _DataType h, const _DataType i)
 fills matrix with parameters passed
Matrix33< _DataType > inverse ()
 calc the inverse matrix with adjoints
void setIdentity ()
void setRow (const int Index, const _DataType V1, _DataType V2, _DataType V3)
template<class T >
void makeCofactorMatrix (const Matrix33< T > &Mat)
 The Cofactormatrix is defined as $ \mbox{Cof} A := \mbox{det} A \cdot A^{-T} $.
template<class T >
void makeDerivedCofactorMatrix (const Matrix33< T > &Mat, int I, int J)
 qc::Computes the matrix $ \partial_{a_{ij}} \mbox{Cof} A $.
_DataType det () const
 computes the determinant of this matrix.
_DataType tr ()
 computes the trace of this matrix.
Matrix33< _DataType > & operator*= (const Matrix33< _DataType > &Other)
 $ A\mapsto A*B $
void transpose ()
 $ A \mapsto A^T $
aol::Matrix33< _DataType > transposed () const
 return (this matrix) transposed (two copies necessary)
void setRotationAboutX (_DataType alpha)
 Set to rotation matrix in the yz plane (about x axis).
void setRotationAboutY (_DataType alpha)
 Set to rotation matrix in the xz plane (about y axis).
void setRotationAboutZ (_DataType alpha)
 Set to rotation matrix in the xy plane (about z axis).
void setRotationAboutAxis (_DataType Alpha, short Axis)
 Set to rotation matrix about the ith axis (angle=``alpha'',axis=``Axis'').
Vec3< _DataType > operator* (const Vec3< _DataType > &vec) const

Detailed Description

template<typename _DataType>
class aol::Matrix33< _DataType >

A simple 3x3 matrix. Including all methods which aren't in class Mat

Definition at line 975 of file smallMat.h.


Member Typedef Documentation

template<typename _DataType>
typedef _DataType aol::Matrix33< _DataType >::DataType

Reimplemented from aol::Mat< 3, 3, _DataType >.

Definition at line 978 of file smallMat.h.


Constructor & Destructor Documentation

template<typename _DataType>
aol::Matrix33< _DataType >::Matrix33 (  )  [inline]

Constructor.

Definition at line 981 of file smallMat.h.

      : Mat<3, 3, _DataType>() { }

template<typename _DataType>
aol::Matrix33< _DataType >::Matrix33 ( const _DataType  a,
const _DataType  b,
const _DataType  c,
const _DataType  d,
const _DataType  e,
const _DataType  f,
const _DataType  g,
const _DataType  h,
const _DataType  i 
) [inline]

Constructor (for return value optimization) fills this with: [ a b c ] [ d e f ] [ g h i ]

Definition at line 989 of file smallMat.h.

                                                                       {
    this->_row[0][0] = a;     this->_row[0][1] = b;    this->_row[0][2] = c;
    this->_row[1][0] = d;     this->_row[1][1] = e;    this->_row[1][2] = f;
    this->_row[2][0] = g;     this->_row[2][1] = h;    this->_row[2][2] = i;
  }

template<typename _DataType>
aol::Matrix33< _DataType >::Matrix33 ( const Matrix33< _DataType > &  rhs  )  [inline]

Copy-constructor.

Definition at line 998 of file smallMat.h.

      : Mat<3, 3, _DataType> ( rhs ) {}

template<typename _DataType>
aol::Matrix33< _DataType >::Matrix33 ( const Mat< 3, 3, _DataType > &  rhs  )  [inline]

Copy-constructor.

Definition at line 1002 of file smallMat.h.

      : Mat<3, 3, _DataType> ( rhs ) {}

template<typename _DataType>
aol::Matrix33< _DataType >::Matrix33 ( const Matrix33Symm< _DataType > &  mat  )  [explicit]

Copy from symmetric matrix.

Definition at line 215 of file smallMat.cpp.

References aol::Matrix33< _DataType >::fill().

                                                                                                 {
  fill ( mat[0][0], mat [0][1], mat [0][2],
         mat[1][0], mat [1][1], mat [1][2],
         mat[2][0], mat [2][1], mat [2][2] );
}


Member Function Documentation

template<typename _DataType>
_DataType aol::Matrix33< _DataType >::det (  )  const [inline]

computes the determinant of this matrix.

Definition at line 1091 of file smallMat.h.

Referenced by aol::BlockGaussSeidelSweeper< DataType, BlockOpType >::cacheDiagInverses(), tpcfe::CFEInterfaceTriangulationWithVonMisesStressGeneratorBase< GridType >::computeTetraData(), aol::Matrix44< _DataType >::det(), tpcfe::determineElementAndTetraForWC(), aol::Matrix33< RealType >::inverse(), and tpcfe::CFEBlockMultigridProjectAvgConstr< CFEBlockOpType, CFEMassOpType, CMode >::setCoarsePreconditioner().

                        {
    return this->_row[0][0]*this->_row[1][1]*this->_row[2][2] + this->_row[0][1]*this->_row[1][2]*this->_row[2][0] +
           this->_row[0][2]*this->_row[1][0]*this->_row[2][1] - this->_row[0][2]*this->_row[1][1]*this->_row[2][0] -
           this->_row[0][1]*this->_row[1][0]*this->_row[2][2] - this->_row[0][0]*this->_row[1][2]*this->_row[2][1];
  }

template<typename _DataType>
void aol::Matrix33< _DataType >::fill ( const _DataType  a,
const _DataType  b,
const _DataType  c,
const _DataType  d,
const _DataType  e,
const _DataType  f,
const _DataType  g,
const _DataType  h,
const _DataType  i 
) [inline]

fills matrix with parameters passed

Definition at line 1009 of file smallMat.h.

Referenced by aol::Matrix44< _DataType >::det(), and aol::Matrix33< _DataType >::Matrix33().

                                                                         {

    this->_row[0][0] = a;     this->_row[0][1] = b;    this->_row[0][2] = c;
    this->_row[1][0] = d;     this->_row[1][1] = e;    this->_row[1][2] = f;
    this->_row[2][0] = g;     this->_row[2][1] = h;    this->_row[2][2] = i;
  }

template<typename _DataType>
Matrix33<_DataType> aol::Matrix33< _DataType >::inverse (  )  [inline]

calc the inverse matrix with adjoints

Definition at line 1019 of file smallMat.h.

Referenced by aol::BlockGaussSeidelSweeper< DataType, BlockOpType >::cacheDiagInverses(), qc::DistanceSweeper3d< DataType, LocalBitArrayType, LocalDistanceArrayType, _GridType >::calcBarycentricCoords(), qc::DistanceSweeper3d< DataType, LocalBitArrayType, LocalDistanceArrayType, _GridType >::calcIntersectionPoint(), tpcfe::CFEJCElastOp< _ConfiguratorType >::computeLocalTetraMatrix(), tpcfe::CFEFullyAnisotropicElastOp< _ConfiguratorType >::computeLocalTetraMatrix(), tpcfe::CFEInterfaceTriangulationWithVonMisesStressGeneratorBase< GridType >::computeTetraData(), tpcfe::determineElementAndTetraForWC(), qc::meanZeroShiftAndRotationProjector< ConfiguratorType >::momentMatrixLinearized(), and tpcfe::CFEBlockMultigridProjectAvgConstr< CFEBlockOpType, CFEMassOpType, CMode >::setCoarsePreconditioner().

                                {
    _DataType determinante ( det() );
    if ( determinante == _DataType ( 0 ) ) {
      throw ( Exception ( "matrix not invertible.", __FILE__, __LINE__ ) );
    }

    Matrix33 res;
    _DataType A;

    for ( int i = 0; i < 3; ++i ) {
      for ( int j = 0; j < 3; ++j ) {
        // calc the determinant, the sign is automatically ok
        A = this->_row[ ( i+1 ) % 3][ ( j+1 ) % 3] * this->_row[ ( i+2 ) % 3][ ( j+2 ) % 3]
            - this->_row[ ( i+1 ) % 3][ ( j+2 ) % 3] * this->_row[ ( i+2 ) % 3][ ( j+1 ) % 3];
        // consider the transposed matrix:
        res.set ( j, i, A / determinante );
      }
    }

    return res;
  }

template<typename _DataType>
template<class T >
void aol::Matrix33< _DataType >::makeCofactorMatrix ( const Matrix33< T > &  Mat  )  [inline]

The Cofactormatrix is defined as $ \mbox{Cof} A := \mbox{det} A \cdot A^{-T} $.

Definition at line 1060 of file smallMat.h.

                                                     {
    this->_row[0][0] =   Mat.get ( 1, 1 ) * Mat.get ( 2, 2 ) - Mat.get ( 1, 2 ) * Mat.get ( 2, 1 );
    this->_row[1][0] = - Mat.get ( 0, 1 ) * Mat.get ( 2, 2 ) + Mat.get ( 2, 1 ) * Mat.get ( 0, 2 );
    this->_row[2][0] =   Mat.get ( 0, 1 ) * Mat.get ( 1, 2 ) - Mat.get ( 1, 1 ) * Mat.get ( 0, 2 );

    this->_row[0][1] = - Mat.get ( 1, 0 ) * Mat.get ( 2, 2 ) + Mat.get ( 2, 0 ) * Mat.get ( 1, 2 );
    this->_row[1][1] =   Mat.get ( 0, 0 ) * Mat.get ( 2, 2 ) - Mat.get ( 0, 2 ) * Mat.get ( 2, 0 );
    this->_row[2][1] = - Mat.get ( 0, 0 ) * Mat.get ( 1, 2 ) + Mat.get ( 1, 0 ) * Mat.get ( 0, 2 );

    this->_row[0][2] =   Mat.get ( 1, 0 ) * Mat.get ( 2, 1 ) - Mat.get ( 1, 1 ) * Mat.get ( 2, 0 );
    this->_row[1][2] = - Mat.get ( 0, 0 ) * Mat.get ( 2, 1 ) + Mat.get ( 0, 1 ) * Mat.get ( 2, 0 );
    this->_row[2][2] =   Mat.get ( 0, 0 ) * Mat.get ( 1, 1 ) - Mat.get ( 1, 0 ) * Mat.get ( 0, 1 );
  }

template<typename _DataType>
template<class T >
void aol::Matrix33< _DataType >::makeDerivedCofactorMatrix ( const Matrix33< T > &  Mat,
int  I,
int  J 
) [inline]

qc::Computes the matrix $ \partial_{a_{ij}} \mbox{Cof} A $.

Definition at line 1079 of file smallMat.h.

                                                                          {
    this->setZero();

    this->_row[ (I + 1) % 3 ][ (J + 1) % 3 ] =   Mat.get( (I + 2) % 3, (J + 2) % 3 );
    this->_row[ (I + 2) % 3 ][ (J + 2) % 3 ] =   Mat.get( (I + 1) % 3, (J + 1) % 3 );
    this->_row[ (I + 1) % 3 ][ (J + 2) % 3 ] = - Mat.get( (I + 2) % 3, (J + 1) % 3 );
    this->_row[ (I + 2) % 3 ][ (J + 1) % 3 ] = - Mat.get( (I + 1) % 3, (J + 2) % 3 );

  }

template<typename _DataType>
Vec3<_DataType> aol::Matrix33< _DataType >::operator* ( const Vec3< _DataType > &  vec  )  const [inline]

Definition at line 1168 of file smallMat.h.

                                                                 {
    Vec3<_DataType> Res;
    for ( int i = 0; i < 3; ++i )
      for ( int j = 0; j < 3; ++j )
        Res[i] += this->_row[i][j] * vec[j];

    return( Res );
  }

template<typename _DataType>
Matrix33<_DataType>& aol::Matrix33< _DataType >::operator*= ( const Matrix33< _DataType > &  Other  )  [inline]

$ A\mapsto A*B $

Definition at line 1107 of file smallMat.h.

                                                                       {
    Matrix33<_DataType> tmp;
    tmp = *this;
    this->setZero( );
    for ( int i = 0; i < 3; ++i ) {
      for ( int j = 0; j < 3; ++j ) {
        for ( int k = 0; k < 3; ++k ) {
          this->_row[i][j] += tmp._row[i][k] * Other._row[k][j];
        }
      }
    }
    return *this;
  }

template<typename _DataType>
void aol::Matrix33< _DataType >::setIdentity (  )  [inline]
template<typename _DataType>
void aol::Matrix33< _DataType >::setRotationAboutAxis ( _DataType  Alpha,
short  Axis 
) [inline]

Set to rotation matrix about the ith axis (angle=``alpha'',axis=``Axis'').

Definition at line 1159 of file smallMat.h.

Referenced by qc::meanZeroShiftAndRotationProjector< ConfiguratorType >::Displacement3DMomentNormSqrGradient::applyAdd(), qc::meanZeroShiftAndRotationProjector< ConfiguratorType >::Displacement3DMomentNormSqr::applyAdd(), and qc::meanZeroShiftAndRotationProjector< ConfiguratorType >::momentMatrixNonlinear().

                                                            {
    switch ( Axis ) {
    case 0: this->setRotationAboutX( Alpha ); break;
    case 1: this->setRotationAboutY( Alpha ); break;
    case 2: this->setRotationAboutZ( Alpha ); break;
    default: this->setRotationAboutZ( Alpha );
    }
  }

template<typename _DataType>
void aol::Matrix33< _DataType >::setRotationAboutX ( _DataType  alpha  )  [inline]

Set to rotation matrix in the yz plane (about x axis).

Definition at line 1135 of file smallMat.h.

Referenced by qc::ShapeLevelsetGenerator< DataType >::generateRotatedHalfcubeLevelset(), qc::ShapeLevelsetGenerator< DataType >::generateXRotated3DRodsLevelset(), and aol::Matrix33< RealType >::setRotationAboutAxis().

                                             {
    const _DataType co = cos ( alpha ), si = sin ( alpha );
    this->_row[0][0] = 1.0;    this->_row[0][1] = 0.0;    this->_row[0][2] = 0.0; 
    this->_row[1][0] = 0.0;    this->_row[1][1] = co ;    this->_row[1][2] = -si; 
    this->_row[2][0] = 0.0;    this->_row[2][1] = si ;    this->_row[2][2] = co ; 
  }

template<typename _DataType>
void aol::Matrix33< _DataType >::setRotationAboutY ( _DataType  alpha  )  [inline]

Set to rotation matrix in the xz plane (about y axis).

Definition at line 1143 of file smallMat.h.

Referenced by aol::Matrix33< RealType >::setRotationAboutAxis().

                                             {
    const _DataType co = cos ( alpha ), si = sin ( alpha );
    this->_row[0][0] = co ;    this->_row[0][1] = 0.0;    this->_row[0][2] = -si; 
    this->_row[1][0] = 0.0;    this->_row[1][1] = 1.0;    this->_row[1][2] = 0.0; 
    this->_row[2][0] = si ;    this->_row[2][1] = 0.0;    this->_row[2][2] = co ; 
  }

template<typename _DataType>
void aol::Matrix33< _DataType >::setRotationAboutZ ( _DataType  alpha  )  [inline]

Set to rotation matrix in the xy plane (about z axis).

Definition at line 1151 of file smallMat.h.

Referenced by aol::Matrix33< RealType >::setRotationAboutAxis().

                                             {
    const _DataType co = cos ( alpha ), si = sin ( alpha );
    this->_row[0][0] = co ;    this->_row[0][1] =-si ;    this->_row[0][2] = 0.0; 
    this->_row[1][0] = si ;    this->_row[1][1] = co ;    this->_row[1][2] = 0.0; 
    this->_row[2][0] = 0.0;    this->_row[2][1] = 0.0;    this->_row[2][2] = 1.0; 
  }

template<typename _DataType>
void aol::Matrix33< _DataType >::setRow ( const int  Index,
const _DataType  V1,
_DataType  V2,
_DataType  V3 
) [inline]
template<typename _DataType>
_DataType aol::Matrix33< _DataType >::tr (  )  [inline]

computes the trace of this matrix.

Definition at line 1099 of file smallMat.h.

                 {
    return this->_row[0][0] + this->_row[1][1] + this->_row[2][2];
  }

template<typename _DataType>
void aol::Matrix33< _DataType >::transpose (  )  [inline]
template<typename _DataType>
aol::Matrix33<_DataType> aol::Matrix33< _DataType >::transposed (  )  const [inline]

return (this matrix) transposed (two copies necessary)

Reimplemented from aol::Mat< 3, 3, _DataType >.

Definition at line 1128 of file smallMat.h.

Referenced by tpcfe::CFEVirtualNode< RealType, CFE_TPOSELAST, NodalCoeffType >::determineConstraints().

                                             {
    aol::Matrix33<_DataType> tmp = *this;
    tmp.transpose();
    return ( tmp );
  }


The documentation for this class was generated from the following files:

Generated on Fri Sep 9 2011 21:09:15 for QuocMesh by doxygen 1.7.1