Skip to content

Instantly share code, notes, and snippets.

@KristofferC
Created March 16, 2015 14:06
Show Gist options
  • Save KristofferC/a1a884a0af1818653c3d to your computer and use it in GitHub Desktop.
Save KristofferC/a1a884a0af1818653c3d to your computer and use it in GitHub Desktop.
using FixedSizeArrays
# Point types
abstract AbstractPoint{L} <: FixedVector{Int, L}
immutable Point2<: AbstractPoint{2}
x::Float64
y::Float64
end
# Vertex types
abstract AbstractVertex{L} <: FixedVector{Int, L}
immutable Vertex3 <: AbstractVertex{3}
v1::Int
v2::Int
v3::Int
end
immutable Vertex4 <: AbstractVertex{4}
v1::Int
v2::Int
v3::Int
end
# Node types, a node contains a point + an identifier
abstract AbstractGeoNode
immutable GeoNode2 <: AbstractGeoNode
n::Int
coordinates::Point2
end
immutable GeoNode3 <: AbstractGeoNode
n::Int
coordinates::Point3
end
# Element types, an element contains a VertexN + an identifer
abstract AbstractGeoElem
abstract AbstractGeoElem2 <: AbstractGeoElem
abstract AbstractGeoElem3 <: AbstractGeoElem
# Triangle
immutable GeoTrig <: AbstractGeoElem2
n::Int
vertices::Vertex3
end
# Quadraterial
immutable GeoQuad <: AbstractGeoElem2
n::Int
vertices::Vertex4
end
# Tetraheder
immutable GeoTetra <: AbstractGeoElem3
n::Int
vertices::Vertex4
end
# A set is a collection of nodes or elements with a given name.
abstract AbstractSet
immutable NodeSet <: AbstractSet
name::String
nodes::Vector{Int}
end
immutable ElementSet <: AbstractSet
name::String
elements::Vector{Int}
end
# A GeoMesh is a collection of nodes, elements, element sets and node sets.
abstract AbstractGeoMesh
immutable GeoMesh2 <: AbstractGeoMesh
nodes::Vector{GeoNode2}
elements::Vector{AbstractGeoElem2}
elementsets::Dict{ASCIIString, ElementSet}
nodesets::Dict{ASCIIString, NodeSet}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment