mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Fix most DAGMC-related errors
This commit is contained in:
parent
964fdfde30
commit
39961dc0a4
4 changed files with 32 additions and 32 deletions
|
|
@ -9,14 +9,14 @@
|
|||
|
||||
#include "hdf5.h"
|
||||
#include "pugixml.hpp"
|
||||
#ifdef DAGMC
|
||||
#include "DagMC.hpp"
|
||||
#endif
|
||||
|
||||
#include "openmc/constants.h"
|
||||
#include "openmc/neighbor_list.h"
|
||||
#include "openmc/position.h"
|
||||
|
||||
#ifdef DAGMC
|
||||
#include "DagMC.hpp"
|
||||
#endif
|
||||
#include "openmc/surface.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
|
|
|
|||
34
src/cell.cpp
34
src/cell.cpp
|
|
@ -830,29 +830,25 @@ openmc_extend_cells(int32_t n, int32_t* index_start, int32_t* index_end)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DAGMC
|
||||
int32_t next_cell(DAGCell* cur_cell, DAGSurface* surf_xed)
|
||||
{
|
||||
moab::EntityHandle surf =
|
||||
surf_xed->dagmc_ptr_->entity_by_id(2, surf_xed->id_);
|
||||
moab::EntityHandle vol =
|
||||
cur_cell->dagmc_ptr_->entity_by_id(3, cur_cell->id_);
|
||||
|
||||
moab::EntityHandle new_vol;
|
||||
cur_cell->dagmc_ptr_->next_vol(surf, vol, new_vol);
|
||||
|
||||
return cur_cell->dagmc_ptr_->index_by_handle(new_vol);
|
||||
}
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
// Fortran compatibility functions
|
||||
//==============================================================================
|
||||
|
||||
extern "C" {
|
||||
int cells_size() { return model::cells.size(); }
|
||||
|
||||
#ifdef DAGMC
|
||||
int32_t next_cell(DAGCell* cur_cell, DAGSurface* surf_xed)
|
||||
{
|
||||
moab::EntityHandle surf =
|
||||
surf_xed->dagmc_ptr_->entity_by_id(2, surf_xed->id_);
|
||||
moab::EntityHandle vol =
|
||||
cur_cell->dagmc_ptr_->entity_by_id(3, cur_cell->id_);
|
||||
|
||||
moab::EntityHandle new_vol;
|
||||
cur_cell->dagmc_ptr_->next_vol(surf, vol, new_vol);
|
||||
|
||||
return cur_cell->dagmc_ptr_->index_by_handle(new_vol);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" int cells_size() { return model::cells.size(); }
|
||||
|
||||
} // namespace openmc
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ void load_dagmc_geometry()
|
|||
void read_geometry_dagmc()
|
||||
{
|
||||
// Check if dagmc.h5m exists
|
||||
std::string filename = settings::path_input + "dagmc.h5m"
|
||||
std::string filename = settings::path_input + "dagmc.h5m";
|
||||
if (!file_exists(filename)) {
|
||||
fatal_error("Geometry DAGMC file '" + filename + "' does not exist!");
|
||||
}
|
||||
|
|
@ -324,7 +324,7 @@ void read_geometry_dagmc()
|
|||
write_message("Reading DAGMC geometry...", 5);
|
||||
load_dagmc_geometry();
|
||||
|
||||
model::root_universe = find_root_universe()
|
||||
model::root_universe = find_root_universe();
|
||||
}
|
||||
|
||||
void free_memory_dagmc()
|
||||
|
|
|
|||
|
|
@ -581,17 +581,21 @@ Particle::cross_surface()
|
|||
|
||||
#ifdef DAGMC
|
||||
if (settings::dagmc) {
|
||||
int32_t i_cell = next_cell(model::cells[last_cell[0]],
|
||||
model::surfaces[std::abs(surface)]);
|
||||
auto cellp = dynamic_cast<DAGCell*>(model::cells[last_cell[0]]);
|
||||
// TODO: off-by-one
|
||||
auto surfp = dynamic_cast<DAGSurface*>(model::surfaces[std::abs(surface) - 1]);
|
||||
int32_t i_cell = next_cell(cellp, surfp) - 1;
|
||||
// save material and temp
|
||||
last_material = material;
|
||||
last_sqrtkT = sqrtKT;
|
||||
last_sqrtkT = sqrtkT;
|
||||
// set new cell value
|
||||
coord[0].cell = i_cell
|
||||
coord[0].cell = i_cell;
|
||||
cell_instance = 0;
|
||||
material = model::cells[i_cell]->material[0];
|
||||
sqrtKT = model::cells[i_cell]->sqrtKT[0];
|
||||
return
|
||||
// TODO: off-by-one
|
||||
int mat = model::cells[i_cell]->material_[0];
|
||||
material = (mat == MATERIAL_VOID) ? mat : mat + 1;
|
||||
sqrtkT = model::cells[i_cell]->sqrtkT_[0];
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue