Skip to content

Commit 50c3f76

Browse files
committed
clean up
1 parent 13bb321 commit 50c3f76

6 files changed

Lines changed: 11 additions & 77 deletions

File tree

include/openmc/cell.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Universe {
6060
public:
6161
int32_t id_; //!< Unique ID
6262
vector<int32_t> cells_; //!< Cells within this universe
63-
int filled_with_triso_base_ = -1;
63+
int filled_with_triso_base_ = -1; //!< ID of cell filled with virtual lattice
6464

6565
//! \brief Write universe information to an HDF5 group.
6666
//! \param group_id An HDF5 group id.
@@ -217,7 +217,7 @@ class Cell {
217217
bool triso_particle_;
218218

219219

220-
// Specification of the viryual lattice
220+
//! \brief Specification of the virtual lattice
221221
vector<double> vl_lower_left_;
222222
vector<double> vl_pitch_;
223223
vector<int32_t> vl_shape_;

openmc/cell.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def __init__(self, cell_id=None, name='', fill=None, region=None):
118118
self.pitch = None
119119
self.shape = None
120120

121-
122121
def __contains__(self, point):
123122
if self.region is None:
124123
return True
@@ -586,7 +585,6 @@ def create_xml_subelement(self, xml_element, memo=None):
586585
element.set("pitch", ' '.join(map(str, self.pitch)))
587586
element.set("shape", ' '.join(map(str, self.shape)))
588587

589-
590588
if len(self._name) > 0:
591589
element.set("name", str(self.name))
592590

openmc/model/triso.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -830,11 +830,10 @@ def create_triso_lattice(trisos, lower_left, pitch, shape, background, virtual=F
830830
real_shape = copy.deepcopy(shape)
831831
pitch = [real_pitch[i]*real_shape[i] for i in range(len(real_pitch))]
832832
shape = [1 for i in range(len(real_shape))]
833-
833+
834834
lattice = openmc.RectLattice()
835835
lattice.lower_left = lower_left
836836
lattice.pitch = pitch
837-
838837

839838
indices = list(np.broadcast(*np.ogrid[:shape[2], :shape[1], :shape[0]]))
840839
triso_locations = {idx: [] for idx in indices}
@@ -872,7 +871,6 @@ def create_triso_lattice(trisos, lower_left, pitch, shape, background, virtual=F
872871
background_cell.pitch = real_pitch
873872
background_cell.shape = real_shape
874873
background_cell.lower_left = [-pitch[i]/2 for i in range(len(pitch))]
875-
876874

877875
u = openmc.Universe()
878876
u.add_cell(background_cell)

src/cell.cpp

Lines changed: 5 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,7 @@ vector<vector<int32_t>> \
119119
vector<vector<int32_t>> triso_distribution(lattice_shape[0]*lattice_shape[1]*lattice_shape[2]);
120120
vector<double> mesh_center(3);
121121
vector<int> mesh_ind(3);
122-
/*
123-
for (int i=0; i<lattice_shape[0]; i++) {
124-
for (int j=0; j<lattice_shape[1]; j++) {
125-
for (int k=0; k<lattice_shape[2]; k++) {
126-
mesh_center[0]=(i+0.5)*lattice_pitch[0]+lattice_lower_left[0];
127-
mesh_center[1]=(j+0.5)*lattice_pitch[1]+lattice_lower_left[1];
128-
mesh_center[2]=(k+0.5)*lattice_pitch[2]+lattice_lower_left[2];
129-
for (int32_t token : cell_rpn) {
130-
if (token >= OP_UNION) continue;
131-
if (model::surfaces[abs(token) - 1]->triso_in_mesh(mesh_center, lattice_pitch)) {
132-
triso_distribution[i+j*lattice_shape[0]+k*lattice_shape[0]*lattice_shape[1]].push_back(token);
133-
model::surfaces[abs(token) - 1]->connect_to_triso_base(id, "base");
134-
}
135-
}
136-
}
137-
}
138-
}*/
122+
139123
for (int32_t token : cell_rpn) {
140124
if (token >= OP_UNION) continue;
141125
vector<double> triso_center=model::surfaces[abs(token) - 1]->get_center();
@@ -160,11 +144,9 @@ vector<vector<int32_t>> \
160144
}
161145
}
162146

163-
164147
return triso_distribution;
165148
}
166149

167-
168150
//==============================================================================
169151
//! Convert infix region specification to Reverse Polish Notation (RPN)
170152
//!
@@ -586,7 +568,7 @@ CSGCell::CSGCell(pugi::xml_node cell_node)
586568
} else {
587569
virtual_lattice_ = false;
588570
}
589-
571+
590572
if (check_for_node(cell_node, "triso_particle")) {
591573
triso_particle_ = get_node_value_bool(cell_node, "triso_particle");
592574
} else {
@@ -771,40 +753,6 @@ std::pair<double, int32_t> CSGCell::distance(
771753
double min_dis_vl;
772754
int32_t i_surf_vl;
773755
if (virtual_lattice_) {
774-
/*
775-
double tol_dis = p.collision_distance();
776-
double u_value = sqrt(pow(u.x,2)+pow(u.y,2)+pow(u.z,2)); //don't know if u has been normalized
777-
vector<double> norm_u = {u.x/u_value, u.y/u_value, u.z/u_value};
778-
vector<double> r_end = {r.x+tol_dis*norm_u[0], r.y+tol_dis*norm_u[1], r.z+tol_dis*norm_u[2]};
779-
double temp_pos_x, temp_pos_y, temp_pos_z;
780-
vector<vector<int>> passed_lattice={{floor((r.x-vl_lower_left_[0])/vl_pitch_[0]),\
781-
floor((r.y-vl_lower_left_[1])/vl_pitch_[1]),\
782-
floor((r.z-vl_lower_left_[2])/vl_pitch_[2]), 0}};
783-
int index_start;
784-
int index_end;
785-
for (int i = 0; i < 3; i++){
786-
if (passed_lattice[0][i] == vl_shape_[i]) {
787-
passed_lattice[0][i] = vl_shape_[i]-1;
788-
}
789-
}
790-
791-
if (u.x > 0) {
792-
index_start = ceil((r.x-vl_lower_left_[0])/vl_pitch_[0]);
793-
index_end = floor((r_end[0]-vl_lower_left_[0])/vl_pitch_[0]);
794-
if (index_start <= index_end && index_start < vl_shape_[0]) {
795-
for (int i = index_start; i <= index_end; i++) {
796-
if (i >= vl_shape_[0]) break;
797-
temp_pos_x = i*vl_pitch_[0]+vl_lower_left_[0];
798-
temp_pos_y = (temp_pos_x-r.x)*norm_u[1]/norm_u[0]+r.y;
799-
temp_pos_z = (temp_pos_x-r.x)*norm_u[2]/norm_u[0]+r.z;
800-
passed_lattice.push_back({i, floor((temp_pos_y-vl_lower_left_[1])/vl_pitch_[1]),\
801-
floor((temp_pos_z-vl_lower_left_[2])/vl_pitch_[2]),\
802-
(temp_pos_x-r.x)/norm_u[0]})
803-
}
804-
}
805-
}
806-
*/
807-
808756
double max_dis = p->collision_distance();
809757
double tol_dis = 0;
810758
vector<double> dis_to_bou(3), dis_to_bou_max(3);
@@ -835,14 +783,10 @@ std::pair<double, int32_t> CSGCell::distance(
835783
}
836784

837785
while(true) {
838-
839-
840-
841786
if (lat_ind[0] < 0 || lat_ind[0] >= vl_shape_[0] ||\
842787
lat_ind[1] < 0 || lat_ind[1] >= vl_shape_[1] ||\
843788
lat_ind[2] < 0 || lat_ind[2] >= vl_shape_[2]) break;
844789

845-
846790
for (int token : vl_triso_distribution_[lat_ind[0]+lat_ind[1]*vl_shape_[0]+lat_ind[2]*vl_shape_[0]*vl_shape_[1]]) {
847791
bool coincident {std::abs(token) == std::abs(on_surface)};
848792
double d {model::surfaces[abs(token) - 1]->distance(r, u, coincident)};
@@ -853,7 +797,6 @@ std::pair<double, int32_t> CSGCell::distance(
853797
}
854798
}
855799
}
856-
857800

858801
int mes_bou_crossed=0;
859802
if (dis_to_bou[1] < dis_to_bou[0]) {
@@ -876,13 +819,13 @@ std::pair<double, int32_t> CSGCell::distance(
876819
}
877820

878821
dis_to_bou[mes_bou_crossed] += dis_to_bou_max[mes_bou_crossed];
879-
822+
880823
if (tol_dis > max_dis) {
881824
break;
882825
}
883826
}
884827

885-
828+
886829
} else {
887830
for (int32_t token : rpn_) {
888831
// Ignore this token if it corresponds to an operator rather than a region.
@@ -903,7 +846,7 @@ std::pair<double, int32_t> CSGCell::distance(
903846
}
904847
}
905848
}
906-
849+
907850
return {min_dist, i_surf};
908851
}
909852

src/geometry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ bool find_cell_inner(Particle& p, const NeighborList* neighbor_list)
148148
const auto& univ {model::universes[i_universe]};
149149
found = univ->find_cell(p);
150150
}
151-
151+
152152
if (!found) {
153153
return found;
154154
}

src/particle.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,7 @@ void Particle::cross_surface()
397397
if (settings::verbosity >= 10 || trace()) {
398398
write_message(1, " Crossing surface {}", surf->id_);
399399
}
400-
/*
401-
if (surf->id_ >= 11675 && surf->id_ <=23340) {
402-
write_message(1, " {}", surf->id_);
403-
}*/
400+
404401
if (surf->surf_source_ && simulation::current_batch == settings::n_batches) {
405402
SourceSite site;
406403
site.r = r();
@@ -453,7 +450,6 @@ void Particle::cross_surface()
453450
}
454451
#endif
455452

456-
457453
if (surf->is_triso_surface_) {
458454
if (surface() > 0){
459455
for (int i = n_coord(); i < model::n_coord_levels; i++) {
@@ -477,7 +473,7 @@ void Particle::cross_surface()
477473
if (i_cell == C_NONE) {
478474
int i_universe = coord(n_coord() - 1).universe;
479475
const auto& univ {model::universes[i_universe]};
480-
476+
481477
if (univ->filled_with_triso_base_ != -1) {
482478
coord(n_coord() - 1).cell = model::cell_map[univ->filled_with_triso_base_];
483479
found=true;
@@ -542,7 +538,6 @@ void Particle::cross_surface()
542538
if (neighbor_list_find_cell(*this))
543539
return;
544540
}
545-
546541

547542
// ==========================================================================
548543
// COULDN'T FIND PARTICLE IN NEIGHBORING CELLS, SEARCH ALL CELLS

0 commit comments

Comments
 (0)