Skip to content

Commit 7365b84

Browse files
committed
Drop compressed Grid::read in pineappl_v0 crate
1 parent 363cb76 commit 7365b84

4 files changed

Lines changed: 4 additions & 19 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pineappl/src/v0.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn read_uncompressed_v0(mut reader: impl BufRead) -> Result<Grid> {
4545
use pineappl_v0::pids::PidBasis as PidBasisV0;
4646
use pineappl_v0::subgrid::Subgrid as _;
4747

48-
let grid = GridV0::read(&mut reader).map_err(|err| Error::Other(err.into()))?;
48+
let grid = GridV0::read_uncompressed(&mut reader).map_err(|err| Error::Other(err.into()))?;
4949
let convolutions: Vec<_> = grid
5050
.convolutions()
5151
.into_iter()

pineappl_v0/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ bitflags = "2.4.2"
2222
enum_dispatch = "0.3.7"
2323
float-cmp = { default-features = false, version = "0.9.0" }
2424
itertools = "0.10.1"
25-
lz4_flex = "0.11.6"
2625
ndarray = { features = ["serde"], version = "0.15.4" }
2726
rustc-hash = "1.1.0"
2827
serde = { features = ["derive"], version = "1.0.130" }

pineappl_v0/src/grid.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ use super::convolutions::Convolution;
66
use super::pids::PidBasis;
77
use super::subgrid::{SubgridEnum, SubgridParams};
88
use bitflags::bitflags;
9-
use lz4_flex::frame::FrameDecoder;
109
use ndarray::{Array3, ArrayView3};
1110
use serde::{Deserialize, Serialize, Serializer};
1211
use std::collections::{BTreeMap, HashMap};
13-
use std::io::{self, BufRead, BufReader, Read};
12+
use std::io::{self, BufRead};
1413
use thiserror::Error;
1514

1615
/// This structure represents a position (`x1`, `x2`, `q2`) in a `Subgrid` together with a
@@ -166,24 +165,12 @@ impl Grid {
166165
PidBasis::Pdg
167166
}
168167

169-
/// Construct a `Grid` by deserializing it from `reader`. Reading is buffered.
168+
/// Construct a `Grid` by deserializing it from `reader`.
170169
///
171170
/// # Errors
172171
///
173172
/// If reading from the compressed or uncompressed stream fails an error is returned.
174-
pub fn read(reader: impl Read) -> Result<Self, GridError> {
175-
let mut reader = BufReader::new(reader);
176-
let buffer = reader.fill_buf().map_err(GridError::IoFailure)?;
177-
let magic_bytes: [u8; 4] = buffer[0..4].try_into().unwrap_or_else(|_| unreachable!());
178-
179-
if u32::from_le_bytes(magic_bytes) == 0x18_4D_22_04 {
180-
Self::read_uncompressed(FrameDecoder::new(reader))
181-
} else {
182-
Self::read_uncompressed(reader)
183-
}
184-
}
185-
186-
fn read_uncompressed(mut reader: impl BufRead) -> Result<Self, GridError> {
173+
pub fn read_uncompressed(mut reader: impl BufRead) -> Result<Self, GridError> {
187174
let magic_bytes: [u8; 16] = reader.fill_buf().map_err(GridError::IoFailure)?[0..16]
188175
.try_into()
189176
.unwrap_or_else(|_| unreachable!());

0 commit comments

Comments
 (0)