what happened?

This commit is contained in:
Jukka Aho
2015-06-22 23:19:58 +03:00
5 changed files with 170 additions and 99 deletions
+4 -1
View File
@@ -15,5 +15,8 @@ We have decided not to use them. See issue #18.
Supported Julia versions
------------------------
We support Julia versions 0.4+
Only pull requests to src folder
--------------------------------
See [issue #29](https://github.com/JuliaFEM/JuliaFEM/issues/29). This ensures peer review check for contributors and hopefully will decrease the number of merge conflicts.
+5 -3
View File
@@ -2,10 +2,12 @@
[![Join the chat at https://gitter.im/JuliaFEM/JuliaFEM](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/JuliaFEM/JuliaFEM?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Build Status: [![Build Status](https://api.travis-ci.org/ovainola/JuliaFEM.svg?branch=master)](https://travis-ci.org/ovainola/JuliaFEM)
Build Status: [![Build Status](https://travis-ci.org/JuliaFEM/JuliaFEM.svg?branch=master)](https://travis-ci.org/JuliaFEM/JuliaFEM)
Code Coverage: [![Coverage Status](https://coveralls.io/repos/ovainola/JuliaFEM/badge.svg?branch=master)](https://coveralls.io/r/ovainola/JuliaFEM?branch=master)
http://juliafem.readthedocs.org/en/latest/
The JuliaFEM project develops open-source software for reliable, scalable, distributed Finite Element Methdod.
The JuliaFEM software library is a framework that allows for the distributed processing of large Finite Element Models across clusters of computers using simple programming models. It is designed to scale up from single servers to thousands of machines, each offering local computation and storage. The basic design principle is: everything is nonlinear. All physics models are nonlinear from which the linearization are made as a special cases.
@@ -34,6 +36,6 @@ We strongly believe in the test driven development as well as building on top of
Errors should never pass silently.
```
Please start by reading some practical examples of [the Julia style.](http://julia.readthedocs.org/en/latest/manual/style-guide/)
Interested in participating? Please start by reading [CONTRIBUTING.md](https://github.com/JuliaFEM/JuliaFEM/blob/master/CONTRIBUTING.md).
Contributors: see [contributors](https://github.com/ovainola/JuliaFEM/blob/master/contributors)
Contributors: see [contributors](https://github.com/JuliaFEM/JuliaFEM/blob/master/contributors)
+11 -1
View File
@@ -1,5 +1,15 @@
import os
import sys
import re
import juliadoc
extensions = ['juliadoc.julia', 'juliadoc.jlhelp']
extensions = ['sphinx.ext.mathjax',
'juliadoc.julia',
'juliadoc.jldoctest',
'juliadoc.jlhelp']
master_doc = 'index'
html_theme_path = [juliadoc.get_theme_dir()]
html_sidebars = juliadoc.default_sidebars()
+141
View File
@@ -0,0 +1,141 @@
using JuliaFEM
using Base.Test
using Logging
@Logging.configure(level=DEBUG)
function test_create_model()
m = new_model()
fn = fieldnames(m)
@test :model in fn
@test :nodes in fn
@test :elements in fn
@test :element_nodes in fn
@test :element_gauss_points in fn
end
test_create_model()
function test_add_field()
m = new_model()
field = new_field(m.elements, "color")
@test "color" in keys(m.elements)
end
test_add_field()
function test_get_field()
m = new_model()
field = new_field(m.elements, "color")
field[1] = "red" # set element 1 field value to "red"
field2 = get_field(m.elements, "color") # get color field
@test field2[1] == "red"
end
test_get_field()
function test_get_field_if_it_doesnt_exist()
m = new_model()
# FIXME: how to test exception?
# @assert "throw error when" field = get_field(m.elements, "temperature")
field = get_field(m.elements, "temperature"; create_if_doesnt_exist=true)
field[1] = 173
field2 = get_field(m.elements, "temperature")
@test field2[1] == 173
end
test_get_field_if_it_doesnt_exist()
function test_get_field_throw_exception()
m = new_model()
@test_throws ASCIIString get_field(m.elements, "temperature")
end
test_get_field_throw_exception()
function test_add_and_get_nodes()
m = new_model()
nodes = Dict(1 => [0.0, 0.0, 0.0],
2 => [1.0, 0.0, 0.0],
3 => [0.0, 1.0, 0.0],
4 => [0.0, 0.0, 1.0])
add_nodes(m, nodes)
subset = get_nodes(m, [2, 3])
@test length(subset) == 2
@test subset[2] == [1.0, 0.0, 0.0]
@test subset[3] == [0.0, 1.0, 0.0]
end
test_add_and_get_nodes()
function test_print()
lines_with_print = Dict()
#src = readdir("/src")
#src_dir = "/home/travis/build/ovainola/JuliaFEM/src"
src_dir = "../src"
src = readdir(src_dir)
for file_name in src
fil = open(joinpath(src_dir,file_name),"r")
for line in readlines(fil)
if ismatch(r"print",line)
lines_with_print[file_name] = "print"
end
end
close(fil)
end
#@test lines_with_print == Dict()
@debug("number of lines with print = ", length(lines_with_print))
@debug(lines_with_print)
@test length(lines_with_print) == 0
end
test_print()
function test_add_element()
m = new_model()
nodes = Dict(1 => [0.0, 0.0, 0.0],
2 => [1.0, 0.0, 0.0],
3 => [0.0, 1.0, 0.0],
4 => [0.0, 0.0, 1.0])
add_nodes(m, nodes)
el1 = Dict("element_type" => 0x6, "node_ids" => [1, 2, 3, 4])
el2 = Dict("element_type" => 0x6, "node_ids" => [4, 3, 2, 1])
elements = Dict(1 => el1, 2 => el2)
add_elements(m, elements)
@debug(m)
@test m.elements["element_type"][1] == 0x6
@test m.elements["connectivity"][1] == [1, 2, 3, 4]
end
test_add_element()
function test_get_element()
m = new_model()
nodes = Dict(1 => [0.0, 0.0, 0.0],
2 => [1.0, 0.0, 0.0],
3 => [0.0, 1.0, 0.0],
4 => [0.0, 0.0, 1.0])
add_nodes(m, nodes)
el1 = Dict("element_type" => 0x6, "node_ids" => [1, 2, 3, 4])
el2 = Dict("element_type" => 0x6, "node_ids" => [4, 3, 2, 1])
elements = Dict(1 => el1, 2 => el2)
#println(elements)
add_elements(m, elements)
#println(m)
# get elements by element id
els = get_elements(m, [1])
#println(els)
@test length(els) == 1
@test 1 in keys(els)
@test els[1]["element_type"] == 0x6
@test els[1]["node_ids"] == [1, 2, 3, 4]
end
test_get_element()
include("test_xdmf.jl")
include("solver_tests/test_elasticity_solver.jl")
# write your own tests here
# @test 1 == JuliaFEM.test()
# @test_approx_eq 1.0 1.0
+9 -94
View File
@@ -1,110 +1,26 @@
using JuliaFEM
using Base.Test
using FactCheck
using Logging
@Logging.configure(level=DEBUG)
function test_create_model()
m = new_model()
fn = fieldnames(m)
@test :model in fn
@test :nodes in fn
@test :elements in fn
@test :element_nodes in fn
@test :element_gauss_points in fn
end
test_create_model()
function test_add_field()
m = new_model()
field = new_field(m.elements, "color")
@test "color" in keys(m.elements)
end
test_add_field()
function test_get_field()
m = new_model()
field = new_field(m.elements, "color")
field[1] = "red" # set element 1 field value to "red"
field2 = get_field(m.elements, "color") # get color field
@test field2[1] == "red"
end
test_get_field()
function test_get_field_if_it_doesnt_exist()
m = new_model()
# FIXME: how to test exception?
# @assert "throw error when" field = get_field(m.elements, "temperature")
field = get_field(m.elements, "temperature"; create_if_doesnt_exist=true)
field[1] = 173
field2 = get_field(m.elements, "temperature")
@test field2[1] == 173
end
test_get_field_if_it_doesnt_exist()
function test_get_field_throw_exception()
m = new_model()
@test_throws ASCIIString get_field(m.elements, "temperature")
end
test_get_field_throw_exception()
function test_add_and_get_nodes()
m = new_model()
nodes = Dict(1 => [0.0, 0.0, 0.0],
2 => [1.0, 0.0, 0.0],
3 => [0.0, 1.0, 0.0],
4 => [0.0, 0.0, 1.0])
add_nodes(m, nodes)
subset = get_nodes(m, [2, 3])
@test length(subset) == 2
@test subset[2] == [1.0, 0.0, 0.0]
@test subset[3] == [0.0, 1.0, 0.0]
end
test_add_and_get_nodes()
function test_print()
facts("Testing if somebody used print, println(), @sprint in src directory") do
# TODO: make better reqular expression. Currently it will match all print words
lines_with_print = Dict()
#src = readdir("/src")
#src_dir = "/home/travis/build/ovainola/JuliaFEM/src"
src_dir = "../src"
src = readdir(src_dir)
for file_name in src
fil = open(joinpath(src_dir,file_name),"r")
for line in readlines(fil)
for (line_number,line) in enumerate(readlines(fil))
if ismatch(r"print",line)
lines_with_print[file_name] = "print"
lines_with_print[file_name * ":$line_number"] = "print found in line: $line_number"
end
end
close(fil)
end
#@test lines_with_print == Dict()
@debug("number of lines with print = ", length(lines_with_print))
@debug(lines_with_print)
@test length(lines_with_print) == 0
end
test_print()
function test_add_element()
m = new_model()
nodes = Dict(1 => [0.0, 0.0, 0.0],
2 => [1.0, 0.0, 0.0],
3 => [0.0, 1.0, 0.0],
4 => [0.0, 0.0, 1.0])
add_nodes(m, nodes)
el1 = Dict("element_type" => 0x6, "node_ids" => [1, 2, 3, 4])
el2 = Dict("element_type" => 0x6, "node_ids" => [4, 3, 2, 1])
elements = Dict(1 => el1, 2 => el2)
add_elements(m, elements)
@debug(m)
@test m.elements["element_type"][1] == 0x6
@test m.elements["connectivity"][1] == [1, 2, 3, 4]
@fact lines_with_print => isempty "Instead of println() use Logging.jl package"
end
<<<<<<< HEAD
test_add_element()
@@ -136,7 +52,6 @@ test_get_element()
include("test_xdmf.jl")
include("solver_tests/test_elasticity_solver.jl")
include("test_model.jl")
=======
>>>>>>> 1794244a42142f1581f0594dd6d94bc8326a0759
# write your own tests here
# @test 1 == JuliaFEM.test()
# @test_approx_eq 1.0 1.0