Prioritize boundary inflow over boundary outflow on ghost cells
This commit is contained in:
@@ -753,7 +753,9 @@ namespace FloodSWE.Networking
|
||||
var ghostIndices = new List<int>(128);
|
||||
var ghostLevels = new List<float>(128);
|
||||
var ghostVelocities = new List<Vector2>(128);
|
||||
var ghostInflowCells = new HashSet<int>();
|
||||
var ghostOutflowCells = new HashSet<int>();
|
||||
var suppressedOutflowCells = new HashSet<int>();
|
||||
var boundarySinkIdsWithGhostOutflow = new HashSet<int>();
|
||||
|
||||
foreach (var pair in activeBoundaryInflowGhostCells)
|
||||
@@ -778,9 +780,16 @@ namespace FloodSWE.Networking
|
||||
Vector2 velocity = new Vector2(profile.velocityUMps, profile.velocityVMps);
|
||||
for (int i = 0; i < cells.Length; i++)
|
||||
{
|
||||
ghostIndices.Add(cells[i]);
|
||||
int idx = cells[i];
|
||||
if (idx < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ghostIndices.Add(idx);
|
||||
ghostLevels.Add(level);
|
||||
ghostVelocities.Add(velocity);
|
||||
ghostInflowCells.Add(idx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -817,10 +826,18 @@ namespace FloodSWE.Networking
|
||||
for (int i = 0; i < cells.Length; i++)
|
||||
{
|
||||
int idx = cells[i];
|
||||
if (idx >= 0)
|
||||
if (idx < 0)
|
||||
{
|
||||
ghostOutflowCells.Add(idx);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ghostInflowCells.Contains(idx))
|
||||
{
|
||||
suppressedOutflowCells.Add(idx);
|
||||
continue;
|
||||
}
|
||||
|
||||
ghostOutflowCells.Add(idx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -988,7 +1005,7 @@ namespace FloodSWE.Networking
|
||||
if (verboseDiagnostics)
|
||||
{
|
||||
Debug.Log(
|
||||
$"SweServerRuntime: forcing applied status={lastForcingStatus} ghost={ghostIndices.Count} depth={forcedDepthCells} freeOutflow={ghostOutflowCells.Count}");
|
||||
$"SweServerRuntime: forcing applied status={lastForcingStatus} ghost={ghostIndices.Count} depth={forcedDepthCells} freeOutflow={ghostOutflowCells.Count} suppressedOutflowByInflow={suppressedOutflowCells.Count}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user