Skip to content
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

Merged
merged 10 commits into from
Oct 17, 2018

Conversation

wuwenbin2006
Copy link
Contributor

The code crashed when I ran it in explicit3D ray tracing mode. Some bugs are fixed and the code ran smoothly but got the wrong results.

…etry class

In the destructor function of Geometry class, materials should not be released in case they will be needed somewhere else. The materials could be freed explicitly by dict.clear() in python and delete in cpp.
src/Cell.cpp Outdated
@@ -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) {
Copy link
Contributor

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.

void Cell::retrieveRotation(double* rotations, int num_axes,

			    std::string units) {

@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this suffice to close issue #226 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found when the number of sectors is 2, the code crashes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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

std::map<int, Material*>::iterator iter;
for (iter = materials.begin(); iter != materials.end(); ++iter)
delete iter->second;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a if (_loaded_from_file) { instead, we can't go back to memory leaking the materials

src/Geometry.cpp Outdated
surf = (*s_iter).second->_surface;
all_surfs[surf->getId()] = surf;
surf = (*s_iter).second->_surface;
all_surfs[surf->getId()] = surf;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it a debug log if necessary

@GiudGiud
Copy link
Contributor

@wuwenbin2006 I will further review this only when the fix is complete and when explicit ray tracing provides the same results as OTF ray tracing.
It would be a good occasion to add a test comparing the ray tracing at this point as well.

@GiudGiud GiudGiud merged commit f05648b into mit-crpg:3D-MOC Oct 17, 2018
@wuwenbin2006 wuwenbin2006 deleted the some-fixes-for-explict3D branch October 19, 2018 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants