-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the numeric type of the input nodes as the output type in grid ge…
…nerators (#973)
- Loading branch information
1 parent
3ae61fa
commit 44e43d8
Showing
3 changed files
with
31 additions
and
6 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
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,24 @@ | ||
# Helper function to test grid generation for a given floating-point type | ||
function test_generate_grid(T::Type) | ||
# Define the cell types to test | ||
cell_types = [ | ||
Line, QuadraticLine, | ||
Quadrilateral, QuadraticQuadrilateral, Triangle, QuadraticTriangle, | ||
Hexahedron, Wedge, Pyramid, Tetrahedron, SerendipityQuadraticHexahedron] | ||
|
||
# Loop over all cell types and test grid generation | ||
for CT in cell_types | ||
rdim = Ferrite.getrefdim(CT) | ||
nels = ntuple(i -> 2, rdim) | ||
left = - ones(Vec{rdim,T}) | ||
right = ones(Vec{rdim,T}) | ||
grid = generate_grid(CT, nels, left, right) | ||
@test isa(grid, Grid{rdim, CT, T}) | ||
end | ||
end | ||
|
||
# Run tests for different floating-point types | ||
@testset "Generate Grid Tests" begin | ||
test_generate_grid(Float64) | ||
test_generate_grid(Float32) | ||
end |