Commit 2c6e63ce authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Refactoring matrices.

parent d4110bcf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
#include <TNL/Devices/Host.h>
#include <TNL/Vectors/Vector.h>
#include <TNL/Config/ParameterContainer.h>
#include <TNL/Matrices/CSRMatrix.h>
#include <TNL/Matrices/CSR.h>
#include <TNL/Solvers/preconditioners/Dummy.h>
#include <TNL/Solvers/SolverMonitor.h>
#include <TNL/Operators/euler/fvm/LaxFridrichs.h>
@@ -46,7 +46,7 @@ class navierStokesSolver
   typedef Mesh MeshType;
   typedef Vector< RealType, DeviceType, IndexType> DofVectorType;

   typedef CSRMatrix< RealType, DeviceType, IndexType > DiscreteSolverMatrixType;
   typedef CSR< RealType, DeviceType, IndexType > DiscreteSolverMatrixType;
   typedef Dummy< RealType, DeviceType, IndexType > DiscreteSolverPreconditioner;

   enum BoundaryConditionType { dirichlet, neumann, noSlip };
+4 −4
Original line number Diff line number Diff line
@@ -18,8 +18,8 @@
#include "quad-test-conf.h"
#include <TNL/Config/ConfigDescription.h>
#include <TNL/Config/ParameterContainer.h>
#include <TNL/Matrices/CSRMatrix.h>
//#include "../../src/matrix/CSRMatrix.h"
#include <TNL/Matrices/CSR.h>
//#include "../../src/matrix/CSR.h"
#include "Quadcpp.h"

int main(int argc, char* argv[]) {
@@ -38,14 +38,14 @@ int main(int argc, char* argv[]) {
		cerr << "I am not able to open the file " << inputFile << "." << std::endl;
		return 1;
	}
	CSRMatrix <double> doubleMatrix("double");
	CSR <double> doubleMatrix("double");
	if(! doubleMatrix.load(binaryFile)) {
		cerr << "Unable to restore the CSR matrix." << std::endl;
		return 1;
	}
	binaryFile.close();
	
	CSRMatrix <QuadDouble> quadMatrix("quad");
	CSR <QuadDouble> quadMatrix("quad");
	quadMatrix = doubleMatrix;
	return EXIT_SUCCESS;
}
 No newline at end of file
+24 −24
Original line number Diff line number Diff line
SET( headers Matrix.h
             Matrix_impl.h
             DenseMatrix.h
             DenseMatrix_impl.h
             TridiagonalMatrix.h
             TridiagonalMatrix_impl.h
             MultidiagonalMatrix.h
             MultidiagonalMatrix_impl.h
             SparseMatrix.h
             SparseMatrix_impl.h
             EllpackMatrix.h
             EllpackMatrix_impl.h
             SlicedEllpackMatrix.h
             SlicedEllpackMatrix_impl.h
             ChunkedEllpackMatrix.h
             ChunkedEllpackMatrix_impl.h
             CSRMatrix.h
             CSRMatrix_impl.h 
             Dense.h
             Dense_impl.h
             Tridiagonal.h
             Tridiagonal_impl.h
             Multidiagonal.h
             Multidiagonal_impl.h
             Sparse.h
             Sparse_impl.h
             Ellpack.h
             Ellpack_impl.h
             SlicedEllpack.h
             SlicedEllpack_impl.h
             ChunkedEllpack.h
             ChunkedEllpack_impl.h
             CSR.h
             CSR_impl.h 
             MatrixReader.h
             MatrixReader_impl.h
             MatrixWriter.h
             MatrixWriter_impl.h
             MatrixSetter.h
             MatrixSetter_impl.h
             SparseMatrixRow.h
             SparseMatrixRow_impl.h
             DenseMatrixRow.h
             DenseMatrixRow_impl.h
             TridiagonalMatrixRow.h
             TridiagonalMatrixRow_impl.h
             SparseRow.h
             SparseRow_impl.h
             DenseRow.h
             DenseRow_impl.h
             TridiagonalRow.h
             TridiagonalRow_impl.h
             MultidiagonalMatrixSetter.h
             MultidiagonalMatrixSetter_impl.h
             MultidiagonalMatrixRow.h
             MultidiagonalMatrixRow_impl.h  )
             MultidiagonalRow.h
             MultidiagonalRow_impl.h  )

SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/TNL/matrices )
set( common_SOURCES  )
+18 −18
Original line number Diff line number Diff line
/***************************************************************************
                          CSRMatrix.h  -  description
                          CSR.h  -  description
                             -------------------
    begin                : Dec 10, 2013
    copyright            : (C) 2013 by Tomas Oberhuber
@@ -10,7 +10,7 @@

#pragma once 

#include <TNL/Matrices/SparseMatrix.h>
#include <TNL/Matrices/Sparse.h>
#include <TNL/Vectors/Vector.h>

namespace TNL {
@@ -22,30 +22,30 @@ namespace Matrices {
#endif

template< typename Real >
class tnlCusparseCSRMatrix;
class tnlCusparseCSR;

template< typename Device >
class CSRMatrixDeviceDependentCode;
class CSRDeviceDependentCode;

template< typename Real, typename Device = Devices::Host, typename Index = int >
class CSRMatrix : public SparseMatrix< Real, Device, Index >
class CSR : public Sparse< Real, Device, Index >
{
   public:

   typedef Real RealType;
   typedef Device DeviceType;
   typedef Index IndexType;
   typedef typename SparseMatrix< RealType, DeviceType, IndexType >:: CompressedRowsLengthsVector CompressedRowsLengthsVector;
   typedef CSRMatrix< Real, Device, Index > ThisType;
   typedef CSRMatrix< Real, Devices::Host, Index > HostType;
   typedef CSRMatrix< Real, Devices::Cuda, Index > CudaType;
   typedef SparseMatrix< Real, Device, Index > BaseType;
   typedef typename Sparse< RealType, DeviceType, IndexType >:: CompressedRowsLengthsVector CompressedRowsLengthsVector;
   typedef CSR< Real, Device, Index > ThisType;
   typedef CSR< Real, Devices::Host, Index > HostType;
   typedef CSR< Real, Devices::Cuda, Index > CudaType;
   typedef Sparse< Real, Device, Index > BaseType;
   typedef typename BaseType::MatrixRow MatrixRow;


   enum SPMVCudaKernel { scalar, vector, hybrid };

   CSRMatrix();
   CSR();

   static String getType();

@@ -59,7 +59,7 @@ class CSRMatrix : public SparseMatrix< Real, Device, Index >
   IndexType getRowLength( const IndexType row ) const;

   template< typename Real2, typename Device2, typename Index2 >
   bool setLike( const CSRMatrix< Real2, Device2, Index2 >& matrix );
   bool setLike( const CSR< Real2, Device2, Index2 >& matrix );

   void reset();

@@ -139,12 +139,12 @@ class CSRMatrix : public SparseMatrix< Real, Device, Index >
   // TODO: add const RealType& multiplicator = 1.0 )

   template< typename Real2, typename Index2 >
   void addMatrix( const CSRMatrix< Real2, Device, Index2 >& matrix,
   void addMatrix( const CSR< Real2, Device, Index2 >& matrix,
                   const RealType& matrixMultiplicator = 1.0,
                   const RealType& thisMatrixMultiplicator = 1.0 );

   template< typename Real2, typename Index2 >
   void getTransposition( const CSRMatrix< Real2, Device, Index2 >& matrix,
   void getTransposition( const CSR< Real2, Device, Index2 >& matrix,
                          const RealType& matrixMultiplicator = 1.0 );

   template< typename Vector >
@@ -206,9 +206,9 @@ class CSRMatrix : public SparseMatrix< Real, Device, Index >

   int cudaWarpSize, hybridModeSplit;

   typedef CSRMatrixDeviceDependentCode< DeviceType > DeviceDependentCode;
   friend class CSRMatrixDeviceDependentCode< DeviceType >;
   friend class tnlCusparseCSRMatrix< RealType >;
   typedef CSRDeviceDependentCode< DeviceType > DeviceDependentCode;
   friend class CSRDeviceDependentCode< DeviceType >;
   friend class tnlCusparseCSR< RealType >;
#ifdef HAVE_UMFPACK
    template< typename Matrix, typename Preconditioner >
    friend class UmfpackWrapper;
@@ -219,5 +219,5 @@ class CSRMatrix : public SparseMatrix< Real, Device, Index >
} // namespace Matrices
} // namespace TNL

#include <TNL/Matrices/CSRMatrix_impl.h>
#include <TNL/Matrices/CSR_impl.h>
+65 −65

File changed and moved.

Preview size limit exceeded, changes collapsed.

Loading