comparison src/Grids/equidistant_grid.jl @ 1902:f93ba5832146 feature/grids/parameter_spaces

Copy changes related to ParameterSpace from feature/grids/manifolds
author Jonatan Werpers <jonatan@werpers.com>
date Sat, 01 Feb 2025 22:12:53 +0100
parents 516eaabf1169
children 04c251bccbd4
comparison
equal deleted inserted replaced
1900:418566cdd689 1902:f93ba5832146
133 gs = map(equidistant_grid, limit_lower, limit_upper, dims) 133 gs = map(equidistant_grid, limit_lower, limit_upper, dims)
134 return TensorGrid(gs...) 134 return TensorGrid(gs...)
135 end 135 end
136 136
137 """ 137 """
138 equidistant_grid(limit_lower::T, limit_upper::T, size::Int) 138 equidistant_grid(limit_lower::Number, limit_upper::Number, size::Int)
139 139
140 Constructs a 1D equidistant grid. 140 Constructs a 1D equidistant grid.
141 """ 141 """
142 function equidistant_grid(limit_lower::Number, limit_upper::Number, size::Int) 142 function equidistant_grid(limit_lower::Number, limit_upper::Number, size::Int)
143 if any(size .<= 0) 143 if size <= 0
144 throw(DomainError("size must be postive")) 144 throw(DomainError("size must be postive"))
145 end 145 end
146 146
147 if any(limit_upper.-limit_lower .<= 0) 147 if limit_upper-limit_lower <= 0
148 throw(DomainError("side length must be postive")) 148 throw(DomainError("side length must be postive"))
149 end 149 end
150
150 return EquidistantGrid(range(limit_lower, limit_upper, length=size)) # TBD: Should it use LinRange instead? 151 return EquidistantGrid(range(limit_lower, limit_upper, length=size)) # TBD: Should it use LinRange instead?
151 end 152 end
153
154 equidistant_grid(d::Interval, size::Int) = equidistant_grid(limits(d)..., size)
155 equidistant_grid(hb::HyperBox, dims::Vararg{Int}) = equidistant_grid(limits(hb)..., dims...)
156
152 157
153 CartesianBoundary{D,BID} = TensorGridBoundary{D,BID} # TBD: What should we do about the naming of this boundary? 158 CartesianBoundary{D,BID} = TensorGridBoundary{D,BID} # TBD: What should we do about the naming of this boundary?
154 159
155 160
156 """ 161 """