-
Notifications
You must be signed in to change notification settings - Fork 641
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
separately delete forward dft chunk for adjoint optimization #2251
Conversation
src/meepgeom.cpp
Outdated
next_forward_chunk = current_forward_chunk->next_in_dft; | ||
delete current_forward_chunk; | ||
current_forward_chunk = next_forward_chunk; | ||
} |
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.
Doesn't this need to set fields_f[i]->chunks = NULL
or something?
Lines 182 to 190 in fba8aeb
fields object, which is a bit different.
|
src/meepgeom.cpp
Outdated
} | ||
} | ||
|
||
} // material_grids_addgradient | ||
|
||
void delete_forward_dft_chunk(std::vector<meep::dft_fields *> fields_f) { |
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.
It seems like it would make more sense to have a dft_fields::delete_dft_chunks
method, and then just call it for each element of the array.
@@ -304,6 +304,13 @@ def calculate_gradient(self): | |||
for ar in range(len(self.objective_functions)) | |||
] | |||
|
|||
for dri in range(self.num_design_regions): | |||
mp._delete_forward_dft_chunk( | |||
self.forward_design_region_monitors[dri][0].swigobj, |
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.
Just call self.forward_design_region_monitors[dri][0].delete_dft_chunks()
on each of the objects?
Codecov Report
@@ Coverage Diff @@
## master #2251 +/- ##
==========================================
+ Coverage 73.23% 73.24% +0.01%
==========================================
Files 17 17
Lines 4916 4919 +3
==========================================
+ Hits 3600 3603 +3
Misses 1316 1316
|
Fix #2097. Delete forward dft chunks at the end of all adjoint gradients calculation.