Skip to content

Commit

Permalink
remove difference between DEFAULT and SUBVOXEL
Browse files Browse the repository at this point in the history
  • Loading branch information
zxkjack123 committed Mar 20, 2019
1 parent cb56d9b commit 0e9a901
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
14 changes: 3 additions & 11 deletions src/source_sampling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -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();
}

Expand All @@ -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
Expand Down Expand Up @@ -148,8 +140,8 @@ pyne::SourceParticle pyne::Sampler::particle_birth(std::vector<double> 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;
}
Expand Down
2 changes: 0 additions & 2 deletions src/source_sampling.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down
7 changes: 2 additions & 5 deletions tests/test_source_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0e9a901

Please sign in to comment.