Update ordered-float

This commit is contained in:
Youser Nayme 2024-06-23 12:51:16 -04:00
parent ca6bcaab7d
commit a12c320f8c
No known key found for this signature in database
GPG Key ID: 08E3619383679CAE
3 changed files with 12 additions and 20 deletions

17
Cargo.lock generated
View File

@ -4582,15 +4582,6 @@ dependencies = [
"num-traits",
]
[[package]]
name = "ordered-float"
version = "3.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc"
dependencies = [
"num-traits",
]
[[package]]
name = "ordered-float"
version = "4.2.0"
@ -7115,7 +7106,7 @@ dependencies = [
"lazy_static",
"num-derive",
"num-traits",
"ordered-float 3.9.2",
"ordered-float 4.2.0",
"petgraph 0.6.5",
"rand 0.8.5",
"rand_chacha 0.3.1",
@ -7258,7 +7249,7 @@ name = "veloren-common-systems"
version = "0.10.0"
dependencies = [
"itertools 0.13.0",
"ordered-float 3.9.2",
"ordered-float 4.2.0",
"rand 0.8.5",
"rayon",
"specs",
@ -7496,7 +7487,7 @@ dependencies = [
"native-dialog",
"num 0.4.3",
"num_cpus",
"ordered-float 3.9.2",
"ordered-float 4.2.0",
"rand 0.8.5",
"rand_chacha 0.3.1",
"rayon",
@ -7595,7 +7586,7 @@ dependencies = [
"noise",
"num 0.4.3",
"num-traits",
"ordered-float 3.9.2",
"ordered-float 4.2.0",
"rand 0.8.5",
"rand_chacha 0.3.1",
"rayon",

View File

@ -146,7 +146,7 @@ hashbrown = { version = "0.14", features = ["rayon", "serde", "nightly"] }
fxhash = { version = "0.2.1" }
crossbeam-utils = { version = "0.8.1" }
crossbeam-channel = { version = "0.5" }
ordered-float = { version = "3", default-features = true }
ordered-float = { version = "4.2", default-features = true }
num = { version = "0.4" }
num-traits = { version = "0.2" }
vek = { version = "0.17.0", features = ["serde"] }

View File

@ -12,7 +12,7 @@ use tracing::{debug, error, info, warn};
use itertools::izip;
use noise::NoiseFn;
use num::{Float, Zero};
use ordered_float::NotNan;
use ordered_float::{FloatCore, NotNan};
use rayon::prelude::*;
use std::{
cmp::{Ordering, Reverse},
@ -1253,7 +1253,7 @@ fn erode(
// Egress with no outgoing flows.
// wh for oceans is always at least min_erosion_height.
let uplift_i = uplift(posi) as Alt;
wh[posi] = min_erosion_height.max(h_t_i + uplift_i);
wh[posi] = FloatCore::max(min_erosion_height, h_t_i + uplift_i);
lake_sill[stacki] = posi as isize;
lake_water_volume[stacki] = 0.0;
} else {
@ -1335,7 +1335,8 @@ fn erode(
if mask_kk.any() {
let h_j = rec_heights_kk;
let elev_j = h_j;
let dh = 0.0.max(new_h_i as SimdType - elev_j);
let dh =
FloatCore::max(0.0, new_h_i as SimdType - elev_j);
let powf = |a: SimdType, b| a.powf(b);
let dh_fs_sample = k_fs_fact_kk as SimdType
* powf(dh, n as SimdType - 1.0);
@ -1543,7 +1544,7 @@ fn erode(
// +max(0.d0,min(lake_sediment(lake_sill(ij)),
// lake_water_volume(lake_sill(ij))))/
// lake_water_volume(lake_sill(ij))*(water(ij)-h(ij))
*h += (0.0.max(lake_silt[stacki].min(lake_water_volume[lposi]))
*h += (FloatCore::max(0.0, lake_silt[stacki].min(lake_water_volume[lposi]))
/ lake_water_volume[lposi]
* (wh[posi] - *h) as Compute) as Alt;
}
@ -1613,7 +1614,7 @@ fn erode(
panic!("Disconnected lake!");
}
// wh for oceans is always at least min_erosion_height.
wh[posi] = min_erosion_height.max(old_h_i as Alt);
wh[posi] = FloatCore::max(min_erosion_height, old_h_i as Alt);
} else {
let posj = posj as usize;
// Find the water height for this chunk's receiver; we only apply thermal
@ -1818,7 +1819,7 @@ pub(crate) fn fill_sinks<F: Float + Send + Sync>(
/// adjacency list).
/// - The adjacency list (stored in a single vector), indexed by the second
/// indirection vector.
pub fn get_lakes<F: Float>(
pub fn get_lakes<F: FloatCore>(
map_size_lg: MapSizeLg,
h: impl Fn(usize) -> F,
downhill: &mut [isize],