Commit 4c52f750 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Refactoring CSR-specific getters

parent f92e11fc
Loading
Loading
Loading
Loading
+9 −21
Original line number Diff line number Diff line
@@ -225,34 +225,22 @@ public:

   // The following getters allow us to interface TNL with external C-like
   // libraries such as UMFPACK or SuperLU, which need the raw data.
   Index* getRowPointers()
   const Containers::Vector< Index, Device, Index >&
   getRowPointers() const
   {
       return this->rowPointers.getData();
      return this->rowPointers;
   }

   const Index* getRowPointers() const
   const Containers::Vector< Index, Device, Index >&
   getColumnIndexes() const
   {
       return this->rowPointers.getData();
      return this->columnIndexes;
   }

   Index* getColumnIndexes()
   const Containers::Vector< Real, Device, Index >&
   getValues() const
   {
       return this->columnIndexes.getData();
   }

   const Index* getColumnIndexes() const
   {
       return this->columnIndexes.getData();
   }

   Real* getValues()
   {
       return this->values.getData();
   }

   const Real* getValues() const
   {
       return this->values.getData();
      return this->values;
   }

protected:
+9 −9
Original line number Diff line number Diff line
@@ -88,9 +88,9 @@ solve( const Vector& b,

    // symbolic reordering of the sparse matrix
    status = umfpack_di_symbolic( size, size,
                                  matrix->getRowPointers(),
                                  matrix->getColumnIndexes(),
                                  matrix->getValues(),
                                  matrix->getRowPointers().getData(),
                                  matrix->getColumnIndexes().getData(),
                                  matrix->getValues().getData(),
                                  &Symbolic, Control, Info );
    if( status != UMFPACK_OK ) {
        std::cerr << "error: symbolic reordering failed" << std::endl;
@@ -98,9 +98,9 @@ solve( const Vector& b,
    }

    // numeric factorization
    status = umfpack_di_numeric( matrix->getRowPointers(),
                                 matrix->getColumnIndexes(),
                                 matrix->getValues(),
    status = umfpack_di_numeric( matrix->getRowPointers().getData(),
                                 matrix->getColumnIndexes().getData(),
                                 matrix->getValues().getData(),
                                 Symbolic, &Numeric, Control, Info );
    if( status != UMFPACK_OK ) {
        std::cerr << "error: numeric factorization failed" << std::endl;
@@ -109,9 +109,9 @@ solve( const Vector& b,

    // solve with specified right-hand-side
    status = umfpack_di_solve( system_type,
                               matrix->getRowPointers(),
                               matrix->getColumnIndexes(),
                               matrix->getValues(),
                               matrix->getRowPointers().getData(),
                               matrix->getColumnIndexes().getData(),
                               matrix->getValues().getData(),
                               x.getData(),
                               b.getData(),
                               Numeric, Control, Info );