diff --git a/CMakeLists.txt b/CMakeLists.txt index b19e91e..e59df60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ #Specify the version being used aswell as the language -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.19) #Name your project here project(bimsim) @@ -10,7 +10,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}") find_package(CUDA) #find OpenCV -find_package(OpenCV REQUIRED ) +#find_package(OpenCV REQUIRED ) find_package(Boost REQUIRED) diff --git a/FindSTIM.cmake b/FindSTIM.cmake index bf5762a..c05f9f6 100644 --- a/FindSTIM.cmake +++ b/FindSTIM.cmake @@ -1,9 +1,27 @@ +# finds the STIM library (downloads it if it isn't present) +# set STIMLIB_PATH to the directory containing the stim subdirectory (the stim repository) + include(FindPackageHandleStandardArgs) -set(STIM_INCLUDE_DIR $ENV{STIMLIB_PATH}) +set(STIM_ROOT $ENV{STIM_ROOT}) + +IF(NOT UNIX) + IF(NOT STIM_ROOT) + MESSAGE("ERROR: STIM_ROOT environment variable must be set!") + ENDIF(NOT STIM_ROOT) -find_package_handle_standard_args(STIM DEFAULT_MSG STIM_INCLUDE_DIR) + FIND_PATH(STIM_INCLUDE_DIRS DOC "Path to GLFW include directory." + NAMES stim/image/image.h + PATHS ${STIM_ROOT}) +ENDIF(NOT UNIX) + +find_package_handle_standard_args(STIM DEFAULT_MSG STIM_INCLUDE_DIRS) if(STIM_FOUND) - set(STIM_INCLUDE_DIRS ${STIM_INCLUDE_DIR}) -endif() + set(STIM_INCLUDE_DIRS ${STIM_INCLUDE_DIRS}) +elseif(STIM_FOUND) + message("STIM library not found. Set the STIM_ROOT environment variable to the STIM location.") + message("STIMLIB can be found here: https://git.stim.ee.uh.edu/codebase/stimlib") +endif(STIM_FOUND) + +find_package_handle_standard_args(STIM DEFAULT_MSG STIM_INCLUDE_DIRS) diff --git a/bimsim.cu b/bimsim.cu index 2899b2f..7f1289d 100644 --- a/bimsim.cu +++ b/bimsim.cu @@ -356,7 +356,7 @@ int main(int argc, char* argv[]){ beam.eval(E0, g_Nl); //evaluate the incident field if(g_debug_images && s == 0){ - stim::filename incident_file = outfile.prefix(outfile.prefix() + "_0_nfi"); + stim::filename incident_file = outfile.with_prefix(outfile.prefix() + "_0_nfi"); E0.image(incident_file.str(), stim::complexMag); } E0.lowpass(stim::TAU / g_lambda * g_NA_obj[1]); //apply the objective cut-off filter to generate the far-field image @@ -366,14 +366,14 @@ int main(int argc, char* argv[]){ spheres.eval(E, beam, g_Nl, g_MC); if(g_debug_images && s == 0){ - stim::filename nf_file = outfile.prefix(outfile.prefix() + "_1_nfs"); + stim::filename nf_file = outfile.with_prefix(outfile.prefix() + "_1_nfs"); E.image(nf_file.str(), stim::complexMag); } E.propagate(g_backprop, stim::TAU / g_lambda); //propagate the field back to the origin if(g_debug_images && s == 0){ - stim::filename propagate_file = outfile.prefix(outfile.prefix()+"_2_nfprop"); + stim::filename propagate_file = outfile.with_prefix(outfile.prefix()+"_2_nfprop"); E.image(propagate_file.str(), stim::complexMag); } @@ -382,7 +382,7 @@ int main(int argc, char* argv[]){ Eff.intensity(I); //calculate the far field intensity and add it to the single-beam image if(g_debug_images && s == 0){ - stim::filename cropped_file = outfile.prefix(outfile.prefix() + "_3_cropped"); + stim::filename cropped_file = outfile.with_prefix(outfile.prefix() + "_3_cropped"); Eff.image(cropped_file.str(), stim::complexMag); } P = (double)(s + 1) / (double)g_sources.size() * 100; @@ -396,15 +396,15 @@ int main(int argc, char* argv[]){ //save the near-field image if (g_debug_images) { - stim::filename nearfield_real_file = outfile.prefix(outfile.prefix() + "_3_detector_real"); + stim::filename nearfield_real_file = outfile.with_prefix(outfile.prefix() + "_3_detector_real"); E.image(nearfield_real_file.str(), stim::complexReal); - stim::filename nearfield_imag_file = outfile.prefix(outfile.prefix() + "_3_detector_imag"); + stim::filename nearfield_imag_file = outfile.with_prefix(outfile.prefix() + "_3_detector_imag"); E.image(nearfield_imag_file.str(), stim::complexImaginary); } //save the background and single-beam images - stim::filename background_file = outfile.prefix(outfile.prefix() + "background"); - stim::filename intensity_file = outfile.prefix(outfile.prefix() + "intensity"); + stim::filename background_file = outfile.with_prefix(outfile.prefix() + "background"); + stim::filename intensity_file = outfile.with_prefix(outfile.prefix() + "intensity"); if (use_cuda) { stim::gpu2image(I0, background_file.str(), g_R_ff, g_R_ff, stim::cmBrewer); @@ -419,6 +419,6 @@ int main(int argc, char* argv[]){ float* A; HANDLE_ERROR( cudaMalloc(&A, sizeof(float) * g_R_ff * g_R_ff) ); gpu_absorbance(A, I, I0, g_R_ff * g_R_ff); - stim::filename absorbance_file = outfile.prefix(outfile.prefix() + "absorbance"); + stim::filename absorbance_file = outfile.with_prefix(outfile.prefix() + "absorbance"); stim::gpu2image(A, absorbance_file.str(), g_R_ff, g_R_ff, stim::cmBrewer); } \ No newline at end of file -- libgit2 0.21.4