Skip to content

Commit

Permalink
Merge pull request #76 from gridap/adds_algoim_interface
Browse files Browse the repository at this point in the history
Adds algoim interface
  • Loading branch information
ericneiva committed Jan 22, 2024
2 parents 380e9f0 + cea454f commit 4073fa5
Show file tree
Hide file tree
Showing 19 changed files with 1,183 additions and 17 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,41 @@ jobs:
- run: |
julia --color=yes --project=. --check-bounds=yes --depwarn=error -e '
(1,) .== 1; include("test/GridapEmbeddedTests/runtests.jl")'
algoimutils:
name: AlgoimUtils ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.8'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- run: |
julia --color=yes --project=. --check-bounds=yes --depwarn=error -e '
using Pkg; Pkg.instantiate()'
- run: |
julia --color=yes --project=. --check-bounds=yes --depwarn=error -e '
(1,) .== 1; include("test/AlgoimUtilsTests/runtests.jl")'
docs:
name: Documentation
runs-on: ubuntu-latest
Expand Down
40 changes: 27 additions & 13 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GridapEmbedded.jl Copyright and License
==

Copyright (c) 2020 by [Francesc Verdugo](mailto:[email protected]) and [Santiago Badia](mailto:[email protected]).
Copyright (c) 2020 by [Francesc Verdugo](mailto:[email protected]), [Eric Neiva](mailto:[email protected]) and [Santiago Badia](mailto:[email protected]).

GridapEmbedded.jl is licensed under the MIT Expat License

Expand All @@ -28,19 +28,33 @@ SOFTWARE.
Citing `Gridap`
==

In order to give credit to the `Gridap` contributors, we simply ask you to cite the refence below in any publication in which you have made use of `Gridap` packages.

F. Verdugo and S. Badia. *A user-guide to Gridap -- grid-based approximation of partial differential equations in Julia*, 2019. [arXiv:1910.01412](https://arxiv.org/abs/1910.01412)
In order to give credit to the `Gridap` contributors, we simply ask you to cite the references below in any publication in which you have made use of `Gridap` packages.

```
@article{gridap_guide_2019,
author={Francesc Verdugo and Santiago Badia},
journal = {{arXiv}},
title = {{A user-guide to Gridap -- grid-based approximation of partial differential equations in Julia}},
year = {2019},
eprint={1910.01412},
archivePrefix={arXiv},
primaryClass={cs.MS},
@article{Badia2020,
doi = {10.21105/joss.02520},
url = {https://doi.org/10.21105/joss.02520},
year = {2020},
publisher = {The Open Journal},
volume = {5},
number = {52},
pages = {2520},
author = {Santiago Badia and Francesc Verdugo},
title = {Gridap: An extensible Finite Element toolbox in Julia},
journal = {Journal of Open Source Software}
}
@article{Verdugo2022,
doi = {10.1016/j.cpc.2022.108341},
url = {https://doi.org/10.1016/j.cpc.2022.108341},
year = {2022},
month = jul,
publisher = {Elsevier {BV}},
volume = {276},
pages = {108341},
author = {Francesc Verdugo and Santiago Badia},
title = {The software design of Gridap: A Finite Element package based on the Julia {JIT} compiler},
journal = {Computer Physics Communications}
}
```

Expand Down Expand Up @@ -92,4 +106,4 @@ By making a contribution to this project, I certify that:
Contact
==

Please, contact the project administrators, [Santiago Badia](mailto:[email protected]) and [Francesc Verdugo](mailto:[email protected].edu), for further questions about licenses and terms of use.
Please, contact the project administrators, [Francesc Verdugo](mailto:[email protected]), [Eric Neiva](mailto:[email protected]) and [Santiago Badia](mailto:santiago.badia@monash.edu), for further questions about licenses and terms of use.
7 changes: 6 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.8.3] - 2024-08-02
## [0.9.0] - 2024-01-22

### Added
- Interface to Algoim v0.2, which provides algoim's high-order quadrature algorithms for domains implicitly-defined by multivariate polynomials and high-order accurate algorithms for computing closest points on implicitly-defined surfaces. Since PR [#76](https://github.com/gridap/GridapEmbedded.jl/pull/76).

## [0.8.3] - 2024-01-02

### Added
- Support for FillArrays v1. Since PR [#75](https://github.com/gridap/GridapEmbedded.jl/pull/75).
Expand Down
7 changes: 5 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
name = "GridapEmbedded"
uuid = "8838a6a3-0006-4405-b874-385995508d5d"
authors = ["Francesc Verdugo <[email protected].edu>"]
version = "0.8.3"
authors = ["Francesc Verdugo <[email protected]>", "Eric Neiva <[email protected]>", "Santiago Badia <santiago.badia@monash.edu>"]
version = "0.9.0"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Algoim = "0eb9048c-21de-4c7a-bfac-056de1940b74"
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
CxxWrap = "1f15a43c-97ca-5a2a-ae31-89f07a497df4"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
Gridap = "56d4f2e9-7ea1-5844-9cf6-b9c51ca7ce8e"
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MiniQhull = "978d7f02-9e05-4691-894f-ae31a51d76ca"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
algoimWrapper_jll = "3c43aa7b-5398-51f3-8d75-8f051e6faa4d"

[compat]
AbstractTrees = "0.3.3, 0.4"
Expand Down
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ makedocs(;
],
repo="https://github.com/gridap/GridapEmbedded.jl/blob/{commit}{path}#L{line}",
sitename="GridapEmbedded.jl",
authors="Francesc Verdugo <[email protected].edu>",
authors="Francesc Verdugo <[email protected]>, Eric Neiva <[email protected]> and Santiago Badia <santiago.badia@monash.edu>",
)

