Skip to content
Snippets Groups Projects
Commit e8c5b3d2 authored by Armin Co's avatar Armin Co
Browse files

Simulation with Gauss Box

parent 553476bb
No related branches found
No related tags found
No related merge requests found
...@@ -84,7 +84,7 @@ Particle::Particle(Properties properties, GameOptions &options, Player &playerOn ...@@ -84,7 +84,7 @@ Particle::Particle(Properties properties, GameOptions &options, Player &playerOn
else else
{ {
// "Simulation" // "Simulation"
calculateSchroedingerPotential(m_staticBorders, m_xAt, m_yAt, m_properties.elements()); calculateGaussBox(m_staticBorders, m_xAt, m_yAt, m_properties.elements());
} }
fftw_init_threads(); fftw_init_threads();
......
...@@ -92,3 +92,12 @@ void calculateSchroedingerPotential(float *potential, double *xAt, double *yAt, ...@@ -92,3 +92,12 @@ void calculateSchroedingerPotential(float *potential, double *xAt, double *yAt,
potential[i] = ( pow2(pow2(xAt[i]) + pow2(yAt[i])) ) / 200.0; potential[i] = ( pow2(pow2(xAt[i]) + pow2(yAt[i])) ) / 200.0;
} }
} }
void calculateGaussBox(float *potential, double *xAt, double *yAt, int arrayElements)
{
constexpr double grow = 2.0;
for (int i{0}; i < arrayElements; ++i)
{
potential[i] = 1.0 / ((exp( -pow2(xAt[i]*grow) + -pow2(yAt[i]*grow))) * 5500.0);
}
}
\ No newline at end of file
...@@ -18,5 +18,5 @@ void calculateMomentumViewPositions(float *points, int arraySize); ...@@ -18,5 +18,5 @@ void calculateMomentumViewPositions(float *points, int arraySize);
void calculateTriangleIndices(uint32_t *indices, int arraySize); void calculateTriangleIndices(uint32_t *indices, int arraySize);
void calculateBorderPotential(float *potential, double *yAt, int arrayElements); void calculateBorderPotential(float *potential, double *yAt, int arrayElements);
void calculateSchroedingerPotential(float *potential, double *xAt, double *yAt, int arrayElements); void calculateSchroedingerPotential(float *potential, double *xAt, double *yAt, int arrayElements);
void calculateGaussBox(float *potential, double *xAt, double *yAt, int arrayElemnts);
#endif #endif
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment