NESSie
Constants
NESSie._etol
— Function_etol(::Float64)
_etol(::Type{Float64})
_etol(::Float32)
_etol(::Type{Float32})
Common tolerance values internally used by NESSie.
Return type
T
NESSie.σ
— ConstantGeometric quantity $σ(ξ)$
\[σ(ξ) = \lim_{ε→0} \frac{1}{4πε²} ∫_{r ∈ Ω:|r-ξ|=ε} dΓᵣ = \frac{1}{2}\]
for almost all $ξ ∈ Γ$ (cf. [Ste03]).
NESSie.ec
— Constant$10^{10}$ times the elementary charge (for $Å → m$ conversion)
Unit
$C$
NESSie.potprefactor
— Functionpotprefactor(T::Type{Float64} = Float64)
potprefactor(T::Type{Float32})
Common prefactor for all potentials $φ_Ω$ and $φ_Σ$:
\[\frac{1.602 ⋅ 10^{-19}}{10^{-10} ⋅ 4π ⋅ ε₀} ≈ 1.145 ⋅ 4π\]
Return type
T
NESSie.yukawa
— Functionyukawa(opt::Option{T})
Exponent $1/Λ$ for the fundamental solution of the yukawa operator
\[Λ := λ\sqrt{\frac{ε_∞}{ε_Σ}}\]
Return type
T
Utility functions
NESSie._cos
— Function_cos(
u ::AbstractVector{T},
v ::AbstractVector{T},
unorm::T=_norm(u),
vnorm::T=_norm(v)
)
Computes the cosine of the angle between the given vectors u
and v
with lengths unorm
and vnorm
, respectively.
Return type
T
NESSie._dot
— Function_dot(
u::AbstractVector{T},
v::AbstractVector{T}
)
Fast dot product for 3-element vectors.
Return type
T
NESSie._norm
— Function_norm(u::AbstractVector{T})
Fast Euclidean norm for 3-element vectors.
Return type
T
NESSie._seek
— Function_seek(
fh ::IOStream,
prefix ::String,
skiptheline::Bool = true
)
Fast-forwards an IOStream to the next line starting with the given prefix
. In case there is no such line, the stream handle will be set to EOF.
Arguments
skiptheline
If true, said line will also be skipped
Return type
Void
NESSie._sign
— Function_sign(
u::AbstractVector{T},
v::AbstractVector{T},
n::AbstractVector{T}
)
Determines whether the normal vector of the plane specified by the vectors u
and v
has the same orientation as the given normal vector n
. Returns $1$ if both normals have the same orientation, $0$ if at least one of the vectors is zero, and $-1$ otherwise.
Return type
T
NESSie.cathetus
— Functioncathetus(hyp::T, cosθ::T)
Computes the cathetus $c₁$ of a triangle given the hypotenuse $h$ and the cosine of the exterior angle $θ$ between the hypotenuse and the other cathetus $c₂$.
\[c₂ = h ⋅ \cos(θ) \\ h² = c₁² + c₂² \\ ⇔ c₁ = \sqrt{h² ⋅ (1 - \cos²(θ))}\]
Return type
T
NESSie.ddot
— Functionddot(
u::AbstractVector{T},
v::AbstractVector{T},
n::AbstractVector{T}
)
Devectorized computation of (u-v)⋅n
.
Return type
T
NESSie.distance
— Functiondistance(
q ::AbstractVector{T},
elem::Triangle{T}
)
Calculates the (positive or negative) distance from the given point q
to the plane the given triangle elem
is located in. Negative distances correspond to point locations on the 'inside' wrt. to the element's (outward-facing) normal vector.
Return type
T
NESSie.eye!
— Functioneye!(
m::AbstractMatrix{T},
α::Number=one(T)
)
Initializes the given matrix m
with αI
, with I
being an identity matrix with the same dimensions as m
.
Return type
Void
Example
julia> m = 2 * ones(2, 2)
2×2 Matrix{Float64}:
2.0 2.0
2.0 2.0
julia> eye!(m); m
2×2 Matrix{Float64}:
1.0 0.0
0.0 1.0
julia> eye!(m, 2); m
2×2 Matrix{Float64}:
2.0 0.0
0.0 2.0
NESSie.isdegenerate
— Functionisdegenerate(elem::Triangle{T})
Tests whether the given triangle is degenerate.
Return type
Bool
NESSie.pluseye!
— Functionpluseye!(
m::AbstractMatrix{T},
α::Number=one(T)
)
Adds α
to all diagonal elements of matrix m
.
Return type
Void
Example
julia> m = 2 * ones(2, 2)
2×2 Matrix{Float64}:
2.0 2.0
2.0 2.0
julia> pluseye!(m); m
2×2 Matrix{Float64}:
3.0 2.0
2.0 3.0
julia> pluseye!(m, 2); m
2×2 Matrix{Float64}:
5.0 2.0
2.0 5.0
NESSie.props
— Functionprops(
elem::Triangle{T}
)
Computes the given triangle's properties, that is, centroid, normal, distance to origin, and area. Returns the completely initialized Triangle as a copy.
The given triangle remains unchanged!
Return type
Triangle
NESSie.reverseindex
— Functionreverseindex(v::AbstractVector{T})
Creates a reverse index for the given vector v
, that is, a dictionary linking the object IDs of the vector elements to the corresponding position in the vector.
Return type
Dict{UInt, UInt}
NESSie.unpack
— Functionunpack(data::Vector{Vector{T}})
Unpacks the given vector of vectors into a single vector.
Return type
Vector{T}
Example
julia> unpack([[1, 2], [3]])
3-element Vector{Int64}:
1
2
3
NESSie.vertexnormals
— Functionvertexnormals(model::Model{T, Triangle{T}})
Returns a vector containing the normal vectors of the given model's triangles.
Return type
Vector{Vector{T}}