Mesh

Base.eltypeMethod
eltype(Ωₕ::AbstractMeshType) -> Type
eltype(::Type{<:AbstractMeshType}) -> Type

Return the floating-point coordinate element type of the points in Ωₕ.

source
Bramble.markers!Method
markers!(Ωₕ::AbstractMeshType, mesh_markers::MeshMarkers) -> Nothing

Override the markers dictionary in Ωₕ. Used internally during mesh refinement, where the old dictionary is sized for the old grid and is replaced outright rather than merged into.

source
Bramble.set_indices!Method
set_indices!(Ωₕ::AbstractMeshType, indices::CartesianIndices) -> Nothing

Override the grid indices in Ωₕ. Used internally during mesh refinement.

source
Bramble.generate_indicesMethod
generate_indices(pts::Int) -> CartesianIndices{1}
generate_indices(pts::NTuple{D, Int}) -> CartesianIndices{D}

Return the CartesianIndices of a mesh with pts[i] points in each direction.

For scalar input (Int), returns 1D CartesianIndices. For tuple input, returns multi-dimensional CartesianIndices.

source
Bramble._expand_uniformMethod
mesh(Ω::Domain, npts::NTuple{D, Int}, unif::Union{Bool, NTuple{D, Bool}}; backend = backend(eltype(Ω))) -> AbstractMeshType{D}
mesh(Ω::Domain{<:CartesianProduct{D}}, npts::Int, unif::Union{Bool, NTuple{D, Bool}} = true; backend = backend(eltype(Ω))) -> AbstractMeshType{D}
mesh(Ω::Domain, npts::NTuple{D, Int}; uniform = true, backend = backend(eltype(Ω))) -> MeshnD
mesh(X::CartesianProduct, npts, args...; kwargs...) -> AbstractMeshType

Return a Mesh1D or MeshnD ($D=2,3$) discretizing the Domain Ω or CartesianProduct X.

When passing a CartesianProduct X directly, mesh automatically constructs domain(X), provisioning default :boundary and :interior geometric markers. Passing a single integer npts::Int constructs an isotropic grid with npts points along every coordinate axis.

Arguments

  • Ω: Continuous domain to discretize.
  • X: Continuous geometric set to discretize directly.
  • npts: Number of grid points along each coordinate direction, or a single integer for an isotropic grid.
  • unif: Boolean flag or tuple of flags specifying whether the point distribution along each axis is uniform.

Keywords

  • uniform: Convenience keyword alternative to positional unif. Accepts a Bool or an NTuple{D, Bool}. Defaults to true across all axes.
  • backend: Linear algebra and memory storage Backend. Defaults to backend(eltype(Ω)).
  • warn_marker_mismatch::Bool = true: warn if Ω carries a custom :boundary/:interior marker that disagrees with this mesh's own geometric one. The custom marker is kept either way; set to false for a deliberate redefinition you don't want flagged.

Examples

I = interval(0.0, 1.0)
Ωₕ = mesh(domain(I), 10)                      # uniform by default
Ωₕ_nonunif = mesh(domain(I), 10, false)       # explicit non-uniform

# Direct CartesianProduct input
X = interval(0, 1) × interval(4, 5)
Ωₕ_2d = mesh(X, (10, 15))                     # uniform by default
Ωₕ_iso = mesh(X, 20)                          # isotropic 20x20 grid
Ωₕ_mixed = mesh(X, (10, 15), (true, false))
source
Base.axesMethod
Base.axes(Ωₕ::AbstractMeshType)
Base.axes(Ωₕ::AbstractMeshType, d::Integer)

Return the axes of the mesh's CartesianIndices.

source
Base.firstindexMethod
Base.firstindex(Ωₕ::AbstractMeshType)
Base.firstindex(Ωₕ::AbstractMeshType, d::Integer)

Return the first valid index of Ωₕ.

source
Base.iterateFunction
Base.iterate(Ωₕ::AbstractMeshType, [state])

Iterate over all grid points of Ωₕ, returning coordinates point(Ωₕ, idx) for each index.

source
Base.lastindexMethod
Base.lastindex(Ωₕ::AbstractMeshType)
Base.lastindex(Ωₕ::AbstractMeshType, d::Integer)

