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

Minor upgrades #12

Merged
merged 2 commits into from
Oct 9, 2023
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: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ if(GUI)
target_compile_definitions(Aether_GUI PUBLIC -DGTK_RMV_RESIZE -DWX30_RESTRICT)
endif()
endif()

source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${base_gui} ${gui_src} ${gl_tools_src} ${gl3w}
${extra_sources} ${fd_solver} ${fdfd_core} ${fdtd_core}
${fdtd_modes} ${lua_src}
${math_src} ${multilayers_src} ${sensor_src}
${selene_src} ${source_src} ${structure_src})

if(OLD_ITERATOR)
add_definitions(-DLINUX_ITERATOR_TWEAK)
Expand Down
10 changes: 5 additions & 5 deletions contribs/build_mingw/build_dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ cmake --install "cmake_build"
###########

cd ${sources_path}
if(!(Test-Path zlib1213.zip))
if(!(Test-Path zlib13.zip))
{
Invoke-WebRequest -URI https://zlib.net/zlib1213.zip -OutFile zlib1213.zip
Expand-Archive -Force ./zlib1213.zip
Invoke-WebRequest -URI https://zlib.net/zlib13.zip -OutFile zlib13.zip
Expand-Archive -Force ./zlib13.zip
}
cd zlib1213/zlib-1.2.13
cd zlib13/zlib-1.3
cmake -B "cmake_build" -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX="${build_path}/zlib" -DCMAKE_BUILD_TYPE=Release
cmake --build "cmake_build" --config Release --parallel 8
cmake --install "cmake_build"
Expand Down Expand Up @@ -64,7 +64,7 @@ if(!(Test-Path freetype.zip))
Invoke-WebRequest -UserAgent "Wget" -URI https://sourceforge.net/projects/freetype/files/latest/download -OutFile freetype.zip
Expand-Archive -Force ./freetype.zip
}
cd freetype/freetype-2.13.1
cd freetype/freetype-2.13.2
cmake -B "cmake_build" -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX="${build_path}/freetype" -DCMAKE_BUILD_TYPE=Release `
-DFT_DISABLE_HARFBUZZ=ON `
-DFT_DISABLE_BZIP2=ON `
Expand Down
10 changes: 5 additions & 5 deletions contribs/build_vs2022/build_dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ cmake --install "cmake_build"
###########

cd ${sources_path}
if(!(Test-Path zlib1213.zip))
if(!(Test-Path zlib13.zip))
{
Invoke-WebRequest -URI https://zlib.net/zlib1213.zip -OutFile zlib1213.zip
Expand-Archive -Force ./zlib1213.zip
Invoke-WebRequest -URI https://zlib.net/zlib13.zip -OutFile zlib13.zip
Expand-Archive -Force ./zlib13.zip
}
cd zlib1213/zlib-1.2.13
cd zlib13/zlib-1.3
cmake -B "cmake_build" -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX="${build_path}/zlib" -DCMAKE_BUILD_TYPE=Release
cmake --build "cmake_build" --config Release --parallel 8
cmake --install "cmake_build"
Expand Down Expand Up @@ -72,7 +72,7 @@ if(!(Test-Path freetype.zip))
Invoke-WebRequest -UserAgent "Wget" -URI https://sourceforge.net/projects/freetype/files/latest/download -OutFile freetype.zip
Expand-Archive -Force ./freetype.zip
}
cd freetype/freetype-2.13.1
cd freetype/freetype-2.13.2
cmake -B "cmake_build" -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX="${build_path}/freetype" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${build_path}/zlib" `
-DFT_DISABLE_HARFBUZZ=ON `
-DFT_DISABLE_BZIP2=ON `
Expand Down
6 changes: 3 additions & 3 deletions src/GUI/Selene/gui_selene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ SeleneFrame::SeleneFrame(wxString const &title)
irfs.resize(4);

