[WIP] fmsolvr: simplified and removed unused code; upgraded FMSolvr from C++17 to C++20 #22
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "m.zych/fmsolvr:WIP/parallelization/intra-node/lgpl21+minimize"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The pre_processing() and post_processing() member functions are completely unnecessary, since without them, it is still possible to execute code before and/or after executing each task. Depending on whether code needs to be executed for a specific task-type or simply for all tasks, regardless of their type, code can be added to: - eventify/Task.hpp template <typename ProcessorType, typename TreePartitionType> class Task { void execute () { // invoke pre-processing code before a task has started executing // processor_.execute(tree_partition_); // // invoke post-processing code after a task has finished executing } }; - eventify/Processor.hpp template <typename... Args> struct P2MProcessor : public AbstractProcessor<Args...> { template <typename TreePartitionType> void execute (TreePartitionType tree_partition) { // invoke pre-processing code before P2M task has started executing // fmsolvr::pass1_P2M(...); // // invoke post-processing code after P2M task has finished executing } };All task of type P2P are scheduled in the function pass12345(), via TaskFactory::CreateAndEnqueueTask(), with a TreePartition representing a single target box: void fmsolvr::pass12345(...) { ... for (unsigned i = 0; i < fmm_handle.particle_handle().num_boxes_lowest(); ++i) { task_factory.CreateAndEnqueueTask( task_factory.p2p, typename FMMHandle::tree_partition_type(i, d)); } ... } template <typename box_id_type> class TreePartition { ... // range representing a single box public: // | TreePartition(SfcIndexType begin, SfcIndexType end, depth_type d) // | : begin_(begin), end_(end), d_(d){} // | // v TreePartition(SfcIndexType id, depth_type d) : begin_(id), end_(id + 1), d_(d){} ... private: SfcIndexType begin_, end_; depth_type d_; }; Calling the .box_range() and .first() member functions is "equivalent", as long as, a TreePartition represents a single box: template <typename box_id_type> class TreePartition { using BoxID = box_id_type; ... using BoxRangeType = BoxRange<BoxID>; ... BoxRangeType box_range() const { return BoxRangeType(begin_, end_, d_); } BoxID first() const { return BoxID(begin_, d_); } ... }; template <typename box_id_type> class BoxRange { using BoxID = box_id_type; ... class BoxIterator { public: BoxIterator(SfcIndexType pos, depth_type d) : pos_(pos), d_(d){} bool operator==(const BoxIterator &other) const { return other.pos_ == pos_ && other.d_ == d_; } bool operator!=(const BoxIterator &other) const { return !operator==(other); } BoxIterator &operator++() { // FIXME depth increment, only on one depth at the moment pos_++; return *this; } ... BoxID operator*() const { return BoxID(pos_, d_); } ... private: SfcIndexType pos_; depth_type d_; }; ... public: BoxRange(SfcIndexType begin, SfcIndexType end, depth_type d) : begin_(begin, d), end_(end, d) {} BoxIterator begin() const { return begin_; } BoxIterator end() const { return end_; } ... private: BoxIterator begin_, end_; };