diff --git a/Addons/HMat/Src/FDenseMatrix.hpp b/Addons/HMat/Src/Blocks/FDenseMatrix.hpp similarity index 100% rename from Addons/HMat/Src/FDenseMatrix.hpp rename to Addons/HMat/Src/Blocks/FDenseMatrix.hpp diff --git a/Addons/HMat/Src/Utils/FHUtils.hpp b/Addons/HMat/Src/Utils/FHUtils.hpp index 18465931cbe021e1d4f80726b83016ec2c054d1b..83d74543e941e017cb4bfa4bcfe293702649b415 100644 --- a/Addons/HMat/Src/Utils/FHUtils.hpp +++ b/Addons/HMat/Src/Utils/FHUtils.hpp @@ -1,6 +1,8 @@ #ifndef FHUTILS_HPP #define FHUTILS_HPP +// @SCALFMM_PRIVATE + #include "Utils/FGlobal.hpp" #include <cstring> diff --git a/Addons/HMat/Src/Utils/FSvgRect.hpp b/Addons/HMat/Src/Utils/FSvgRect.hpp index 943a02b580498b2befa2e0c82da4d4693b155aa0..44473306675dd82f526fd35ae6aae6b0d07258c0 100644 --- a/Addons/HMat/Src/Utils/FSvgRect.hpp +++ b/Addons/HMat/Src/Utils/FSvgRect.hpp @@ -1,6 +1,8 @@ #ifndef FSVGRECT_HPP #define FSVGRECT_HPP +// @SCALFMM_PRIVATE + #include "Utils/FGlobal.hpp" #include "Utils/FAssert.hpp" diff --git a/Addons/HMat/Src/Viewers/FDenseBlockWrapper.hpp b/Addons/HMat/Src/Viewers/FDenseBlockWrapper.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2e56632505d0802883bdfeee0727d9b0f2e141c1 --- /dev/null +++ b/Addons/HMat/Src/Viewers/FDenseBlockWrapper.hpp @@ -0,0 +1,39 @@ +#ifndef FDENSEBLOCKWRAPPER_HPP +#define FDENSEBLOCKWRAPPER_HPP + +// @SCALFMM_PRIVATE + +template <class FReal> +class FDenseBlockWrapper{ +protected: + const FReal* values; + const int nbRows; + const int nbCols; + const int leadingDim; + +public: + FDenseBlockWrapper(const FReal* inValues, const int inNbRows, const int inNbCols, const int inLeading) + : values(inValues), nbRows(inNbRows), nbCols(inNbCols), leadingDim(inLeading){ + } + + int getNbRows() const { + return nbRows; + } + + int getNbCols() const { + return nbCols; + } + + FReal getValue(const int rowIdx, const int colIdx) const{ + FAssertLF(rowIdx < nbRows); + FAssertLF(colIdx < nbCols); + return values[colIdx*leadingDim + rowIdx]; + } + + constexpr bool existsForReal() const{ + return true; + } +}; + +#endif // FDENSEBLOCKWRAPPER_HPP + diff --git a/Addons/HMat/Src/Viewers/FMatGrid.hpp b/Addons/HMat/Src/Viewers/FMatGrid.hpp index f7332418bf742d4023f072e258f4a1f533c0602d..d816041f77e4514b9e2f0cbd12023ee1b94eb119 100644 --- a/Addons/HMat/Src/Viewers/FMatGrid.hpp +++ b/Addons/HMat/Src/Viewers/FMatGrid.hpp @@ -6,39 +6,7 @@ #include "Utils/FGlobal.hpp" #include "Utils/FAssert.hpp" - -template <class FReal> -class FDenseBlockWrapper{ -protected: - const FReal* values; - const int nbRows; - const int nbCols; - const int leadingDim; - -public: - FDenseBlockWrapper(const FReal* inValues, const int inNbRows, const int inNbCols, const int inLeading) - : values(inValues), nbRows(inNbRows), nbCols(inNbCols), leadingDim(inLeading){ - } - - int getNbRows() const { - return nbRows; - } - - int getNbCols() const { - return nbCols; - } - - FReal getValue(const int rowIdx, const int colIdx) const{ - FAssertLF(rowIdx < nbRows); - FAssertLF(colIdx < nbCols); - return values[colIdx*leadingDim + rowIdx]; - } - - constexpr bool existsForReal() const{ - return true; - } -}; - +#include "FDenseBlockWrapper.hpp" template <class FReal> class FMatGrid { diff --git a/Addons/HMat/Tests/testDiv2Bissection.cpp b/Addons/HMat/Tests/testDiv2Bissection.cpp index 69157deb236a4ccb5df313f9c5a1126f54b9feec..2524bd1017b06a754b71004bd420f25b8c995e5d 100644 --- a/Addons/HMat/Tests/testDiv2Bissection.cpp +++ b/Addons/HMat/Tests/testDiv2Bissection.cpp @@ -1,8 +1,8 @@ // @SCALFMM_PRIVATE -#include "../Src/Core/FDiv2Bissection.hpp" -#include "../Src/Containers/FMatGrid.hpp" +#include "../Src/Containers/FDiv2Bissection.hpp" +#include "../Src/Viewers/FMatGrid.hpp" #include "../Src/Utils/FSvgRect.hpp" #include "Utils/FParameters.hpp" diff --git a/Addons/HMat/Tests/testDiv2Gemv.cpp b/Addons/HMat/Tests/testDiv2Gemv.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cb6fb61d52e662a9eefabab747be0821ce2ac1a5 --- /dev/null +++ b/Addons/HMat/Tests/testDiv2Gemv.cpp @@ -0,0 +1,44 @@ + +// @SCALFMM_PRIVATE + +#include "../Src/Containers/FDiv2Bissection.hpp" +#include "../Src/Viewers/FMatGrid.hpp" +#include "../Src/Blocks/FDenseMatrix.hpp" + +#include "Utils/FParameters.hpp" +#include "Utils/FParameterNames.hpp" + +int main(int argc, char** argv){ + static const FParameterNames DimParam = { + {"-N", "-nb", "-dim"} , + "Dim of the matrix." + }; + static const FParameterNames HeightParam = { + {"-h", "-height"} , + "Number of dissection (+1)." + }; + + FHelpDescribeAndExit(argc, argv, + "Test the bisection.",SvgOutParam, + DimParam,HeightParam); + + const int dim = FParameters::getValue(argc, argv, DimParam.options, 100); + const int height = FParameters::getValue(argc, argv, HeightParam.options, 4); + + std::cout << "Config : dim = " << dim << "\n"; + std::cout << "Config : height = " << height << "\n"; + + { + typedef double FReal; + typedef FMatGrid<FReal> MatrixClass; + typedef FDenseMatrix<FReal> LeafClass; + typedef FDenseMatrix<FReal> CellClass; + typedef FDiv2Bissection<FReal, LeafClass, CellClass> GridClass; + + GridClass bissection(dim, height); + bissection.fillBlocks(matrix); + } + + return 0; +} +