Skip to content

Commit

Permalink
Apply clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
rhornung67 committed Jul 15, 2024
1 parent 37a5e71 commit 99f2fbd
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 96 deletions.
2 changes: 1 addition & 1 deletion src/axom/core/IteratorBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class IteratorBase
struct accessor : IterType
{
AXOM_HOST_DEVICE accessor(const IterType& base) : IterType(base) { }

AXOM_SUPPRESS_HD_WARN
AXOM_HOST_DEVICE
static void adv(IterType& instance, PosType n)
Expand Down
149 changes: 58 additions & 91 deletions src/axom/core/tests/core_openmp_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,17 @@ template <typename Key, typename T, typename Hash, typename Policy>
void test_storage(experimental::Map<Key, T, Hash, Policy> &test)
{
experimental::Map<Key, T, Hash, Policy> *test2 = &test;
axom::for_all<Policy>(
0,
test.max_size(),
[=](IndexType idx) {
Key key = idx;
T value = key * 27;
auto ret_test = test2->insert(key, value);
EXPECT_EQ(true, ret_test.second);
});
axom::for_all<Policy>(0, test.max_size(), [=](IndexType idx) {
Key key = idx;
T value = key * 27;
auto ret_test = test2->insert(key, value);
EXPECT_EQ(true, ret_test.second);
});
EXPECT_EQ(false, test.empty());
axom::for_all<Policy>(
0,
test.max_size(),
[=](IndexType idx) {
Key key = idx;
EXPECT_EQ(key * 27, test2->find(key).value);
});
axom::for_all<Policy>(0, test.max_size(), [=](IndexType idx) {
Key key = idx;
EXPECT_EQ(key * 27, test2->find(key).value);
});
//This should fail, since we're at capacity.
auto ret = test.insert(test.max_size(), 900);
EXPECT_EQ(false, ret.second);
Expand All @@ -55,57 +49,42 @@ template <typename Key, typename T, typename Hash, typename Policy>
void test_subscript(experimental::Map<Key, T, Hash, Policy> &test)
{
experimental::Map<Key, T, Hash, Policy> *test2 = &test;
axom::for_all<Policy>(
0,
test.size(),
[=](IndexType idx) {
Key key = idx;
EXPECT_EQ(key * 27, (*test2)[key]);
});
axom::for_all<Policy>(0, test.size(), [=](IndexType idx) {
Key key = idx;
EXPECT_EQ(key * 27, (*test2)[key]);
});
}

template <typename Key, typename T, typename Hash, typename Policy>
void test_insert_assign(experimental::Map<Key, T, Hash, Policy> &test)
{
experimental::Map<Key, T, Hash, Policy> *test2 = &test;
axom::for_all<Policy>(
0,
test.max_size(),
[=](IndexType idx) {
Key key = idx;
T value = key * 27;
auto ret_test = test2->insert_or_assign(key, value);
EXPECT_EQ(true, ret_test.second);
});
axom::for_all<Policy>(0, test.max_size(), [=](IndexType idx) {
Key key = idx;
T value = key * 27;
auto ret_test = test2->insert_or_assign(key, value);
EXPECT_EQ(true, ret_test.second);
});

EXPECT_EQ(false, test.empty());
axom::for_all<Policy>(
0,
test.max_size(),
[=](IndexType idx) {
Key key = idx;
EXPECT_EQ(key * 27, test2->find(key).value);
});

axom::for_all<Policy>(
0,
test.max_size(),
[=](IndexType idx) {
Key key = idx;
T value = key * 28;
auto ret_test = test2->insert_or_assign(key, value);
EXPECT_EQ(false, ret_test.second);
EXPECT_EQ(ret_test.first->key, key);
});
axom::for_all<Policy>(0, test.max_size(), [=](IndexType idx) {
Key key = idx;
EXPECT_EQ(key * 27, test2->find(key).value);
});

axom::for_all<Policy>(0, test.max_size(), [=](IndexType idx) {
Key key = idx;
T value = key * 28;
auto ret_test = test2->insert_or_assign(key, value);
EXPECT_EQ(false, ret_test.second);
EXPECT_EQ(ret_test.first->key, key);
});

EXPECT_EQ(test.size(), test.max_size());
axom::for_all<Policy>(
0,
test.max_size(),
[=](IndexType idx) {
Key key = idx;
EXPECT_EQ(key * 28, test2->find(key).value);
});
axom::for_all<Policy>(0, test.max_size(), [=](IndexType idx) {
Key key = idx;
EXPECT_EQ(key * 28, test2->find(key).value);
});
}

template <typename Key, typename T, typename Hash, typename Policy>
Expand All @@ -114,15 +93,12 @@ void test_remove(experimental::Map<Key, T, Hash, Policy> &test)
std::size_t to_erase = test.size();
experimental::Map<Key, T, Hash, Policy> *test2 = &test;

axom::for_all<Policy>(
0,
to_erase,
[=](IndexType idx) {
Key key = (Key)idx;
bool erased = test2->erase(key);
EXPECT_EQ(erased, true);
EXPECT_EQ(test2->find(key), test2->end());
});
axom::for_all<Policy>(0, to_erase, [=](IndexType idx) {
Key key = (Key)idx;
bool erased = test2->erase(key);
EXPECT_EQ(erased, true);
EXPECT_EQ(test2->find(key), test2->end());
});
EXPECT_EQ(test.size(), 0);
test.insert(0, 900);
auto ret = test.find(0);
Expand All @@ -137,31 +113,22 @@ void test_rehash(experimental::Map<Key, T, Hash, Policy> &test, int num, int fac
experimental::Map<Key, T, Hash, Policy> *test2 = &test;
test.rehash(num, fact);

axom::for_all<Policy>(
0,
original_size,
[=](IndexType idx) {
Key key = idx;
EXPECT_EQ(key * 27, test2->find(key).value);
});

axom::for_all<Policy>(
original_size,
test.max_size(),
[=](IndexType idx) {
Key key = idx;
T value = key * 27;
auto ret_test = test2->insert(key, value);
EXPECT_EQ(true, ret_test.second);
});

axom::for_all<Policy>(
original_size,
test.max_size(),
[=](IndexType idx) {
Key key = idx;
EXPECT_EQ(key * 27, test2->find(key).value);
});
axom::for_all<Policy>(0, original_size, [=](IndexType idx) {
Key key = idx;
EXPECT_EQ(key * 27, test2->find(key).value);
});

axom::for_all<Policy>(original_size, test.max_size(), [=](IndexType idx) {
Key key = idx;
T value = key * 27;
auto ret_test = test2->insert(key, value);
EXPECT_EQ(true, ret_test.second);
});

axom::for_all<Policy>(original_size, test.max_size(), [=](IndexType idx) {
Key key = idx;
EXPECT_EQ(key * 27, test2->find(key).value);
});
auto ret = test.insert(test.max_size(), 900);
EXPECT_EQ(false, ret.second);
}
Expand Down
1 change: 0 additions & 1 deletion src/axom/slam/BivariateMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,6 @@ class BivariateMap
}

public:

AXOM_HOST_DEVICE const BivariateSetType* set() const { return m_bset.get(); }

const MapType* getMap() const { return &m_map; }
Expand Down
2 changes: 1 addition & 1 deletion src/axom/slam/OrderedSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ struct OrderedSet
{
return SizePolicyType::size();
}

AXOM_SUPPRESS_HD_WARN
AXOM_HOST_DEVICE inline bool empty() const { return SizePolicyType::empty(); }

Expand Down
2 changes: 0 additions & 2 deletions src/axom/slam/SubMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,6 @@ class SubMap<SuperMapType, SubsetType, InterfacePolicy>::RangeIterator
}

public:

AXOM_SUPPRESS_HD_WARN
AXOM_HOST_DEVICE RangeIterator(PositionType pos, SubMap sMap)
: IterBase(pos)
Expand Down Expand Up @@ -522,7 +521,6 @@ class SubMap<SuperMapType, SubsetType, InterfacePolicy>::RangeIterator
PositionType numComp() const { return m_mapIter.numComp(); }

protected:

/** Implementation of advance() as required by IteratorBase */
AXOM_SUPPRESS_HD_WARN
AXOM_HOST_DEVICE void advance(PositionType n)
Expand Down

0 comments on commit 99f2fbd

Please sign in to comment.