Chi-Tech
sweepscheduler_fifo.cc
Go to the documentation of this file.
1#include "sweepscheduler.h"
2
3#include "chi_runtime.h"
4#include "chi_log.h"
5
6// ###################################################################
7/**Applies a First-In-First-Out sweep scheduling.*/
9 SweepChunk& sweep_chunk)
10{
11 typedef AngleSetStatus Status;
12
14
15 auto ev_info_i =
16 std::make_shared<chi::ChiLog::EventInfo>(std::string("Sweep initiated"));
17
20
21 //================================================== Loop over AngleSetGroups
23 while (completion_status == AngleSetStatus::NOT_FINISHED)
24 {
25 completion_status = AngleSetStatus::FINISHED;
26
27 for (auto& angle_set_group : angle_agg_.angle_set_groups)
28 for (auto& angle_set : angle_set_group.AngleSets())
29 {
30 const auto angle_set_status = angle_set->AngleSetAdvance(
31 sweep_chunk, sweep_timing_events_tag_, ExecutionPermission::EXECUTE);
32 if (angle_set_status == AngleSetStatus::NOT_FINISHED)
33 completion_status = AngleSetStatus::NOT_FINISHED;
34 }// for angleset
35 }// while not finished
36
37 //================================================== Receive delayed data
39 bool received_delayed_data = false;
40 while (not received_delayed_data)
41 {
42 received_delayed_data = true;
43
44 for (auto& angle_set_group : angle_agg_.angle_set_groups)
45 for (auto& angle_set : angle_set_group.AngleSets())
46 {
47 if (angle_set->FlushSendBuffers() == Status::MESSAGES_PENDING)
48 received_delayed_data = false;
49
50 if (not angle_set->ReceiveDelayedData())
51 received_delayed_data = false;
52 }
53 }
54
55 //================================================== Reset all
56 for (auto& angle_set_group : angle_agg_.angle_set_groups)
57 for (auto& angle_set : angle_set_group.AngleSets())
58 angle_set->ResetSweepBuffers();
59
60 for (auto& [bid, bndry] : angle_agg_.sim_boundaries)
61 {
63 {
64 auto rbndry = std::static_pointer_cast<
66 rbndry->ResetAnglesReadyStatus();
67 }
68 }
69
71}
static chi::ChiLog & log
Definition: chi_runtime.h:81
static chi::MPI_Info & mpi
Definition: chi_runtime.h:78
@ SINGLE_OCCURRENCE
Signals a single occurrence.
@ EVENT_BEGIN
Signals the begin of an event.
@ EVENT_END
Signals the end of an event.
void LogEvent(size_t ev_tag, EventType ev_type, const std::shared_ptr< EventInfo > &ev_info)
Definition: chi_log.cc:204
void Barrier() const
Definition: mpi_info.cc:38
std::vector< AngleSetGroup > angle_set_groups
std::map< uint64_t, SweepBndryPtr > sim_boundaries
void ScheduleAlgoFIFO(SweepChunk &sweep_chunk)
const std::vector< size_t > sweep_timing_events_tag_
@ REFLECTING
Reflecting boundary condition about a normal.