-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some fixes for explicit3D ray tracing #357
Changes from 5 commits
c55f013
68dd53a
d583160
0755ce9
746a60d
6954d5d
e455ed4
fca1d1c
92d7505
44874f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -299,7 +299,7 @@ double* Cell::getRotationMatrix() { | |
* @param units the angular units in "radians" or "degrees" (default) | ||
*/ | ||
void Cell::retrieveRotation(double* rotations, int num_axes, | ||
std::string units) { | ||
std::string units) { | ||
if (num_axes != 3) | ||
log_printf(ERROR, "Unable to get rotation with %d axes for Cell %d. " | ||
"The rotation array should be length 3.", num_axes, _id); | ||
|
@@ -1002,8 +1002,11 @@ void Cell::setNumRings(int num_rings) { | |
if (num_rings < 0) | ||
log_printf(ERROR, "Unable to give %d rings to Cell %d since this is " | ||
"a negative number", num_rings, _id); | ||
|
||
_num_rings = num_rings; | ||
|
||
if (num_rings == 1) | ||
_num_rings = 0; | ||
else | ||
_num_rings = num_rings; | ||
} | ||
|
||
|
||
|
@@ -1061,7 +1064,7 @@ void Cell::addSurface(int halfspace, Surface* surface) { | |
*/ | ||
void Cell::removeSurface(Surface* surface) { | ||
|
||
if (_surfaces.find(surface->getId()) != _surfaces.end()) { | ||
if (surface != NULL && _surfaces.find(surface->getId()) != _surfaces.end()) { | ||
delete _surfaces[surface->getId()]; | ||
_surfaces.erase(surface->getId()); | ||
} | ||
|
@@ -1331,7 +1334,7 @@ void Cell::ringify(std::vector<Cell*>& subcells, double max_radius) { | |
} | ||
|
||
if (num_zcylinders > 2) | ||
log_printf(NORMAL, "Unable to ringify Cell %d since it " | ||
log_printf(ERROR, "Unable to ringify Cell %d since it " | ||
"contains more than 2 ZCYLINDER Surfaces", _id); | ||
|
||
if (x1 != x2 && num_zcylinders == 2) | ||
|
@@ -1367,7 +1370,7 @@ void Cell::ringify(std::vector<Cell*>& subcells, double max_radius) { | |
increment = fabs(radius1 - radius2) / _num_rings; | ||
|
||
/* Heuristic to improve area-balancing for low number of rings */ | ||
if (halfspace1 == 0 && radius1 == max_radius && _num_rings < 3) | ||
if (radius1 == max_radius && _num_rings < 3) | ||
increment = 1.5 * (radius1 - radius2) / _num_rings; | ||
} | ||
|
||
|
@@ -1407,6 +1410,7 @@ void Cell::ringify(std::vector<Cell*>& subcells, double max_radius) { | |
Cell* ring = (*iter3)->clone(); | ||
ring->setNumSectors(0); | ||
ring->setNumRings(0); | ||
ring->removeSurface(zcylinder1); | ||
|
||
/* Add ZCylinder only if this is not the outermost ring in an | ||
* unbounded Cell (i.e. the moderator in a fuel pin cell) */ | ||
|
@@ -1434,6 +1438,7 @@ void Cell::ringify(std::vector<Cell*>& subcells, double max_radius) { | |
Cell* ring = clone(); | ||
ring->setNumSectors(0); | ||
ring->setNumRings(0); | ||
ring->removeSurface(zcylinder1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this suffice to close issue #226 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not solve this issue completely. It is hard to remove the abundant outer box surfaces for outer most cells ( moderator usually). However, this could be improved more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found when the number of sectors is 2, the code crashes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is the problem when a point is on the surface. In this case, the evaluation value would be so tiny that it could be either minus or positive. Will be fixed in other PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This removeSurfaces doesn't actually work. It's calling getSurfaces which returns a const map, so you can't delete from it. No need to make a PR to fix it, all of this is gone with Regions |
||
|
||
/* Add ZCylinder only if this is not the outermost ring in an | ||
* unbounded Cell (i.e. the moderator in a fuel pin cell) */ | ||
|
@@ -1557,7 +1562,8 @@ std::string Cell::toString() { | |
std::map<int, surface_halfspace*>::iterator iter; | ||
string << ", Surfaces: "; | ||
for (iter = _surfaces.begin(); iter != _surfaces.end(); ++iter) | ||
string << iter->second->_surface->toString() << ", "; | ||
string << "\nhalfspace = " << iter->second->_halfspace << ", " << | ||
iter->second->_surface->toString(); | ||
|
||
return string.str(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,13 +42,6 @@ Geometry::Geometry() { | |
* @brief Destructor clears FSR to Cells and Materials maps. | ||
*/ | ||
Geometry::~Geometry() { | ||
|
||
/* Free all materials */ | ||
std::map<int, Material*> materials = _root_universe->getAllMaterials(); | ||
std::map<int, Material*>::iterator iter; | ||
for (iter = materials.begin(); iter != materials.end(); ++iter) | ||
delete iter->second; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a |
||
/* Free all surfaces */ | ||
if (_loaded_from_file) { | ||
std::map<int, Surface*> surfaces = getAllSurfaces(); | ||
|
@@ -422,8 +415,8 @@ std::map<int, Surface*> Geometry::getAllSurfaces() { | |
surfs = cell->getSurfaces(); | ||
|
||
for (s_iter = surfs.begin(); s_iter != surfs.end(); ++s_iter) { | ||
surf = (*s_iter).second->_surface; | ||
all_surfs[surf->getId()] = surf; | ||
surf = (*s_iter).second->_surface; | ||
all_surfs[surf->getId()] = surf; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation |
||
} | ||
} | ||
} | ||
|
@@ -2052,12 +2045,12 @@ void Geometry::segmentize3D(Track3D* track, bool setup) { | |
} | ||
|
||
/* Calculate the local centroid of the segment if available */ | ||
if (_contains_FSR_centroids && !setup) { | ||
Point* centroid = getFSRCentroid(fsr_id); | ||
if (!setup) { | ||
//Point* centroid = getFSRCentroid(fsr_id); | ||
Point* starting_point = start.getHighestLevel()->getPoint(); | ||
double x_start = starting_point->getX() - centroid->getX(); | ||
double y_start = starting_point->getY() - centroid->getY(); | ||
double z_start = starting_point->getZ() - centroid->getZ(); | ||
double x_start = starting_point->getX(); | ||
double y_start = starting_point->getY(); | ||
double z_start = starting_point->getZ(); | ||
new_segment->_starting_position[0] = x_start; | ||
new_segment->_starting_position[1] = y_start; | ||
new_segment->_starting_position[2] = z_start; | ||
|
@@ -2625,11 +2618,11 @@ void Geometry::computeFissionability(Universe* univ) { | |
|
||
Material* material; | ||
std::map<int, Material*> materials; | ||
std::map<int, Material*>::iterator mat_iter; | ||
std::map<int, Material*>::iterator mat_iter; | ||
|
||
Universe* universe; | ||
std::map<int, Universe*> universes; | ||
std::map<int, Universe*>::iterator univ_iter; | ||
std::map<int, Universe*>::iterator univ_iter; | ||
|
||
/* If no Universe was passed in as an argument, then this is the first | ||
* recursive call from a user via Python, so get the base Universe */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,12 +203,14 @@ void LocalCoords::detectLoop() { | |
int n = 0; | ||
|
||
LocalCoords* iter = _next; | ||
while (_next != NULL) { | ||
while (iter != NULL) { | ||
iter = iter->getNext(); | ||
n++; | ||
if (n > 1000) | ||
log_printf(ERROR, "Infinite loop of coords"); | ||
} | ||
log_printf(DEBUG, "The LocalCoords is: %s\n", toString().c_str()); | ||
log_printf(NORMAL, "The depth of the chain is %d \n", n); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make it a debug log if necessary |
||
} | ||
|
||
|
||
|
@@ -413,7 +415,7 @@ LocalCoords* LocalCoords::getHighestLevel() { | |
|
||
|
||
/** | ||
* @brief Translate all of the x,y coordinates for each LocalCoords object in | ||
* @brief Translate all of the x,y,z coordinates for each LocalCoords object in | ||
* the linked list. | ||
* @details This method will traverse the entire linked list and apply the | ||
* translation to each element. | ||
|
@@ -475,7 +477,7 @@ void LocalCoords::prune() { | |
LocalCoords* next = curr->getPrev(); | ||
|
||
/* Iterate over LocalCoords beneath this one in the linked list */ | ||
while (curr != this) { | ||
while (curr != this) {// it seems nothing has been down in this while loop | ||
next = curr->getPrev(); | ||
if (curr->getPosition() == -1) | ||
curr->deleteArray(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that the style guide says to leave 5 blank spaces, but it looks a lot better yo have the arguments on the second line line up with the parenthesis. We could change the guide lines.