Lines Matching +full:petsc +full:- +full:dist
3 #include <petsc/private/cpp/unordered_map.hpp>
15 // see https://stackoverflow.com/questions/2590677/how-do-i-combine-hash-values-in-c0x
43 using namespace Petsc::util;
132 PetscCallAbort(PETSC_COMM_SELF, this->printer(value, this->buffer)); in operator ()()
133 PetscFunctionReturn(this->buffer.c_str()); in operator ()()
164 using map_type = Petsc::UnorderedMap<T...>;
181 PetscCallCXX(oss << "map: '" << this->map_name << "'\n"); in view_map()
189 …entry : map) PetscCallCXX(oss << " key: [" << this->key_printer(entry.first) << "] -> [" << thi… in view_map()
198 PetscCall(this->view_map(map__)); \
199 SETERRQ(comm__, ierr__, "%s: " base_mess__, this->map_name.c_str(), __VA_ARGS__); \
242 …ret.second, PETSC_COMM_SELF, PETSC_ERR_PLIB, "%s reinserted key '%s'", op, this->key_printer(key)); in test_insert()
243 …irst->first == key, PETSC_COMM_SELF, PETSC_ERR_PLIB, "%s returned iterator key '%s' != expected '%… in test_insert()
244 …->second == value, PETSC_COMM_SELF, PETSC_ERR_PLIB, "%s returned iterator value '%s' != expected '… in test_insert()
245 …SC_ERR_PLIB, "%s map[%s] '%s' != '%s'", op, this->key_printer(key), this->value_printer(map[key]),… in test_insert()
246 …_PLIB, "%s changed value '%s' != expected '%s'", op, this->value_printer(map[key_const]), this->va… in test_insert()
262 PetscCall(this->check_size_capacity_coherent(map)); in test_insert()
266 PetscCall(this->check_size_capacity_coherent(map, size_before + 1, capacity_before)); in test_insert()
268 …SELF, PETSC_ERR_PLIB, "Map default key %s != map value %s", this->key_printer(key), this->value_pr… in test_insert()
280 PetscCall(this->check_size_capacity_coherent(map, 0, capacity_before)); in test_insert()
284 auto key_value_pairs = this->make_key_values(kv_size); in test_insert()
289 PetscCall(this->check_size_capacity_coherent(map, 0, 0)); in test_insert()
292 PetscCall(this->check_size_capacity_coherent(map, key_value_pairs.size(), 0)); in test_insert()
299 const auto dist = std::distance(kv_begin, found); in test_insert() local
302 …PLIB, "Map contained key-value pair (%s, %s) not present in input range!", this->key_printer(it->f… in test_insert()
303 …dist >= 0, PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Index of found key-value pair (%s -> %s) %t… in test_insert()
305 PetscCallCXX(++found_key_value.at(static_cast<std::size_t>(dist))); in test_insert()
308 // there should only be 1 instance of each key-value in the map in test_insert()
310 … insert key %s (value %s), have find count %zu", this->key_printer(key_value_pairs[i].first), this… in test_insert()
315 // clang-format off in test_insert()
330 // clang-format on in test_insert()
336 // clang-format off in test_insert()
351 // clang-format on in test_insert()
355 …nger contains key-value pair (%s -> %s) after std::copy() and container went out of scope", this->… in test_insert()
356 …->first == saved_value.first, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Map founnd iterator key (%s) does … in test_insert()
357 …->second == saved_value.second, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Map founnd iterator value (%s) d… in test_insert()
375 const auto sample_values = this->make_key_values(145); in test_find()
383 …!= map.end(), PETSC_COMM_SELF, PETSC_ERR_PLIB, "Failed to find %s in map", this->key_printer(key)); in test_find()
384 …apCheck(map, it->first == key, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Find iterator key %s != expected … in test_find()
385 …eck(map, it->second == value, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Find iterator value %s != expected… in test_find()
386 … reports false, even though map.find(key) successfully found it! key: %s", this->key_printer(key)); in test_find()
387 …t(key) == 1, PETSC_COMM_SELF, PETSC_ERR_PLIB, "map.count(%s) %zu != 1", this->key_printer(key), ma… in test_find()
395 …e_begin->first == key, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Equal range iterator key %s != expected %… in test_find()
396 …gin->second == value, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Equal range iterator value %s != expected … in test_find()
414 auto sample_values = this->make_key_values(57); in test_erase()
430 const auto begin_key = it->first; in test_erase()
431 const auto begin_val = it->second; in test_erase()
434 …MM_SELF, PETSC_ERR_PLIB, "Erasing %s did not work, found again in map", this->key_printer(begin_ke… in test_erase()
445 … PETSC_ERR_PLIB, "Iterator (%s -> %s) occupied after erase", this->key_printer(before->first), thi… in test_erase()
468 …MM_SELF, PETSC_ERR_PLIB, "Map capacity should be 0 (have %zu) after clear() -> shrink_to_fit()!", … in test_erase()
502 sample_values = this->make_key_values(); in test_erase()
518 // stupid dummy function because auto-lambdas are C++14
526 constexpr const char *it_name = is_normal ? "Non-const" : "Const"; in test_iterators()
533 PetscCallCXX(--it); in test_iterators()
534 PetscCallCXX(it2--); in test_iterators()
535 …TSC_COMM_SELF, PETSC_ERR_PLIB, "%s iterator does not equal itself after --it, and it2--", it_name); in test_iterators()
559 PetscCallCXX(--it); in test_iterators()
565 PetscCallCXX(it--); in test_iterators()
574 const auto sample_values = this->make_key_values(97); in test_misc()
578 PetscCall(this->test_iterators(map, map.begin(), map.begin())); in test_misc()
579 PetscCall(this->test_iterators(map, map.cbegin(), map.cbegin())); in test_misc()
593 PetscCall(this->test_insert(map_copy)); in test_misc()
595 PetscCall(this->test_find(map_copy)); in test_misc()
597 PetscCall(this->test_erase(map_copy)); in test_misc()
605 PetscCall(this->test_insert(moved_copy)); in test_misc()
607 PetscCall(this->test_find(moved_copy)); in test_misc()
609 PetscCall(this->test_erase(moved_copy)); in test_misc()
618 PetscCall(this->test_insert()); in test()
619 PetscCall(this->test_find()); in test()
620 PetscCall(this->test_erase()); in test()
621 PetscCall(this->test_misc()); in test()
630 std::generate(v.begin(), v.end(), this->generator); in make_key_values()
716 …PetscCall(make_tester<int, double>(vwr, "int-double basic map", int_printer, double_printer, int_d… in main()
717 …PetscCall(make_tester<int, double, BadHash>(vwr, "int-double bad hash map", int_printer, double_pr… in main()
720 …PetscCall(make_tester<int, Foo, BadHash>(vwr, "int-foo bad hash map", int_printer, foo_printer, in… in main()
723 …PetscCall(make_tester<Foo, Bar>(vwr, "foo-bar basic map", foo_printer, bar_printer, foo_bar_genera… in main()
724 …PetscCall(make_tester<Foo, Bar, BadHash>(vwr, "foo-bar bad hash map", foo_printer, bar_printer, fo… in main()
732 …PetscCall(make_tester<std::pair<int, double>, std::pair<int, double>>(vwr, "pair<int, double>-pair… in main()
733 …:pair<int, double>, std::pair<int, double>, BadHash>(vwr, "pair<int, double>-pair<int, double> bad… in main()