Skip to content

Commit d8372c4

Browse files
committed
Improve docstring of RegularGrid
1 parent 67de7e8 commit d8372c4

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

src/domains/meshes/regulargrid.jl

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,26 @@
33
# ------------------------------------------------------------------
44

55
"""
6-
RegularGrid(dims, origin, spacing)
6+
RegularGrid(start, finish; dims=dims)
77
8-
A regular grid with dimensions `dims`, lower left corner at `origin`
9-
and cell spacing `spacing`. The three arguments must have the same length.
8+
A regular grid from `start` point to `finish` point with dimensions `dims`.
9+
The number of dimensions must match the number of coordinates of the points.
1010
11-
RegularGrid(dims, origin, spacing, offset)
12-
13-
A regular grid with dimensions `dims`, with lower left corner of element
14-
`offset` at `origin` and cell spacing `spacing`.
15-
16-
RegularGrid(start, finish, dims=dims)
11+
RegularGrid(start, finish, spacing)
1712
18-
Alternatively, construct a regular grid from a `start` point to a `finish`
19-
with dimensions `dims`.
13+
Alternatively, construct a regular grid from `start` point to `finish` point
14+
by specifying the `spacing` for each dimension.
2015
21-
RegularGrid(start, finish, spacing)
16+
RegularGrid(dims, origin, spacing, offset=(1, 1, ...))
2217
23-
Alternatively, construct a regular grid from a `start` point to a `finish`
24-
point using a given `spacing`.
18+
Alternatively, construct a regular grid with dimensions `dims`, lower left
19+
corner of `offset` element at `origin` point, and `spacing` for each dimension.
2520
2621
RegularGrid(dims)
27-
RegularGrid(dim1, dim2, ...)
22+
RegularGrid(dim₁, dim₂, ...)
2823
29-
Finally, a regular grid can be constructed by only passing the dimensions
30-
`dims` as a tuple, or by passing each dimension `dim1`, `dim2`, ... separately.
31-
In this case, the origin and spacing default to (0,0,...) and (1,1,...).
24+
Alternatively, construct a regular grid with dimensions `dims = (dim₁, dim₂, ...)`,
25+
origin point with coordinates `(0m, 0m, ...)` and spacing equal to `(1m, 1m, ...)`.
3226
3327
## Examples
3428
@@ -38,10 +32,11 @@ Create a 3D grid with 100x100x50 hexahedrons:
3832
julia> RegularGrid(100, 100, 50)
3933
```
4034
41-
Create a 2D grid with 100 x 100 quadrangles and origin at (10.0, 20.0):
35+
Create a 2D grid from point (0.0, 0.0) to point (10.0, 20.0)
36+
with spacing equal to (1.0, 2.0):
4237
4338
```julia
44-
julia> RegularGrid((100, 100), (10.0, 20.0), (1.0, 1.0))
39+
julia> RegularGrid((0.0, 0.0), (10.0, 20.0), (1.0, 2.0))
4540
```
4641
4742
Create a 1D grid from -1 to 1 with 100 segments:

0 commit comments

Comments
 (0)