deploydocs(;
Expand Down
1 change: 1 addition & 0 deletions src/AgFEM/AgFEM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ using GridapEmbedded.Interfaces: compute_subcell_to_inout

export aggregate
export color_aggregates
export aggregate_narrow_band
export AggregateAllCutCells
export compute_cell_bboxes
export compute_cell_to_dface_bboxes
Expand Down
12 changes: 12 additions & 0 deletions src/AgFEM/AggregateBoundingBoxes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ function init_bboxes(cell_to_coords,cut::EmbeddedDiscretization;in_or_out=IN)
bgcell_to_cbboxes
end

function init_bboxes(cell_to_coords,cut_measure::Measure)
bgcell_to_cbboxes = init_bboxes(cell_to_coords)
quad = get_cell_quadrature(cut_measure)
trian = get_triangulation(quad)
model = get_active_model(trian)
ccell_to_bgcell = get_cell_to_parent_cell(model)
for (cc,bc) in enumerate(ccell_to_bgcell)
bgcell_to_cbboxes[bc] = compute_subcell_bbox(quad.cell_point[cc])
end
bgcell_to_cbboxes
end

function init_cut_bboxes(cut,ccell_to_bgcell,in_or_out)
subcell_to_inout = compute_subcell_to_inout(cut,cut.geo)
subcell_is_in = lazy_map(i->i==in_or_out,subcell_to_inout)
Expand Down
57 changes: 57 additions & 0 deletions src/AgFEM/CellAggregation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,60 @@ function _color_aggregates_barrier(cell_to_cellin,cell_to_faces,face_to_cells)

cell_to_color
end

# Specialised methods for Algoim quadratures

function aggregate(bgtrian,cell_to_is_active,cell_to_is_cut,in_or_out)
n_cells = length(cell_to_is_active)
@assert n_cells == length(cell_to_is_cut)

cell_to_unit_cut_meas = lazy_map(cell_to_is_active,cell_to_is_cut) do isa, isc
!isa ? 0.0 : (isc ? 0.0 : 1.0)
end

cell_to_inoutcut = lazy_map(cell_to_is_active,cell_to_is_cut) do isa, isc
!isa ? OUT : (isc ? CUT : IN)
end

cell_to_coords = get_cell_coordinates(bgtrian)
model = get_background_model(bgtrian)
topo = get_grid_topology(model)
D = num_cell_dims(model)
cell_to_faces = get_faces(topo,D,D-1)
face_to_cells = get_faces(topo,D-1,D)
# A hack follows to avoid constructing the actual facet_to_inoutcut array
facet_to_inoutcut = fill(in_or_out,num_faces(model,D-1))

threshold = 1.0
_aggregate_by_threshold_barrier(
threshold,cell_to_unit_cut_meas,facet_to_inoutcut,cell_to_inoutcut,
in_or_out,cell_to_coords,cell_to_faces,face_to_cells)
end

function aggregate_narrow_band(bgtrian,cell_to_is_in_narrow,cell_to_is_active,cell_to_is_cut,in_or_out)
n_cells = length(cell_to_is_in_narrow)
@assert n_cells == length(cell_to_is_active)
@assert n_cells == length(cell_to_is_cut)

cell_to_unit_cut_meas = lazy_map(cell_to_is_active,cell_to_is_cut) do isa, isc
( isa & !isc ) ? 1.0 : 0.0
end

cell_to_inoutcut = lazy_map(cell_to_is_in_narrow,cell_to_is_active,cell_to_is_cut) do isn, isa, isc
!isn ? OUT : ( ( isa & !isc ) ? IN : CUT )
end

cell_to_coords = get_cell_coordinates(bgtrian)
model = get_background_model(bgtrian)
topo = get_grid_topology(model)
D = num_cell_dims(model)
cell_to_faces = get_faces(topo,D,D-1)
face_to_cells = get_faces(topo,D-1,D)
# A hack follows to avoid constructing the actual facet_to_inoutcut array
facet_to_inoutcut = fill(in_or_out,num_faces(model,D-1))

threshold = 1.0
_aggregate_by_threshold_barrier(
threshold,cell_to_unit_cut_meas,facet_to_inoutcut,cell_to_inoutcut,
in_or_out,cell_to_coords,cell_to_faces,face_to_cells)
end
Loading

2 comments on commit 4073fa5

@ericneiva
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator register()

@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/99314

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

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.9.0 -m "<description of version>" 4073fa5b40823a43d6b6a8da3c29d98c477d0377
git push origin v0.9.0

Please sign in to comment.