Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

matfile/denseOWrapper.hh
Go to the documentation of this file.
00001 #ifndef DENSEOWRAPPER_HH_
00002 #define DENSEOWRAPPER_HH_
00003 
00004 
00005 using namespace matfile;
00006 
00007 namespace concepts{
00008 
00017 class DenseOWrapper{
00018   
00019   //Methoden die der Writer bzw. ArrayDenseWrapper erwartet
00020 public: 
00021   
00022   
00023   typedef ArrayDenseWrapper Type; 
00024   
00025   template<class T>
00026   DenseOWrapper(concepts::Matrix<T>& matrix);
00027   
00028   virtual ~DenseOWrapper(){};
00029   
00030   bool isComplex() const{
00031   return isComplex_;
00032   }
00033    
00034   Real* realData(uint i, uint j) const{
00035     if(!isComplex_)
00036       return &((*matrix_r)(i,j));
00037     return &((*matrix_c)(i,j).real());
00038   }
00039   
00040   Real* complexData(uint i, uint j) const{
00041     return &((*matrix_c)(i,j).imag());
00042   }
00043   
00044   const MATtype realType() const {
00045     return realType_;
00046   }
00047   
00048   const MATtype imagType() const {
00049     return cmplxType_;
00050   }
00051   
00052   void size(miINT32_t& rows, miINT32_t& cols) const {
00053     rows = rows_;
00054     cols = cols_;
00055   }
00056     
00057   private:
00058     
00059     bool isComplex_;
00060     
00061     //Number of rows, colums
00062     miINT32_t rows_, cols_;
00063 
00064     //matrices
00065     concepts::DenseMatrix<Real>* matrix_r;
00066     concepts::DenseMatrix<Cmplx>* matrix_c;
00067    
00068     //Daten fuer matfile
00069     MATtype realType_, cmplxType_; 
00070 };
00071 
00072 
00079 template<class T>
00080 DenseOWrapper::DenseOWrapper(concepts::Matrix< T >& matrix){
00081   
00082   //Setze standard Informationen
00083   isComplex_ = (NumTraits<T>::isComplex == 1);
00084   rows_ = matrix.dimX();
00085   cols_ = matrix.dimY();
00086   
00087   //Setze Informationen fuer matfile
00088   realType_ = NumTraits<T>::MatType;
00089   cmplxType_ = NumTraits<T>::MatType;
00090   
00091   //Setze Pointer auf die Matrix
00092   if(!isComplex_)
00093     matrix_r = dynamic_cast<DenseMatrix<Real>*>(&matrix);
00094   else
00095     matrix_c = dynamic_cast<DenseMatrix<Cmplx>*>(&matrix);
00096   }
00097 
00098 //DenseOWrapper::~DenseOWrapper(){
00099 //}
00100 
00101 }
00102 #endif

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)