ElastoPlasm Reference
ElastoPlasm.kwargser
— Methodkwargser(type::Symbol, kwargs::Any; dim::Number=2) -> Dict
Generates a configuration dictionary for simulation or API routines by merging user-supplied keyword arguments with default reference values.
Arguments
type::Symbol
: The configuration type (e.g.,:instr
) to load defaults for.kwargs::Any
: Dictionary of user-supplied keyword arguments to override defaults.dim::Number=2
: (Optional) Spatial dimension, used for kernel initialization.
Returns
Dict
: A dictionary containing the merged configuration, with kernels and precision set for:instr
type.
Behavior
- For
type == :instr
, mergeskwargs
with required defaults, sets precision, and attaches kernel functions. - For other types, merges
kwargs
with defaults and returns the result. - Warns about any unused keyword arguments.
Example
cfg = kwargser(:instr, Dict(:dtype => 64, :locking => true); dim=3)
ElastoPlasm.require
— Functionrequire(in::Symbol=:instr) -> Dict
Returns a reference configuration dictionary for simulation instructions or API routines.
Arguments
in::Symbol
: The configuration type to load defaults for. Only:instr
is supported.
Returns
Dict
: A dictionary containing default configuration values for simulation, including precision, basis, deformation framework, mapping scheme, locking mitigation, random field generator, plasticity, non-local regularization, plotting options, and performance mode.
Behavior
- If
in == :instr
, returns a dictionary with all default simulation options. - Throws an error for unsupported symbols.
Example
cfg = require(:instr)
Supported keys and their purpose
:dtype
— Arithmetic precision:basis
— Shape function type:fwrk
— Deformation framework:trsfr
— Mapping scheme:vollock
— Volumetric locking mitigation:grf
— Gaussian Random Field generator:plast
— Plasticity onset and flow law:nonloc
— Non-local regularization:plot
— Plotting options:perf
— Performance mode
ElastoPlasm.config_plot
— Functionconfig_plot(titf=12, gf=12, tickf=10, lf=10, lw=2, fs=:box, l=nothing, g=false)
Configures the default styling parameters for plots, allowing customization of fonts, line widths, frame style, labels, and grid visibility.
Arguments
titf
: Font size for the plot title (default:12
).gf
: Font size for guide elements, such as axis labels and legends (default:12
).tickf
: Font size for tick labels (default:10
).lf
: Font size for legend text (default:10
).lw
: Line width for plot lines (default:2
).fs
: Frame style for the plot, e.g.,:box
or:none
(default::box
).l
: Label for the plot, ornothing
for no label (default:nothing
).g
: Grid display option;true
to show grid,false
to hide (default:false
).
Returns
nothing
Example
config_plot(titf=14, gf=12, tickf=8, lf=12, lw=3, fs=:box, l="My Plot", g=true)
ElastoPlasm.set_paths
— Methodset_paths(new_dir::String, path::String; interactive::Bool=true) -> Dict{Symbol, String}
Creates and manages subdirectories within a specified base path, optionally allowing interactive selection of which folders to generate.
Arguments
new_dir::String
: Name of the main directory to create within the base path.path::String
: The base directory in whichnew_dir
will be created.interactive::Bool=true
: If true, prompts the user to select which subdirectories to create; if false, creates all default subdirectories automatically.
Returns
Dict{Symbol, String}
: Dictionary mapping subdirectory names (as symbols) to their absolute paths.
Behavior
- Ensures the main directory exists within the base path.
- Interactively or automatically creates subdirectories (e.g.,
plot
,dat
). - Cleans up specific file types in newly created subdirectories if they already existed.
- Logs information about generated and cleaned paths.
Example
paths = set_paths("results", pwd(); interactive=false)
println(paths[:plot]) # Absolute path to the plot subdirectory