changeset 15:3d032081832d

mergemania
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 17 Dec 2018 14:50:23 +0100
parents b11b67c02d1a (diff) 4e5319cbe04b (current diff)
children c61af27cb67a
files grid.jl
diffstat 1 files changed, 52 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/grid.jl	Mon Dec 17 14:48:17 2018 +0100
+++ b/grid.jl	Mon Dec 17 14:50:23 2018 +0100
@@ -1,1 +1,52 @@
-abstract type BoundaryID end
+module grid
+
+abstract type Grid end
+
+function numberOfDimensions(grid::Grid)
+    error("Not yet implemented");
+end
+
+function numberOfPoints(grid::Grid)
+    error("Not yet implemented");
+end
+
+function points(grid::Grid)
+    error("Not yet implemented");
+end
+
+abstract type BoundaryId end
+
+# Move to seperate file.
+struct EquidistantGrid <: Grid
+    numberOfDimensions::UInt;
+    numberOfPoints::Vector(UInt);
+    limits::Vector{Pair{Real, Real}};
+    function EquidistantGrid(nDims, nPoints, lims)
+        @assert nDims == size(nPoints);
+        return new(nDims, nPoints, lims);
+    end
+end
+
+# Getter functions for public properties?
+function numberOfDimensions(grid::EquidistantGrid)
+    return grid.numberOfDimensions;
+end
+
+function numberOfPoints(grid::EquidistantGrid)
+    return grid.numberOfPoints;
+end
+
+
+function points(grid::EquidistantGrid)
+    points::Array{Real,3}(undef, numberOfPoints(grid));
+#    for i ∈ eachindex(points)
+#        points(i) = i/
+#    end
+    return points;
+end
+
+function limitsForDimension(grid::EquidistantGrid, dim::UInt)
+    @assert dim <= 3
+    @assert dim >= 1
+    return grid.limits(dim);
+end