Skip to content

Instantly share code, notes, and snippets.

View PetrKryslUCSD's full-sized avatar

Petr Krysl PetrKryslUCSD

View GitHub Profile
@PetrKryslUCSD
PetrKryslUCSD / FEMMBaseModule.jl
Created May 19, 2017 19:28
FEMMBaseModule.jl
module FEMMBaseModule
typealias FInt Int
typealias FFlt Float64
typealias FFltVec Vector{FFlt}
typealias FIntVec Vector{FInt}
typealias FFltMat Matrix{FFlt}
typealias FIntMat Matrix{FInt}
abstract FESet
@PetrKryslUCSD
PetrKryslUCSD / Driver.jl
Created May 20, 2017 00:54
Reproducing the strange allocation
module Driver
using FESetModule
using FEMMBaseModule
function run1()
J = ones(2, 2)
loc = zeros(1,3)
conn = reshape([1,2,3], 1, 3)
N = zeros(3,1)
using FinEtools
using FinEtools.MeshExportModule
println("""Heat conduction example from JuAFEM.""")
t0 = time()
A = 2.0
thermal_conductivity = eye(2,2); # conductivity matrix
function getsource!(forceout::FFltVec, XYZ::FFltMat, tangents::FFltMat, fe_label::FInt)
forceout[1] = 1.0; #heat source
using JuAFEM
# using UnicodePlots
t0 = time()
grid = generate_grid(Quadrilateral, (1000,1000))
addnodeset!(grid, "boundary", x -> abs(x[1]) ≈ 1 || abs(x[2]) ≈ 1);
dim = 2
ip = Lagrange{dim, RefCube, 1}()
qr = QuadratureRule{dim, RefCube}(2)
Variables:
fens1::FinEtools.FENodeSetModule.FENodeSet
fens2::FinEtools.FENodeSetModule.FENodeSet
tolerance::Float64
dim::Int64
nn1<optimized out>
nn2<optimized out>
xyz1<optimized out>
id1<optimized out>
xyz2<optimized out>
module moinbounds13
using FinEtools
using FinEtools.MatrixUtilityModule: add_mggt_ut_only!, complete_lt!
using LinearAlgebra: Transpose, mul!
using BenchmarkTools
function add_mggt_ut_only_wo!(Ke::FFltMat, gradN::FFltMat, mult::FFlt)
@assert size(Ke, 1) == size(Ke, 2)
Kedim = size(Ke, 1)
nne, mdim = size(gradN)
mx::FInt = 0
module naivelu
using BenchmarkTools
using LinearAlgebra
"""
naivelu!(a)
Naive LU decomposition implementation.
@PetrKryslUCSD
PetrKryslUCSD / testinglu.jl
Last active September 20, 2020 01:56
Testing LU
module testinglu
using LinearAlgebra
import LinearAlgebra: lu!, generic_lufact!, BlasInt, checknonsingular
function better_generic_lufact!(A::StridedMatrix{T}, ::Val{Pivot} = Val(true);
check::Bool = true) where {T,Pivot}
m, n = size(A)
minmn = min(m,n)
info = 0
using PlotlyJS
using JSON
plots = scatter3d(;x = rand(6), y = rand(6), z = rand(6))
layout = Layout(width="600", height="600", autosize=true, title="Change the view, then switch to commandline",
scene=attr(
xaxis=attr(title="X", gridcolor="rgb(255, 255, 255)",
zerolinecolor="rgb(255, 255, 255)",
showbackground=true,
backgroundcolor="rgb(25, 25, 25)"),
module FESpaces
using StaticArrays
using MeshCore
using MeshCore: nshapes, indextype, nrelations, retrieve, manifdim, IncRel
using MeshKeeper: Mesh, baseincrel, increl
using ..FElements: nfeatofdim, ndofsperfeat, ndofsperelem
mutable struct FEField{N, T, IT}
dofnums::Vector{SVector{N, IT}}