From ef65c6994aa9e74359d9e25f93222026f2e22a4c Mon Sep 17 00:00:00 2001 From: adany292 <adany292@student.liu.se> Date: Sun, 8 Dec 2024 21:01:31 +0100 Subject: [PATCH] MOved files not used by FludiSimulatorApp to deeprecated dir old_src, src dir now only inludes used files --- {src => old_src}/CMakeLists.txt | 0 old_src/Camera.cpp | 88 +++++++++ {src => old_src}/GUI_fluid_sim.cpp | 0 {src => old_src}/MakeFile_Alt.txt | 0 {src => old_src}/Makefile | 0 {src => old_src}/Particle.h | 0 old_src/constants.h | 21 +++ old_src/include/Camera.h | 35 ++++ {src => old_src}/include/PCISPH_sim.h | 0 old_src/include/float3_helper_math.h | 233 ++++++++++++++++++++++++ {src => old_src}/itterative_PCISPH.cu | 2 +- {src/cuda => old_src}/kernels_cuda.cu | 0 {src => old_src}/kernels_cuda.h | 0 {src => old_src}/main.cpp | 4 +- {src => old_src}/main3.cpp | 0 {src => old_src}/screen_spaced_main.cpp | 0 old_src/spawn_particles.cpp | 154 ++++++++++++++++ old_src/spawn_particles.h | 22 +++ src/include/spawn_particles.h | 4 +- src/spawn_particles.cpp | 3 + 20 files changed, 562 insertions(+), 4 deletions(-) rename {src => old_src}/CMakeLists.txt (100%) create mode 100644 old_src/Camera.cpp rename {src => old_src}/GUI_fluid_sim.cpp (100%) rename {src => old_src}/MakeFile_Alt.txt (100%) rename {src => old_src}/Makefile (100%) rename {src => old_src}/Particle.h (100%) create mode 100644 old_src/constants.h create mode 100644 old_src/include/Camera.h rename {src => old_src}/include/PCISPH_sim.h (100%) create mode 100644 old_src/include/float3_helper_math.h rename {src => old_src}/itterative_PCISPH.cu (99%) rename {src/cuda => old_src}/kernels_cuda.cu (100%) rename {src => old_src}/kernels_cuda.h (100%) rename {src => old_src}/main.cpp (99%) rename {src => old_src}/main3.cpp (100%) rename {src => old_src}/screen_spaced_main.cpp (100%) create mode 100644 old_src/spawn_particles.cpp create mode 100644 old_src/spawn_particles.h diff --git a/src/CMakeLists.txt b/old_src/CMakeLists.txt similarity index 100% rename from src/CMakeLists.txt rename to old_src/CMakeLists.txt diff --git a/old_src/Camera.cpp b/old_src/Camera.cpp new file mode 100644 index 0000000..eab52c4 --- /dev/null +++ b/old_src/Camera.cpp @@ -0,0 +1,88 @@ +// Camera.cpp +#include "include/Camera.h" +#include <cstdio> +#include <cstdlib> + +static Camera* g_camera = nullptr; + +Camera::Camera(vec3 position, vec3 target, vec3 up, float fov_, float aspect_, float zNear_, float zFar_) + : campos(position), forward(VectorSub(target, position)), upVector(up), + fov(fov_), aspectRatio(aspect_), zNear(zNear_), zFar(zFar_), rotationMatrix(IdentityMatrix()) +{ + float norm = sqrtf(forward.x*forward.x + forward.y*forward.y + forward.z*forward.z); + forward = ScalarMult(forward, 1.0f / norm); +} + +// Processes keyboard input to control the camera +void Camera::processKey(unsigned char key) +{ + switch (key) + { + case 'w': + campos += ScalarMult(forward, 0.5f); + break; + case 's': + campos -= ScalarMult(forward, 0.5f); + break; + case 'a': + campos -= ScalarMult(CrossProduct(forward, upVector), 0.5f); + break; + case 'd': + campos += ScalarMult(CrossProduct(forward, upVector), 0.5f); + break; + case 'j': + rotateSide(0.03f); + break; + case 'l': + rotateSide(-0.03f); + break; + case 'i': + // Rotate upwards + rotateUp(0.05f); + break; + case 'k': + // Rotate downwards + rotateUp(-0.05f); + break; + case 32: // SPACEBAR + campos += ScalarMult(upVector, 1.0f); + break; + case 'c': + campos -= ScalarMult(upVector, 1.0f); + break; + case 'v': + // Toggle boundary display + toggleDisplayBorder(); + break; + case 0x1b: // ESC + exit(0); + } +} + +void Camera::reshape(int width, int height) { + glViewport(0, 0, width, height); + aspectRatio = (float)width / (float)height; +} + +mat4 Camera::getViewMatrix() const { + return lookAt(campos, VectorAdd(campos, forward), upVector); +} + +mat4 Camera::getProjectionMatrix() const { + return perspective(fov, aspectRatio, zNear, zFar); +} + +void Camera::rotateSide(float angle) { + mat3 rot = mat4tomat3(Ry(angle)); + forward = MultMat3Vec3(rot, forward); +} + +void Camera::rotateUp(float angle) { + vec3 side = CrossProduct(forward, upVector); + mat3 rot = mat4tomat3(ArbRotate(side, angle)); + forward = MultMat3Vec3(rot, forward); +} + +void initCamera(Camera& camera) { + g_camera = &camera; +} diff --git a/src/GUI_fluid_sim.cpp b/old_src/GUI_fluid_sim.cpp similarity index 100% rename from src/GUI_fluid_sim.cpp rename to old_src/GUI_fluid_sim.cpp diff --git a/src/MakeFile_Alt.txt b/old_src/MakeFile_Alt.txt similarity index 100% rename from src/MakeFile_Alt.txt rename to old_src/MakeFile_Alt.txt diff --git a/src/Makefile b/old_src/Makefile similarity index 100% rename from src/Makefile rename to old_src/Makefile diff --git a/src/Particle.h b/old_src/Particle.h similarity index 100% rename from src/Particle.h rename to old_src/Particle.h diff --git a/old_src/constants.h b/old_src/constants.h new file mode 100644 index 0000000..5f45e20 --- /dev/null +++ b/old_src/constants.h @@ -0,0 +1,21 @@ +// constants.h +#ifndef CONSTANTS_H +#define CONSTANTS_H + +const float h_BOUND_X_MIN = -6.0f; +const float h_BOUND_X_MAX = 12.0f; +const float h_BOUND_Y_MIN = 0.0f; +const float h_BOUND_Y_MAX = 10.0f; +const float h_BOUND_Z_MIN = -4.0f; +const float h_BOUND_Z_MAX = 4.0f; + +const float h_GAS_CONSTANT = 0.02f; +const float h_VISCOSITY = 0.2f; + +const float h_PARTICLE_MASS = 0.4f; +const float h_REST_DENSITY = 3000.0f; + +const float h_PI = 3.14159265358979323846f; +const float h_H = 0.35f; // Smoothing radius + +#endif // CONSTANTS_H diff --git a/old_src/include/Camera.h b/old_src/include/Camera.h new file mode 100644 index 0000000..8c96803 --- /dev/null +++ b/old_src/include/Camera.h @@ -0,0 +1,35 @@ +// Camera.h +#ifndef CAMERA_H +#define CAMERA_H + +#include "VectorUtils4.h" + +class Camera { +private: + vec3 campos; + vec3 forward; + vec3 upVector; + float fov; + float aspectRatio; + float zNear; + float zFar; + bool displayBorder = false; + mat4 rotationMatrix; + + void rotateSide(float angle); + void rotateUp(float angle); + +public: + Camera(vec3 position, vec3 target, vec3 up, float fov, float aspect, float zNear, float zFar); + void processKey(unsigned char key); + void reshape(int width, int height); + mat4 getViewMatrix() const; + mat4 getProjectionMatrix() const; + bool shouldDisplayBorder() const { return displayBorder; } + void toggleDisplayBorder() { displayBorder = !displayBorder; } + void setAspectRatio(float aspect) { aspectRatio = aspect; } +}; + +void initCamera(Camera& camera); + +#endif diff --git a/src/include/PCISPH_sim.h b/old_src/include/PCISPH_sim.h similarity index 100% rename from src/include/PCISPH_sim.h rename to old_src/include/PCISPH_sim.h diff --git a/old_src/include/float3_helper_math.h b/old_src/include/float3_helper_math.h new file mode 100644 index 0000000..521a695 --- /dev/null +++ b/old_src/include/float3_helper_math.h @@ -0,0 +1,233 @@ +/* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of NVIDIA CORPORATION nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file implements common mathematical operations on vector types + * (float3, float4 etc.) since these are not provided as standard by CUDA. + * + * The syntax is modeled on the Cg standard library. + * + * This is part of the Helper library includes + * + * Thanks to Linh Hah for additions and fixes. + */ + +#ifndef HELPER_MATH_H +#define HELPER_MATH_H + +#include "cuda_runtime.h" + +typedef unsigned int uint; +typedef unsigned short ushort; + +#ifndef EXIT_WAIVED +#define EXIT_WAIVED 2 +#endif + +#include <math.h> + + +//////////////////////////////////////////////////////////////////////////////// +// negate +//////////////////////////////////////////////////////////////////////////////// + +inline __host__ __device__ float3 operator-(float3 &a) +{ + return make_float3(-a.x, -a.y, -a.z); +} + +//////////////////////////////////////////////////////////////////////////////// +// addition +//////////////////////////////////////////////////////////////////////////////// + + +inline __host__ __device__ float3 operator+(float3 a, float3 b) +{ + return make_float3(a.x + b.x, a.y + b.y, a.z + b.z); +} +inline __host__ __device__ void operator+=(float3 &a, float3 b) +{ + a.x += b.x; + a.y += b.y; + a.z += b.z; +} +inline __host__ __device__ float3 operator+(float3 a, float b) +{ + return make_float3(a.x + b, a.y + b, a.z + b); +} +inline __host__ __device__ void operator+=(float3 &a, float b) +{ + a.x += b; + a.y += b; + a.z += b; +} + + +//////////////////////////////////////////////////////////////////////////////// +// subtract +//////////////////////////////////////////////////////////////////////////////// + + +inline __host__ __device__ float3 operator-(float3 a, float3 b) +{ + return make_float3(a.x - b.x, a.y - b.y, a.z - b.z); +} +inline __host__ __device__ void operator-=(float3 &a, float3 b) +{ + a.x -= b.x; + a.y -= b.y; + a.z -= b.z; +} +inline __host__ __device__ float3 operator-(float3 a, float b) +{ + return make_float3(a.x - b, a.y - b, a.z - b); +} +inline __host__ __device__ float3 operator-(float b, float3 a) +{ + return make_float3(b - a.x, b - a.y, b - a.z); +} +inline __host__ __device__ void operator-=(float3 &a, float b) +{ + a.x -= b; + a.y -= b; + a.z -= b; +} + + +//////////////////////////////////////////////////////////////////////////////// +// multiply +//////////////////////////////////////////////////////////////////////////////// + + +inline __host__ __device__ float3 operator*(float3 a, float3 b) +{ + return make_float3(a.x * b.x, a.y * b.y, a.z * b.z); +} +inline __host__ __device__ void operator*=(float3 &a, float3 b) +{ + a.x *= b.x; + a.y *= b.y; + a.z *= b.z; +} +inline __host__ __device__ float3 operator*(float3 a, float b) +{ + return make_float3(a.x * b, a.y * b, a.z * b); +} +inline __host__ __device__ float3 operator*(float b, float3 a) +{ + return make_float3(b * a.x, b * a.y, b * a.z); +} +inline __host__ __device__ void operator*=(float3 &a, float b) +{ + a.x *= b; + a.y *= b; + a.z *= b; +} + + +//////////////////////////////////////////////////////////////////////////////// +// divide +//////////////////////////////////////////////////////////////////////////////// + + +inline __host__ __device__ float3 operator/(float3 a, float3 b) +{ + return make_float3(a.x / b.x, a.y / b.y, a.z / b.z); +} +inline __host__ __device__ void operator/=(float3 &a, float3 b) +{ + a.x /= b.x; + a.y /= b.y; + a.z /= b.z; +} +inline __host__ __device__ float3 operator/(float3 a, float b) +{ + return make_float3(a.x / b, a.y / b, a.z / b); +} +inline __host__ __device__ void operator/=(float3 &a, float b) +{ + a.x /= b; + a.y /= b; + a.z /= b; +} +inline __host__ __device__ float3 operator/(float b, float3 a) +{ + return make_float3(b / a.x, b / a.y, b / a.z); +} + + + +//////////////////////////////////////////////////////////////////////////////// +// dot product +//////////////////////////////////////////////////////////////////////////////// + + +inline __host__ __device__ float dot(float3 a, float3 b) +{ + return a.x * b.x + a.y * b.y + a.z * b.z; +} + +//////////////////////////////////////////////////////////////////////////////// +// length +//////////////////////////////////////////////////////////////////////////////// + +inline __host__ __device__ float length(float3 v) +{ + return sqrtf(dot(v, v)); +} + +//////////////////////////////////////////////////////////////////////////////// +// normalize +//////////////////////////////////////////////////////////////////////////////// + +inline __host__ __device__ float3 normalize(float3 v) +{ + float invLen = rsqrtf(dot(v, v)); + return v * invLen; +} + +//////////////////////////////////////////////////////////////////////////////// +// floor +//////////////////////////////////////////////////////////////////////////////// + +inline __host__ __device__ float3 floorf(float3 v) +{ + return make_float3(floorf(v.x), floorf(v.y), floorf(v.z)); +} + + +//////////////////////////////////////////////////////////////////////////////// +// cross product +//////////////////////////////////////////////////////////////////////////////// + +inline __host__ __device__ float3 cross(float3 a, float3 b) +{ + return make_float3(a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x); +} + + +#endif \ No newline at end of file diff --git a/src/itterative_PCISPH.cu b/old_src/itterative_PCISPH.cu similarity index 99% rename from src/itterative_PCISPH.cu rename to old_src/itterative_PCISPH.cu index f4cc0bb..af9fbde 100644 --- a/src/itterative_PCISPH.cu +++ b/old_src/itterative_PCISPH.cu @@ -1,7 +1,7 @@ // kernels_cuda_pcisph.cu #include "include/PCISPH_sim.h" -#include "settings/constants.h" +#include "constants.h" #include "include/float3_helper_math.h" #include <cuda_runtime.h> #include <cuda_gl_interop.h> diff --git a/src/cuda/kernels_cuda.cu b/old_src/kernels_cuda.cu similarity index 100% rename from src/cuda/kernels_cuda.cu rename to old_src/kernels_cuda.cu diff --git a/src/kernels_cuda.h b/old_src/kernels_cuda.h similarity index 100% rename from src/kernels_cuda.h rename to old_src/kernels_cuda.h diff --git a/src/main.cpp b/old_src/main.cpp similarity index 99% rename from src/main.cpp rename to old_src/main.cpp index 081d3e7..e1c2cf6 100644 --- a/src/main.cpp +++ b/old_src/main.cpp @@ -14,9 +14,9 @@ #include "MicroGlut.h" #include "GL_utilities.h" -#include "PCISPH_sim.h" // Header for CUDA function declarations +#include "include/PCISPH_sim.h" // Header for CUDA function declarations #include "spawn_particles.h" -#include "Camera.h" +#include "include/Camera.h" #include "constants.h" #define MAIN diff --git a/src/main3.cpp b/old_src/main3.cpp similarity index 100% rename from src/main3.cpp rename to old_src/main3.cpp diff --git a/src/screen_spaced_main.cpp b/old_src/screen_spaced_main.cpp similarity index 100% rename from src/screen_spaced_main.cpp rename to old_src/screen_spaced_main.cpp diff --git a/old_src/spawn_particles.cpp b/old_src/spawn_particles.cpp new file mode 100644 index 0000000..e448070 --- /dev/null +++ b/old_src/spawn_particles.cpp @@ -0,0 +1,154 @@ +// spawn_particles.cpp +#include "spawn_particles.h" +#include "constants.h" + +#include <cmath> // For std::pow +#include <ctime> +#include <vector> +#include <cstdlib> + +// Initialize fluid particles +void initParticles( + std::vector<float3> &h_positions, + std::vector<float3> &h_velocities, + const int NUM_PARTICLES, + const float GRID_SPACING) +{ + // Seed the random number generator + srand(static_cast<unsigned int>(time(0))); + + // Calculate particles per axis + int particlesPerAxis = static_cast<int>(ceil(pow(NUM_PARTICLES, 1.0f / 3.0f))); + + int index = 0; + for (int i = 0; i < particlesPerAxis && index < NUM_PARTICLES; ++i) { + for (int j = 0; j < particlesPerAxis && index < NUM_PARTICLES; ++j) { + for (int k = 0; k < particlesPerAxis && index < NUM_PARTICLES; ++k) { + // Center particles around the origin + float x = (i - (particlesPerAxis - 1) / 2.0f) * GRID_SPACING; + float y = (j - (particlesPerAxis - 1) / 2.0f) * GRID_SPACING + 2.0f; + float z = (k - (particlesPerAxis - 1) / 2.0f) * GRID_SPACING; + + // Add random perturbation within [-0.1*dx, 0.1*dx] + float perturbation = 0.1f * GRID_SPACING; + float rand_x = ((float)rand() / RAND_MAX - 0.5f) * 2.0f * perturbation; + float rand_y = ((float)rand() / RAND_MAX - 0.5f) * 2.0f * perturbation; + float rand_z = ((float)rand() / RAND_MAX - 0.5f) * 2.0f * perturbation; + + h_positions[index] = make_float3( + x + rand_x, + y + rand_y, + z + rand_z + ); + + // Initialize velocities + h_velocities[index] = make_float3(0.0f, 0.0f, 0.0f); + + ++index; + } + } + } + + // If NUM_PARTICLES is not a perfect cube, initialize remaining particles + for (; index < NUM_PARTICLES; ++index) { + h_positions[index] = make_float3(0.0f, 10.0f, 0.0f); // Default position + h_velocities[index] = make_float3(0.0f, 0.0f, 0.0f); // Default velocity + } +} + +// Create boundary particles +void createBoundaryParticles( + std::vector<float3> &boundary_positions, + std::vector<float3> &boundary_velocities, + int boundaryLayers, + float spacing) +{ + // Compute the number of particles along each dimension for a given spacing + int nx = static_cast<int>((h_BOUND_X_MAX - h_BOUND_X_MIN)/spacing) + 1; + int ny = static_cast<int>((h_BOUND_Y_MAX - h_BOUND_Y_MIN)/spacing) + 1; + int nz = static_cast<int>((h_BOUND_Z_MAX - h_BOUND_Z_MIN)/spacing) + 1; + + // Initialize velocities to zero for boundary + float3 zeroVel = make_float3(0.0f, 0.0f, 0.0f); + + // Y-min boundary (e.g., "floor") + for (int layer = 0; layer < boundaryLayers; layer++) { + float y = h_BOUND_Y_MIN - (layer+1)*spacing; // placing layers below Ymin + for (int ix = 0; ix < nx; ix++) { + for (int iz = 0; iz < nz; iz++) { + float x = h_BOUND_X_MIN + ix*spacing; + float z = h_BOUND_Z_MIN + iz*spacing; + boundary_positions.push_back(make_float3(x, y, z)); + boundary_velocities.push_back(zeroVel); + } + } + } + + /* + // Y-max boundary (ceiling) + for (int layer = 0; layer < boundaryLayers; layer++) { + float y = h_BOUND_Y_MAX + (layer+1)*spacing; + for (int ix = 0; ix < nx; ix++) { + for (int iz = 0; iz < nz; iz++) { + float x = h_BOUND_X_MIN + ix*spacing; + float z = h_BOUND_Z_MIN + iz*spacing; + boundary_positions.push_back(make_float3(x, y, z)); + boundary_velocities.push_back(zeroVel); + } + } + } + */ + + // X-min boundary (vertical wall on the left) + int ny_cells = ny; // from earlier computation + for (int layer = 0; layer < boundaryLayers; layer++) { + float x = h_BOUND_X_MIN - (layer+1)*spacing; + for (int iy = 0; iy < ny_cells; iy++) { + for (int iz = 0; iz < nz; iz++) { + float y = h_BOUND_Y_MIN + iy*spacing; + float z = h_BOUND_Z_MIN + iz*spacing; + boundary_positions.push_back(make_float3(x, y, z)); + boundary_velocities.push_back(zeroVel); + } + } + } + + // X-max boundary (vertical wall on the right) + for (int layer = 0; layer < boundaryLayers; layer++) { + float x = h_BOUND_X_MAX + (layer+1)*spacing; + for (int iy = 0; iy < ny_cells; iy++) { + for (int iz = 0; iz < nz; iz++) { + float y = h_BOUND_Y_MIN + iy*spacing; + float z = h_BOUND_Z_MIN + iz*spacing; + boundary_positions.push_back(make_float3(x, y, z)); + boundary_velocities.push_back(zeroVel); + } + } + } + + // Z-min boundary (front wall) + for (int layer = 0; layer < boundaryLayers; layer++) { + float z = h_BOUND_Z_MIN - (layer+1)*spacing; + for (int ix = 0; ix < nx; ix++) { + for (int iy = 0; iy < ny_cells; iy++) { + float x = h_BOUND_X_MIN + ix*spacing; + float y = h_BOUND_Y_MIN + iy*spacing; + boundary_positions.push_back(make_float3(x, y, z)); + boundary_velocities.push_back(zeroVel); + } + } + } + + // Z-max boundary (back wall) + for (int layer = 0; layer < boundaryLayers; layer++) { + float z = h_BOUND_Z_MAX + (layer+1)*spacing; + for (int ix = 0; ix < nx; ix++) { + for (int iy = 0; iy < ny_cells; iy++) { + float x = h_BOUND_X_MIN + ix*spacing; + float y = h_BOUND_Y_MIN + iy*spacing; + boundary_positions.push_back(make_float3(x, y, z)); + boundary_velocities.push_back(zeroVel); + } + } + } +} diff --git a/old_src/spawn_particles.h b/old_src/spawn_particles.h new file mode 100644 index 0000000..ab9ae76 --- /dev/null +++ b/old_src/spawn_particles.h @@ -0,0 +1,22 @@ +// spawn_particles.h +#ifndef SPAWN_PARTICLES_H +#define SPAWN_PARTICLES_H + +#include <vector> +#include <cuda_runtime.h> // for float3 + + +void createBoundaryParticles( + std::vector<float3> &boundary_positions, + std::vector<float3> &boundary_velocities, + int boundaryLayers, + float spacing +); + +void initParticles( + std::vector<float3> &h_positions, + std::vector<float3> &h_velocities, + const int NUM_PARTICLES, + const float GRID_SPACING +); +#endif // SPAWN_PARTICLES_H \ No newline at end of file diff --git a/src/include/spawn_particles.h b/src/include/spawn_particles.h index e0a77c4..a27939e 100644 --- a/src/include/spawn_particles.h +++ b/src/include/spawn_particles.h @@ -5,6 +5,8 @@ #include <vector> #include <cuda_runtime.h> // for float3 +namespace FluidSimulation { + void createBoundaryParticles( std::vector<float3> &boundary_positions, std::vector<float3> &boundary_velocities, @@ -18,5 +20,5 @@ void initParticles( const int NUM_PARTICLES, const float GRID_SPACING ); - +} #endif // SPAWN_PARTICLES_H \ No newline at end of file diff --git a/src/spawn_particles.cpp b/src/spawn_particles.cpp index 98ddfaf..255f0ed 100644 --- a/src/spawn_particles.cpp +++ b/src/spawn_particles.cpp @@ -7,6 +7,7 @@ #include <vector> #include <cstdlib> +namespace FluidSimulation { // Initialize fluid particles void initParticles( std::vector<float3> &h_positions, @@ -152,3 +153,5 @@ void createBoundaryParticles( } } } + +} \ No newline at end of file -- GitLab