Return the last valid index of Ωₕ.

source
Base.lengthMethod
Base.length(Ωₕ::AbstractMeshType) -> Int

Return the total number of points in Ωₕ, matching npoints(Ωₕ).

source
Base.sizeMethod
Base.size(Ωₕ::AbstractMeshType) -> NTuple{D, Int}
Base.size(Ωₕ::AbstractMeshType, d::Integer) -> Int

Return the tuple of point counts along each spatial dimension, matching npoints(Ωₕ, Tuple).

source
Bramble.__process_condition!Method
__process_condition!(mesh_marker::BitVector, identifier, Ωₕ::AbstractMeshType) -> Nothing

Core logic for evaluating a function-based (level-set) marker predicate across all mesh points.

source
Bramble._ensure_geometric_markers!Method
_ensure_geometric_markers!(mesh_markers::MeshMarkers, Ωₕ::AbstractMeshType) -> Nothing

Seed :boundary and :interior from the mesh's own geometry, preserving any existing custom definitions registered under those names.

If a pre-existing custom marker with the same name disagrees with the geometric boundary, a warning is issued because downstream operators (restrict_to) assume geometric semantics — unless warn_marker_mismatch is false, for a caller that has deliberately redefined the label and does not want to be told so on every mesh built from it.

source
Bramble._init_mesh_markersMethod
_init_mesh_markers(Ωₕ::AbstractMeshType, domain_markers::DomainMarkers) -> MeshMarkers

Internal helper function to construct and initialize the MeshMarkers dictionary.

Allocates BitVector storage initialized to false for every symbol, tuple, and condition label defined in domain_markers.

source
Bramble._mark_indices!Method
_mark_indices!(marker_set::AbstractVector{Bool}, linear_indices, indices_to_mark) -> Nothing

Utility function to update a boolean marker vector.

Sets entries to true at the linear positions corresponding to indices_to_mark.

source
Bramble._set_markers_conditions!Method
_set_markers_conditions!(mesh_markers::MeshMarkers, conditions, Ωₕ::AbstractMeshType) -> Nothing

Iterate through all function-based markers and evaluate them across the mesh.

source
Bramble._set_markers_symbols!Method
_set_markers_symbols!(mesh_markers::MeshMarkers, symbols, Ωₕ::AbstractMeshType) -> Nothing

Process markers identified by predefined symbols (:left, :top, etc.) or collections of symbols.

source
Bramble.boundary_symbol_to_cartesianMethod
boundary_symbol_to_cartesian(indices::CartesianIndices{1}) -> NamedTuple
boundary_symbol_to_cartesian(indices::CartesianIndices{2}) -> NamedTuple
boundary_symbol_to_cartesian(indices::CartesianIndices{3}) -> NamedTuple

Map canonical boundary symbols (:xmin, :xmax, :ymin, :ymax, :zmin, :zmax) and legacy viewpoint aliases (:left, :right, :top, :bottom, :front, :back) to their corresponding CartesianIndices on the mesh boundary.

Returns

A NamedTuple with boundary symbols as keys and CartesianIndices as values:

  • 1D: :xmin, :xmax, :left, :right
  • 2D: :xmin, :xmax, :ymin, :ymax, :left, :right, :bottom, :top
  • 3D: All six faces: :xmin, :xmax, :ymin, :ymax, :zmin, :zmax, :back, :front, :left, :right, :bottom, :top

Examples

julia> boundary_symbol_to_cartesian(CartesianIndices((1:3, 1:4)))
(xmin = CartesianIndices((1:1, 1:4)), xmax = CartesianIndices((3:3, 1:4)), ymin = CartesianIndices((1:3, 1:1)), ymax = CartesianIndices((1:3, 4:4)), left = CartesianIndices((1:1, 1:4)), right = CartesianIndices((3:3, 1:4)), bottom = CartesianIndices((1:3, 1:1)), top = CartesianIndices((1:3, 4:4)))

See also: boundary_symbol_to_dict, set_markers!.

source
Bramble.process_label_for_mesh!Method
process_label_for_mesh!(npts::Integer, markers_mesh::MeshMarkers, set_labels) -> Nothing

Initialize boolean indicator vectors for a collection of marker labels within markers_mesh.

