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

User defined materials #114

Merged
merged 66 commits into from
Dec 15, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
dfc4edf
trying mkdocs stuff on master branch as readthedocs seems to have tro…
HomerReid Jun 3, 2017
59dface
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Jun 10, 2017
59b2315
synced with stevengj/master
HomerReid Jun 10, 2017
7b4a40a
sync with stevenj master
HomerReid Jun 11, 2017
73c728a
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Jun 16, 2017
eb70f1d
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Jun 18, 2017
2661470
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Jul 6, 2017
6b81dd9
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Jul 17, 2017
d6a1c33
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Jul 27, 2017
bcaec1e
updates
HomerReid Jul 27, 2017
d3e57d5
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Jul 28, 2017
9db22ba
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Jul 28, 2017
25f1abd
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Aug 3, 2017
62b6020
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Aug 8, 2017
49d7b20
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Aug 14, 2017
0f9293b
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Aug 14, 2017
47090d5
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Aug 16, 2017
3348c4a
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Aug 20, 2017
0a395dc
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Sep 7, 2017
c68d2d7
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Sep 21, 2017
bdb08d9
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Sep 24, 2017
82893b7
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Sep 29, 2017
a81e02f
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Sep 29, 2017
6e4baa9
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Oct 5, 2017
4e7ef9c
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Oct 12, 2017
4463f88
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Oct 16, 2017
8567a05
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Oct 19, 2017
8c9841d
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Oct 20, 2017
68ab3b2
Merge branch 'master' of http://github.com/stevengj/meep
HomerReid Nov 2, 2017
eab8d73
Merge branch 'master' of ssh://github.com/HomerReid/meep
HomerReid Nov 3, 2017
5abf883
Merge branch 'master' of https://github.com/StevenGJ/meep
HomerReid Nov 3, 2017
fc0b60d
Merge branch 'master' of http://github.com/stevengj/meep
HomerReid Nov 3, 2017
4329e9f
initial commit of modeExpansion branch with new mode-decomposition fe…
HomerReid Oct 19, 2017
832b0e0
updates
HomerReid Oct 19, 2017
78ad82b
initial stab at support for user-defined material functions in libmee…
HomerReid Oct 19, 2017
c153ba2
updates
HomerReid Oct 20, 2017
615cf98
updates
HomerReid Oct 20, 2017
df501f9
redefined user_defined_materials, but the way I did it can't *possibl…
HomerReid Oct 20, 2017
8739e1d
update material_type_destroy() to free memory allocated by user funct…
HomerReid Nov 3, 2017
5f2df81
Merge branch 'master' of http://github.com/stevengj/meep
HomerReid Nov 30, 2017
5bb8db4
Merge branch 'userDefinedMaterials' of ssh://github.com/HomerReid/mee…
HomerReid Nov 30, 2017
3c30a08
revamped handling of material_data structures; added libmeepgeom/user…
HomerReid Dec 1, 2017
16d71be
revamped handling of material structures
HomerReid Dec 1, 2017
cffff6f
updates to revamped handling of material_data structures in libmeepgeom
HomerReid Dec 1, 2017
96a2b17
make_user_material now calls user function at the origin to initializ…
HomerReid Dec 5, 2017
f92b16e
removed is_material_or_user function
HomerReid Dec 7, 2017
a90b283
removed spurious image files in doc/docs/images
HomerReid Dec 15, 2017
f541af8
Merge branch 'master' of http://github.com/stevengj/meep
HomerReid Dec 15, 2017
9c2912c
initial commit of modeExpansion branch with new mode-decomposition fe…
HomerReid Oct 19, 2017
72281d7
updates
HomerReid Oct 19, 2017
b7feffe
initial stab at support for user-defined material functions in libmee…
HomerReid Oct 19, 2017
4b2c715
updates
HomerReid Oct 20, 2017
a752951
updates
HomerReid Oct 20, 2017
d2757bf
redefined user_defined_materials, but the way I did it can't *possibl…
HomerReid Oct 20, 2017
d8db022
update material_type_destroy() to free memory allocated by user funct…
HomerReid Nov 3, 2017
119558d
revamped handling of material_data structures; added libmeepgeom/user…
HomerReid Dec 1, 2017
df83e9d
revamped handling of material structures
HomerReid Dec 1, 2017
27b12cc
updates to revamped handling of material_data structures in libmeepgeom
HomerReid Dec 1, 2017
518e821
make_user_material now calls user function at the origin to initializ…
HomerReid Dec 5, 2017
7f7ec44
removed is_material_or_user function
HomerReid Dec 7, 2017
894d3e1
removed spurious image files in doc/docs/images
HomerReid Dec 15, 2017
e44d6d5
Merge branch 'userDefinedMaterials' of ssh://github.com/HomerReid/mee…
HomerReid Dec 15, 2017
d91bdd4
updated python code/typemaps to reflect changes to material_data in l…
HomerReid Dec 15, 2017
192fc0c
updates to python typemaps to reflect changes to material_data struct…
HomerReid Dec 15, 2017
412a44a
Merge branch 'master' of http://github.com/stevengj/meep into userDef…
HomerReid Dec 15, 2017
489c8d2
updates to python typemaps to reflect changes to material_data struct…
HomerReid Dec 15, 2017
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
5 changes: 4 additions & 1 deletion libmeepgeom/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ libmeepgeom_la_SOURCES = \

