-
Notifications
You must be signed in to change notification settings - Fork 633
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
Resolve m-number adjoint bugs introduced by 1855 #2194
Changes from 1 commit
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 |
---|---|---|
|
@@ -793,4 +793,15 @@ bool operator==(const comms_key &lhs, const comms_key &rhs) { | |
return (lhs.ft == rhs.ft) && (lhs.phase == rhs.phase) && (lhs.pair == rhs.pair); | ||
} | ||
|
||
void fields::change_m_number(double new_m){ | ||
m = new_m; | ||
for (int i = 0; i < num_chunks; i++) { | ||
chunks[i]->change_m_number(new_m); | ||
} | ||
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. At the very least, this needs to check that 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. What do you envision Or are you suggesting we refactor the initialization of the fields to
As a first pass, it might be easiest to leave 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. My latest commit adds a check to make sure that the fields are consistent. If the user requests complex fields when the current setup is using real fields, I just abort. This isn't a problem for the adjoint code. We have a similar check in the python routine. But rather than aborting, we just reinitialize. |
||
} | ||
|
||
void fields_chunk::change_m_number(double new_m) { | ||
m = new_m; | ||
} | ||
|
||
} // namespace meep |
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 would be better to just add a boolean argument to
fields::use_real_fields
so that we can switch back to real fields without initializing. And then this could be called byfields::change_m_number
form ≠ 1