-
Notifications
You must be signed in to change notification settings - Fork 640
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
Meep geom #56
Merged
Merged
Meep geom #56
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
dfc4edf
trying mkdocs stuff on master branch as readthedocs seems to have tro…
HomerReid 59dface
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid 59b2315
synced with stevengj/master
HomerReid 6202778
add missing line to configure.ac
HomerReid 808c908
add Makefile.am and other missing files
HomerReid 45c16f5
added libmeep_geom with three working tests
HomerReid 248b517
renamed meep_geom -> meepgeom; removed -std=c++11 compiler flag
HomerReid bdd64ac
change .travis.yml to pull from libctl master instead of specific commit
HomerReid b02a481
further updates to remove c++11 syntax
HomerReid 872554f
removed bend-flux-ll.cpp test from libmeepgeom
HomerReid a1117e6
static initialization for vacuum material_type structure
HomerReid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
LIBCTLGEOM = -lctlgeom | ||
LIBMEEP = $(top_builddir)/src/libmeep.la | ||
MEEPLIBS = $(LIBCTLGEOM) $(LIBMEEP) | ||
|
||
lib_LTLIBRARIES = libmeepgeom.la | ||
pkginclude_HEADERS = meepgeom.hpp material_data.hpp | ||
|
||
#AM_CPPFLAGS = -I$(top_srcdir)/src -std=c++11 | ||
AM_CPPFLAGS = -I$(top_srcdir)/src | ||
|
||
libmeepgeom_la_SOURCES = \ | ||
meepgeom.cpp meepgeom.hpp material_data.hpp | ||
|
||
libmeepgeom_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@ | ||
|
||
check_PROGRAMS = pw-source-ll bend-flux-ll ring-ll | ||
|
||
pw_source_ll_SOURCES = pw-source-ll.cpp | ||
pw_source_ll_LDADD = libmeepgeom.la $(MEEPLIBS) | ||
|
||
bend_flux_ll_SOURCES = bend-flux-ll.cpp | ||
bend_flux_ll_LDADD = libmeepgeom.la $(MEEPLIBS) | ||
|
||
ring_ll_SOURCES = ring-ll.cpp | ||
ring_ll_LDADD = libmeepgeom.la $(MEEPLIBS) | ||
|
||
TESTS = pw-source-ll bend-flux-ll ring-ll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
% Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
*/ | ||
|
||
#include "meep_geom.hpp" | ||
#include "meepgeom.hpp" | ||
|
||
namespace meep_geom { | ||
|
||
|
@@ -23,39 +23,55 @@ namespace meep_geom { | |
/***************************************************************/ | ||
/* global variables for default material */ | ||
/***************************************************************/ | ||
vector3 ones={1.0,1.0,1.0}; | ||
vector3 zeroes={0.0,0.0,0.0}; | ||
|
||
//susceptibility_list empty_sus_list{ .items=0, .num_items=0 }; | ||
susceptibility_list empty_sus_list{ 0, 0 }; | ||
|
||
medium_struct vacuum_medium{ | ||
.epsilon_diag = ones, | ||
.epsilon_offdiag = zeroes, | ||
.mu_diag = ones, | ||
.mu_offdiag = zeroes, | ||
.E_susceptibilities = empty_sus_list, | ||
.H_susceptibilities = empty_sus_list, | ||
.E_chi2_diag = zeroes, | ||
.E_chi3_diag = zeroes, | ||
.H_chi2_diag = zeroes, | ||
.H_chi3_diag = zeroes, | ||
.D_conductivity_diag = zeroes, | ||
.B_conductivity_diag = zeroes | ||
}; | ||
|
||
material_data vacuum_material_data{ | ||
material_data::MEDIUM, 0, 0, &vacuum_medium | ||
}; | ||
material_type vacuum; | ||
material_type air; | ||
medium_struct vacuum_medium; | ||
material_data vacuum_material_data; | ||
bool materials_initialized = false; | ||
|
||
void initialize_materials() | ||
{ | ||
materials_initialized=true; | ||
|
||
vector3 ones, zeroes; | ||
ones.x = ones.y = ones.z = 1.0; | ||
zeroes.x = zeroes.y = zeroes.z = 0.0; | ||
|
||
vacuum_medium.epsilon_diag | ||
= vacuum_medium.mu_diag | ||
= ones; | ||
|
||
vacuum_medium.epsilon_offdiag | ||
= vacuum_medium.mu_offdiag | ||
= vacuum_medium.E_chi2_diag | ||
= vacuum_medium.E_chi3_diag | ||
= vacuum_medium.H_chi2_diag | ||
= vacuum_medium.H_chi3_diag | ||
= vacuum_medium.D_conductivity_diag | ||
= vacuum_medium.B_conductivity_diag | ||
= zeroes; | ||
|
||
vacuum_medium.E_susceptibilities.num_items=0; | ||
vacuum_medium.E_susceptibilities.items=0; | ||
vacuum_medium.H_susceptibilities.num_items=0; | ||
vacuum_medium.H_susceptibilities.items=0; | ||
|
||
vacuum_material_data.which_subclass = material_data::MEDIUM; | ||
vacuum_material_data.user_func=0; | ||
vacuum_material_data.user_data=0; | ||
vacuum_material_data.medium = &vacuum_medium; | ||
|
||
material_type vacuum { (void *)&vacuum_material_data }; | ||
material_type air = vacuum; | ||
vacuum.data=(void *)&vacuum_material_data; | ||
air = vacuum; | ||
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. I wouldn't bother with the the 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. OK, I removed it. |
||
} | ||
|
||
/***************************************************************/ | ||
/***************************************************************/ | ||
/***************************************************************/ | ||
material_type make_dielectric(double epsilon) | ||
{ | ||
if (!materials_initialized) initialize_materials(); | ||
|
||
material_data *md = (material_data *)malloc(sizeof(*md)); | ||
md->which_subclass=material_data::MEDIUM; | ||
md->user_func=0; | ||
|
@@ -1490,6 +1506,7 @@ void set_materials_from_geometry(meep::structure *s, | |
bool verbose) | ||
{ | ||
geom_epsilon::verbose=verbose; | ||
if (!materials_initialized) initialize_materials(); | ||
|
||
// set global variables in libctlgeom based on data fields in s | ||
default_material = vacuum; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why does this need to be a function? Can't you just use a static initializer
const material_type vacuum = {....}
?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.
No, this is what was preventing the build from working on Travis. Previously I had all the initializations done the way you suggested, but these static structure initializations require the
-std=c++11
compiler flag, which is not supported by the compiler versions used by Travis.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.
Static structure initializations can be done even in 1990 ANSI C. You just can't use named fields. i.e.
(Note that the unspecified extra fields in
vacuum_medium
are initialized to 0, per the C/C++ standard.)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.
OK, in the latest commit (a1117e6) I've eliminated the
initialize_materials()
function in favor of static structure initializers.