Skip to content

Commit

Permalink
Replaced repetitive debug output code in VDisp with a function
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilSoleymani committed Aug 18, 2022
1 parent 8c79ea6 commit cc2fe2d
Showing 1 changed file with 39 additions and 87 deletions.
126 changes: 39 additions & 87 deletions src/vdisp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,155 +143,117 @@ GAMMA_W = Observable([0.03125, 0.9810]) # Unit weight of water (0.03125 tcf = 6
MIN_LAYER_SIZE = Observable([0.0254, 1/12]) # Default minimum layer size (0.0254 m = 2.54 cm or (1/12) ft = 1 in)

# Update QML variables
debugPrint(msg::String) = if PRINT_DEBUG println(msg) end
setProblemName = on(problemName) do val
if PRINT_DEBUG
println("Got an update: ", val)
end
debugPrint("Got an update for problemName: $val")
end
setModel = on(model) do val
if PRINT_DEBUG
println("Got an update: ", val)
end
debugPrint("Got an update for model: $val")
end
setFoundation = on(foundation) do val
if PRINT_DEBUG
println("Got an update: ", val)
end
debugPrint("Got an update for foundation: $val")
end
setAppliedPressure = on(appliedPressure) do val
if PRINT_DEBUG
println("Got an update: ", val)
end
debugPrint("Got an update for appliedPressure: $val")
end
setPressurePoint = on(center) do val
if PRINT_DEBUG
println("Got an update: ", val)
end
debugPrint("Got an update for center: $val")
end
setLength = on(foundationLength) do val
if PRINT_DEBUG
println("Got an update: ", val)
end
debugPrint("Got an update for foundationLength: $val")
end
setWidth = on(foundationWidth) do val
if PRINT_DEBUG
println("Got an update: ", val)
end
debugPrint("Got an update for foundationWidth: $val")
end
setOutputIncrements = on(outputIncrements) do val
if PRINT_DEBUG
println("Got an update: ", val)
end
debugPrint("Got an update for outputIncrements: $val")
end
setSaturatedAboveWaterTable = on(saturatedAboveWaterTable) do val
if PRINT_DEBUG
println("Got an update: ", val)
end
debugPrint("Got an update for saturatedAboveWaterTable: $val")
end
setMaterials = on(materials) do val
if PRINT_DEBUG
println("\nGot an update for materials: ", val)
end
debugPrint("Got an update for materials: $val")
end
setMaterialNames = on(materialNamesQML) do val
if PRINT_DEBUG
println("Got an update: ", val)
end
debugPrint("Got an update for materialNames: $val")

matNames = Array{String}(undef,0)
for v in val
push!(matNames, QML.value(v))
end
global materialNames = copy(matNames)
end
setSpecificGravity = on(specificGravityQML) do val
if PRINT_DEBUG
println("Got an update: ", val)
end
debugPrint("Got an update for specificGravity: $val")

sg = Array{Float64}(undef,0)
for v in val
push!(sg, QML.value(v))
end
global specificGravity = copy(sg)
end
setVoidRatio = on(voidRatioQML) do val
if PRINT_DEBUG
println("Got an update: ", val)
end
debugPrint("Got an update for voidRatio: $val")

vr = Array{Float64}(undef,0)
for v in val
push!(vr, QML.value(v))
end
global voidRatio = copy(vr)
end
setWaterContent = on(waterContentQML) do val
if PRINT_DEBUG
println("Got an update: ", val)
end
debugPrint("Got an update for waterContent: $val")

wc = Array{Float64}(undef,0)
for v in val
push!(wc, QML.value(v))
end
global waterContent = copy(wc)
end
setSubdivisions = on(subdivisionsQML) do val
if PRINT_DEBUG
println("\nGot an update for subdivisions: ", val)
end
debugPrint("Got an update for subdivisions: $val")

