Skip to content

Commit

Permalink
Updating altmath library: SIMD for altmath is now optional
Browse files Browse the repository at this point in the history
  • Loading branch information
lasagnaphil committed Aug 21, 2019
1 parent f38bfa1 commit ad650ff
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 45 deletions.
29 changes: 0 additions & 29 deletions .idea/codeStyles/Project.xml

This file was deleted.

3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ set(ALTLIB_DIR ${PROJECT_SOURCE_DIR}/deps/altlib)
add_subdirectory(${ALTLIB_DIR})

set(ALTMATH_DIR ${PROJECT_SOURCE_DIR}/deps/altmath)
set(altmath_build_tests OFF)
set(altmath_build_tests OFF CACHE BOOL "Turn off tests.")
add_subdirectory(${ALTMATH_DIR})


set(LIBRARY_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
file(GLOB_RECURSE LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)

Expand Down
2 changes: 1 addition & 1 deletion demo/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <SDL.h>

#include "vec2d.h"
#include "vec2.h"
#include "Camera2D.h"
#include "FluidSim2D.h"
#include "FluidRenderer2D.h"
Expand Down
2 changes: 2 additions & 0 deletions demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ file(GLOB DEMO_HEADERS *.h)

add_executable(fluid_sim_demo ${DEMO_SOURCES} ${DEMO_HEADERS})

# target_compile_definitions(fluid_sim_demo PUBLIC ALTMATH_USE_SIMD)

target_link_libraries(fluid_sim_demo LINK_PUBLIC fluid_sim)
target_link_libraries(fluid_sim_demo PUBLIC altlib)
target_link_libraries(fluid_sim_demo PUBLIC altmath)
Expand Down
2 changes: 1 addition & 1 deletion demo/Camera2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <StackVec.h>
#include "vec2.h"
#include "mat4f.h"
#include "mat4.h"

#include "InputManager.h"

Expand Down
2 changes: 1 addition & 1 deletion demo/FluidRenderer2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "FluidRenderer2D.h"

#include <vec4f.h>
#include <vec4.h>
#include "App.h"
#include "FluidSim2D.h"

Expand Down
4 changes: 2 additions & 2 deletions demo/Shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#include "Storage.h"
#include "StringPool.h"

#include <mat4f.h>
#include <mat4.h>
#include <vec2.h>
#include <vec3.h>
#include <vec4f.h>
#include <vec4.h>

struct Shader {
GLuint id;
Expand Down
6 changes: 3 additions & 3 deletions demo/Transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#ifndef ALTLIB_TRANSFORM_H
#define ALTLIB_TRANSFORM_H

#include <vec4f.h>
#include <quatf.h>
#include <mat4f.h>
#include <vec4.h>
#include <quat.h>
#include <mat4.h>
#include <mat_utils.h>

struct Transform {
Expand Down
5 changes: 3 additions & 2 deletions include/Array2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

#include <math_utils.h>
#include <vec_utils.h>
#include <vec2d.h>
#include <vec2dx4.h>
#include <vec2.h>
#include "immintrin.h"

template <typename T>
Expand Down Expand Up @@ -376,6 +375,7 @@ struct Array2D<double> {
(*this)(x2, y2) += disp.x * disp.y * value;
}

/*
void linearDistribute(vec2dx4 pos, vec4d value) {
auto floor = aml::toInt(aml::floor(pos));
auto disp = vec2dx4 {pos.x - aml::toDouble(floor.x), pos.y - aml::toDouble(floor.y)};
Expand All @@ -397,6 +397,7 @@ struct Array2D<double> {
(*this)(x2.v[i], y2.v[i]) += v4.v[i];
}
}
*/

double linearExtract(vec2d pos) {
int ui = (int) pos.x;
Expand Down
2 changes: 1 addition & 1 deletion include/FluidSim2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <cstdint>
#include <StackVec.h>
#include <vec2d.h>
#include <vec2.h>
#include "Array2D.h"
#include "MACGrid2D.h"
#include "PerformanceCounter.h"
Expand Down
3 changes: 1 addition & 2 deletions src/FluidSim2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//

#include <ctime>
#include <vec2dx4.h>
#include <math_utils.h>
#include <Defer.h>
#include <Queue.h>
Expand Down Expand Up @@ -595,7 +594,7 @@ void FluidSim2D::applyAdvection() {
auto nextPos = pos + (2./9.)*dt*k1 + (3./9.)*dt*k2 + (4./9.)*dt*k3;
nextPos = clampPos(nextPos);

if (isnan(pos.x) || isnan(pos.y)) {
if (std::isnan(pos.x) || std::isnan(pos.y)) {
log_error("Advected position is NaN! pos=(%d, %d), idx=%d", pos.x, pos.y, i);
exit(1);
}
Expand Down

0 comments on commit ad650ff

Please sign in to comment.