Skip to content

Commit

Permalink
remove unused volume parameter from _get_gradient (#2361)
Browse files Browse the repository at this point in the history
  • Loading branch information
oskooi authored Jan 2, 2023
1 parent 8143573 commit d29eadc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion python/adjoint/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def get_gradient(
fields_f[1].swigobj,
fields_f[2].swigobj,
sim.gv,
vol.swigobj,
onp.array(frequencies),
sim.geps,
finite_difference_step,
Expand Down
8 changes: 4 additions & 4 deletions python/meep.i
Original file line number Diff line number Diff line change
Expand Up @@ -844,9 +844,9 @@ meep::volume_list *make_volume_list(const meep::volume &v, int c,

%inline %{
void _get_gradient(PyObject *grad, double scalegrad,
meep::dft_fields *fields_a_0, meep::dft_fields *fields_a_1, meep::dft_fields *fields_a_2,
meep::dft_fields *fields_f_0, meep::dft_fields *fields_f_1, meep::dft_fields *fields_f_2,
meep::grid_volume *grid_volume, meep::volume *where, PyObject *frequencies,
meep::dft_fields *fields_a_0, meep::dft_fields *fields_a_1, meep::dft_fields *fields_a_2,
meep::dft_fields *fields_f_0, meep::dft_fields *fields_f_1, meep::dft_fields *fields_f_2,
meep::grid_volume *grid_volume, PyObject *frequencies,
meep_geom::geom_epsilon *geps, double fd_step) {

// clean the gradient array
Expand All @@ -872,7 +872,7 @@ void _get_gradient(PyObject *grad, double scalegrad,
if (PyArray_DIMS(pao_grad)[0] != nf) meep::abort("Numpy grad array is allocated for %td frequencies; it should be allocated for %td.",PyArray_DIMS(pao_grad)[0],nf);

// calculate the gradient
meep_geom::material_grids_addgradient(grad_c,ng,nf,adjoint_fields,forward_fields,frequencies_c,scalegrad,*grid_volume,*where,geps,fd_step);
meep_geom::material_grids_addgradient(grad_c,ng,nf,adjoint_fields,forward_fields,frequencies_c,scalegrad,*grid_volume,geps,fd_step);

}
%}
Expand Down
4 changes: 2 additions & 2 deletions src/meepgeom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2829,8 +2829,8 @@ void material_grids_addgradient_point(double *v, vector3 p, double scalegrad, ge
void material_grids_addgradient(double *v, size_t ng, size_t nf,
std::vector<meep::dft_fields *> fields_a,
std::vector<meep::dft_fields *> fields_f, double *frequencies,
double scalegrad, meep::grid_volume &gv, meep::volume &where,
geom_epsilon *geps, double du) {
double scalegrad, meep::grid_volume &gv, geom_epsilon *geps,
double du) {
/* ------------------------------------------------------------ */
// initialize local gradient array
/* ------------------------------------------------------------ */
Expand Down
4 changes: 2 additions & 2 deletions src/meepgeom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ geom_box_tree calculate_tree(const meep::volume &v, geometric_object_list g);
void material_grids_addgradient(double *v, size_t ng, size_t nf,
std::vector<meep::dft_fields *> fields_a,
std::vector<meep::dft_fields *> fields_f, double *frequencies,
double scalegrad, meep::grid_volume &gv, meep::volume &where,
geom_epsilon *geps, double du = 1e-6);
double scalegrad, meep::grid_volume &gv, geom_epsilon *geps,
double du = 1e-6);

/***************************************************************/
/* routines in GDSIIgeom.cc ************************************/
Expand Down

0 comments on commit d29eadc

Please sign in to comment.