diff --git a/src/MeshData.jl b/src/MeshData.jl index a37097c6..7a6f002e 100644 --- a/src/MeshData.jl +++ b/src/MeshData.jl @@ -221,6 +221,26 @@ MeshData(mesh::Tuple{<:Tuple, Matrix{Int64}}, rd::RefElemData, other_args...; kw MeshData(VXYZ, EToV, rd::RefElemData, other_args...; kwargs...) = MeshData(VXYZ..., EToV, rd, other_args...; kwargs...) # splats VXYZ +""" + MeshData(cells_per_dimension, rd::RefElemData{NDIMS}; + coordinates_min = ntuple(_ -> -1.0, NDIMS), + coordinates_max = ntuple(_ -> 1.0, NDIMS), + is_periodic=ntuple(_ -> false, NDIMS)) where {NDIMS} + +Returns a `MeshData` initialized on a uniform mesh with `cells_per_dimension` elements per +dimension scaled to the following tensor product domain: +`[coordinates_min[1], coordinates_max[1]]x[coordinates_min[2], coordinates_max[2]], ...`. +""" +function MeshData(cells_per_dimension, rd::RefElemData{NDIMS}; + coordinates_min = ntuple(_ -> -1.0, NDIMS), + coordinates_max = ntuple(_ -> 1.0, NDIMS), + is_periodic=ntuple(_ -> false, NDIMS)) where {NDIMS} + VXYZ, EToV = uniform_mesh(rd.element_type, cells_per_dimension) + VXYZ = map((x, xmin, xmax) -> (@. 0.5 * (x + 1) * (xmax - xmin) + xmin), + VXYZ, coordinates_min, coordinates_max) + return MeshData(VXYZ, EToV, rd; is_periodic) +end + function MeshData(VX::AbstractVector, EToV, rd::RefElemData{1}; is_periodic=(false, )) # Construct global coordinates