Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DG1d.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DG
DG1d.jl
Commits
e33013da
Commit
e33013da
authored
1 year ago
by
Florian Atteneder
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
e0376db2
Branches
fa/amr-1d
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/amr.jl
+46
-0
46 additions, 0 deletions
src/amr.jl
with
46 additions
and
0 deletions
src/amr.jl
0 → 100644
+
46
−
0
View file @
e33013da
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment