From 85ec9758f342c0a680f8904cf9b4924fa7c7010e Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Sat, 13 Feb 2016 01:08:07 +0200 Subject: [PATCH] pre and posthooks for assembly --- src/assembly.jl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/assembly.jl b/src/assembly.jl index 469f6cf..fe5ea4d 100644 --- a/src/assembly.jl +++ b/src/assembly.jl @@ -30,13 +30,25 @@ function append!(assembly::Assembly, sub_assembly::Assembly) append!(assembly.c, sub_assembly.c) end -function assemble!(problem::Problem, time::Float64; empty_assembly::Bool=true) +function assemble_prehook! +end + +function assemble_posthook! +end + +function assemble!(problem::Problem, time::Real; empty_assembly::Bool=true) + if method_exists(assemble_prehook!, Tuple{typeof(problem), Real}) + assemble_prehook!(problem, time) + end !problem.assembly.changed && return empty_assembly && empty!(problem.assembly) for element in get_elements(problem) assemble!(problem.assembly, problem, element, time) end problem.assembly.changed = true + if method_exists(assemble_posthook!, Tuple{typeof(problem), Real}) + assemble_posthook!(problem, time) + end return problem.assembly end