pub mod bundle;
pub mod cgns;
pub mod exodus;
pub mod fluent;
pub mod gmsh;
pub mod hdf5;
pub mod partitioned;
pub mod petsc_hdf5;
pub mod ply;
pub mod vtk;
pub mod xdmf;
use crate::data::coordinates::Coordinates;
use crate::data::discretization::Discretization;
use crate::data::mixed_section::MixedSectionStore;
use crate::data::section::Section;
use crate::data::storage::Storage;
use crate::mesh_error::MeshSieveError;
use crate::topology::cell_type::CellType;
use crate::topology::labels::LabelSet;
use crate::topology::sieve::Sieve;
use std::collections::BTreeMap;
use std::io::{Read, Write};
pub use bundle::MeshBundle;
pub use partitioned::{
GatherPolicy, NeighborLinks, OverlapLink, OverlapMetadata, PartitionedMeshData,
PartitionedMeshMetadata, PartitionedMeshWriteOutcome, read_partitioned_mesh,
write_local_piece_with_metadata, write_partitioned_mesh,
};
#[derive(Debug)]
pub struct MeshData<S, V, St, CtSt>
where
St: Storage<V>,
CtSt: Storage<CellType>,
{
pub sieve: S,
pub coordinates: Option<Coordinates<V, St>>,
pub sections: BTreeMap<String, Section<V, St>>,
pub mixed_sections: MixedSectionStore,
pub labels: Option<LabelSet>,
pub cell_types: Option<Section<CellType, CtSt>>,
pub discretization: Option<Discretization>,
}
impl<S, V, St, CtSt> MeshData<S, V, St, CtSt>
where
St: Storage<V>,
CtSt: Storage<CellType>,
{
pub fn new(sieve: S) -> Self {
Self {
sieve,
coordinates: None,
sections: BTreeMap::new(),
mixed_sections: MixedSectionStore::default(),
labels: None,
cell_types: None,
discretization: None,
}
}
}
pub trait SieveSectionReader {
type Sieve: Sieve;
type Value;
type Storage: Storage<Self::Value>;
type CellStorage: Storage<CellType>;
fn read<R: Read>(
&self,
reader: R,
) -> Result<MeshData<Self::Sieve, Self::Value, Self::Storage, Self::CellStorage>, MeshSieveError>;
}
pub trait SieveSectionWriter {
type Sieve: Sieve;
type Value;
type Storage: Storage<Self::Value>;
type CellStorage: Storage<CellType>;
fn write<W: Write>(
&self,
writer: W,
mesh: &MeshData<Self::Sieve, Self::Value, Self::Storage, Self::CellStorage>,
) -> Result<(), MeshSieveError>;
}