Skip to content

Instantly share code, notes, and snippets.

View KristofferC's full-sized avatar
🇸🇪

Kristoffer Carlsson KristofferC

🇸🇪
View GitHub Profile
import LinAlg.norm
abstract AbstractVoigt{T}
immutable VoigtStress <: AbstractVoigt
xx::Float64
yy::Float64
zz::Float64
yz::Float64
xz::Float64
using PyCall
@pyimport vtk
function create_vtk_object(mesh::Mesh)
n_nodes = length(mesh.nodes)
# Add points to vtkPoints
points = pycall(vtk.vtkPoints, PyAny)
for node in mesh.nodes
###########################FUNCTIONS##################################
##### exportVTK
function exportVTK(DataMat, NameMat ,filename, dh, Nxyz)
nx = dh[1]*(Nxyz[1]-1);
ny = dh[2]*(Nxyz[2]-1);
nz = dh[3]*(Nxyz[3]-1);
x, y, z = ndgrid(0:dh[1]:nx, 0:dh[2]:ny, 0:dh[3]:nz );
using FixedSizeArrays
# Point types
abstract AbstractPoint{L} <: FixedVector{Int, L}
immutable Point2<: AbstractPoint{2}
x::Float64
y::Float64
end
# Hyper spheres are used to bound points in space.
# For a node all it's children are bounded by the
# node's hyper sphere.
immutable HyperSphere{T <: FloatingPoint}
center::Vector{T}
r::T
end
# Checks if two spheres overlap.
# They do if the distance between their centers
# Defines data types representing a purely geometrical mesh.
##########
# Points #
##########
immutable Point2<: FixedVector{Float64, 2}
x::Float64
y::Float64
end
typealias Vector2 Point2
function isnothermitian(A::SparseMatrixCSC)
m, n = size(A)
if m != n; return false; end
CHECK_PERCENTAGE = 0.001
colptr = A.colptr
rowval = A.rowval
nzval = A.nzval
nrnzval = length(nzval)
function ishermitian_new(A::SparseMatrixCSC)
m, n = size(A)
if m != n; return false; end
colptr = A.colptr
rowval = A.rowval
nzval = A.nzval
start_indices = copy(A.colptr)
nrnzval = length(nzval)
@inbounds for col = 1 : A.n
function isstructsym(A::SparseMatrixCSC)
m, n = size(A)
if m != n; return false; end
colptr = A.colptr
rowval = A.rowval
nzval = A.nzval
tracker = copy(A.colptr)
@inbounds for col = 1:A.n
for p = tracker[col]:colptr[col+1]-1
do ii=1,nslip
!
k_alpha(ii)=n_k_alpha(ii)-XX(ii)
phi(ii)=(sum( Mbar*s_x_m(1:9,ii) ) )-&
( -para(8)*k_alpha(ii)+kappa_nl(ii) )-para(11)
if ( phi(ii).gt.0.d0 ) then
mclaur=phi(ii)
else
mclaur=0.d0
endif