pub struct Closed<T>(pub T);Expand description
Restrict points to the inside of a shape.
Closed is a newtype that wraps a shape. It prevents bodies and sites from
existing outside the shape. Bodies and sites are never wrapped, and there are no
ghost sites.
Tuple Fields§
§0: TTrait Implementations§
Source§impl<B, X> AppendMicrostate<B, OrientedPoint<Cartesian<2>, Angle>, X, Closed<Hypercuboid<2>>> for HoomdGsdFile
impl<B, X> AppendMicrostate<B, OrientedPoint<Cartesian<2>, Angle>, X, Closed<Hypercuboid<2>>> for HoomdGsdFile
Source§fn append_microstate(
&mut self,
microstate: &Microstate<B, OrientedPoint<Cartesian<2>, Angle>, X, Closed<Hypercuboid<2>>>,
) -> Result<Frame<'_>, AppendError>
fn append_microstate( &mut self, microstate: &Microstate<B, OrientedPoint<Cartesian<2>, Angle>, X, Closed<Hypercuboid<2>>>, ) -> Result<Frame<'_>, AppendError>
Append the contents of the microstate as a frame in a GSD file. Read more
Source§impl<B, X> AppendMicrostate<B, OrientedPoint<Cartesian<3>, Versor>, X, Closed<Hypercuboid<3>>> for HoomdGsdFile
impl<B, X> AppendMicrostate<B, OrientedPoint<Cartesian<3>, Versor>, X, Closed<Hypercuboid<3>>> for HoomdGsdFile
Source§fn append_microstate(
&mut self,
microstate: &Microstate<B, OrientedPoint<Cartesian<3>, Versor>, X, Closed<Hypercuboid<3>>>,
) -> Result<Frame<'_>, AppendError>
fn append_microstate( &mut self, microstate: &Microstate<B, OrientedPoint<Cartesian<3>, Versor>, X, Closed<Hypercuboid<3>>>, ) -> Result<Frame<'_>, AppendError>
Append the contents of the microstate as a frame in a GSD file. Read more
Source§impl<B, X> AppendMicrostate<B, Point<Cartesian<2>>, X, Closed<Hypercuboid<2>>> for HoomdGsdFile
impl<B, X> AppendMicrostate<B, Point<Cartesian<2>>, X, Closed<Hypercuboid<2>>> for HoomdGsdFile
Source§fn append_microstate(
&mut self,
microstate: &Microstate<B, Point<Cartesian<2>>, X, Closed<Hypercuboid<2>>>,
) -> Result<Frame<'_>, AppendError>
fn append_microstate( &mut self, microstate: &Microstate<B, Point<Cartesian<2>>, X, Closed<Hypercuboid<2>>>, ) -> Result<Frame<'_>, AppendError>
Append the contents of the microstate as a frame in a GSD file. Read more
Source§impl<B, X> AppendMicrostate<B, Point<Cartesian<3>>, X, Closed<Hypercuboid<3>>> for HoomdGsdFile
impl<B, X> AppendMicrostate<B, Point<Cartesian<3>>, X, Closed<Hypercuboid<3>>> for HoomdGsdFile
Source§fn append_microstate(
&mut self,
microstate: &Microstate<B, Point<Cartesian<3>>, X, Closed<Hypercuboid<3>>>,
) -> Result<Frame<'_>, AppendError>
fn append_microstate( &mut self, microstate: &Microstate<B, Point<Cartesian<3>>, X, Closed<Hypercuboid<3>>>, ) -> Result<Frame<'_>, AppendError>
Append the contents of the microstate as a frame in a GSD file. Read more
Source§impl<'de, T> Deserialize<'de> for Closed<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Closed<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T, P> Distribution<P> for Closed<T>where
T: Distribution<P>,
impl<T, P> Distribution<P> for Closed<T>where
T: Distribution<P>,
Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> P
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> P
Generate points uniformly distributed in the wrapped shape.
§Example
use hoomd_geometry::{IsPointInside, shape::Sphere};
use hoomd_microstate::boundary::Closed;
use rand::{SeedableRng, distr::Distribution, rngs::StdRng};
let sphere = Closed(Sphere {
radius: 5.0.try_into()?,
});
let mut rng = StdRng::seed_from_u64(1);
let point = sphere.sample(&mut rng);
assert!(sphere.0.is_point_inside(&point));Source§fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
Create an iterator that generates random values of
T, using rng as
the source of randomness. Read moreSource§impl<S, T> GenerateGhosts<S> for Closed<T>where
S: Default,
impl<S, T> GenerateGhosts<S> for Closed<T>where
S: Default,
Source§impl<P, T> MapPoint<P> for Closed<T>where
T: MapPoint<P>,
impl<P, T> MapPoint<P> for Closed<T>where
T: MapPoint<P>,
Source§fn map_point(&self, point: P, other: &Self) -> Result<P, Error>
fn map_point(&self, point: P, other: &Self) -> Result<P, Error>
Map a point in the wrapped shape to another.
§Errors
hoomd_geometry::Error::PointOutsideShape when point is outside
self.shape().
§Example
use hoomd_geometry::{MapPoint, shape::Rectangle};
use hoomd_microstate::boundary::Closed;
use hoomd_vector::Cartesian;
let closed_a = Closed(Rectangle::with_equal_edges(10.0.try_into()?));
let closed_b = Closed(Rectangle::with_equal_edges(20.0.try_into()?));
let mapped_point =
closed_a.map_point(Cartesian::from([-1.0, 1.0]), &closed_b);
assert_eq!(mapped_point, Ok(Cartesian::from([-2.0, 2.0])));
assert_eq!(
closed_a.map_point(Cartesian::from([-100.0, 1.0]), &closed_b),
Err(hoomd_geometry::Error::PointOutsideShape)
);Source§impl<T> Scale for Closed<T>where
T: Scale,
impl<T> Scale for Closed<T>where
T: Scale,
Source§fn scale_length(&self, v: PositiveReal) -> Self
fn scale_length(&self, v: PositiveReal) -> Self
Scale the wrapped shape.
§Example
use hoomd_geometry::{Scale, shape::Sphere};
use hoomd_microstate::boundary::Closed;
let sphere = Closed(Sphere {
radius: 5.0.try_into()?,
});
let scaled_sphere = sphere.scale_length(0.5.try_into()?);
assert_eq!(scaled_sphere.0.radius.get(), 2.5);Source§fn scale_volume(&self, v: PositiveReal) -> Self
fn scale_volume(&self, v: PositiveReal) -> Self
Scale the wrapped shape.
§Example
use hoomd_geometry::{Scale, shape::Rectangle};
use hoomd_microstate::boundary::Closed;
let closed = Closed(Rectangle::with_equal_edges(10.0.try_into()?));
let scaled_closed = closed.scale_volume(4.0.try_into()?);
assert_eq!(scaled_closed.0.edge_lengths[0].get(), 20.0);impl<T> StructuralPartialEq for Closed<T>
Auto Trait Implementations§
impl<T> Freeze for Closed<T>where
T: Freeze,
impl<T> RefUnwindSafe for Closed<T>where
T: RefUnwindSafe,
impl<T> Send for Closed<T>where
T: Send,
impl<T> Sync for Closed<T>where
T: Sync,
impl<T> Unpin for Closed<T>where
T: Unpin,
impl<T> UnsafeUnpin for Closed<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Closed<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more