Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Add LevelProperty public attribute to all the levels #22

Merged
merged 9 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions include/xsparse/level_capabilities/co_iteration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ namespace xsparse::level_capabilities
}
}

// Function to get the is_ordered properties of the levels as a tuple of booleans
constexpr auto ordered_levels() const noexcept
{
return std::apply([](auto&... levels) { return std::tuple{ levels.is_ordered... }; },
m_levelsTuple);
}

public:
class coiteration_helper
{
Expand Down
2 changes: 1 addition & 1 deletion include/xsparse/levels/compressed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace xsparse
PK,
ContainerTraits,
LevelProperties>;

using LevelProperty = LevelProperties; // Expose LevelProperties as a public attribute
public:
compressed(IK size)
: m_size(std::move(size))
Expand Down
8 changes: 7 additions & 1 deletion include/xsparse/levels/dense.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ namespace xsparse
LevelProperties>;
using BaseTraits
= util::base_traits<dense, std::tuple<LowerLevels...>, IK, PK, LevelProperties>;

using LevelProperty = LevelProperties; // Expose LevelProperties as a public attribute
public:
// Function to access the LevelProperties object
const LevelProperties LevelProperty() const
{
return LevelProperties{};
}

dense(IK size)
: m_size(std::move(size))
{
Expand Down
2 changes: 1 addition & 1 deletion include/xsparse/levels/hashed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace xsparse
PK,
ContainerTraits,
LevelProperties>;

using LevelProperty = LevelProperties; // Expose LevelProperties as a public attribute
public:
class iteration_helper
{
Expand Down
2 changes: 1 addition & 1 deletion include/xsparse/levels/offset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace xsparse
PK,
ContainerTraits,
LevelProperties>;

using LevelProperty = LevelProperties; // Expose LevelProperties as a public attribute
public:
offset(IK size)
: m_size(std::move(size))
Expand Down
2 changes: 1 addition & 1 deletion include/xsparse/levels/range.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace xsparse
PK,
ContainerTraits,
LevelProperties>;

using LevelProperty = LevelProperties; // Expose LevelProperties as a public attribute
public:
range(IK size_N, IK size_M)
: m_size_N(std::move(size_N))
Expand Down
2 changes: 1 addition & 1 deletion include/xsparse/levels/singleton.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace xsparse
PK,
ContainerTraits,
LevelProperties>;

using LevelProperty = LevelProperties; // Expose LevelProperties as a public attribute
public:
singleton(IK size)
: m_size(std::move(size))
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include(../cmake/tools.cmake)

include(../cmake/CPM.cmake)

CPMAddPackage("gh:doctest/doctest@2.4.9")
CPMAddPackage("gh:doctest/doctest#v2.4.11")
CPMAddPackage("gh:TheLartians/Format.cmake@1.7.3")

if(TEST_INSTALLED_VERSION)
Expand Down
3 changes: 3 additions & 0 deletions test/source/dense_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ TEST_CASE("Dense-BaseCase")
++loop;
}
CHECK(loop == SIZE);

// Check basic properties of all dense levels
CHECK(d.LevelProperty().is_full);
adam2392 marked this conversation as resolved.
Show resolved Hide resolved
}

TEST_CASE("Dense-2D")
Expand Down