Skip to content
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
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -311,23 +311,30 @@ if(USE_MKL)
target_include_directories(febioopt PRIVATE ${MKL_INC})
target_compile_definitions(febioopt PRIVATE MKL_ISS PARDISO)

target_include_directories(feimglib PRIVATE ${MKL_INC})
target_compile_definitions(feimglib PRIVATE HAVE_MKL)

if(WIN32 OR APPLE)
target_link_libraries(numcore PRIVATE ${MKL_OMP_LIB} ${MKL_LIBS})
target_link_libraries(febioopt PRIVATE ${MKL_OMP_LIB} ${MKL_LIBS})
target_link_libraries(feimglib PRIVATE ${MKL_OMP_LIB} ${MKL_LIBS})
else()
target_link_libraries(numcore PRIVATE -Wl,--start-group ${MKL_OMP_LIB} ${MKL_LIBS} -Wl,--end-group)
target_link_libraries(febioopt PRIVATE -Wl,--start-group ${MKL_OMP_LIB} ${MKL_LIBS} -Wl,--end-group)
target_link_libraries(feimglib PRIVATE -Wl,--start-group ${MKL_OMP_LIB} ${MKL_LIBS} -Wl,--end-group)
endif()

if(FORCE_SYSTEM_OMP)
target_link_libraries(numcore PRIVATE ${OpenMP_C_LIBRARIES})
target_link_libraries(febioopt PRIVATE ${OpenMP_C_LIBRARIES})
target_link_libraries(feimglib PRIVATE ${OpenMP_C_LIBRARIES})
endif()
else()
# If not using MKL, we still need OpenMP from the system.
if(${OpenMP_C_FOUND})
target_link_libraries(numcore PRIVATE ${OpenMP_C_LIBRARIES})
target_link_libraries(febioopt PRIVATE ${OpenMP_C_LIBRARIES})
target_link_libraries(feimglib PRIVATE ${OpenMP_C_LIBRARIES})
endif()
endif()

Expand Down
8 changes: 5 additions & 3 deletions FEImgLib/ImageMap.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//#include "stdafx.h"
#include "ImageMap.h"
#include "math.h"
#include "algorithm"
#include "iostream"

ImageMap::ImageMap(Image& img) : m_img(img)
{
Expand Down Expand Up @@ -32,9 +34,9 @@ ImageMap::POINT ImageMap::map(const vec3d& p)
double dy = 1.0 / (double) (ny - 1);
double dz = (nz>1?1.0 / (double) (nz - 1):1.0);

int i = (int) floor(x*(nx - 1));
int j = (int) floor(y*(ny - 1));
int k = (int) floor(z*(nz - 1));
int i = (int) std::max(floor(x * (nx - 1)), 0.0);
int j = (int) std::max(floor(y * (ny - 1)), 0.0);
int k = (int) std::max(floor(z * (nz - 1)), 0.0);

if (i == nx-1) i--;
if (j == ny-1) j--;
Expand Down
4 changes: 3 additions & 1 deletion FEImgLib/image_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ FEIMGLIB_API void fftblur_2d(Image& trg, Image& src, float d)
float* y = trg.data();

// for zero blur radius, we just copy the image
// SL: Why not copy i.e. if (d <= 0) { trg = src; return; }?
if (d <= 0.f)
{
for (int i = 0; i < nx * ny; ++i) y[i] = x[i];
Expand Down Expand Up @@ -166,9 +167,10 @@ FEIMGLIB_API void fftblur_3d(Image& trg, Image& src, float d)
float* y = trg.data();

// for zero blur radius, we just copy the image
// SL: Why not copy i.e. if (d <= 0) { trg = src; return; }?
if (d <= 0.f)
{
for (int i = 0; i < nx * ny*nz; ++i) y[i] = x[i];
for (int i = 0; i < nx * ny * nz; ++i) y[i] = x[i];
return;
}

Expand Down
Loading