Files
JuliaFEM.jl/test/test_sparse.jl
T
Jukka Aho c307c1482c Testing/code coverage (#83)
Change the code coverage to green. 

* removed duplicate code

* Removed unused code

* removed unmaintained code

* DCTI + DVTI refactored

* discrete fields refactored and tested

* fields are now tested quite well.

* Removed obsolete code not used anywhere

* Element descriptions to common dictionary

* size in global const dictionary also

* Added coverage to sparse tools and removed couple unused functions

* get nonzero rows from SparseMatrixCSC

* bugfix: extending element basis now working and tested

* Removed two unused functions from elements.jl

* removed useless function

* Useless conversion

* remove elasticity assembly using ForwardDiff because it's not used anywhere'

* Added basic testing for NURBS. Fixed bug in NSolid interpolation.

* removed unused functions

* Removed some debug stuff

* renamed file

* removed field assembly posthook, i think not good idea at all

* test for nnz(K) == 0 and automatic determination of dofs

* Testing that solver is throwing error if having problems with boundary assembly

* Removed some unused options. Refactoring.

* Moved solver non-related code to elements.jl

* Removed custom exception (no need)

* unneeded postprocess code

* More tests for NURBS elements.

* Removed unfinished .mail parser

* proper use of Logging package

* also read results

* renamed test file

* create_surface_elements accepts surface name in String now

* bugfix: remove zero rows from constraint matrix after manually removing dofs from some boundary assemblies.

* New test, displacement 3d patch test

* skip displacement field in surface element splitting if not defined

* test element splitting and linear surface elements, fails.

* Bugfix: Xdmf, not XDMF

* removed nonworking tests, requires bugfix

* abaqus_read_results is not working -> bug
2017-01-30 12:28:33 +02:00

48 lines
1.2 KiB
Julia

# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
using JuliaFEM
using JuliaFEM.Testing
@testset "Add to SparseMatrixCOO" begin
A = SparseMatrixCOO()
A2 = reshape(collect(1:9), 3, 3)
add!(A, sparse(A2))
@test isapprox(full(A), full(A2))
end
@testset "Add to SparseVectorCOO" begin
b = SparseVectorCOO()
b2 = collect(1:3)
add!(b, sparse(b2))
@test isapprox(full(b), full(b2))
end
@testset "Failure to add data to sparse vector due dimensino mismatch" begin
b = SparseVectorCOO()
@test_throws ErrorException add!(b, [1, 2], [1.0, 2.0, 3.0])
end
@testset "Test combining of SparseMatrixCOO" begin
k = convert(Matrix{Float64}, reshape(collect(1:9), 3, 3))
dofs1 = [1, 2, 3]
dofs2 = [2, 3, 4]
A = SparseMatrixCOO()
add!(A, dofs1, dofs1, k)
add!(A, dofs2, dofs2, k)
A1 = full(A)
optimize!(A)
A2 = full(A)
@test isapprox(A1, A2)
end
@testset "resize of sparse matrix and sparse vector" begin
A = sparse(rand(3, 3))
B = resize_sparse(A, 4, 4)
@test size(B) == (4, 4)
a = sparse(rand(3))
b = resize_sparsevec(a, 4)
@test size(b) == (4, )
end