Skip to content

Commit d39e802

Browse files
committedMar 21, 2025·
test - use local scope to prevent function redef warning
1 parent 99d214b commit d39e802

File tree

2 files changed

+34
-30
lines changed

2 files changed

+34
-30
lines changed
 

‎examples/ex301_linear_elasticity.jl

+17-15
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,24 @@ function linearelasticityweakform(deltadu::Array{Float64}, w::Array{Float64})
4646
end
4747

4848
# linear elasticity operators
49-
function makeoperator(basis::TensorBasis)
50-
inputs = [
51-
OperatorField(basis, [EvaluationMode.gradient], "gradent of deformation"),
52-
OperatorField(basis, [EvaluationMode.quadratureweights], "quadrature weights"),
53-
]
54-
outputs = [
55-
OperatorField(
56-
basis,
57-
[EvaluationMode.gradient],
58-
"test function gradient of deformation",
59-
),
60-
]
61-
return Operator(linearelasticityweakform, mesh, inputs, outputs)
49+
begin
50+
local function makeoperator(basis::TensorBasis)
51+
inputs = [
52+
OperatorField(basis, [EvaluationMode.gradient], "gradent of deformation"),
53+
OperatorField(basis, [EvaluationMode.quadratureweights], "quadrature weights"),
54+
]
55+
outputs = [
56+
OperatorField(
57+
basis,
58+
[EvaluationMode.gradient],
59+
"test function gradient of deformation",
60+
),
61+
]
62+
return Operator(linearelasticityweakform, mesh, inputs, outputs)
63+
end
64+
fineoperator = makeoperator(finebasis)
65+
coarseoperator = makeoperator(coarsebasis)
6266
end
63-
fineoperator = makeoperator(finebasis)
64-
coarseoperator = makeoperator(coarsebasis)
6567

6668
# Chebyshev smoother
6769
chebyshev = Chebyshev(fineoperator)

‎examples/ex311_hyperelasticity.jl

+17-15
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,24 @@ function neohookeanweakform(deltadu::Array{Float64}, w::Array{Float64})
6060
end
6161

6262
# linearized Neo-Hookean operators
63-
function makeoperator(basis::TensorBasis)
64-
inputs = [
65-
OperatorField(basis, [EvaluationMode.gradient], "gradent of deformation"),
66-
OperatorField(basis, [EvaluationMode.quadratureweights], "quadrature weights"),
67-
]
68-
outputs = [
69-
OperatorField(
70-
basis,
71-
[EvaluationMode.gradient],
72-
"test function gradient of deformation",
73-
),
74-
]
75-
return Operator(neohookeanweakform, mesh, inputs, outputs)
63+
begin
64+
local function makeoperator(basis::TensorBasis)
65+
inputs = [
66+
OperatorField(basis, [EvaluationMode.gradient], "gradent of deformation"),
67+
OperatorField(basis, [EvaluationMode.quadratureweights], "quadrature weights"),
68+
]
69+
outputs = [
70+
OperatorField(
71+
basis,
72+
[EvaluationMode.gradient],
73+
"test function gradient of deformation",
74+
),
75+
]
76+
return Operator(neohookeanweakform, mesh, inputs, outputs)
77+
end
78+
fineoperator = makeoperator(finebasis)
79+
coarseoperator = makeoperator(coarsebasis)
7680
end
77-
fineoperator = makeoperator(finebasis)
78-
coarseoperator = makeoperator(coarsebasis)
7981

8082
# Chebyshev smoother
8183
chebyshev = Chebyshev(fineoperator)

0 commit comments

Comments
 (0)
Please sign in to comment.