pub struct FoamMesh {
pub path: PathBuf,
pub boundary: HashMap<String, Boundary>,
pub points: Vec<Point3<f64>>,
pub faces: Vec<Vec<usize>>,
pub cell_faces: Vec<Vec<usize>>,
pub owners: Vec<usize>,
pub neighbors: Vec<i64>,
pub cell_neighbors: Vec<Vec<i64>>,
pub cell_centers: Option<Vec<Point3<f64>>>,
/* private fields */
}
Fields§
§path: PathBuf
§boundary: HashMap<String, Boundary>
§points: Vec<Point3<f64>>
§faces: Vec<Vec<usize>>
A face is defined as a list of point indices. Each face also is represented in the list of owners and neighbors.
cell_faces: Vec<Vec<usize>>
§owners: Vec<usize>
Indices of the cell that is the owner of the respective face.
neighbors: Vec<i64>
Indices of neighboring cells for each internal face.
cell_neighbors: Vec<Vec<i64>>
§cell_centers: Option<Vec<Point3<f64>>>
Implementations§
Source§impl FoamMesh
impl FoamMesh
pub fn new<P: AsRef<Path>>(path: P) -> Result<FoamMesh, Error>
Sourcepub fn read_cell_centers<P: AsRef<Path>>(
&mut self,
filename: P,
) -> Result<(), Error>
pub fn read_cell_centers<P: AsRef<Path>>( &mut self, filename: P, ) -> Result<(), Error>
Read cell center coordinates from the given file
(e.g., 0/C
).
Such a file can be generated by running
postProcess -func 'writeCellCentres' -time 0
.
pub fn num_inner_faces(&self) -> usize
pub fn num_cells(&self) -> usize
Sourcepub fn cell_neighbor_cells(&self, cell_id: usize) -> Option<&Vec<i64>>
pub fn cell_neighbor_cells(&self, cell_id: usize) -> Option<&Vec<i64>>
Return the indices of neighbor cells of the cell with index cell_id
.
Sourcepub fn is_cell_on_boundary(
&self,
cell_id: usize,
bd_name: Option<String>,
) -> bool
pub fn is_cell_on_boundary( &self, cell_id: usize, bd_name: Option<String>, ) -> bool
Check if a cell is on a boundary.
Run-time complexity is in O(n), where n is the maximum number of neighbors of a cell.
Sourcepub fn is_face_on_boundary(
&self,
face_id: usize,
bd_name: Option<String>,
) -> bool
pub fn is_face_on_boundary( &self, face_id: usize, bd_name: Option<String>, ) -> bool
Check if a face is a boundary face (in O(1)).
Sourcepub fn boundary_cells(&self, bd_name: &str) -> Vec<usize>
pub fn boundary_cells(&self, bd_name: &str) -> Vec<usize>
Get cell IDs of cells on a given boundary. Returns an empty vector if the named boundary does not exist.
Sourcepub fn parse_scalars<P: AsRef<Path>, T: FromStr>(
filename: P,
skip: usize,
) -> Result<Vec<T>, Error>
pub fn parse_scalars<P: AsRef<Path>, T: FromStr>( filename: P, skip: usize, ) -> Result<Vec<T>, Error>
Parse scalar values from a given ASCII file.
Expects a file in the following format:
// …
11360
(
42
0
3
// …
)
Sourcepub fn parse_faces<P: AsRef<Path>>(
filename: P,
skip: usize,
) -> Result<Vec<Vec<usize>>, Error>
pub fn parse_faces<P: AsRef<Path>>( filename: P, skip: usize, ) -> Result<Vec<Vec<usize>>, Error>
Parse faces from a given ASCII file. Each face is a list of point indices.
Expects a file in the following format:
// …
11360
(
4(1 42 1723 1682)
3(2 3 4)
// …
)
Sourcepub fn parse_points<P: AsRef<Path>>(
filename: P,
skip: usize,
) -> Result<Vec<Point3<f64>>, Error>
pub fn parse_points<P: AsRef<Path>>( filename: P, skip: usize, ) -> Result<Vec<Point3<f64>>, Error>
Parse mesh point data from a given ASCII file.
Expects a file in the following format:
// …
5043
(
(42 0 1)
(3 2.001 13.37)
// …
)
Sourcepub fn parse_boundary<P: AsRef<Path>>(
filename: P,
skip: usize,
) -> Result<HashMap<String, Boundary>, Error>
pub fn parse_boundary<P: AsRef<Path>>( filename: P, skip: usize, ) -> Result<HashMap<String, Boundary>, Error>
Parse an OpenFOAM boundary definition file.
Expects a file in the following format:
// …
3
(
inlet
{
type patch;
nFaces 605;
startFace 971201;
}
outlet
{
type patch;
nFaces 605;
startFace 971806;
}
walls
{
type patch;
nFaces 23848;
startFace 972411;
}
)
Auto Trait Implementations§
impl Freeze for FoamMesh
impl RefUnwindSafe for FoamMesh
impl Send for FoamMesh
impl Sync for FoamMesh
impl Unpin for FoamMesh
impl UnwindSafe for FoamMesh
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.