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

separately delete forward dft chunk for adjoint optimization #2251

Merged
merged 9 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions python/adjoint/optimization_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ def calculate_gradient(self):
for ar in range(len(self.objective_functions))
]

for dri in range(self.num_design_regions):
for i in range(3):
self.forward_design_region_monitors[dri][i].remove()
stevengj marked this conversation as resolved.
Show resolved Hide resolved

# Cleanup list of lists
if len(self.gradient) == 1:
self.gradient = self.gradient[0] # only one objective function
Expand Down
1 change: 0 additions & 1 deletion src/meepgeom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2999,7 +2999,6 @@ void material_grids_addgradient(double *v, size_t ng, size_t nf,
for (int i = 0; i < 3; i++) {
for (int ii = 0; ii < adjoint_dft_chunks[i].size(); ii++) {
delete adjoint_dft_chunks[i][ii];
delete forward_dft_chunks[i][ii];
}
}

Expand Down