Cleanup: use const pointer for the gravity vector

This commit is contained in:
Campbell Barton
2025-02-02 13:56:46 +11:00
parent 4cd827870d
commit 36531006da
2 changed files with 6 additions and 3 deletions

View File

@@ -89,7 +89,10 @@ typedef struct SPHData {
ParticleData *pa;
float mass;
std::optional<blender::Map<blender::OrderedEdge, int>> eh;
float *gravity;
/** The gravity as a `float[3]`, may also be null when the simulation doesn't use gravity. */
const float *gravity;
float hfac;
/* Average distance to neighbors (other particles in the support domain),
* for calculating the Courant number (adaptive time step). */

View File

@@ -1795,7 +1795,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
ParticleSpring *spring = nullptr;
SPHRangeData pfr;
SPHNeighbor *pfn;
float *gravity = sphdata->gravity;
const float *gravity = sphdata->gravity;
const std::optional<blender::Map<blender::OrderedEdge, int>> &springhash = sphdata->eh;
float q, u, rij, dv[3];
@@ -1996,7 +1996,7 @@ static void sphclassical_force_cb(void *sphdata_v,
SPHFluidSettings *fluid = psys[0]->part->fluid;
SPHRangeData pfr;
SPHNeighbor *pfn;
float *gravity = sphdata->gravity;
const float *gravity = sphdata->gravity;
float dq, u, rij, dv[3];
float pressure, npressure;