From df342211ccb82edda53ff063053e54c6e17dcb4b Mon Sep 17 00:00:00 2001 From: shriwise Date: Wed, 16 May 2018 17:24:52 -0500 Subject: [PATCH] Populating c-side structures. Updating Fortran universe population in read_geometry_xml. --- src/cad.cpp | 27 +++++++++++++++++++++------ src/input_xml.F90 | 2 +- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/cad.cpp b/src/cad.cpp index 790a88f765..65cab484f8 100644 --- a/src/cad.cpp +++ b/src/cad.cpp @@ -15,17 +15,32 @@ void load_cad_geometry_c() rval = DAGMC->init_OBBTree(); MB_CHK_ERR_CONT(rval); + int32_t cad_univ_id = 0; // universe is always 0 for CAD + // initialize cell objects openmc::n_cells = DAGMC->num_entities(3); for(int i = 0; i < openmc::n_cells; i++) { // set cell ids using global IDs - openmc::CADCell c = openmc::CADCell(); - c.id = DAGMC->id_by_index(3, i); - c.dagmc_ptr = DAGMC; - c.universe = 0; // set to zero for now - openmc::cells_c.push_back(&c); - openmc::cell_dict[c.id] = i; + openmc::CADCell* c = new openmc::CADCell(); + c->id = DAGMC->id_by_index(3, i); + c->dagmc_ptr = DAGMC; + c->universe = cad_univ_id; // set to zero for now + c->material.push_back(40); // TEMPORARY + openmc::cells_c.push_back(c); + openmc::cell_dict[c->id] = i; + + // Populate the Universe vector and dict + auto it = openmc::universe_dict.find(cad_univ_id); + if (it == openmc::universe_dict.end()) { + openmc::universes_c.push_back(new openmc::Universe()); + openmc::universes_c.back()-> id = cad_univ_id; + openmc::universes_c.back()->cells.push_back(i); + openmc::universe_dict[cad_univ_id] = openmc::universes_c.size() - 1; + } + else { + openmc::universes_c[it->second]->cells.push_back(i); + } } // initialize surface objects diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 911ec99fa0..fcd568e756 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -435,7 +435,7 @@ contains u % cells(:) = 0 end associate end do - root_universe = find_root_universe() + 1 + root_universe = 0 + 1 do i = 1, n_cells ! Get index in universes array