Skip to content
Merged

Dev #16

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# See https://domluna.github.io/JuliaFormatter.jl/stable/ for a list of options
style = "blue"

margin = 92

align_assignment = true
Expand All @@ -15,4 +14,4 @@ format_docstrings = true
conditional_to_if = true
indent_submodule = true

always_for_in=true
always_for_in = true
12 changes: 12 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
coverage:
status:
project:
default:
informational: true
patch:
default:
informational: true

comment:
layout: "reach, diff, flags, files"
require_changes: true
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2

updates:
- package-ecosystem: "julia"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
23 changes: 23 additions & 0 deletions .github/workflows/AutoMerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Auto-merge dependency PRs

on: pull_request_target

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
name: Dependabot
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Fetch Dependabot metadata
uses: dependabot/fetch-metadata@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47 changes: 35 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,64 @@
name: CI

env:
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: conservative

on:
push:
branches:
- 'master'
- 'dev'
tags: '*'
- main
- dev
tags: "*"
pull_request:
branches:
- 'master'
- main
- dev
release:
types: [published]

permissions:
actions: write
contents: read

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.10'
- "1.10"
- "1"
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v3
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v3
- name: Ensure General registry
run: |
julia -e '
using Pkg
if isempty(Pkg.Registry.reachable_registries())
try
Pkg.Registry.add()
catch
ENV["JULIA_PKG_SERVER"] = ""
Pkg.Registry.add(Pkg.RegistrySpec(
url="https://github.com/JuliaRegistries/General.git",
))
end
end'
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v4
- uses: codecov/codecov-action@v6
with:
files: lcov.info
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
37 changes: 28 additions & 9 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,49 @@
name: Documentation

env:
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: conservative

on:
push:
branches:
- 'master'
- 'dev'
tags: '*'
- main
- dev
tags: "*"
pull_request:
release:
types: [published]

jobs:
build:
name: Documentation
permissions:
contents: write
statuses: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v3
with:
version: '1'
version: "1"
- uses: julia-actions/cache@v3
- name: Ensure General registry
run: |
julia -e '
using Pkg
if isempty(Pkg.Registry.reachable_registries())
try
Pkg.Registry.add()
catch
ENV["JULIA_PKG_SERVER"] = ""
Pkg.Registry.add(Pkg.RegistrySpec(
url="https://github.com/JuliaRegistries/General.git",
))
end
end'
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
run: julia --project=docs/ docs/make.jl
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
run: julia --project=docs/ docs/make.jl
5 changes: 5 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
name: TagBot

on:
issue_comment:
types:
- created
workflow_dispatch:

permissions:
contents: write

jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
Expand Down
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
.vscode/
*.dat
*.jld2
*.jl.*.cov
*.jl.cov
*.jl.mem
*.mem
lcov.info
/Manifest.toml
/docs/Manifest.toml
/docs/build/
lcov.info
*.vscode
/docs/site/
12 changes: 12 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cff-version: 1.2.0
message: "If you use this software, please cite it using the metadata below."
title: "CorrectionFactorMatrixMethod.jl"
type: software
authors:
- family-names: Tetzner
given-names: Joshua
repository-code: "https://github.com/JoshuaTetzner/CorrectionFactorMatrixMethod.jl"
url: "https://JoshuaTetzner.github.io/CorrectionFactorMatrixMethod.jl/"
license: MIT
version: 0.1.0
# doi: "Add the Zenodo DOI after the first archived release."
51 changes: 45 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CorrectionFactorMatrixMethod"
uuid = "1b32fdd5-07c8-465a-bf7d-415ac82a78be"
version = "0.1.0"
authors = ["""Joshua <joshua.tetzner@uni-rostock.de\n>"""]
authors = ["Joshua Tetzner <joshua.tetzner@uni-rostock.de>"]

[deps]
BlockSparseMatrices = "1ef78180-cc57-4e70-b6ec-c3e471307147"
Expand All @@ -22,8 +22,47 @@ CFMMBEAST = ["BEAST", "CompScienceMeshes"]
CFMMExaFMMt = ["ExaFMMt", "BEAST"]

[compat]
BlockSparseMatrices = "0.3.0"
CompScienceMeshes = "0.12"
MKL = "0.6.3"
OhMyThreads = "0.8.4"
SparseArrays = "1.12.0"
Aqua = "0.8"
BEAST = "2"
BlockSparseMatrices = "0.3"
CompScienceMeshes = "0.11, 0.12"
ExaFMMt = "0.1"
ExplicitImports = "1"
H2Trees = "0.3"
JET = "0.9, 0.10, 0.11"
JuliaFormatter = "2"
LinearAlgebra = "1.10"
LinearMaps = "3"
MKL = "0.9"
OhMyThreads = "0.8"
SparseArrays = "1.10"
StaticArrays = "1"
Test = "1.10"
TestItemRunner = "1"
TestItems = "1"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"

[targets]
test = [
"Aqua",
"BEAST",
"CompScienceMeshes",
"ExaFMMt",
"ExplicitImports",
"JET",
"JuliaFormatter",
"StaticArrays",
"Test",
"TestItemRunner",
"TestItems",
]
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,80 @@
# CorrectionFactorMatrixMethod.jl

[![Docs-stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://JoshuaTetzner.github.io/CorrectionFactorMatrixMethod.jl/stable/)
[![Docs-dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://JoshuaTetzner.github.io/CorrectionFactorMatrixMethod.jl/dev/)
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/JoshuaTetzner/CorrectionFactorMatrixMethod.jl/blob/main/LICENSE)
[![CI](https://github.com/JoshuaTetzner/CorrectionFactorMatrixMethod.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/JoshuaTetzner/CorrectionFactorMatrixMethod.jl/actions/workflows/CI.yml)
[![codecov](https://codecov.io/gh/JoshuaTetzner/CorrectionFactorMatrixMethod.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/JoshuaTetzner/CorrectionFactorMatrixMethod.jl)

## Introduction

This package builds matrix-free boundary-element operators that combine a fast
multipole approximation of the far interactions with directly assembled
near-field corrections. The result behaves like the dense boundary-element
matrix under matrix-vector products, but is never assembled explicitly, so it
can be used directly inside an iterative solver such as `Krylov.gmres`.

The generic correction and linear-map machinery lives in the core package.
Support for concrete operators and spaces is provided through package
extensions for
[BEAST.jl](https://github.com/krcools/BEAST.jl),
[CompScienceMeshes.jl](https://github.com/krcools/CompScienceMeshes.jl), and
[ExaFMMt.jl](https://github.com/JoshuaTetzner/ExaFMMt.jl), which are loaded
automatically once these packages are available.

## Correction-Factor Matrix Method

For a boundary-element matrix $A$, the far field is approximated by an
FMM-backed map $A_\mathrm{FMM}$. The near interactions are evaluated with the
boundary-element quadrature and corrected for the part already represented by
the FMM:

$$Ax \approx A_\mathrm{FMM}\,x + \left(A_\mathrm{near} - A_\mathrm{FMM,near}\right)x.$$

The sparse correction blocks are selected from an
[H2Trees.jl](https://github.com/djukic14/H2Trees.jl) tree. A matrix-vector
product evaluates the FMM map first and then adds the sparse near correction.
Transpose and adjoint products follow the corresponding `LinearMaps.jl`
interfaces. Further details are given in the
[documentation](https://JoshuaTetzner.github.io/CorrectionFactorMatrixMethod.jl/dev/details/method/).

## Installation

Installing CorrectionFactorMatrixMethod is done by entering the package manager
(enter `]` at the Julia REPL) and issuing:

```
pkg> add https://github.com/JoshuaTetzner/CorrectionFactorMatrixMethod.jl.git
```

The supported boundary-element integration requires Julia 1.10 or later.

## First steps

Load the optional BEAST, CompScienceMeshes, and ExaFMMt packages, build a
boundary-element operator with its test and trial spaces, and assemble the
correction-factor operator:

```julia
using BEAST, CompScienceMeshes, ExaFMMt
using CorrectionFactorMatrixMethod

mesh = meshsphere(1.0, 0.4)
space = raviartthomas(mesh)
operator = Maxwell3D.singlelayer(; wavenumber=1.0)

matrix = CFMM.assemble(operator, space)
result = matrix * rand(scalartype(operator), numfunctions(space))
```

[`CFMM.assemble`](https://JoshuaTetzner.github.io/CorrectionFactorMatrixMethod.jl/dev/manual/manual/)
constructs an optimized tree automatically. Existing trees and all lower-level
FMM, quadrature, and scheduler options can be supplied as keywords. The
returned operator implements the `LinearMaps.jl` interface, so it can be passed
straight to an iterative solver. Runnable EFIE and MFIE examples are in the
[`examples/`](examples) directory and in the
[documentation](https://JoshuaTetzner.github.io/CorrectionFactorMatrixMethod.jl/dev/).

## References

- [1] Adelman, Ross, Nail A. Gumerov, and Ramani Duraiswami. *FMM/GPU-Accelerated Boundary Element Method for Computational Magnetics and Electrostatics.* IEEE Transactions on Magnetics 53, no. 12 (December 2017): 1–11. [https://doi.org/10.1109/TMAG.2017.2725951](https://doi.org/10.1109/TMAG.2017.2725951).
8 changes: 8 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[deps]
CorrectionFactorMatrixMethod = "1b32fdd5-07c8-465a-bf7d-415ac82a78be"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

[compat]
CorrectionFactorMatrixMethod = "0.1"
Documenter = "1"
julia = "1.10"
Loading