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

Fix for Issue #1834 #1840

Merged
merged 4 commits into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions libpympb/pympb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ void mode_solver::init(int p, bool reset_fields, geometric_object_list *geometry
meep_geom::material_data *_default_material) {
int have_old_fields = 0;

default_material = _default_material;
set_default_material(_default_material);

n[0] = grid_size.x;
n[1] = grid_size.y;
Expand Down Expand Up @@ -909,7 +909,9 @@ void mode_solver::reset_epsilon(geometric_object_list *geometry) {
};

if (!epsilon_input_file.empty()) {
default_material = meep_geom::make_file_material(epsilon_input_file.c_str());
meep_geom::material_type material = meep_geom::make_file_material(epsilon_input_file.c_str());
set_default_material(material);
material_free(material);
}

// TODO: support mu_input_file
Expand Down
2 changes: 1 addition & 1 deletion src/meepgeom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace meep_geom {
material_data vacuum_material_data;
material_type vacuum = &vacuum_material_data;

static void set_default_material(material_type _default_material) {
void set_default_material(material_type _default_material) {
if (default_material != NULL) {
if (default_material == _default_material) return;
material_free((material_type)default_material);
Expand Down
1 change: 1 addition & 0 deletions src/meepgeom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ material_type make_material_grid(bool do_averaging, double beta, double eta, dou
vector3 vec_to_vector3(const meep::vec &pt);
meep::vec vector3_to_vec(const vector3 v3);

void set_default_material(material_type _default_material);
void epsilon_material_grid(material_data *md, double u);
void epsilon_file_material(material_data *md, vector3 p);
bool susceptibility_equal(const susceptibility &s1, const susceptibility &s2);
Expand Down