From 01cbf2516fb535090044facf720201fbbc45d02c Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Fri, 1 Jan 2016 18:52:40 +0200 Subject: [PATCH] lets use FieldProblem(ElasticityProblem, ...) instead of FieldProblem{ElasticityProblem}(...) so that we can extend FieldProblem and BoundaryProblem without redefining everything in problems. --- src/problems.jl | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/problems.jl b/src/problems.jl index 8d9c3de..aae9925 100644 --- a/src/problems.jl +++ b/src/problems.jl @@ -17,6 +17,33 @@ type BoundaryProblem{T<:AbstractProblem} elements :: Vector{Element} end +""" Construct new field problem. + +Examples +-------- +Create vector-valued (dim=3) elasticity problem: + +julia> prob = FieldProblem(ElasticityProblem, "this is my problem", 3) + +""" +function FieldProblem(problem_type::DataType, name::ASCIIString, dim::Int, elements=[]) + FieldProblem{problem_type}(name, dim, elements) +end + + +""" Construct new boundary problem. + +Examples +-------- +Create Dirichlet boundary problem for vector-valued (dim=3) elasticity problem. + +julia> bc1 = FieldProblem(DirichletProblem, "support dy=0", "displacement", 3) + +""" +function BoundaryProblem(problem_type::DataType, name::ASCIIString, parent_field_name::ASCIIString, parent_field_dim::Int, dim::Int=1, elements=[]) + BoundaryProblem{problem_type}(name, parent_field_name, parent_field_dim, dim, elements) +end + typealias Problem FieldProblem typealias AllProblems Union{FieldProblem, BoundaryProblem}