For each label in set_labels, assigns a BitVector of length npts initialized to false.

Arguments

  • npts: Total number of grid points in the mesh.
  • markers_mesh: MeshMarkers dictionary modified in-place.
  • set_labels: Collection of Symbol labels to initialize.
source
Bramble.set_markers!Method
set_markers!(Ωₕ::AbstractMeshType, domain_markers::DomainMarkers) -> Nothing

Evaluate domain markers onto mesh points, creating BitVector indicators for each label.

Supports three classes of domain markers:

  1. Symbol markers: predefined boundary labels (:left, :right, etc.).
  2. Tuple markers: unions of boundary symbols.
  3. Function markers: level-set boolean predicates x -> Bool.

Also seeds the default geometric markers :boundary and :interior if not already defined.

Arguments

  • Ωₕ: Target mesh whose markers field is populated.
  • domain_markers: DomainMarkers containing semantic boundary or regional labels.

Keywords

  • warn_marker_mismatch::Bool = true: whether to warn when a custom :boundary/:interior marker disagrees with the mesh's own geometric definition. The custom marker is kept either way; set to false to silence the warning for an intentional redefinition (see mesh).

Examples

Ω = domain(interval(0, 1) × interval(0, 1),
           :inlet => :left,
           :outlet => :right,
           :walls => (:top, :bottom),
           :obstacle => x -> norm(x .- 0.5) < 0.2)
Ωₕ = mesh(Ω, (20, 20), (true, true))
# Ωₕ.markers contains BitVectors for :inlet, :outlet, :walls, :obstacle, :boundary, :interior

See also: DomainMarkers, MeshMarkers.

source
Base.copyMethod
Base.copy(Ωₕ::Mesh1D) -> Mesh1D

Create a copy of mesh Ωₕ. The copy is shallow with respect to immutable fields (set, indices, backend, collapsed), but deep with respect to mutable data fields (pts, half_pts, half_spacings, markers).

source
Base.showMethod
Base.show(io::IO, Ωₕ::Mesh1D) -> Nothing

Custom display for Mesh1D objects with detailed mesh summary, domain information, and markers.

source
Bramble.half_points!Method
half_points!(Ωₕ::Mesh1D, pts::AbstractVector) -> Nothing

Override the precomputed cell center cache in Ωₕ.

source
Bramble.half_spacings!Method
half_spacings!(Ωₕ::Mesh1D, pts::AbstractVector) -> Nothing

Override the precomputed cell width cache in Ωₕ.

source
Base.copyMethod
Base.copy(Ωₕ::MeshnD{D}) -> MeshnD{D}

Create a copy of mesh Ωₕ. The copy is shallow with respect to immutable fields (set, indices, backend), but deep with respect to mutable data fields (submeshes, markers).

source
Base.showMethod
Base.show(io::IO, Ωₕ::MeshnD) -> Nothing

Custom display for MeshnD objects with detailed mesh summary, domain information, and markers.

source
Bramble._meshMethod
_mesh(Ω::Domain, npts::NTuple{D, Int}, unif::NTuple{D, Bool}, backend) -> MeshnD{D}

Internal constructor for multi-dimensional tensor-product mesh MeshnD.

Builds the 1D submeshes along each axis and combines them into a MeshnD. Collapsed dimensions (degenerate single-point intervals) are forced to a point count of 1.

Arguments

  • Ω: Multi-dimensional continuous Domain to discretize.
  • npts: Number of points in each spatial dimension.
  • unif: Uniformity flags for each spatial dimension.
  • backend: Linear algebra Backend.
source
Bramble.print_mesh_headerMethod
print_mesh_header(pp::PrettyPrinter, mesh_type::String, D::Int, T::Type, npts) -> Nothing

Print a styled header for mesh objects.

source
Bramble.print_mesh_markersMethod
print_mesh_markers(pp::PrettyPrinter, mesh_markers::MeshMarkers) -> Nothing

Print marker information and labeled point counts for a mesh.

source
Bramble.print_mesh_summaryMethod
print_mesh_summary(pp::PrettyPrinter, npts, topodim::Int, collapsed::Bool) -> Nothing

Print a summary line for mesh properties (number of points, topology).

source