-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c6bafb
commit 4a7d81d
Showing
13 changed files
with
208 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# ChebParticleMesh | ||
|
||
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://Xuanzhao Gao.github.io/ChebParticleMesh.jl/stable/) | ||
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://Xuanzhao Gao.github.io/ChebParticleMesh.jl/dev/) | ||
[![Build Status](https://github.com/Xuanzhao Gao/ChebParticleMesh.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/Xuanzhao Gao/ChebParticleMesh.jl/actions/workflows/CI.yml?query=branch%3Amain) | ||
[![Build Status](https://travis-ci.com/Xuanzhao Gao/ChebParticleMesh.jl.svg?branch=main)](https://travis-ci.com/Xuanzhao Gao/ChebParticleMesh.jl) | ||
[![Coverage](https://codecov.io/gh/Xuanzhao Gao/ChebParticleMesh.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/Xuanzhao Gao/ChebParticleMesh.jl) | ||
<!-- [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://HPMolSim.github.io/ChebParticleMesh.jl/stable/) --> | ||
<!-- [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://HPMolSim.github.io/ChebParticleMesh.jl/dev/) --> | ||
[![Build Status](https://github.com/HPMolSim/ChebParticleMesh.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/HPMolSim/ChebParticleMesh.jl/actions/workflows/CI.yml?query=branch%3Amain) | ||
[![Build Status](https://travis-ci.com/HPMolSim/ChebParticleMesh.jl.svg?branch=main)](https://travis-ci.com/HPMolSim/ChebParticleMesh.jl) | ||
[![Coverage](https://codecov.io/gh/HPMolSim/ChebParticleMesh.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/HPMolSim/ChebParticleMesh.jl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
function interpolate_single!(q::T, pos::Point{3, T}, gridinfo::GridInfo{T}, gridbox::GridBox{T}, chebcoefs::NTuple{3, ChebCoef{T}}) where{T} | ||
|
||
cheb_value = gridbox.cheb_value | ||
near_id_image = image_grid_id(pos, gridinfo) | ||
near_pos_image = image_grid_pos(near_id_image, gridinfo) | ||
for i in 1:3 | ||
dx = pos[i] - near_pos_image[i] | ||
pwcheb_eval!(dx, cheb_value[i], chebcoefs[i]) | ||
end | ||
|
||
@turbo for i in - gridinfo.w[1] : gridinfo.w[1] | ||
for j in - gridinfo.w[2] : gridinfo.w[2] | ||
for k in - gridinfo.w[3] : gridinfo.w[3] | ||
gridbox.image_grid[ | ||
near_id_image.idx + i, | ||
near_id_image.idy + j, | ||
near_id_image.idz + k] += | ||
q * | ||
cheb_value[1][i + gridinfo.w[1] + 1] * | ||
cheb_value[2][j + gridinfo.w[2] + 1] * | ||
cheb_value[3][k + gridinfo.w[3] + 1] | ||
end | ||
end | ||
end | ||
|
||
return nothing | ||
end | ||
|
||
function interpolate!(qs::Vector{T}, poses::Vector{Point{3, T}}, gridinfo::GridInfo{T}, gridbox::GridBox{T}, chebcoefs::NTuple{3, ChebCoef{T}}) where{T} | ||
|
||
@assert length(qs) == length(poses) | ||
grid_revise_image!(gridbox) | ||
|
||
for i in 1:length(qs) | ||
interpolate_single!(qs[i], poses[i], gridinfo, gridbox, chebcoefs) | ||
end | ||
|
||
return nothing | ||
end | ||
|
||
function interpolate_single_direct!(q::T, pos::Point{3, T}, gridinfo::GridInfo{T}, gridbox::GridBox{T}, chebcoefs::NTuple{3, ChebCoef{T}}) where{T} | ||
|
||
cheb_value = gridbox.cheb_value | ||
near_id_image = image_grid_id(pos, gridinfo) | ||
near_pos_image = image_grid_pos(near_id_image, gridinfo) | ||
for i in 1:3 | ||
dx = pos[i] - near_pos_image[i] | ||
f_eval!(dx, cheb_value[i], chebcoefs[i]) | ||
end | ||
|
||
@turbo for i in - gridinfo.w[1] : gridinfo.w[1] | ||
for j in - gridinfo.w[2] : gridinfo.w[2] | ||
for k in - gridinfo.w[3] : gridinfo.w[3] | ||
gridbox.image_grid[ | ||
near_id_image.idx + i, | ||
near_id_image.idy + j, | ||
near_id_image.idz + k] += | ||
q * | ||
cheb_value[1][i + gridinfo.w[1] + 1] * | ||
cheb_value[2][j + gridinfo.w[2] + 1] * | ||
cheb_value[3][k + gridinfo.w[3] + 1] | ||
end | ||
end | ||
end | ||
|
||
return nothing | ||
end | ||
|
||
function interpolate_direct!(qs::Vector{T}, poses::Vector{Point{3, T}}, gridinfo::GridInfo{T}, gridbox::GridBox{T}, chebcoefs::NTuple{3, ChebCoef{T}}) where{T} | ||
|
||
@assert length(qs) == length(poses) | ||
grid_revise_image!(gridbox) | ||
|
||
for i in 1:length(qs) | ||
interpolate_single_direct!(qs[i], poses[i], gridinfo, gridbox, chebcoefs) | ||
end | ||
|
||
return nothing | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@testset "Chebyshev interpolation vs direct interpolation" begin | ||
f = x -> exp(-x^2 * 10.0) | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
using ChebParticleMesh | ||
using Test | ||
using ExTinyMD | ||
|
||
@testset "ChebParticleMesh.jl" begin | ||
include("utils.jl") | ||
include("chebpoly.jl") | ||
include("index.jl") | ||
include("interpolate.jl") | ||
end |