Skip to content

Commit

Permalink
20240208: Changes by Erol Cemiloglu
Browse files Browse the repository at this point in the history
changed main loop window draw array inclusion so works on windows OS
  • Loading branch information
erolcem committed Feb 8, 2024
1 parent 67aceaf commit 0544563
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
build
out
bld_vc
.cache
.idea
.vs
Expand Down
4 changes: 2 additions & 2 deletions headers/const.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

constexpr int N = 20;
constexpr int N = 50;
constexpr int SIZE = (N + 2) * (N + 2);
constexpr int CELL_SIZE = 30;
constexpr int CELL_SIZE = 15;

#define IX(i, j) (i + (N + 2) * j)
#define SWAP(arr1, arr2) std::swap(arr1, arr2)
2 changes: 1 addition & 1 deletion headers/matrix_change.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ template <int S> class DensitySolver {
std::array<float, S> x;

DensitySolver(float diff, float dt)
: size_(SIZE), diff_(diff), dt_(dt), u_{2.0f}, v_{2.0f}, x{0.0f},
: size_(SIZE), diff_(diff), dt_(dt), u_{0.01f}, v_{0.01f}, x{0.0f},
x0_{0.0f} {}

void add_density(float d, int index) {
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ an SFML window
void GreyScaleMatrixToSFML(sf::RenderWindow &window,
const std::array<float, SIZE> &densityArray) {
for (int i = 0; i < N + 2; i++) {
for (int j = 0; j <= N + 2; j++) {
for (int j = 0; j < N + 2; j++) {

sf::RectangleShape pixel(sf::Vector2f(CELL_SIZE, CELL_SIZE));
pixel.setPosition((j * CELL_SIZE), (i * CELL_SIZE));
Expand Down Expand Up @@ -93,7 +93,7 @@ int main() {
ds.add_density(1, 435);

fluid_gui.update_display(GreyScaleMatrixToSFML, ds.x);
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(std::chrono::milliseconds(5));
// ds.test_display();
ds.dens_step();
}
Expand Down

0 comments on commit 0544563

Please sign in to comment.