Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin-Duignan committed Mar 5, 2024
2 parents 15dc5e9 + 852d5da commit ae6b4ac
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 12 deletions.
64 changes: 64 additions & 0 deletions CMakeCache.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# This is the CMakeCache file.
# For build in directory: /Users/ahnafmasud/Documents/GitHub/FluidSim
# It was generated by CMake: /opt/homebrew/Cellar/cmake/3.28.3/bin/cmake
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
# VALUE is the current value for the KEY.

########################
# EXTERNAL cache entries
########################

//Value Computed by CMake.
CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=/Users/ahnafmasud/Documents/GitHub/FluidSim/CMakeFiles/pkgRedirects

//No help, variable specified on the command line.
CMAKE_MAKE_PROGRAM:UNINITIALIZED=/usr/bin/make

//No help, variable specified on the command line.
CMAKE_TOOLCHAIN_FILE:UNINITIALIZED=C:srcvcpkgscriptsbuildsystemsvcpkg.cmake


########################
# INTERNAL cache entries
########################

//This is the directory where this CMakeCache.txt was created
CMAKE_CACHEFILE_DIR:INTERNAL=/Users/ahnafmasud/Documents/GitHub/FluidSim
//Major version of cmake used to create the current loaded cache
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
//Minor version of cmake used to create the current loaded cache
CMAKE_CACHE_MINOR_VERSION:INTERNAL=28
//Patch version of cmake used to create the current loaded cache
CMAKE_CACHE_PATCH_VERSION:INTERNAL=3
//Path to CMake executable.
CMAKE_COMMAND:INTERNAL=/opt/homebrew/Cellar/cmake/3.28.3/bin/cmake
//Path to cpack program executable.
CMAKE_CPACK_COMMAND:INTERNAL=/opt/homebrew/Cellar/cmake/3.28.3/bin/cpack
//Path to ctest program executable.
CMAKE_CTEST_COMMAND:INTERNAL=/opt/homebrew/Cellar/cmake/3.28.3/bin/ctest
//Path to cache edit program executable.
CMAKE_EDIT_COMMAND:INTERNAL=/opt/homebrew/Cellar/cmake/3.28.3/bin/ccmake
//Name of external makefile project generator.
CMAKE_EXTRA_GENERATOR:INTERNAL=
//Name of generator.
CMAKE_GENERATOR:INTERNAL=Unix Makefiles
//Generator instance identifier.
CMAKE_GENERATOR_INSTANCE:INTERNAL=
//Name of generator platform.
CMAKE_GENERATOR_PLATFORM:INTERNAL=
//Name of generator toolset.
CMAKE_GENERATOR_TOOLSET:INTERNAL=
//Source directory with the top level CMakeLists.txt file for this
// project
CMAKE_HOME_DIRECTORY:INTERNAL=/Users/ahnafmasud/Documents/GitHub/FluidSim
//number of local generators
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1
//Path to CMake installation.
CMAKE_ROOT:INTERNAL=/opt/homebrew/Cellar/cmake/3.28.3/share/cmake

1 change: 1 addition & 0 deletions CMakeFiles/cmake.check_cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This file is generated by cmake for dependency checking of the CMakeCache.txt file
6 changes: 3 additions & 3 deletions headers/event_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class EventManager {
// fmt::println("Mouse button pressed event received");

if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) {
// fmt::println("Mouse left pressed");
fmt::println("Mouse left pressed");

auto x = event.mouseButton.x / S_CELL_SIZE;
auto y = event.mouseButton.y / S_CELL_SIZE;
Expand All @@ -40,7 +40,7 @@ class EventManager {
return 0;
}

// fmt::println("Left mouse button was pressed at ({}, {})", x, y);
fmt::println("Left mouse button was pressed at ({}, {})", x, y);

return IX(static_cast<size_t>(y), static_cast<size_t>(x));
}
Expand Down Expand Up @@ -70,7 +70,7 @@ class EventManager {
auto y = mousePos.y / S_CELL_SIZE;

if (0 <= x && x <= S_AXIS_SIZE && 0 <= y && y <= S_AXIS_SIZE) [[likely]] {
fmt::println("Left mouse button is being held down at ({}, {})", x, y);
//fmt::println("Left mouse button is being held down at ({}, {})", x, y);

return IX(sign_cast(y), sign_cast(x));
}
Expand Down
21 changes: 12 additions & 9 deletions headers/matrix_change.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DensitySolver {
: m_diffuse_changer { 20 }
, m_diff { 0.0f }
, m_dt { 0.0f }
, m_u { 0.0f }
, m_u { 0.51f }
, m_v { 0.0f }
, m_x0 { 0.0f }
, m_x { 0.0f }
Expand All @@ -37,8 +37,8 @@ class DensitySolver {
: m_diffuse_changer { 20 }
, m_diff { diff }
, m_dt { dt }
, m_u { 0.01f }
, m_v { 0.01f }
, m_u { 0.51f }
, m_v { 1.01f }
, m_x0 { 0.0f }
, m_x { 0.0f }
{
Expand Down Expand Up @@ -100,7 +100,7 @@ class DensitySolver {
}
}

void _M_set_bnd(int b) {
void _M_set_bnd(int b) {
for (size_t i = 1; i <= AXIS_SIZE; i++) {
m_x[IX(0, i)] = b == 1 ? -m_x[IX(1, i)] : m_x[IX(1, i)];
m_x[IX(AXIS_SIZE + 1, i)] = b == 1 ? -m_x[IX(AXIS_SIZE, i)] : m_x[IX(AXIS_SIZE, i)];
Expand All @@ -111,7 +111,7 @@ class DensitySolver {
m_x[IX(0, AXIS_SIZE + 1)] = 0.5f * (m_x[IX(1, AXIS_SIZE + 1)] + m_x[IX(0, AXIS_SIZE)]);
m_x[IX(AXIS_SIZE + 1, 0)] = 0.5f * (m_x[IX(AXIS_SIZE, 0)] + m_x[IX(AXIS_SIZE + 1, 1)]);
m_x[IX(AXIS_SIZE + 1, AXIS_SIZE + 1)] = 0.5f * (m_x[IX(AXIS_SIZE, AXIS_SIZE + 1)] + m_x[IX(AXIS_SIZE + 1, AXIS_SIZE)]);
}
}
auto _M_diffuse() -> void
{
float a = m_dt * m_diff * AXIS_SIZE * AXIS_SIZE;
Expand All @@ -124,7 +124,7 @@ class DensitySolver {
}
}

_M_set_bnd(0);
_M_set_bnd(2);
}
}

Expand All @@ -134,13 +134,13 @@ class DensitySolver {

for (auto i = 1uL; i <= AXIS_SIZE; i++) {
for (auto j = 1uL; j <= AXIS_SIZE; j++) {
auto a = static_cast<float>(i) - dt0 * m_u[IX(i, j)];
auto b = static_cast<float>(j) - dt0 * m_v[IX(i, j)];
auto a = static_cast<float>(i) - dt0 * 0.051f;//m_u[IX(i, j)];
auto b = static_cast<float>(j) - dt0 * 0.05f;//m_v[IX(i, j)];

// Clamp values to ensure they stay within bounds
a = std::max(0.5f, std::min(static_cast<float>(AXIS_SIZE) + 0.5f, a));
b = std::max(0.5f, std::min(static_cast<float>(AXIS_SIZE) + 0.5f, b));

auto i0 = static_cast<size_t>(a);
auto i1 = i0 + 1;
auto j0 = static_cast<size_t>(b);
Expand All @@ -150,8 +150,11 @@ class DensitySolver {
auto s0 = 1 - s1;
auto t1 = b - static_cast<float>(j0);
auto t0 = 1 - t1;



m_x[IX(i, j)] = s0 * (t0 * m_x0[IX(i0, j0)] + t1 * m_x0[IX(i0, j1)]) + s1 * (t0 * m_x0[IX(i1, j0)] + t1 * m_x0[IX(i1, j1)]);

}
}

Expand Down

0 comments on commit ae6b4ac

Please sign in to comment.