Mesh
Base.eltype — Method
eltype(Ωₕ::AbstractMeshType) -> Type
eltype(::Type{<:AbstractMeshType}) -> TypeReturn the floating-point coordinate element type of the points in Ωₕ.
Bramble.markers! — Method
markers!(Ωₕ::AbstractMeshType, mesh_markers::MeshMarkers) -> NothingOverride 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.
Bramble.set_indices! — Method
set_indices!(Ωₕ::AbstractMeshType, indices::CartesianIndices) -> NothingOverride the grid indices in Ωₕ. Used internally during mesh refinement.
Bramble.generate_indices — Method
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.
Bramble._expand_uniform — Method
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...) -> AbstractMeshTypeReturn 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 positionalunif. Accepts aBoolor anNTuple{D, Bool}. Defaults totrueacross all axes.backend: Linear algebra and memory storageBackend. Defaults tobackend(eltype(Ω)).warn_marker_mismatch::Bool = true: warn ifΩcarries a custom:boundary/:interiormarker that disagrees with this mesh's own geometric one. The custom marker is kept either way; set tofalsefor 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))Base.firstindex — Method
Base.firstindex(Ωₕ::AbstractMeshType)
Base.firstindex(Ωₕ::AbstractMeshType, d::Integer)Return the first valid index of Ωₕ.
Base.iterate — Function
Base.iterate(Ωₕ::AbstractMeshType, [state])Iterate over all grid points of Ωₕ, returning coordinates point(Ωₕ, idx) for each index.
Base.lastindex — Method
Base.lastindex(Ωₕ::AbstractMeshType)
Base.lastindex(Ωₕ::AbstractMeshType, d::Integer)Return the last valid index of Ωₕ.
Base.length — Method
Base.length(Ωₕ::AbstractMeshType) -> IntReturn the total number of points in Ωₕ, matching npoints(Ωₕ).
Bramble.__process_condition! — Method
__process_condition!(mesh_marker::BitVector, identifier, Ωₕ::AbstractMeshType) -> NothingCore logic for evaluating a function-based (level-set) marker predicate across all mesh points.
Bramble._ensure_geometric_markers! — Method
_ensure_geometric_markers!(mesh_markers::MeshMarkers, Ωₕ::AbstractMeshType) -> NothingSeed :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.
Bramble._init_mesh_markers — Method
_init_mesh_markers(Ωₕ::AbstractMeshType, domain_markers::DomainMarkers) -> MeshMarkersInternal 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.
Bramble._mark_indices! — Method
_mark_indices!(marker_set::AbstractVector{Bool}, linear_indices, indices_to_mark) -> NothingUtility function to update a boolean marker vector.
Sets entries to true at the linear positions corresponding to indices_to_mark.
Bramble._set_markers_conditions! — Method
_set_markers_conditions!(mesh_markers::MeshMarkers, conditions, Ωₕ::AbstractMeshType) -> NothingIterate through all function-based markers and evaluate them across the mesh.
Bramble._set_markers_symbols! — Method
_set_markers_symbols!(mesh_markers::MeshMarkers, symbols, Ωₕ::AbstractMeshType) -> NothingProcess markers identified by predefined symbols (:left, :top, etc.) or collections of symbols.
Bramble.boundary_symbol_to_cartesian — Method
boundary_symbol_to_cartesian(indices::CartesianIndices{1}) -> NamedTuple
boundary_symbol_to_cartesian(indices::CartesianIndices{2}) -> NamedTuple
boundary_symbol_to_cartesian(indices::CartesianIndices{3}) -> NamedTupleMap 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!.
Bramble.boundary_symbol_to_dict — Method
boundary_symbol_to_dict(indices::CartesianIndices) -> Dict{Symbol, CartesianIndices}Return a dictionary connecting the facet labels of a set to the corresponding CartesianIndices.
See also: boundary_symbol_to_cartesian.
Bramble.process_label_for_mesh! — Method
process_label_for_mesh!(npts::Integer, markers_mesh::MeshMarkers, set_labels) -> NothingInitialize 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:MeshMarkersdictionary modified in-place.set_labels: Collection ofSymbollabels to initialize.
Bramble.set_markers! — Method
set_markers!(Ωₕ::AbstractMeshType, domain_markers::DomainMarkers) -> NothingEvaluate domain markers onto mesh points, creating BitVector indicators for each label.
Supports three classes of domain markers:
- Symbol markers: predefined boundary labels (
:left,:right, etc.). - Tuple markers: unions of boundary symbols.
- Function markers: level-set boolean predicates
x -> Bool.
Also seeds the default geometric markers :boundary and :interior if not already defined.
Arguments
Ωₕ: Target mesh whosemarkersfield is populated.domain_markers:DomainMarkerscontaining semantic boundary or regional labels.
Keywords
warn_marker_mismatch::Bool = true: whether to warn when a custom:boundary/:interiormarker disagrees with the mesh's own geometric definition. The custom marker is kept either way; set tofalseto silence the warning for an intentional redefinition (seemesh).
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, :interiorSee also: DomainMarkers, MeshMarkers.
Bramble.backward_spacings_for_derivative — Method
backward_spacings_for_derivative(Ωₕ::Mesh1D) -> AbstractVectorReturn a vector h with h[i] ==spacing_for_derivative(Ωₕ, i) for every i > 1. Entry 1 is zero: the backward difference has no stencil at the first point.
Bramble.forward_spacing_for_derivative — Method
forward_spacing_for_derivative(Ωₕ::Mesh1D, idx) -> eltype(Ωₕ)Return the spacing that a forward finite difference divides by at idx, which is forward_spacing(Ωₕ, idx) everywhere except the last point, where the difference has no stencil and this is zero.
See also: spacing_for_derivative, spacings.
Bramble.forward_spacings_for_derivative — Method
forward_spacings_for_derivative(Ωₕ::Mesh1D) -> AbstractVectorReturn a vector h with h[i] ==forward_spacing_for_derivative(Ωₕ, i) for every i < npoints(Ωₕ), as a view onto cached spacings. The last entry is omitted because the forward difference has no stencil at the right boundary.
Bramble.half_points! — Method
half_points!(Ωₕ::Mesh1D, pts::AbstractVector) -> NothingOverride the precomputed cell center cache in Ωₕ.
Bramble.half_spacings! — Method
half_spacings!(Ωₕ::Mesh1D, pts::AbstractVector) -> NothingOverride the precomputed cell width cache in Ωₕ.
Bramble.spacing_for_derivative — Method
spacing_for_derivative(Ωₕ::Mesh1D, idx) -> eltype(Ωₕ)Return the spacing that a backward finite difference divides by at idx, which is spacing(Ωₕ, idx) everywhere except the first point, where the difference has no stencil and this is zero.
See also: forward_spacing_for_derivative, spacings.
Bramble._mesh — Method
_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
Bramble.print_mesh_domain_info — Method
print_mesh_domain_info(pp::PrettyPrinter, set::CartesianProduct) -> NothingPrint the domain information for a mesh.
Bramble.print_mesh_header — Method
print_mesh_header(pp::PrettyPrinter, mesh_type::String, D::Int, T::Type, npts) -> NothingPrint a styled header for mesh objects.
Bramble.print_mesh_markers — Method
print_mesh_markers(pp::PrettyPrinter, mesh_markers::MeshMarkers) -> NothingPrint marker information and labeled point counts for a mesh.
Bramble.print_mesh_summary — Method
print_mesh_summary(pp::PrettyPrinter, npts, topodim::Int, collapsed::Bool) -> NothingPrint a summary line for mesh properties (number of points, topology).