-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added element types, added subhex, tet2hex
- Loading branch information
1 parent
f5aac56
commit a8efd8d
Showing
11 changed files
with
609 additions
and
102 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
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,21 @@ | ||
using Comodo | ||
using GLMakie | ||
using GeometryBasics | ||
using Rotations | ||
|
||
# Creating faces and vertices for a rhombic dodecahedron | ||
F,V = rhombicdodecahedron(5.0) | ||
|
||
## Visualize mesh | ||
markersize = 25 | ||
strokewidth = 2 | ||
strokecolor = :black | ||
fig = Figure(size = (800,800)) | ||
|
||
ax1 = Axis3(fig[1, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Rhombic dodecahedron") | ||
|
||
hp1 = poly!(ax1, GeometryBasics.Mesh(V,F), color=:white,transparency=false,strokewidth=strokewidth,strokecolor=strokecolor,shading = FastShading) | ||
hp2 = scatter!(ax1, V,markersize=markersize,color=:red) | ||
hp3 = normalplot(ax1,F,V; color = :green) | ||
|
||
fig |
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,53 @@ | ||
using Comodo | ||
using GLMakie | ||
using GeometryBasics | ||
|
||
#= | ||
This demo shows the use of `subhex` to refine a a hexhedral mesh through splitting. | ||
=# | ||
|
||
boxDim = [2.0,3.0,1.0] # Dimensions for the box in each direction | ||
boxEl = [2,3,1] # Number of elements to use in each direction | ||
E,V,F,Fb,CFb_type = hexbox(boxDim,boxEl) | ||
|
||
Eh0,Vh0 = subhex(E,V,1;direction=0) | ||
Fh0 = element2faces(Eh0) | ||
|
||
Eh1,Vh1 = subhex(E,V,1;direction=1) | ||
Fh1 = element2faces(Eh1) | ||
|
||
Eh2,Vh2 = subhex(E,V,1;direction=2) | ||
Fh2 = element2faces(Eh2) | ||
|
||
Eh3,Vh3 = subhex(E,V,1;direction=3) | ||
Fh3 = element2faces(Eh3) | ||
|
||
|
||
# Visualisation | ||
strokewidth = 3 | ||
linewidth = 4 | ||
|
||
fig = Figure(size=(1600,800)) | ||
|
||
ax0 = Axis3(fig[1, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Refined hexahedral mesh, direction=0 (all)") | ||
hp1 = poly!(ax0,GeometryBasics.Mesh(Vh0,Fh0), strokewidth=strokewidth,shading=FastShading,strokecolor=:black, color=:white, transparency=false, overdraw=false) | ||
hp2 = wireframe!(ax0,GeometryBasics.Mesh(V,F), linewidth=linewidth,color=:red, overdraw=false) | ||
# hp3 = normalplot(ax0,Fh0,Vh0;color=:black) | ||
|
||
ax1 = Axis3(fig[1, 2], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Refined hexahedral mesh, direction=1") | ||
hp1 = poly!(ax1,GeometryBasics.Mesh(Vh1,Fh1), strokewidth=strokewidth,shading=FastShading,strokecolor=:black, color=:white, transparency=false, overdraw=false) | ||
hp2 = wireframe!(ax1,GeometryBasics.Mesh(V,F), linewidth=linewidth,color=:red, overdraw=false) | ||
# hp3 = normalplot(ax1,Fh1,Vh1;color=:black) | ||
|
||
ax2 = Axis3(fig[2, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Refined hexahedral mesh, direction=2") | ||
hp1 = poly!(ax2,GeometryBasics.Mesh(Vh2,Fh2), strokewidth=strokewidth,shading=FastShading,strokecolor=:black, color=:white, transparency=false, overdraw=false) | ||
hp2 = wireframe!(ax2,GeometryBasics.Mesh(V,F), linewidth=linewidth,color=:red, overdraw=false) | ||
# hp3 = normalplot(ax2,Fh2,Vh2;color=:black) | ||
|
||
ax3 = Axis3(fig[2, 2], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Refined hexahedral mesh, direction=3") | ||
hp1 = poly!(ax3,GeometryBasics.Mesh(Vh3,Fh3), strokewidth=strokewidth,shading=FastShading,strokecolor=:black, color=:white, transparency=false, overdraw=false) | ||
hp2 = wireframe!(ax3,GeometryBasics.Mesh(V,F), linewidth=linewidth,color=:red, overdraw=false) | ||
# hp3 = normalplot(ax3,Fh3,Vh3;color=:black) | ||
|
||
fig | ||
|
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,53 @@ | ||
using Comodo | ||
using GLMakie | ||
using GeometryBasics | ||
|
||
#= | ||
This demo shows the use of `tet2hex` to convert tetrahedral elements to hexahedral elements | ||
domain. | ||
=# | ||
|
||
testCase = 1 | ||
|
||
if testCase == 1 | ||
E = [tet4{Int64}(1,2,3,4),tet4{Int64}(2,3,4,5),tet4{Int64}(6,7,8,9)] | ||
V = [Point{3,Float64}(-1.0,0.0,0.0), | ||
Point{3,Float64}( 1.0,0.0,0.0), | ||
Point{3,Float64}( 0.0,1.0,0.0), | ||
Point{3,Float64}( 0.0,0.5,1.0), | ||
Point{3,Float64}( 1.0,1.0,1.0), | ||
Point{3,Float64}( 2.0,0.0,0.0), | ||
Point{3,Float64}( 4.0,0.0,0.0), | ||
Point{3,Float64}( 3.0,1.0,0.0), | ||
Point{3,Float64}( 3.0,0.5,1.0), | ||
] | ||
elseif testCase == 2 | ||
E = [hex8{Int64}(1,2,3,4,5,6,7,8)] | ||
V = [Point{3,Float64}(0.0,0.0,0.0), | ||
Point{3,Float64}(1.0,0.0,0.0), | ||
Point{3,Float64}(1.0,1.0,0.0), | ||
Point{3,Float64}(0.0,1.0,0.0), | ||
Point{3,Float64}(0.0,0.0,1.0), | ||
Point{3,Float64}(1.0,0.0,1.0), | ||
Point{3,Float64}(1.0,1.0,1.0), | ||
Point{3,Float64}(0.0,1.0,1.0), | ||
] | ||
end | ||
F = element2faces(E) | ||
|
||
Eh,Vh = tet2hex(E,V) | ||
Fh = element2faces(Eh) | ||
|
||
# Visualisation | ||
markersize = 25 | ||
|
||
fig = Figure(size=(1600,800)) | ||
|
||
ax1 = Axis3(fig[1, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Wireframe of hexahedral mesh") | ||
hp1 = poly!(ax1,GeometryBasics.Mesh(V,F), strokewidth=3,shading=FastShading,strokecolor=:black, color=:white, transparency=true, overdraw=false) | ||
hp2 = normalplot(ax1,F,V) | ||
|
||
hp1 = poly!(ax1,GeometryBasics.Mesh(Vh,Fh), strokewidth=2,shading=FastShading,strokecolor=:red, color=:red, transparency=true, overdraw=false) | ||
hp2 = normalplot(ax1,Fh,Vh;color=:red) | ||
|
||
fig |
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
Oops, something went wrong.