irfs[0].set_type_fresnel(); irfs[0].name="Fresnel";
irfs[1].set_type(Sel::IRF_PERF_ABS); irfs[1].name="Perfect Absorber";
irfs[2].set_type(Sel::IRF_PERF_ANTIREF); irfs[2].name="Perfect Antireflector";
irfs[3].set_type(Sel::IRF_PERF_MIRROR); irfs[3].name="Perfect Mirror";
irfs[1].set_type(Sel::IRF_Type::PERF_ABS); irfs[1].name="Perfect Absorber";
irfs[2].set_type(Sel::IRF_Type::PERF_ANTIREF); irfs[2].name="Perfect Antireflector";
irfs[3].set_type(Sel::IRF_Type::PERF_MIRROR); irfs[3].name="Perfect Mirror";

// UI

Expand Down
6 changes: 3 additions & 3 deletions src/GUI/Selene/gui_selene_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,11 @@ void SeleneFrame::save_project(wxFileName const &fname_)
file<<name<<":type(";
switch(user_irfs[i]->type)
{
case Sel::IRF_GRATING:
case Sel::IRF_Type::GRATING:
file<<"\"grating\","<<user_irfs[i]->grat_ref_path.generic_string()<<","
<<user_irfs[i]->grat_ref_path.generic_string()<<")\n";
break;
case Sel::IRF_MULTILAYER:
case Sel::IRF_Type::MULTILAYER:
file<<"\"multilayer\")\n";

for(std::size_t j=0;j<user_irfs[i]->ml_heights.size();j++)
Expand All @@ -415,7 +415,7 @@ void SeleneFrame::save_project(wxFileName const &fname_)
file<<name<<":add_layer("<<user_irfs[i]->ml_heights[j]<<","<<mtr(mat)<<")\n";
}
break;
case Sel::IRF_SNELL_SPLITTER:
case Sel::IRF_Type::SNELL_SPLITTER:
file<<"\"snell_splitter\","<<user_irfs[i]->splitting_factor<<")\n";
break;
default:
Expand Down
6 changes: 3 additions & 3 deletions src/GUI/Selene/gui_selene_materials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ IRF_Panel::IRF_Panel(wxWindow *parent,Sel::IRF const &irf)

switch(irf.type)
{
case Sel::IRF_GRATING: type->SetSelection(0); break;
case Sel::IRF_MULTILAYER: type->SetSelection(1); break;
case Sel::IRF_SNELL_SPLITTER: type->SetSelection(2); break;
case Sel::IRF_Type::GRATING: type->SetSelection(0); break;
case Sel::IRF_Type::MULTILAYER: type->SetSelection(1); break;
case Sel::IRF_Type::SNELL_SPLITTER: type->SetSelection(2); break;
}

type->Bind(wxEVT_CHOICE,&IRF_Panel::evt_irf_type,this);
Expand Down
50 changes: 25 additions & 25 deletions src/Selene/sel_irf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Sel
//####################

IRF::IRF()
:type(IRF_NONE),
:type(IRF_Type::NONE),
scatt_ref(0),
splitting_factor(0),
Nl(0), Nth(0)
Expand Down Expand Up @@ -73,7 +73,7 @@ IRF::IRF(IRF const &irf)

void IRF::bootstrap()
{
if(type==IRF_MULTILAYER)
if(type==IRF_Type::MULTILAYER)
ml_model.set_N_layers(ml_heights.size());
}