sub = Array{Int32}(undef,0)
for v in val
push!(sub, QML.value(v))
end
global subdivisions = copy(sub)
end
setTotalDepth = on(totalDepth) do val
if PRINT_DEBUG
println("Got an update: ", val)
end
debugPrint("Got an update for totalDepth: $val")
end
setSoilLayerNumbers = on(soilLayerNumbersQML) do val
if PRINT_DEBUG
println("\nGot an update for soilLayerNumbers: ", val)
end
debugPrint("Got an update for soilLayerNumbers: $val")

sln = Array{Int32}(undef,0)
for v in val
push!(sln, QML.value(v))
end
global soilLayerNumbers = copy(sln)
end
setBounds = on(boundsQML) do val
if PRINT_DEBUG
println("\nGot an update for bounds: ", val)
end
debugPrint("Got an update for bounds: $val")

b = Array{Float64}(undef,0)
for v in val
push!(b, QML.value(v))
end
global bounds = copy(b)
end
setDepthToGroundWaterTable = on(depthToGroundWaterTable) do val
if PRINT_DEBUG
println("\nGot an update for depthToGroundWaterTable: ", val)
end
debugPrint("Got an update for depthToGroundWaterTable: $val")
end
setFoundationDepth = on(foundationDepth) do val
if PRINT_DEBUG
println("\nGot an update for foundationDepth: ", val)
end
debugPrint("Got an update for foundationDepth: $val")
end
setHeaveBegin = on(heaveBegin) do val
if PRINT_DEBUG
println("\nGot an update for heaveBegin: ", val)
end
debugPrint("Got an update for heaveBegin: $val")
end
setHeaveActive = on(heaveActive) do val
if PRINT_DEBUG
println("\nGot an update for heaveActive: ", val)
end
debugPrint("Got an update for heaveEnd: $val")
end
setSwellPressure = on(swellPressureQML) do val
if PRINT_DEBUG
println("\nGot an update for swellPressure: ", val)
end
debugPrint("Got an update for swellPressure: $val")

sp = Array{Float64}(undef,0)
for v in val
Expand All @@ -300,54 +262,44 @@ setSwellPressure = on(swellPressureQML) do val
global swellPressure = copy(sp)
end
setSwellIndex = on(swellIndexQML) do val
if PRINT_DEBUG
println("\nGot an update for swellIndex: ", val)
end
debugPrint("Got an update for swellIndex: $val")
si = Array{Float64}(undef,0)
for v in val
push!(si, QML.value(v))
end
global swellIndex = copy(si)
end
setCompressionIndex = on(compressionIndexQML) do val
if PRINT_DEBUG
println("\nGot an update for compressionIndex: ", val)
end
debugPrint("Got an update for compressionIndex: $val")
ci = Array{Float64}(undef,0)
for v in val
push!(ci, QML.value(v))
end
global compressionIndex = copy(ci)
end
setRecompressionIndex = on(recompressionIndexQML) do val
if PRINT_DEBUG
println("\nGot an update for recompressionIndex: ", val)
end
debugPrint("Got an update for maxPastPressure: $val")
mpp = Array{Float64}(undef,0)
for v in val
push!(mpp, QML.value(v))
end
global recompressionIndex = copy(mpp)
end
setTimeAfterConstruction = on(timeAfterConstruction) do val
if PRINT_DEBUG
println("\nGot an update for timeAfterConstruction: ", val)
end
debugPrint("Got an update for timeAfterConstruction: $val")
end
setConePenetration = on(conePenetrationQML) do val
if PRINT_DEBUG
println("\nGot an update for conePenetration: ", val)
end
debugPrint("Got an update for conePenetration: $val")

cp = Array{Float64}(undef,0)
for v in val
push!(cp, QML.value(v))
end
global conePenetration = copy(cp)
end
setElasticMod = on(elasticModulusQML) do val
if PRINT_DEBUG
println("\nGot an update for elasticModulus: ", val)
end
debugPrint("Got an update for elasticModulus: $val")

em = Array{Float64}(undef,0)
for v in val
push!(em, QML.value(v))
Expand Down

0 comments on commit cc2fe2d

Please sign in to comment.