Chi-Tech
lbsadj_solver_01b_initQOIs.cc
Go to the documentation of this file.
1#include "lbsadj_solver.h"
2
5
6#include "chi_runtime.h"
7#include "chi_log.h"
8
9namespace lbs
10{
11
13{
14 //============================================= Initialize QOIs
15 for (auto& qoi_pair : response_functions_)
16 {
17 const auto& qoi_designation = qoi_pair.first;
18 auto& qoi_cell_subscription = qoi_pair.second;
19
20 for (const auto& cell : grid_ptr_->local_cells)
21 if (qoi_designation.logical_volume->Inside(cell.centroid_))
22 qoi_cell_subscription.push_back(cell.local_id_);
23
24 size_t num_local_subs = qoi_cell_subscription.size();
25 size_t num_globl_subs = 0;
26
27 MPI_Allreduce(&num_local_subs, //sendbuf
28 &num_globl_subs, //recvbuf
29 1, MPI_UNSIGNED_LONG_LONG, //count + datatype
30 MPI_SUM, //operation
31 Chi::mpi.comm ); //communicator
32
33 Chi::log.Log() << "LBAdjointSolver: Number of cells subscribed to "
34 << qoi_designation.name << " = "
35 << num_globl_subs;
36 }
37}
38
39}
static chi::ChiLog & log
Definition: chi_runtime.h:81
static chi::MPI_Info & mpi
Definition: chi_runtime.h:78
LogStream Log(LOG_LVL level=LOG_0)
Definition: chi_log.cc:35
std::vector< RespFuncAndSubs > response_functions_
Definition: lbsadj_solver.h:21
chi_mesh::MeshContinuumPtr grid_ptr_
Definition: lbs_solver.h:75