lets use FieldProblem(ElasticityProblem, ...) instead of FieldProblem{ElasticityProblem}(...) so that we can extend FieldProblem and BoundaryProblem without redefining everything in problems.

This commit is contained in:
Jukka Aho
2016-01-01 18:52:40 +02:00
parent ac54dbf2c8
commit 01cbf2516f
+27
View File
@@ -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}