Skip to content

Commit

Permalink
workaround for double callback invocation by lift() for scalarplot in 3D
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fu committed Sep 8, 2021
1 parent b10fa1e commit 66eaa65
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
6 changes: 4 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GridVisualize"
uuid = "5eed8a63-0fb0-45eb-886d-8d5a387d12b8"
authors = ["Juergen Fuhrmann <[email protected]>"]
version = "0.2.14"
version = "0.2.15"

[deps]
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
Expand All @@ -11,6 +11,7 @@ ElasticArrays = "fdbdab4c-e67f-52f5-8c3f-e7b388dad3d4"
ExtendableGrids = "cfc395e8-590f-11e8-1f13-43a2532b2fa8"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Observables = "510215fc-4207-5dde-b226-833fc4488ee2"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
PkgVersion = "eebad327-c553-4316-9ea0-9fa01ccd7688"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Expand All @@ -22,8 +23,9 @@ Colors = "0.12,0.13,1"
DocStringExtensions = "^0.8.0"
ElasticArrays = "1"
ExtendableGrids = "0.7,0.8"
GeometryBasics = "0.3"
GeometryBasics = "0.4"
OrderedCollections = "1"
Observables = "0.4"
PkgVersion = "0.1"
StaticArrays = "0.12,1"
julia = "1.3"
49 changes: 40 additions & 9 deletions src/makie.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Observables
include("flippablelayout.jl")

function initialize!(p::GridVisualizer,::Type{MakieType})
Expand Down Expand Up @@ -884,18 +885,48 @@ function scalarplot!(ctx, TP::Type{MakieType}, ::Type{Val{3}}, grid , func)
)
end
end



function marching_tetrahedra0(grid::ExtendableGrid,func,planes,flevels; kwargs...)
coord=grid[Coordinates]
cellnodes=grid[CellNodes][:,1:10]
marching_tetrahedra(coord,cellnodes,func,planes,flevels;kwargs...)
end


f0=d->make_mesh(marching_tetrahedra0(d.g,
d.f,
makeplanes(d.x,d.y,d.z),
[d.l],
primepoints=hcat(xyzmin,xyzmax),
primevalues=fminmax,
Tp=Point3f0,
Tf=GLTriangleFace,
Tv=Float32)...)
f=d->make_mesh(marching_tetrahedra(d.g,
d.f,
makeplanes(d.x,d.y,d.z),
[d.l],
primepoints=hcat(xyzmin,xyzmax),
primevalues=fminmax,
Tp=Point3f0,
Tf=GLTriangleFace,
Tv=Float32)...)


# Workaround around
# meshnode=Makie.lift(f,ctx[:data])
# calling initialization with a small dataset

init=f0(ctx[:data][])
meshnode=Observable{typeof(init)}(init)
map!(f, meshnode,ctx[:data])


#### Plane sections and isosurfaces
Makie.mesh!(ctx[:scene],
Makie.lift(d->make_mesh(marching_tetrahedra(d.g,
d.f,
makeplanes(d.x,d.y,d.z),
[d.l],
primepoints=hcat(xyzmin,xyzmax),
primevalues=fminmax,
Tp=Point3f0,
Tf=GLTriangleFace,
Tv=Float32)...),ctx[:data]),
meshnode,
backlight=1f0)

#### Interactions
Expand Down

2 comments on commit 66eaa65

@j-fu
Copy link
Member Author

@j-fu j-fu commented on 66eaa65 Sep 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/44484

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.15 -m "<description of version>" 66eaa65d6725f2ac42c7ed497cb7d6236a77ebca
git push origin v0.2.15

Please sign in to comment.