Helper - Functions

Index

Helpers

PeriLab.Solver_control.Helpers.check_inf_or_nanMethod
check_inf_or_nan(array, msg)

Checks if the sum of the array is finite. If not, an error is raised.

Arguments

  • array: The array to check.
  • msg: The error message to raise.

Returns

  • Bool: true if the sum of the array is finite, false otherwise.
source
PeriLab.Solver_control.Helpers.find_files_with_endingMethod
find_files_with_ending(folder_path::AbstractString, file_ending::AbstractString)

Returns a list of files in folder_path that end with file_ending.

Arguments

  • folder_path::AbstractString: The path to the folder.
  • file_ending::AbstractString: The ending of the files.

Returns

  • file_list::Vector{String}: The list of files that end with file_ending.
source
PeriLab.Solver_control.Helpers.find_indicesMethod
find_indices(vector, what)

Returns the indices of vector that are equal to what.

Arguments

  • vector::Vector: The vector to search in.
  • what: The value to search for.

Returns

  • indices::Vector: The indices of vector that are equal to what.
source
PeriLab.Solver_control.Helpers.find_inverse_bond_idMethod
find_inverse_bond_id(nlist::Vector{Vector{Int64}})

Finds the inverse of the bond id in the nlist.

Arguments

  • nlist::Vector{Vector{Int64}}: The nlist to find the inverse of.

Returns

  • inverse_nlist::Vector{Dict{Int64,Int64}}: The inverse nlist.
source
PeriLab.Solver_control.Helpers.get_active_update_nodesMethod
get_active_update_nodes(active::Vector{Bool}, update_list::Vector{Bool}, nodes::Vector{Int64}, index::Vector{Int64})

Returns the active nodes and the update nodes.

Arguments

  • active::Vector{Bool}: The active vector.
  • update_list::Vector{Bool}: The update vector.
  • nodes::Vector{Int64}: The vector of nodes.
  • index::Vector{Int64}: Pre allocated Vector.

Returns

  • update_nodes::Vector{Int64}: The nodes of update that are true.
source
PeriLab.Solver_control.Helpers.get_fourth_orderMethod
get_fourth_order(CVoigt, dof)

Constructs a symmetric fourth-order tensor from a Voigt notation vector. It uses Tensors.jl package.

This function takes a Voigt notation vector CVoigt and the degree of freedom dof to create a symmetric fourth-order tensor. The CVoigt vector contains components that represent the tensor in Voigt notation, and dof specifies the dimension of the tensor.

Arguments

  • CVoigt::Matrix{Float64}: A vector containing components of the tensor in Voigt notation.
  • dof::Int64: The dimension of the resulting symmetric fourth-order tensor.

Returns

  • SymmetricFourthOrderTensor{dof}: A symmetric fourth-order tensor of dimension dof.

Example

```julia CVoigt = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] dof = 3 result = getfourthorder(CVoigt, dof)

source
PeriLab.Solver_control.Helpers.invertFunction
invert(A::Union{Matrix{Float64},Matrix{Int64}}, error_message::String="Matrix is singular")

Invert a n x n matrix. Throws an error if A is singular.

Arguments

  • A::Union{Matrix{Float64},Matrix{Int64}}: A n x n matrix.
  • error_message::String="Matrix is singular": The error message returned if A is singular.

Returns

  • inverted matrix or nothing if not inverable.
source
PeriLab.Solver_control.Helpers.progress_barMethod
progress_bar(rank::Int64, nsteps::Int64, silent::Bool)

Create a progress bar if the rank is 0. The progress bar ranges from 1 to nsteps + 1.

Arguments

  • rank::Int64: An integer to determine if the progress bar should be created.
  • nsteps::Int64: The total number of steps in the progress bar.
  • silent::Bool: de/activates the progress bar

Returns

  • ProgressBar or UnitRange: If rank is 0, a ProgressBar object is returned. Otherwise, a range from 1 to nsteps + 1 is returned.
source
PeriLab.Solver_control.Helpers.qdimMethod
qdim(order::Int64, dof::Int64)

Calculate the number of terms in a polynomial expansion up to a specified accuracy order. Simplied first complex loop in Peridigm correspondence::computeLagrangianGradientWeights. In the unit test this values where tested.

Arguments

  • order::Int64: The accuracy order of the polynomial expansion.

Returns

  • Int64: The total number of terms in the polynomial expansion.

Description

This function calculates the number of terms in a polynomial expansion up to the specified accuracy order using an analytical formula derived from combinatorial considerations. The function iterates over each order from 1 to the specified order and calculates the sum of binomial coefficients according to the formula: qdim(order) = Σ(i=1 to order) [(i+2)! / (2! * i!)]

source
PeriLab.Solver_control.Helpers.rotateMethod
rotate(nodes::Union{SubArray,Vector{Int64}}, dof::Int64, matrix::Union{SubArray,Array{Float64,3}}, angles::SubArray, back::Bool)

Rotates the matrix.

Arguments

  • nodes::Union{SubArray,Vector{Int64}}: List of block nodes.
  • matrix::Union{SubArray,Array{Float64,3}}: Matrix.
  • rot::SubArray: Rotation tensor.
  • back::Bool: Back.

Returns

  • matrix::SubArray: Matrix.
source
PeriLab.Solver_control.Helpers.rotate_second_order_tensorMethod
rotate_second_order_tensor(angles::Union{Vector{Float64},Vector{Int64}}, tensor::Matrix{Float64}, dof::Int64, back::Bool)

Rotates the second order tensor.

Arguments

  • angles::Union{Vector{Float64},Vector{Int64}}: Angles.
  • tensor::Matrix{Float64}: Second order tensor.
  • dof::Int64: Degree of freedom.
  • back::Bool: Back.

Returns

  • tensor::Matrix{Float64}: Second order tensor.
source