From 0e9a901a13f5c2cbb35436cd86330682e1aca240 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 20 Mar 2019 19:02:58 +0000 Subject: [PATCH] remove difference between DEFAULT and SUBVOXEL --- src/source_sampling.cpp | 14 +++----------- src/source_sampling.h | 2 -- tests/test_source_sampling.py | 7 ++----- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/source_sampling.cpp b/src/source_sampling.cpp index e21eaa2b9d..f000b7fbf6 100644 --- a/src/source_sampling.cpp +++ b/src/source_sampling.cpp @@ -64,7 +64,6 @@ pyne::Sampler::Sampler(std::string filename, bool uniform) : filename(filename), src_tag_name(src_tag_name), e_bounds(e_bounds) { bias_mode = (uniform) ? UNIFORM : ANALOG; - sub_mode = DEFAULT; setup(); } @@ -77,7 +76,6 @@ pyne::Sampler::Sampler(std::string filename, e_bounds(e_bounds), bias_tag_name(bias_tag_name) { bias_mode = USER; - sub_mode = DEFAULT; setup(); } @@ -88,25 +86,19 @@ pyne::Sampler::Sampler(std::string filename, : filename(filename), tag_names(tag_names), e_bounds(e_bounds) { - // determine the bias_mode and sub_mode + // determine the bias_mode if (mode == 0){ bias_mode = ANALOG; - sub_mode = DEFAULT; } else if (mode == 1) { bias_mode = UNIFORM; - sub_mode = DEFAULT; } else if (mode == 2) { bias_mode = USER; - sub_mode = DEFAULT; } else if (mode == 3) { bias_mode = ANALOG; - sub_mode = SUBVOXEL; } else if (mode == 4) { bias_mode = UNIFORM; - sub_mode = SUBVOXEL; } else if (mode == 5) { bias_mode = USER; - sub_mode = SUBVOXEL; } // find out the src_tag_name and bias_tag_name @@ -148,8 +140,8 @@ pyne::SourceParticle pyne::Sampler::particle_birth(std::vector rands) { xyz_rands.push_back(rands[4]); moab::CartVect pos = sample_xyz(ve_idx, xyz_rands); // cell_number - if (sub_mode == SUBVOXEL) { - cell_id = cell_number[ve_idx*max_num_cells + c_idx]; + if (ve_type == moab::MBHEX) { + cell_id = cell_number[ve_idx*max_num_cells + c_idx]; } else { cell_id = -1; } diff --git a/src/source_sampling.h b/src/source_sampling.h index 452600c8bc..b6d632aecb 100644 --- a/src/source_sampling.h +++ b/src/source_sampling.h @@ -130,7 +130,6 @@ namespace pyne { /// Problem modes enum BiasMode {USER, ANALOG, UNIFORM}; - enum SubMode {DEFAULT, SUBVOXEL}; /// Mesh based Monte Carlo source sampling. class Sampler { @@ -198,7 +197,6 @@ namespace pyne { int num_bias_groups; ///< Number of groups tag \a _bias_tag_name int max_num_cells; /// Max number of cells in voxels BiasMode bias_mode; ///< Bias mode: ANALOG, UNIFORM, USER - SubMode sub_mode; ///< Subvoxel/Voxel mode: DEFAULT, SUBVOXEL // mesh moab::Interface* mesh; ///< MOAB mesh int num_ves; ///< Number of mesh volume elements on \a mesh. diff --git a/tests/test_source_sampling.py b/tests/test_source_sampling.py index 91c48c2e16..cdda10b366 100644 --- a/tests/test_source_sampling.py +++ b/tests/test_source_sampling.py @@ -1333,11 +1333,8 @@ def _cal_exp_w_c(s, mode, cell_fracs, src_tag, bias_tag): if svid == -1: raise ValueError("x coordinate not in the voxel, s.x = {0}" .format(str(s.x))) - if mode in (3, 4, 5): - # get the cell_number - exp_c = set(list(current_cell_fracs['cell'])) - else: - exp_c = set([-1]) + # get the cell_number + exp_c = set(list(current_cell_fracs['cell'])) # calculate eid num_e_groups = len(src_tag[0])/max_num_cells