17 bool cycle_allowance_flag,
19 : SPDS(omega, grid, verbose)
22 <<
" Building sweep ordering for Omega = "
29 std::vector<std::set<std::pair<int, double>>> cell_successors(num_loc_cells);
30 std::set<int> location_successors;
31 std::set<int> location_dependencies;
34 omega, location_dependencies, location_successors, cell_successors);
39 for (
auto v : location_successors)
42 for (
auto v : location_dependencies)
49 for (
int c = 0; c < num_loc_cells; ++c)
53 for (
int c = 0; c < num_loc_cells; c++)
54 for (
auto& successor : cell_successors[c])
55 local_DG.
AddEdge(c, successor.first, successor.second);
60 if (cycle_allowance_flag)
67 for (
auto& edge_to_remove : edges_to_remove)
70 edge_to_remove.second);
77 <<
" Generating topological sorting for local sweep ordering";
80 for (
auto v : so_temp)
86 <<
"Topological sorting for local sweep-ordering failed. "
87 <<
"Cyclic dependencies detected. Cycles need to be allowed"
88 <<
" by calling application.";
99 <<
" Communicating sweep dependencies.";
102 std::vector<std::vector<int>> global_dependencies;
103 global_dependencies.resize(
Chi::mpi.process_count);
112 constexpr auto INCOMING =
114 constexpr auto OUTGOING =
120 const size_t num_faces = cell.faces_.size();
121 unsigned int num_dependencies = 0;
122 std::vector<uint64_t> succesors;
124 for (
size_t f = 0; f < num_faces; ++f)
127 if (cell.faces_[f].has_neighbor_)
133 const auto& face = cell.faces_[f];
134 if (face.has_neighbor_ and grid.
IsCellLocal(face.neighbor_id_))
135 succesors.push_back(grid.
cells[face.neighbor_id_].local_id_);
148 <<
" Done computing sweep ordering.\n\n";
static chi::Timer program_timer
static void Exit(int error_code)
static chi::MPI_Info & mpi
std::vector< size_t > GenerateTopologicalSort()
std::vector< std::pair< size_t, size_t > > RemoveCyclicDependencies()
void AddVertex(size_t id, void *context=nullptr)
bool AddEdge(size_t from, size_t to, double weight=1.0)
std::string GetTimeString() const
LocalCellHandler local_cells
bool IsCellLocal(uint64_t cell_global_index) const
std::vector< int > location_dependencies_
const chi_mesh::MeshContinuum & grid_
std::vector< int > location_successors_
std::vector< std::pair< int, int > > local_cyclic_dependencies_
void PrintedGhostedGraph() const
std::vector< std::vector< FaceOrientation > > cell_face_orientations_
void PopulateCellRelationships(const chi_mesh::Vector3 &omega, std::set< int > &location_dependencies, std::set< int > &location_successors, std::vector< std::set< std::pair< int, double > > > &cell_successors)
const std::vector< chi_mesh::sweep_management::Task > & TaskList() const
std::vector< chi_mesh::sweep_management::Task > task_list_
CBC_SPDS(const chi_mesh::Vector3 &omega, const chi_mesh::MeshContinuum &grid, bool cycle_allowance_flag, bool verbose)
void CommunicateLocationDependencies(const std::vector< int > &location_dependencies, std::vector< std::vector< int > > &global_dependencies)
std::string PrintS() const
std::vector< int > item_id