Skip to content

Commit 51706dd

Browse files
committed
- bugfix: in emitter scenes now all particles are reset correctly
1 parent b7f8321 commit 51706dd

File tree

12 files changed

+15
-25
lines changed

12 files changed

+15
-25
lines changed

Changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2.12.5
2+
- bugfix: in emitter scenes now all particles are reset correctly
13
- updated PositionBasedDynamics
24
- updated GenericParameters
35

SPlisHSPlasH/DFSPH/SimulationDataDFSPH.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void SimulationDataDFSPH::reset()
6969
for (unsigned int i = 0; i < nModels; i++)
7070
{
7171
FluidModel *fm = sim->getFluidModel(i);
72-
for (unsigned int j = 0; j < fm->numActiveParticles(); j++)
72+
for (unsigned int j = 0; j < fm->numParticles(); j++)
7373
{
7474
m_density_adv[i][j] = 0.0;
7575
m_pressure_rho2[i][j] = 0.0;

SPlisHSPlasH/FluidModel.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,8 @@ void FluidModel::reset()
202202
setNumActiveParticles(m_numActiveParticles0);
203203
const unsigned int nPoints = numActiveParticles();
204204

205-
struct Comparator {
206-
Comparator(FluidModel* _this) : m_this(_this) {};
207-
bool operator()(unsigned int a, unsigned int b)
208-
{
209-
return m_this->getParticleId(a) < m_this->getParticleId(b);
210-
}
211-
FluidModel* m_this;
212-
};
213-
214-
// Fluid
215-
for (unsigned int i = 0; i < nPoints; i++)
205+
// use numParticles since numActiveParticles is already reset
206+
for (unsigned int i = 0; i < numParticles(); i++)
216207
{
217208
const Vector3r& x0 = getPosition0(i);
218209
getPosition(i) = x0;
@@ -223,11 +214,6 @@ void FluidModel::reset()
223214
m_particleId[i] = i;
224215
m_particleState[i] = ParticleState::Active;
225216
}
226-
// emitted particles
227-
for (unsigned int i = nPoints; i < (unsigned int)m_particleId.size(); i++)
228-
{
229-
m_particleId[i] = i;
230-
}
231217

232218
NeighborhoodSearch *neighborhoodSearch = Simulation::getCurrent()->getNeighborhoodSearch();
233219
if (neighborhoodSearch->point_set(m_pointSetIndex).n_points() != nPoints)

SPlisHSPlasH/ICSPH/SimulationDataICSPH.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void SimulationDataICSPH::reset()
6262
for (unsigned int i = 0; i < nModels; i++)
6363
{
6464
FluidModel *fm = sim->getFluidModel(i);
65-
for (unsigned int j = 0; j < fm->numActiveParticles(); j++)
65+
for (unsigned int j = 0; j < fm->numParticles(); j++)
6666
{
6767
m_pressure[i][j] = 0.0;
6868
}

SPlisHSPlasH/IISPH/SimulationDataIISPH.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void SimulationDataIISPH::reset()
7070
for (unsigned int i = 0; i < nModels; i++)
7171
{
7272
FluidModel *fm = sim->getFluidModel(i);
73-
for (unsigned int j = 0; j < fm->numActiveParticles(); j++)
73+
for (unsigned int j = 0; j < fm->numParticles(); j++)
7474
{
7575
m_lastPressure[i][j] = 0.0;
7676
}

SPlisHSPlasH/PBF/SimulationDataPBF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void SimulationDataPBF::reset()
6363
for (unsigned int i = 0; i < nModels; i++)
6464
{
6565
FluidModel *fm = sim->getFluidModel(i);
66-
for (unsigned int j = 0; j < fm->numActiveParticles(); j++)
66+
for (unsigned int j = 0; j < fm->numParticles(); j++)
6767
{
6868
m_deltaX[i][j].setZero();
6969
m_lambda[i][j] = 0.0;

SPlisHSPlasH/PF/SimulationDataPF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void SimulationDataPF::reset()
6666
for (unsigned int i = 0; i < nModels; i++)
6767
{
6868
FluidModel *fm = sim->getFluidModel(i);
69-
for (unsigned int j = 0; j < fm->numActiveParticles(); j++)
69+
for (unsigned int j = 0; j < fm->numParticles(); j++)
7070
{
7171
m_num_fluid_neighbors[i][j] = 0;
7272
m_old_position[i][j].setZero();

SPlisHSPlasH/Utilities/DebugTools.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ void DebugTools::reset()
185185
for (unsigned int i = 0; i < nModels; i++)
186186
{
187187
FluidModel* fm = sim->getFluidModel(i);
188-
for (unsigned int j = 0; j < fm->numActiveParticles(); j++)
188+
for (unsigned int j = 0; j < fm->numParticles(); j++)
189189
{
190190
m_threadIds[i][j] = 0;
191191
m_numNeighbors[i][j] = 0;

SPlisHSPlasH/Vorticity/MicropolarModel_Bender2017.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ void MicropolarModel_Bender2017::step()
236236

237237
void MicropolarModel_Bender2017::reset()
238238
{
239-
for (unsigned int i = 0; i < m_model->numActiveParticles(); i++)
239+
for (unsigned int i = 0; i < m_model->numParticles(); i++)
240240
m_omega[i].setZero();
241241
}
242242

SPlisHSPlasH/WCSPH/SimulationDataWCSPH.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void SimulationDataWCSPH::reset()
5252
for (unsigned int i = 0; i < nModels; i++)
5353
{
5454
FluidModel *fm = sim->getFluidModel(i);
55-
for (unsigned int j = 0; j < fm->numActiveParticles(); j++)
55+
for (unsigned int j = 0; j < fm->numParticles(); j++)
5656
{
5757
m_pressure[i][j] = 0.0;
5858
m_pressureAccel[i][j].setZero();

0 commit comments

Comments
 (0)