mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Add constructor for CellInstanceFilter. Call prepare_distribcells at simulation
initialization, not program initialization
This commit is contained in:
parent
7581ba1883
commit
fb8b1c9b78
5 changed files with 14 additions and 6 deletions
|
|
@ -51,8 +51,8 @@ public:
|
|||
//----------------------------------------------------------------------------
|
||||
// Constructors, destructors
|
||||
|
||||
//CellInstanceFilter() = default;
|
||||
//CellInstanceFilter(gsl::span<CellInstance> instances);
|
||||
CellInstanceFilter() = default;
|
||||
CellInstanceFilter(gsl::span<CellInstance> instances);
|
||||
~CellInstanceFilter() = default;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -320,6 +320,8 @@ find_root_universe()
|
|||
void
|
||||
prepare_distribcell()
|
||||
{
|
||||
write_message("Preparing distributed cell instances...", 5);
|
||||
|
||||
// Find all cells listed in a DistribcellFilter or CellInstanceFilter
|
||||
std::unordered_set<int32_t> distribcells;
|
||||
for (auto& filt : model::tally_filters) {
|
||||
|
|
@ -395,7 +397,7 @@ prepare_distribcell()
|
|||
for (int map = 0; map < target_univ_ids.size(); map++) {
|
||||
auto target_univ_id = target_univ_ids[map];
|
||||
for (const auto& univ : model::universes) {
|
||||
int32_t offset {0}; // TODO: is this a bug? It matches F90 implementation.
|
||||
int32_t offset = 0;
|
||||
for (int32_t cell_indx : univ->cells_) {
|
||||
Cell& c = *model::cells[cell_indx];
|
||||
|
||||
|
|
|
|||
|
|
@ -269,9 +269,6 @@ void read_input_xml()
|
|||
|
||||
read_tallies_xml();
|
||||
|
||||
// Initialize distribcell_filters
|
||||
prepare_distribcell();
|
||||
|
||||
if (settings::run_mode == RUN_MODE_PLOTTING) {
|
||||
// Read plots.xml if it exists
|
||||
read_plots_xml();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "openmc/container_util.h"
|
||||
#include "openmc/eigenvalue.h"
|
||||
#include "openmc/error.h"
|
||||
#include "openmc/geometry_aux.h"
|
||||
#include "openmc/material.h"
|
||||
#include "openmc/message_passing.h"
|
||||
#include "openmc/nuclide.h"
|
||||
|
|
@ -57,6 +58,9 @@ int openmc_simulation_init()
|
|||
// Skip if simulation has already been initialized
|
||||
if (simulation::initialized) return 0;
|
||||
|
||||
// Initialize distribcell_filters
|
||||
prepare_distribcell();
|
||||
|
||||
// Determine how much work each process should do
|
||||
calculate_work();
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,11 @@
|
|||
|
||||
namespace openmc {
|
||||
|
||||
CellInstanceFilter::CellInstanceFilter(gsl::span<CellInstance> instances)
|
||||
{
|
||||
this->set_cell_instances(instances);
|
||||
}
|
||||
|
||||
void
|
||||
CellInstanceFilter::from_xml(pugi::xml_node node)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue