pub struct Settings { /* private fields */ }
Expand description
A settings struct, used to define boundary conditions, loads, and elements.
Implementations§
Source§impl Settings
impl Settings
Sourcepub fn new(nelx: usize, nely: usize, volume_fraction: f64) -> Self
pub fn new(nelx: usize, nely: usize, volume_fraction: f64) -> Self
Specify the number of elements and volume fraction
use topopt::Settings;
Settings::new(60, 20, 0.5);
Sourcepub fn with_filter_radius(&mut self, filter_radius: f64) -> Self
pub fn with_filter_radius(&mut self, filter_radius: f64) -> Self
Specify the filter radius. If not specified, the default value is 1.5.
Sourcepub fn with_penalty_weight(&mut self, penalty_weight: f64) -> Self
pub fn with_penalty_weight(&mut self, penalty_weight: f64) -> Self
Specify the penalty weight. If not specified, the default value is 1.5.
Sourcepub fn with_active_elements(&mut self, mask: DMatrix<bool>) -> Self
pub fn with_active_elements(&mut self, mask: DMatrix<bool>) -> Self
Specify elements that must remain active (i.e., filled). The active element boolean mask
must have shape nely
× nelx
.
Sourcepub fn with_passive_elements(&mut self, mask: DMatrix<bool>) -> Self
pub fn with_passive_elements(&mut self, mask: DMatrix<bool>) -> Self
Specify elements that must remain passive (i.e., filled). The passive element boolean mask
must have shape nely
× nelx
.
Sourcepub fn with_size(&mut self, nelx: usize, nely: usize) -> Self
pub fn with_size(&mut self, nelx: usize, nely: usize) -> Self
Specify the dimensions of the domain.
Sourcepub fn with_random_initialization(&mut self) -> Self
pub fn with_random_initialization(&mut self) -> Self
Specify the dimensions of the domain.
Source§impl Settings
§Modifying the Boundary Conditions
This group of methods provides utilities for changing the boundary conditions. These methods are applied like so:
impl Settings
§Modifying the Boundary Conditions
This group of methods provides utilities for changing the boundary conditions. These methods are applied like so:
let settings = Settings::new(120, 30, 0.5)
.with_bottom_right_bc(false, true)
.with_bottom_left_bc(false, true);
Sourcepub fn with_left_bc(&mut self, x: bool, y: bool) -> Self
pub fn with_left_bc(&mut self, x: bool, y: bool) -> Self
Apply a boundary condition to the left side of the domain. The arguments define whether or not the nodes are fixed in the x and y directions.
Sourcepub fn with_right_bc(&mut self, x: bool, y: bool) -> Self
pub fn with_right_bc(&mut self, x: bool, y: bool) -> Self
Apply a boundary condition to the right side of the domain. The arguments define whether or not the nodes are fixed in the x and y directions.
Sourcepub fn with_top_bc(&mut self, x: bool, y: bool) -> Self
pub fn with_top_bc(&mut self, x: bool, y: bool) -> Self
Apply a boundary condition to the top side of the domain. The arguments define whether or not the nodes are fixed in the x and y directions.
Sourcepub fn with_bottom_bc(&mut self, x: bool, y: bool) -> Self
pub fn with_bottom_bc(&mut self, x: bool, y: bool) -> Self
Apply a boundary condition to the bottom side of the domain. The arguments define whether or not the nodes are fixed in the x and y directions.
Sourcepub fn with_vertical_midline_bc(&mut self, x: bool, y: bool) -> Self
pub fn with_vertical_midline_bc(&mut self, x: bool, y: bool) -> Self
Apply a boundary condition to the vertical midline of the domain. The arguments define whether or not the nodes are fixed in the x and y directions.
Sourcepub fn with_horizontal_midline_bc(&mut self, x: bool, y: bool) -> Self
pub fn with_horizontal_midline_bc(&mut self, x: bool, y: bool) -> Self
Apply a boundary condition to the horizontal midline of the domain. The arguments define whether or not the nodes are fixed in the x and y directions.
Sourcepub fn with_bottom_right_bc(&mut self, x: bool, y: bool) -> Self
pub fn with_bottom_right_bc(&mut self, x: bool, y: bool) -> Self
Apply a boundary condition to the bottom right corner of the domain. The arguments define whether or not the node is fixed in the x and y directions.
Sourcepub fn with_bottom_left_bc(&mut self, x: bool, y: bool) -> Self
pub fn with_bottom_left_bc(&mut self, x: bool, y: bool) -> Self
Apply a boundary condition to the bottom left corner of the domain. The arguments define whether or not the node is fixed in the x and y directions.
Sourcepub fn with_top_right_bc(&mut self, x: bool, y: bool) -> Self
pub fn with_top_right_bc(&mut self, x: bool, y: bool) -> Self
Apply a boundary condition to the top right corner of the domain. The arguments define whether or not the node is fixed in the x and y directions.
Sourcepub fn with_top_left_bc(&mut self, x: bool, y: bool) -> Self
pub fn with_top_left_bc(&mut self, x: bool, y: bool) -> Self
Apply a boundary condition to the top left corner of the domain. The arguments define whether or not the node is fixed in the x and y directions.
Source§impl Settings
§Modifying the Load Case
This group of methods provides utilities for changing the load case. These methods are applied like so:
impl Settings
§Modifying the Load Case
This group of methods provides utilities for changing the load case. These methods are applied like so:
let settings = Settings::new(120, 30, 0.5)
.with_bottom_right_bc(false, true)
.with_bottom_left_bc(false, true)
.with_top_middle_load(0.0, -1.0);
Sourcepub fn with_bottom_right_load(&mut self, x: f64, y: f64) -> Self
pub fn with_bottom_right_load(&mut self, x: f64, y: f64) -> Self
Set a load at the bottom right corner of the domain. The argument define loads in the x and y directions.
Sourcepub fn with_bottom_left_load(&mut self, x: f64, y: f64) -> Self
pub fn with_bottom_left_load(&mut self, x: f64, y: f64) -> Self
Set a load at the bottom left corner of the domain. The argument define loads in the x and y directions.
Sourcepub fn with_top_right_load(&mut self, x: f64, y: f64) -> Self
pub fn with_top_right_load(&mut self, x: f64, y: f64) -> Self
Set a load at the top right corner of the domain. The argument define loads in the x and y directions.
Sourcepub fn with_top_left_load(&mut self, x: f64, y: f64) -> Self
pub fn with_top_left_load(&mut self, x: f64, y: f64) -> Self
Set a load at the top left corner of the domain. The argument define loads in the x and y directions.
Sourcepub fn with_top_middle_load(&mut self, x: f64, y: f64) -> Self
pub fn with_top_middle_load(&mut self, x: f64, y: f64) -> Self
Set a load at the middle of the top side of the domain. The argument define loads in the x and y directions.
Sourcepub fn with_bottom_middle_load(&mut self, x: f64, y: f64) -> Self
pub fn with_bottom_middle_load(&mut self, x: f64, y: f64) -> Self
Set a load at the middle of the bottom side of the domain. The argument define loads in the x and y directions.
Sourcepub fn with_right_middle_load(&mut self, x: f64, y: f64) -> Self
pub fn with_right_middle_load(&mut self, x: f64, y: f64) -> Self
Set a load at the middle of the right side of the domain. The argument define loads in the x and y directions.
Sourcepub fn with_left_middle_load(&mut self, x: f64, y: f64) -> Self
pub fn with_left_middle_load(&mut self, x: f64, y: f64) -> Self
Set a load at the middle of the left side of the domain. The argument define loads in the x and y directions.
Sourcepub fn with_centered_load(&mut self, x: f64, y: f64) -> Self
pub fn with_centered_load(&mut self, x: f64, y: f64) -> Self
Set a load at the center of the domain. The argument define loads in the x and y directions.
Sourcepub fn with_loads(&mut self, loads: DMatrix<(f64, f64)>) -> Self
pub fn with_loads(&mut self, loads: DMatrix<(f64, f64)>) -> Self
Specify loading at every node. This matrix must shape nely+1
× nelx+1
, where each
element is a tuple defining the loading in x and y directions.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Settings
impl RefUnwindSafe for Settings
impl Send for Settings
impl Sync for Settings
impl Unpin for Settings
impl UnwindSafe for Settings
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.