mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
tet_bin to elem_bin suggestion from @eepeterson
This commit is contained in:
parent
2bfdcefcf6
commit
fba3a9a118
1 changed files with 4 additions and 5 deletions
|
|
@ -193,7 +193,7 @@ MeshSpatial::MeshSpatial(pugi::xml_node node)
|
|||
int32_t mesh_id = std::stoi(get_node_value(node, "mesh_id"));
|
||||
// Get pointer to spatial distribution
|
||||
mesh_idx_ = model::mesh_map.at(mesh_id);
|
||||
|
||||
|
||||
// Check whether mesh pointer points to a mesh
|
||||
mesh_ptr_ = dynamic_cast<Mesh*>(model::meshes[mesh_idx_].get());
|
||||
if (!mesh_ptr_) {fatal_error("Mesh passed to spatial distribution is not a mesh object"); }
|
||||
|
|
@ -237,15 +237,14 @@ MeshSpatial::MeshSpatial(pugi::xml_node node)
|
|||
}
|
||||
|
||||
Position MeshSpatial::sample(uint64_t* seed) const
|
||||
{
|
||||
{
|
||||
// Create random variable for sampling element from mesh
|
||||
float eta = prn(seed);
|
||||
// Sample over the CDF defined in initialization above
|
||||
int32_t tet_bin = lower_bound_index(mesh_CDF_.begin(), mesh_CDF_.end(), eta);
|
||||
return mesh_ptr_->sample(seed, tet_bin);
|
||||
int32_t elem_bin = lower_bound_index(mesh_CDF_.begin(), mesh_CDF_.end(), eta);
|
||||
return mesh_ptr_->sample(seed, elem_bin);
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// SpatialBox implementation
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue