Commit 29946855 authored by Chris Cantwell's avatar Chris Cantwell
Browse files

Merge branch 'fix/remove-spblas' of /opt/gitlab/repositories/nektar

parents b9f0d3d9 f3092fed
......@@ -162,7 +162,6 @@ ENDIF ()
INCLUDE (ThirdPartyTinyxml)
INCLUDE (ThirdPartyLoki)
INCLUDE (ThirdPartyMetis)
INCLUDE (ThirdPartySpblastk)
INCLUDE (ThirdPartyBoost)
INCLUDE (ThirdPartyZlib)
INCLUDE (ThirdPartyFFTW)
......@@ -290,7 +289,6 @@ INSTALL(FILES ${CMAKE_BINARY_DIR}/Nektar++Config.cmake
${CMAKE_SOURCE_DIR}/cmake/FindCHUDFramework.cmake
${CMAKE_SOURCE_DIR}/cmake/FindACML.cmake
${CMAKE_SOURCE_DIR}/cmake/FindArpack.cmake
${CMAKE_SOURCE_DIR}/cmake/FindNistSparseBlas.cmake
${CMAKE_SOURCE_DIR}/cmake/FindOpenBlas.cmake
${CMAKE_SOURCE_DIR}/cmake/FindNativeBlasLapack.cmake
${CMAKE_SOURCE_DIR}/cmake/FindMKL.cmake
......
# Use NIST_SPARSE_BLAS_ADDITIONAL_INCLUDE_DIRS to add additional search directories.
SET(NIST_SPARSE_BLAS_SEARCH_PATHS
${NIST_SPARSE_BLAS_ADDITIONAL_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/ThirdParty/spblastk0.9b/lib
${CMAKE_SOURCE_DIR}/../ThirdParty/spblastk0.9b/lib
${CMAKE_SOURCE_DIR}/ThirdParty/dist/lib
${CMAKE_SOURCE_DIR}/../ThirdParty/dist/lib)
FIND_LIBRARY(NIST_SPARSE_BLAS NAMES sbtk PATHS ${NIST_SPARSE_BLAS_SEARCH_PATHS})
FIND_LIBRARY(NIST_SPARSE_BLAS_DEBUG NAMES sbtk-g PATHS ${NIST_SPARSE_BLAS_SEARCH_PATHS})
GET_FILENAME_COMPONENT(NIST_SPARSE_BLAS_LIB_PATH ${NIST_SPARSE_BLAS} PATH CACHE)
SET(NIST_SPARSE_BLAS_INCLUDE_DIR ${NIST_SPARSE_BLAS_LIB_PATH}/../include CACHE FILEPATH "Sparse matrix solve include directory.")
MARK_AS_ADVANCED(NIST_SPARSE_BLAS)
MARK_AS_ADVANCED(NIST_SPARSE_BLAS_DEBUG)
MARK_AS_ADVANCED(NIST_SPARSE_BLAS_INCLUDE_DIR)
MARK_AS_ADVANCED(NIST_SPARSE_BLAS_LIB_PATH)
IF (NIST_SPARSE_BLAS)
SET(NIST_SPARSE_BLAS_FOUND ON)
ENDIF (NIST_SPARSE_BLAS)
IF (NIST_SPARSE_BLAS_FOUND)
IF (NOT NIST_SPARSE_BLAS_FIND_QUIETLY)
MESSAGE(STATUS "Found NIST Sparse Blas")
ENDIF (NOT NIST_SPARSE_BLAS_FIND_QUIETLY)
ELSE(NIST_SPARSE_BLAS_FOUND)
IF (NIST_SPARSE_BLAS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find NIST sparse blas library.")
ENDIF (NIST_SPARSE_BLAS_FIND_REQUIRED)
ENDIF (NIST_SPARSE_BLAS_FOUND)
......@@ -51,13 +51,6 @@ INCLUDE(${NEKTAR++_ROOT_DIR}/FindLoki.cmake)
SET(TINYXML_ADDITIONAL_INCLUDE_DIRS "@TINYXML_BASE@")
INCLUDE(${NEKTAR++_ROOT_DIR}/FindTinyXml.cmake)
SET(NIST_SPARSE_BLAS_ADDITIONAL_INCLUDE_DIRS "@NIST_SPARSE_BLAS_INCLUDE_DIR@")
SET(NIST_SPARSE_BLAS "@NIST_SPARSE_BLAS@")
SET(NIST_SPARSE_BLAS_DEBUG "@NIST_SPARSE_BLAS_DEBUG@")
SET(NIST_SPARSE_BLAS_INCLUDE_DIR "@NIST_SPARSE_BLAS_INCLUDE_DIR@")
SET(NEKTAR_USE_NIST_SPARSE_BLAS_TOOLKIT "@NEKTAR_USE_NIST_SPARSE_BLAS_TOOLKIT@")
MARK_AS_ADVANCED(NEKTAR_USE_NIST_SPARSE_BLAS_TOOLKIT)
SET(NEKTAR_USE_ACML "@NEKTAR_USE_ACML@")
SET(ACML_USE_SHARED_LIBRARIES "@ACML_USE_SHARED_LIBRARIES@")
SET(ACML_USE_OPENMP_LIBRARIES "@ACML_USE_OPENMP_LIBRARIES@")
......@@ -163,7 +156,7 @@ IF(NEKTAR_USE_ARPACK)
ENDIF(NEKTAR_USE_ARPACK)
INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${LOKI_INCLUDE_DIR} ${TINYXML_BASE} ${NIST_SPARSE_BLAS_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${LOKI_INCLUDE_DIR} ${TINYXML_BASE} )
SET(NEKTAR_PACKAGE_GENERATOR "@NEKTAR_PACKAGE_GENERATOR@")
SET(NEKTAR_USING_BLAS "@NEKTAR_USING_BLAS@")
......
......@@ -47,10 +47,6 @@ MACRO(SET_LAPACK_LINK_LIBRARIES name)
ENDIF( NEKTAR_USE_BLAS_LAPACK )
IF( NEKTAR_USE_NIST_SPARSE_BLAS_TOOLKIT AND NIST_SPARSE_BLAS_FOUND )
TARGET_LINK_LIBRARIES(${name} ${NIST_SPARSE_BLAS} )
ENDIF( NEKTAR_USE_NIST_SPARSE_BLAS_TOOLKIT AND NIST_SPARSE_BLAS_FOUND )
IF( NEKTAR_USE_METIS )
TARGET_LINK_LIBRARIES(${name} optimized ${METIS_LIB} debug
${METIS_LIB} )
......@@ -238,10 +234,8 @@ ENDMACRO(ADD_NEKTAR_EXECUTABLE name component sources)
MACRO(ADD_NEKTAR_LIBRARY name component type)
ADD_LIBRARY(${name} ${type} ${ARGN})
# NIST Sparse BLAS only static, so link into Nektar libraries directly.
TARGET_LINK_LIBRARIES( ${name} ${NIST_SPARSE_BLAS} ${METIS_LIB})
ADD_DEPENDENCIES(${name} spblastk0.9b modmetis-5.1.0 boost tinyxml
zlib-1.2.7)
TARGET_LINK_LIBRARIES( ${name} ${METIS_LIB} )
ADD_DEPENDENCIES(${name} modmetis-5.1.0 boost tinyxml zlib-1.2.7)
SET_PROPERTY(TARGET ${name} PROPERTY FOLDER ${component})
IF (NEKTAR_USE_MPI)
TARGET_LINK_LIBRARIES( ${name} ${GSMPI_LIBRARY} ${XXT_LIBRARY})
......
OPTION(THIRDPARTY_BUILD_NIST_SPBLASTK
"Build NIST Sparse BLAS" ON)
IF (THIRDPARTY_BUILD_NIST_SPBLASTK)
INCLUDE(ExternalProject)
EXTERNALPROJECT_ADD(
spblastk0.9b
PREFIX ${TPSRC}
URL ${TPURL}/spblastk0.9b.tar.bz2
URL_MD5 "93469940f03554939a4600f431eb4d99"
DOWNLOAD_DIR ${TPSRC}
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX:PATH=${TPSRC}/dist
${TPSRC}/src/spblastk0.9b
)
SET(NIST_SPARSE_BLAS sbtk CACHE FILEPATH
"Path to NIST Sparse BLAS." FORCE)
MARK_AS_ADVANCED(NIST_SPARSE_BLAS)
LINK_DIRECTORIES(${TPSRC}/dist/lib)
MESSAGE(STATUS "Build NIST Sparse BLAS: ${TPSRC}/dist/lib/lib${NIST_SPARSE_BLAS}.a")
ELSE (THIRDPARTY_BUILD_NIST_SPBLASTK)
INCLUDE(FindNistSparseBlas)
ENDIF (THIRDPARTY_BUILD_NIST_SPBLASTK)
......@@ -8,7 +8,6 @@ SET(LinkLibraries
optimized ${Boost_IOSTREAMS_LIBRARY_RELEASE} debug ${Boost_IOSTREAMS_LIBRARY_DEBUG}
optimized ${ZLIB_LIBRARY_RELEASE} debug ${ZLIB_LIBRARY_DEBUG}
optimized ${TINYXML_LIB} debug ${TINYXML_LIB}
optimized sbtk debug sbtk
)
SET(HelmholtzCont1DSource Helmholtz1D.cpp)
......
......@@ -8,7 +8,6 @@ SET(LinkLibraries
optimized ${Boost_IOSTREAMS_LIBRARY_RELEASE} debug ${Boost_IOSTREAMS_LIBRARY_DEBUG}
optimized ${ZLIB_LIBRARY_RELEASE} debug ${ZLIB_LIBRARY_DEBUG}
optimized ${TINYXML_LIB} debug ${TINYXML_LIB}
optimized sbtk debug sbtk
)
SET(FldToTec2DSource FldToTec2D.cpp)
......
......@@ -182,10 +182,7 @@ SET(LinearAlgebraHeaders
./LinearAlgebra/StandardMatrix.hpp
./LinearAlgebra/TransF77.hpp
./LinearAlgebra/NistSparseBlas.hpp
./LinearAlgebra/StorageSmvBsr.hpp
./LinearAlgebra/StorageNistBsr.hpp
./LinearAlgebra/StorageNistCsr.hpp
./LinearAlgebra/NistSparseDescriptors.hpp
./LinearAlgebra/SparseDiagBlkMatrix.hpp
./LinearAlgebra/SparseMatrix.hpp
......@@ -209,8 +206,6 @@ SET(LinearAlgebraSources
./LinearAlgebra/StandardMatrix.cpp
./LinearAlgebra/SparseUtils.cpp
./LinearAlgebra/StorageSmvBsr.cpp
./LinearAlgebra/StorageNistBsr.cpp
./LinearAlgebra/StorageNistCsr.cpp
./LinearAlgebra/SparseDiagBlkMatrix.cpp
./LinearAlgebra/SparseMatrix.cpp
)
......
///////////////////////////////////////////////////////////////////////////////
//
// File: NistSparseBlas.hpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: wrapper of functions around NIST sparse BLAS routines
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_SPARSEBLAS_HPP
#define NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_SPARSEBLAS_HPP
namespace SparseBlas
{
extern "C"
{
// -- BLAS Level 1:
// -- BLAS level 2:
// -- BLAS level 3:
///////////////////////////////////////////////////////////////////////////////////
// dcsrmm -- compressed sparse row format matrix-matrix multiply
//
// C <- alpha A B + beta C
//
// Arguments:
//
// int transa Indicates how to operate with the sparse matrix
// 0 : operate with matrix
// 1 : operate with transpose matrix
//
// int m Number of - rows in matrix A
// - rows in matrix C
//
// int n Number of - columns in matrix B
// - columns in matrix C
//
// int k Number of - columns in matrix A
// - rows in matrix B
//
// double alpha Scalar parameter
//
// double beta Scalar parameter
//
// int descra[] Descriptor argument. Nine element integer array
// descra[0] matrix structure
// 0 : general
// 1 : symmetric
// 2 : Hermitian
// 3 : Triangular
// 4 : Skew(Anti)-Symmetric
// 5 : Diagonal
// descra[1] upper/lower triangular indicator
// 1 : lower
// 2 : upper
// descra[2] main diagonal type
// 0 : non-unit
// 1 : unit
// descra[3] Array base
// 0 : C/C++ compatible
// 1 : Fortran compatible
// descra[4] repeated indices?
// 0 : unknown
// 1 : no repeated indices
//
//
// double *val scalar array of length nnz containing matrix entries
//
// int *indx integer array of length nnz containing column indices
//
// int *pntrb integer array of length k such that pntrb(j)-pntrb(1)
// points to location in val of the first nonzero element in row j
//
// int *pntre integer array of length k such that pntre(j)-pntrb(1)
// points to location in val of the last nonzero element in row j
//
// double *b rectangular array with first dimension ldb
//
// double *c rectangular array with first dimension ldc
//
// double *work scratch array of length lwork. lwork should be at least
// max(m,n)
///////////////////////////////////////////////////////////////////////////////////
void dcsrmm(const int transa, const int m, const int n, const int k,
const double alpha, const int descra[], const double val[],
const int indx[], const int pntrb[], const int pntre[],
const double b[], const int ldb,
const double beta, double c[], const int ldc,
double work[], const int lwork);
///////////////////////////////////////////////////////////////////////////////////
// dbsrmm -- block sparse row format matrix-matrix multiply
//
// C <- alpha A B + beta C
//
// Arguments:
//
// int transa Indicates how to operate with the sparse matrix
// 0 : operate with matrix
// 1 : operate with transpose matrix
//
// int mb Number of block rows in matrix A
//
// int n Number of columns in matrix c
//
// int kb Number of block columns in matrix A
//
// double alpha Scalar parameter
//
// double beta Scalar parameter
//
// int descra[] Descriptor argument. Nine element integer array
// descra[0] matrix structure
// 0 : general
// 1 : symmetric
// 2 : Hermitian
// 3 : Triangular
// 4 : Skew(Anti)-Symmetric
// 5 : Diagonal
// descra[1] upper/lower triangular indicator
// 1 : lower
// 2 : upper
// descra[2] main diagonal type
// 0 : non-unit
// 1 : unit
// descra[3] Array base
// 0 : C/C++ compatible
// 1 : Fortran compatible
// descra[4] repeated indices?
// 0 : unknown
// 1 : no repeated indices
//
//
// double *val scalar array of length nnz containing matrix entries
//
// int *bindx integer array of length bnnz consisting of the block column
// indices of the entries of A.
//
// int *bpntrb integer array of length mb such that bpntrb(i)-bpntrb(1)
// points to location in bindx of the first block entry of
// the j-th row of A.
//
// int *bpntre integer array of length mb such that bpntre(i)-bpntrb(1)
// points to location in bindx of the last block entry of
// the j-th row of A.
//
// int lb dimension of blocks
//
// double *b rectangular array with first dimension ldb
//
// double *c rectangular array with first dimension ldc
//
// double *work scratch array of length lwork. lwork should be at least
// max(m,n)
///////////////////////////////////////////////////////////////////////////////////
void dbsrmm(const int transa, const int mb, const int n, const int kb,
const double alpha, const int descra[], const double val[],
const int bindx[], const int bpntrb[], const int bpntre[],
const int lb, const double b[], const int ldb,
const double beta, double c[], const int ldc,
double work[], const int lwork);
void CSR_VecMult_CAB_double(
const int m, const int k,
const double *val, const int *indx,
const int *pntrb, const int *pntre,
const double *b,
double *c,
const int ind_base);
void CSRsymm_VecMult_CAB_double(
const int m, const int k,
const double *val, const int *indx,
const int *pntrb, const int *pntre,
const double *b,
double *c,
const int ind_base);
void BCO_VecMult_CAB_double(
const int mb, const int kb,
const double *val, const int *bindx, const int *bjndx,
const int bnnz, const int lb,
const double *b,
double *c,
const int ind_base);
void BCO_VecMult_CATB_double(
const int mb, const int kb,
const double *val, const int *bindx, const int *bjndx,
const int bnnz, const int lb,
const double *b,
double *c,
const int ind_base);
void BSR_VecMult_CAB_double(
const int mb, const int kb,
const double *val, const int *bindx,
const int *bpntrb, const int *bpntre, const int lb,
const double *b,
double *c,
const int ind_base);
void BSRsymm_VecMult_CAB_double(
const int mb, const int kb,
const double *val, const int *bindx,
const int *bpntrb, const int *bpntre, const int lb,
const double *b,
double *c,
const int ind_base);
void BSR_VecMult_CATB_double(
const int mb, const int kb,
const double *val, const int *bindx,
const int *bpntrb, const int *bpntre, const int lb,
const double *b,
double *c,
const int ind_base);
} // extern "C"
static inline void Dbsrmm(const int transa, const int mb, const int n, const int kb,
const double alpha, const int descra[], const double val[],
const int bindx[], const int bpntrb[], const int bpntre[],
const int lb, const double b[], const int ldb,
const double beta, double c[], const int ldc,
double work[], const int lwork)
{
dbsrmm (transa,mb,n,kb,alpha,descra,val,bindx,
bpntrb,bpntre,lb,b,ldb,beta,c,ldc,work,lwork);
}
static inline void Dcsrmm(const int transa, const int m, const int n, const int k,
const double alpha, const int descra[], const double val[],
const int indx[], const int pntrb[], const int pntre[],
const double b[], const int ldb,
const double beta, double c[], const int ldc,
double work[], const int lwork)
{
dcsrmm (transa,m,n,k,alpha,descra,val,indx,
pntrb,pntre,b,ldb,beta,c,ldc,work,lwork);
}
static inline void Dcsrmv(const int nrows, const int ncols,
const double *mat, const int *indx, const int *ptr,
double *b, double*c, double* work)
{
static int descra[] = {0,0,0,0,0,0,0,0,0};
dcsrmm (0,nrows,1,ncols,1.0,descra,mat,indx,ptr,ptr+1,b,nrows,0.0,c,nrows,work,nrows);
}
}
#endif //NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_SPARSEBLAS_HPP
......@@ -44,8 +44,6 @@
#include <LibUtilities/LinearAlgebra/NistSparseDescriptors.hpp>
#include <LibUtilities/LinearAlgebra/SparseMatrixFwd.hpp>
#include <LibUtilities/LinearAlgebra/SparseDiagBlkMatrix.hpp>
#include <LibUtilities/LinearAlgebra/StorageNistCsr.hpp>
#include <LibUtilities/LinearAlgebra/StorageNistBsr.hpp>
#include <LibUtilities/LinearAlgebra/StorageSmvBsr.hpp>
#include <boost/lexical_cast.hpp>
......@@ -530,8 +528,6 @@ namespace Nektar
// explicit instantiation
template class NekSparseDiagBlkMatrix<StorageNistCsr<NekDouble> >;
template class NekSparseDiagBlkMatrix<StorageNistBsr<NekDouble> >;
template class NekSparseDiagBlkMatrix<StorageSmvBsr<NekDouble> >;
......
......@@ -44,8 +44,6 @@
#include <LibUtilities/LinearAlgebra/NistSparseDescriptors.hpp>
#include <LibUtilities/LinearAlgebra/SparseMatrixFwd.hpp>
#include <LibUtilities/LinearAlgebra/SparseMatrix.hpp>
#include <LibUtilities/LinearAlgebra/StorageNistCsr.hpp>
#include <LibUtilities/LinearAlgebra/StorageNistBsr.hpp>
#include <LibUtilities/LinearAlgebra/StorageSmvBsr.hpp>
#include <boost/lexical_cast.hpp>
......@@ -270,8 +268,6 @@ namespace Nektar
// explicit instantiation
template class NekSparseMatrix<StorageNistCsr<NekDouble> >;
template class NekSparseMatrix<StorageNistBsr<NekDouble> >;
template class NekSparseMatrix<StorageSmvBsr<NekDouble> >;
......
......@@ -68,8 +68,6 @@ namespace Nektar
typedef Array<OneD, BCOMatType> BCOMatVector;
template<typename DataType> class StorageNistCsr;
template<typename DataType> class StorageNistBsr;
template<typename DataType> class StorageSmvBsr;
template<typename SparseStorageType> class NekSparseMatrix;
......
......@@ -40,8 +40,6 @@
#include <LibUtilities/LinearAlgebra/SparseUtils.hpp>
#include <LibUtilities/LinearAlgebra/SparseMatrix.hpp>
#include <LibUtilities/LinearAlgebra/SparseDiagBlkMatrix.hpp>
#include <LibUtilities/LinearAlgebra/StorageNistCsr.hpp>
#include <LibUtilities/LinearAlgebra/StorageNistBsr.hpp>
#include <LibUtilities/LinearAlgebra/StorageSmvBsr.hpp>
......@@ -141,11 +139,7 @@ namespace Nektar{
return os;
}
template std::ostream& operator<<(std::ostream& os, const NekSparseMatrix<StorageNistCsr<NekDouble> >& rhs);
template std::ostream& operator<<(std::ostream& os, const NekSparseMatrix<StorageNistBsr<NekDouble> >& rhs);
template std::ostream& operator<<(std::ostream& os, const NekSparseMatrix<StorageSmvBsr<NekDouble> >& rhs);
template std::ostream& operator<<(std::ostream& os, const NekSparseDiagBlkMatrix<StorageNistCsr<NekDouble> >& rhs);
template std::ostream& operator<<(std::ostream& os, const NekSparseDiagBlkMatrix<StorageNistBsr<NekDouble> >& rhs);
template std::ostream& operator<<(std::ostream& os, const NekSparseDiagBlkMatrix<StorageSmvBsr<NekDouble> >& rhs);
} // namespace
///////////////////////////////////////////////////////////////////////////////
//
// File: StorageNistBsr.cpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Interface to NIST BSR sparse matrix storage.
//
///////////////////////////////////////////////////////////////////////////////
#include <map>
#include <vector>
#include <utility>
#include <fstream>
#include <cmath>
#include <LibUtilities/BasicConst/NektarUnivConsts.hpp>
#include <LibUtilities/LinearAlgebra/NistSparseBlas.hpp>
#include <LibUtilities/LinearAlgebra/StorageNistBsr.hpp>
#include <LibUtilities/LinearAlgebra/NistSparseDescriptors.hpp>
#include <boost/lexical_cast.hpp>
namespace Nektar
{
template<typename DataType>
StorageNistBsr<DataType>::const_iterator::const_iterator(
MatrixStorage matType,
IndexType begin,
IndexType end,
IndexType blkDim,
const DataVectorType& val,
const IndexVectorType& indx,
const IndexVectorType& pntr) :
m_matType(matType),
m_iter(),
m_begin(begin),
m_end(end),
m_blkDim(blkDim),
m_val(val),
m_indx(indx),
m_pntr(pntr)
{
m_iter.nnzindex = begin;
// Here we rewind the iterator to the 'begin'-th
// nonzero double value. Consecutive nonzeros are
// to lie within dense block and when it's done,
// jump to the next dense block.
// NB: m_val stores some explicit zeros that need to be skept.