MCPcopy Create free account
hub / github.com/RenderKit/embree / init

Method init

common/algorithms/parallel_map.h:42–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40 /*! initialized the parallel map from a vector with keys and values */
41 template<typename KeyVector, typename ValVector>
42 void init(const KeyVector& keys, const ValVector& values)
43 {
44 /* reserve sufficient space for all data */
45 assert(keys.size() == values.size());
46 vec.resize(keys.size());
47
48 /* generate key/value pairs */
49 parallel_for( size_t(0), keys.size(), size_t(4*4096), [&](const range<size_t>& r) {
50 for (size_t i=r.begin(); i<r.end(); i++)
51 vec[i] = KeyValue((Key)keys[i],values[i]);
52 });
53
54 /* perform parallel radix sort of the key/value pairs */
55 std::vector<KeyValue> temp(keys.size());
56 radix_sort<KeyValue,Key>(vec.data(),temp.data(),keys.size());
57 }
58
59 /*! Returns a pointer to the value associated with the specified key. The pointer will be nullptr of the key is not contained in the map. */
60 __forceinline const Val* lookup(const Key& key) const

Callers

nothing calls this directly

Calls 7

parallel_forFunction · 0.85
KeyValueClass · 0.85
sizeMethod · 0.45
resizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected