Skip to content

Commit 87879d3

Browse files
update get_min_position and fix particle_histogram_addition_singlecell
1 parent 3cbd1f6 commit 87879d3

12 files changed

+43
-24
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Particle Addition Algorithm,Time Averaged Cell Score Standard Deviation,Time Averaged Mean Score,Time Averaged Maximum Score
22
"Random, constant V",0.021392537313432835,0.007291044776119403,0.17071542288557215
33
"Histogram, constant V",0.013744776119402984,0.004796019900497512,0.09791393034825871
4-
"Gaussian, constant V",0.011992039800995025,0.00433681592039801,0.07456616915422885
5-
"Cutoff-w1, constant V",0.008707462686567165,0.002514925373134328,0.05777462686567164
6-
"Cutoff-c1, constant V",0.008741791044776119,0.002350746268656716,0.060731840796019905
7-
"Uniform, constant V",0.014054228855721392,0.00551592039800995,0.07942238805970149
8-
"Triangular, constant V",0.008707462686567165,0.002514925373134328,0.05777462686567164
4+
"Gaussian, constant V",0.012381592039800996,0.004479601990049751,0.07742139303482586
5+
"Cutoff-w1, constant V",0.008975124378109453,0.0025407960199004976,0.061141293532338305
6+
"Cutoff-c1, constant V",0.008644776119402986,0.002418407960199005,0.06105870646766169
7+
"Uniform, constant V",0.012350746268656716,0.004520398009950248,0.07983034825870647
8+
"Triangular, constant V",0.008975124378109453,0.0025407960199004976,0.061141293532338305
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Particle Addition Algorithm,Time Averaged Cell Score Standard Deviation,Time Averaged Mean Score,Time Averaged Maximum Score
22
"Random, oscillating V",0.01756865671641791,0.005158706467661692,0.12560049751243782
33
"Histogram, oscillating V",0.014391542288557211,0.0038726368159203986,0.10112537313432836
4-
"Gaussian, oscillating V",0.013983084577114427,0.003772139303482587,0.09152835820895523
5-
"Cutoff-w1, oscillating V",0.011802487562189054,0.0025592039800995023,0.08679552238805971
6-
"Cutoff-c1, oscillating V",0.011725373134328356,0.0025134328358208955,0.08731293532338309
7-
"Uniform, oscillating V",0.015202985074626864,0.004738805970149254,0.0932771144278607
8-
"Triangular, oscillating V",0.011802487562189054,0.0025592039800995023,0.08679552238805971
4+
"Gaussian, oscillating V",0.013679104477611942,0.0037542288557213927,0.09291940298507463
5+
"Cutoff-w1, oscillating V",0.01167960199004975,0.002507960199004975,0.0880860696517413
6+
"Cutoff-c1, oscillating V",0.01169452736318408,0.0024512437810945277,0.08780447761194031
7+
"Uniform, oscillating V",0.013403980099502487,0.0037497512437810947,0.09195373134328359
8+
"Triangular, oscillating V",0.01167960199004975,0.002507960199004975,0.0880860696517413
-12.1 KB
Loading
-12.2 KB
Loading
-10.7 KB
Loading
-7.25 KB
Loading
1.83 KB
Loading
693 Bytes
Loading

include/aspect/particle/distribution.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ namespace aspect
199199
/**
200200
* Returns the location of the minimum of the point-density function.
201201
*/
202-
Point<dim>
203-
get_min_position() const;
202+
std::vector<Point<dim>>
203+
get_min_positions() const;
204204

205205
/**
206206
* Returns the standard deviation of the point-density function.
@@ -272,9 +272,11 @@ namespace aspect
272272
Point<dim> max_position;
273273

274274
/**
275-
* `min_position` holds position within the cell where the minimum point density was measured.
275+
* `min_positions` holds positions within the cell where the minimum point density was measured.
276+
* This is a std::vector because there is a chance that there will be multiple minimum positions
277+
* with the same value, especially when particles are already arranged in a regular pattern.
276278
*/
277-
Point<dim> min_position;
279+
std::vector<Point<dim>> min_positions;
278280

279281
/**
280282
* `standard_deviation` holds the standard_deviation of the point-density function after it has been computed.

source/particle/distribution.cc

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,17 @@ namespace aspect
301301
{
302302
max_position = position_in_cell;
303303
}
304+
305+
// if this value is less than the min, we found a new minimum value, clear the list
304306
if (this_value < min)
305307
{
306-
min_position = position_in_cell;
308+
min_positions.clear();
309+
min_positions.push_back(position_in_cell);
310+
}
311+
else if (this_value == min)
312+
{
313+
// Add this position to the vector of identical minimum values
314+
min_positions.push_back(position_in_cell);
307315
}
308316

309317
max = std::max(max, this_value);
@@ -322,9 +330,16 @@ namespace aspect
322330
{
323331
max_position = position_in_cell;
324332
}
333+
// if this value is less than the min, we found a new minimum value, clear the list
325334
if (this_value < min)
326335
{
327-
min_position = position_in_cell;
336+
min_positions.clear();
337+
min_positions.push_back(position_in_cell);
338+
}
339+
else if (this_value == min)
340+
{
341+
// Add this position to the vector of identical minimum values
342+
min_positions.push_back(position_in_cell);
328343
}
329344

330345
max = std::max(max, this_value);
@@ -415,10 +430,10 @@ namespace aspect
415430

416431

417432
template <int dim>
418-
Point<dim>
419-
ParticlePDF<dim>::get_min_position() const
433+
std::vector<Point<dim>>
434+
ParticlePDF<dim>::get_min_positions() const
420435
{
421-
return min_position;
436+
return min_positions;
422437
}
423438

424439

0 commit comments

Comments
 (0)