libmeepgeom_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@

check_PROGRAMS = pw-source-ll ring-ll cyl-ellipsoid-ll absorber-1d-ll array-slice-ll
check_PROGRAMS = pw-source-ll ring-ll cyl-ellipsoid-ll absorber-1d-ll array-slice-ll user-defined-material

absorber_1d_ll_SOURCES = absorber-1d-ll.cpp
absorber_1d_ll_LDADD = libmeepgeom.la $(MEEPLIBS)
Expand All @@ -39,4 +39,7 @@ noinst_PROGRAMS = bend-flux-ll
bend_flux_ll_SOURCES = bend-flux-ll.cpp
bend_flux_ll_LDADD = libmeepgeom.la $(MEEPLIBS)

user_defined_material_SOURCES = user-defined-material.cpp
user_defined_material_LDADD = libmeepgeom.la $(MEEPLIBS)

noinst_DATA = cyl-ellipsoid-eps-ref.h5 array-slice-ll.h5
47 changes: 37 additions & 10 deletions libmeepgeom/material_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,43 @@ typedef struct medium_struct {
} medium_struct;

// prototype for user-defined material function,
// which should allocate, initialize, and return a
// new medium_struct describing the material properties
// at point x
typedef medium_struct *(*user_material_func)(vector3 x, void *user_data);

// which should fill in medium as appropriate to
// describe the material properties at point x
typedef void (*user_material_func)(vector3 x, void *user_data,
medium_struct *medium);

// the various types of materials are as follows:
// MEDIUM: material properties independent of position. In
// this case the 'medium' field below is
// initialized once and doesn't change.
// MATERIAL_FILE: material properties position-dependent, described
// by user-supplied data file. In this case the
// 'medium' field is filled in appropriately at
// each evaluation point by interpolating file data.
// MATERIAL_USER: material properties position-dependent, described
// by user-supplied function. In this case the
// 'medium' field is filled in appropriately at
// each evaluation point by calling the user's
// routine.
// PERFECT_METAL: the 'medium' field is never referenced in this case.
typedef struct material_data_struct
{
enum { MATERIAL_TYPE_SELF, MATERIAL_FUNCTION, PERFECT_METAL, MEDIUM } which_subclass;
enum { MEDIUM,
MATERIAL_FILE, // formerly MATERIAL_TYPE_SELF
MATERIAL_USER, // formerly MATERIAL_FUNCTION
PERFECT_METAL
} which_subclass;

// this field is used for all material types except PERFECT_METAL
medium_struct medium;

// these fields used only if which_subclass==MATERIAL_FUNCTION
// these fields used only if which_subclass==MATERIAL_USER
user_material_func user_func;
void * user_data;

// used only if which_subclass==MEDIUM
medium_struct *medium;
// these fields used only if which_subclass==MATERIAL_FILE
meep::realnum *epsilon_data;
int epsilon_dims[3];

} material_data;

Expand All @@ -92,9 +114,14 @@ typedef struct material_data_struct
int num_items;
} material_type_list;

// global variables and exported functions
// global variables
extern material_type vacuum;

// exported functions for creating particular material types
material_type make_dielectric(double epsilon);
material_type make_user_material(user_material_func user_func,
void *user_data);
material_type make_file_material(char *epsilon_input_file);

void read_epsilon_file(const char *eps_input_file);

Expand Down
Loading