Skip to content
Snippets Groups Projects
Commit e33013da authored by Florian Atteneder's avatar Florian Atteneder
Browse files

wip

parent e0376db2
Branches fa/amr-1d
No related tags found
No related merge requests found
struct AdaptiveMesh{TMesh<:Mesh} <: AbstractMesh
mesh::TMesh
end
const AMesh{T} where T = AdaptiveMesh{T}
regrid!(mesh, cache, evolution) = nothing
function regrid!(amesh::AMesh{Mesh1d}, cache, evolution::Evolution)
# compute new tree layout
newtree = compute_tree_layout(amesh.mesh, cache, evolution)
# legalize new tree layout
# set up new mesh for new tree layout
# resize evolution.stages and use them as caches for interpolation (could also use any
# of the static variables from the cache)
# interpolate data from old mesh to new mesh
# resize all caches
end
function compute_tree_layout(mesh::Mesh1d, cache, evolution)
# dummy method
nc = n_cells(mesh.tree)
flags = rand((-1,0,1), nc)
legalize!(flags, mesh.tree.cells)
# setup refined tree??
end
function legalize!(flags, cells)
# search all -1s and check their neighbors
for (i,f) in zip(flags)
f == -1 || continue
c = cells[i]
il, ir = c.neighbors
if has_neighbor(c, Cart1d.Xmin) && flags[il] == 1
flags[il] = 0
end
if has_neighbor(c, Cart1d.Xmax) && flags[ir] == 1
flags[il] = 0
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment