-
Notifications
You must be signed in to change notification settings - Fork 1
/
cohesive_cell.jl
36 lines (28 loc) · 2.42 KB
/
cohesive_cell.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
abstract type CohesiveCell{refshape} <: Ferrite.AbstractCell{refshape} end
struct CohesiveQuadrilateral <: CohesiveCell{RefQuadrilateral} nodes::NTuple{4, Int} end
struct CohesiveQuadraticQuadrilateral <: CohesiveCell{RefQuadrilateral} nodes::NTuple{6, Int} end
struct CohesiveWedge <: CohesiveCell{RefPrism} nodes::NTuple{6, Int} end
struct CohesiveQuadraticWedge <: CohesiveCell{RefPrism} nodes::NTuple{12, Int} end
struct CohesiveHexahedron <: CohesiveCell{RefHexahedron} nodes::NTuple{8, Int} end
struct CohesiveQuadraticHexahedron <: CohesiveCell{RefHexahedron} nodes::NTuple{18, Int} end
Ferrite.vertices(c::Union{CohesiveQuadrilateral, CohesiveQuadraticQuadrilateral}) = (c.nodes[1], c.nodes[2], c.nodes[3], c.nodes[4])
Ferrite.faces(c::Union{CohesiveQuadrilateral, CohesiveQuadraticQuadrilateral}) = ((c.nodes[1], c.nodes[2]), (c.nodes[3],c.nodes[4]))
# TODO: will FaceValues normals be correct with these definitions?
Ferrite.default_interpolation(::Type{CohesiveQuadrilateral}) = JumpInterpolation(Lagrange{1,RefCube,1}())
Ferrite.default_interpolation(::Type{CohesiveQuadraticQuadrilateral}) = JumpInterpolation(Lagrange{1,RefCube,2}())
Ferrite.default_interpolation(::Type{CohesiveWedge}) = JumpInterpolation(Lagrange{2,RefTetrahedron,1}())
Ferrite.default_interpolation(::Type{CohesiveQuadraticWedge}) = JumpInterpolation(Lagrange{2,RefTetrahedron,2}())
Ferrite.default_interpolation(::Type{CohesiveHexahedron}) = JumpInterpolation(Lagrange{2,RefCube,1}())
Ferrite.cell_to_vtkcell(::Type{CohesiveQuadrilateral}) = VTKCellTypes.VTK_QUAD
Ferrite.cell_to_vtkcell(::Type{CohesiveQuadraticQuadrilateral}) = VTKCellTypes.VTK_BIQUADRATIC_QUAD
Ferrite.cell_to_vtkcell(::Type{CohesiveWedge}) = VTKCellTypes.VTK_WEDGE
Ferrite.cell_to_vtkcell(::Type{CohesiveQuadraticWedge}) = VTKCellTypes.VTK_QUADRATIC_WEDGE
Ferrite.cell_to_vtkcell(::Type{CohesiveHexahedron}) = VTKCellTypes.VTK_HEXAHEDRON
Ferrite.nodes_to_vtkorder(cell::CohesiveQuadrilateral) = [cell.nodes[i] for i in [1,2,4,3]]
#=
cohesive_celltypes = Dict{DataType, String}(CohesiveCell{2,4,2} => "CohesiveQuadrilateral",
CohesiveCell{2,6,2} => "CohesiveQuadraticQuadrilateral",
CohesiveCell{3,6,2} => "CohesiveTetrahedron",
CohesiveCell{3,12,2} => "CohesiveQuadraticTetrahedron",
CohesiveCell{3,8,2} => "CohesiveHexahedron")
=#