Expand Down Expand Up @@ -144,15 +144,15 @@ bool IRF::get_response(Vector3 &out_dir,Vector3 &out_polar,
Vector3 S_vec;
bool is_TE=determine_polarization(S_vec,Fnorm,in_dir,in_polar,is_near_normal);

if(type==IRF_FRESNEL) ray_abs=get_response_fresnel(out_dir,in_dir,Fnorm,n_scal,lambda,n1,n2,is_TE,is_near_normal);
else if(type==IRF_MULTILAYER) ray_abs=get_response_multilayer(out_dir,in_dir,Fnorm,n_scal,lambda,n1,n2,is_TE,is_near_normal);
else if(type==IRF_PERF_ABS)
if(type==IRF_Type::FRESNEL) ray_abs=get_response_fresnel(out_dir,in_dir,Fnorm,n_scal,lambda,n1,n2,is_TE,is_near_normal);
else if(type==IRF_Type::MULTILAYER) ray_abs=get_response_multilayer(out_dir,in_dir,Fnorm,n_scal,lambda,n1,n2,is_TE,is_near_normal);
else if(type==IRF_Type::PERF_ABS)
{
return true;
}
else if(type==IRF_PERF_ANTIREF) ray_abs=get_response_perf_antiref(in_dir,out_dir,Fnorm,lambda,n1,n2);
else if(type==IRF_PERF_MIRROR) compute_snell_reflection(out_dir,in_dir,Fnorm,n_scal);
else if(type==IRF_SCATT_ABS)
else if(type==IRF_Type::PERF_ANTIREF) ray_abs=get_response_perf_antiref(in_dir,out_dir,Fnorm,lambda,n1,n2);
else if(type==IRF_Type::PERF_MIRROR) compute_snell_reflection(out_dir,in_dir,Fnorm,n_scal);
else if(type==IRF_Type::SCATT_ABS)
{
double p=randp();

Expand All @@ -167,18 +167,18 @@ bool IRF::get_response(Vector3 &out_dir,Vector3 &out_polar,
}
else return true;
}
else if(type==IRF_GRATING) ray_abs=get_response_grating(in_dir,out_dir,Fnorm,Ftangent,lambda,n1,n2);
else if(type==IRF_SNELL_SCATT_FILE) ray_abs=get_response_snell_scatt_file(in_dir,out_dir,Fnorm,lambda,n1,n2);
else if(type==IRF_SNELL_FILE) ray_abs=get_response_snell_file(in_dir,out_dir,Fnorm,lambda,n1,n2);
else if(type==IRF_SNELL_SPLITTER) ray_abs=get_response_snell_splitter(in_dir,out_dir,Fnorm,lambda,n1,n2);
else if(type==IRF_Type::GRATING) ray_abs=get_response_grating(in_dir,out_dir,Fnorm,Ftangent,lambda,n1,n2);
else if(type==IRF_Type::SNELL_SCATT_FILE) ray_abs=get_response_snell_scatt_file(in_dir,out_dir,Fnorm,lambda,n1,n2);
else if(type==IRF_Type::SNELL_FILE) ray_abs=get_response_snell_file(in_dir,out_dir,Fnorm,lambda,n1,n2);
else if(type==IRF_Type::SNELL_SPLITTER) ray_abs=get_response_snell_splitter(in_dir,out_dir,Fnorm,lambda,n1,n2);

out_dir.normalize();

if( type==IRF_FRESNEL
|| type==IRF_MULTILAYER
|| type==IRF_PERF_ANTIREF
|| type==IRF_PERF_MIRROR
|| type==IRF_SNELL_SPLITTER)
if( type==IRF_Type::FRESNEL
|| type==IRF_Type::MULTILAYER
|| type==IRF_Type::PERF_ANTIREF
|| type==IRF_Type::PERF_MIRROR
|| type==IRF_Type::SNELL_SPLITTER)
{
if(is_TE) out_polar=S_vec;
else out_polar=crossprod(out_dir,S_vec);
Expand Down Expand Up @@ -667,7 +667,7 @@ void IRF::operator = (IRF const &irf)
g3_tra=irf.g3_tra;
}

void IRF::set_type(int type_)
void IRF::set_type(IRF_Type type_)
{
type=type_;
}
Expand All @@ -676,7 +676,7 @@ void IRF::set_type_grating(std::string ref_fname,std::string tra_fname)
{
int l,p,q;

type=IRF_GRATING;
type=IRF_Type::GRATING;

grat_ref_path=ref_fname;
grat_tra_path=tra_fname;
Expand Down Expand Up @@ -831,17 +831,17 @@ void IRF::set_type_grating(std::string ref_fname,std::string tra_fname)

void IRF::set_type_fresnel()
{
type=IRF_FRESNEL;
type=IRF_Type::FRESNEL;
}

void IRF::set_type_multilayer()
{
type=IRF_MULTILAYER;
type=IRF_Type::MULTILAYER;
}

void IRF::set_type_scatt_abs(double ref)
{
type=IRF_SCATT_ABS;
type=IRF_Type::SCATT_ABS;
scatt_ref=ref;
}

Expand All @@ -864,7 +864,7 @@ void IRF::set_type_snell_file(std::string fname)

double tmp;

type=IRF_SNELL_FILE;
type=IRF_Type::SNELL_FILE;

int Nc=fcountlines(fname);

Expand Down Expand Up @@ -895,7 +895,7 @@ void IRF::set_type_snell_scatt_file(std::string fname)
{
int i;

type=IRF_SNELL_SCATT_FILE;
type=IRF_Type::SNELL_SCATT_FILE;

std::vector<std::vector<double>> data;

Expand Down Expand Up @@ -926,7 +926,7 @@ void IRF::set_type_snell_scatt_file(std::string fname)
void IRF::set_type_snell_splitter(double splitting_factor_)
{
splitting_factor=splitting_factor_;
type=IRF_SNELL_SPLITTER;
type=IRF_Type::SNELL_SPLITTER;
}

}
6 changes: 3 additions & 3 deletions src/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,9 @@ int mode_choice(lua_State *L)
perfect_mirror_IRF;

fresnel_IRF.set_type_fresnel();
perfect_abs_IRF.set_type(Sel::IRF_PERF_ABS);
perfect_antiref_IRF.set_type(Sel::IRF_PERF_ANTIREF);
perfect_mirror_IRF.set_type(Sel::IRF_PERF_MIRROR);
perfect_abs_IRF.set_type(Sel::IRF_Type::PERF_ABS);
perfect_antiref_IRF.set_type(Sel::IRF_Type::PERF_ANTIREF);
perfect_mirror_IRF.set_type(Sel::IRF_Type::PERF_MIRROR);

lua_pushlightuserdata(L,reinterpret_cast<void*>(&fresnel_IRF));
lua_setglobal(L,"SEL_IRF_FRESNEL");
Expand Down
34 changes: 19 additions & 15 deletions src/include/selene/selene_mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,25 @@ limitations under the License.*/
namespace Sel
{

enum class IRF_Type
{
FRESNEL,
FRESNEL_SCATT,
GRATING,
LAMBERT,
MULTILAYER,
NONE,
PERF_ABS,
PERF_ANTIREF,
PERF_MIRROR,
SCATT_ABS,
SNELL_FILE,
SNELL_SCATT_FILE,
SNELL_SPLITTER
};

enum
{
IRF_FRESNEL,
IRF_FRESNEL_SCATT,
IRF_GRATING,
IRF_LAMBERT,
IRF_MULTILAYER,
IRF_NONE,
IRF_PERF_ABS,
IRF_PERF_ANTIREF,
IRF_PERF_MIRROR,
IRF_SCATT_ABS,
IRF_SNELL_FILE,
IRF_SNELL_SCATT_FILE,
IRF_SNELL_SPLITTER,
TANGENT_UNSET,
TANGENT_FIXED,
TANGENT_EXPAND,
Expand Down Expand Up @@ -66,7 +70,7 @@ class smp_order
class IRF
{
public:
int type;
IRF_Type type;
std::string name;

std::string ref_fname;
Expand Down Expand Up @@ -147,7 +151,7 @@ class IRF
bool near_normal(double n_scal);
void operator = (IRF const &IRF);

void set_type(int type);
void set_type(IRF_Type type);
void set_type_grating(std::string ref_fname,std::string tra_fname);
void set_type_fresnel();
void set_type_multilayer();
Expand Down