11export add_subset_element!
2- export get_subset_space
2+ export get_subset_space_objects
33export get_grid_subset
44export get_subset_boundary_inds
55export get_subset_boundary
@@ -76,17 +76,28 @@ function add_subset_element!(
7676end
7777
7878"""
79- get_subset_space (space::all__space, subset::all__grid_subset)
79+ get_subset_space_objects (space::all__space, subset::all__grid_subset)
8080
8181Returns an array of space object indices corresponding to the correct
8282objects_per_dimension (nodes, edges or cells) for the subset elements.
8383"""
84- function get_subset_space (space:: all__space , subset:: all__grid_subset )
84+ function get_subset_space_objects (space:: all__space , subset:: all__grid_subset )
8585 nD = subset. element[1 ]. object[1 ]. dimension
8686 nD_objects = space. objects_per_dimension[nD]. object
8787 return [nD_objects[ele. object[1 ]. index] for ele ∈ subset. element]
8888end
8989
90+ """
91+ get_subset_space_objects(subset::all__grid_subset)
92+
93+ Returns an array of space object indices corresponding to the correct
94+ objects_per_dimension (nodes, edges or cells) for the subset elements.
95+ """
96+ function get_subset_space_objects(subset:: all__grid_subset )
97+ space = get_space(subset)
98+ return get_subset_space_objects(space, subset)
99+ end
100+
90101"""
91102 get_grid_subset(grid_ggd::all__grid_ggd, grid_subset_index::Int)
92103
@@ -102,11 +113,17 @@ function get_grid_subset(grid_ggd::all__grid_ggd, grid_subset_index::Int)
102113end
103114
104115"""
105- get_grid_subset(grid_ggd::all__grid_ggd, grid_subset_name::String)
116+ get_grid_subset(
117+ grid_ggd::all__grid_ggd,
118+ grid_subset_name::String,
119+ )
106120
107121Returns the grid_subset in a grid_ggd with the matching grid_subset_name
108122"""
109- function get_grid_subset(grid_ggd:: all__grid_ggd , grid_subset_name:: String )
123+ function get_grid_subset(
124+ grid_ggd:: all__grid_ggd ,
125+ grid_subset_name:: String ,
126+ )
110127 for subset ∈ grid_ggd. grid_subset
111128 if subset. identifier. name == grid_subset_name
112129 return subset
@@ -174,7 +191,7 @@ function get_grid_ggd(subset::Union{all__grid_subset, all__space})::all__grid_gg
174191end
175192
176193"""
177- get_space_from_subset (subset::all__grid_subset)::all__space
194+ get_space (subset::all__grid_subset)::all__space
178195
179196Get the corresponding space in parent grid_ggd for a grid_subset object.
180197"""
@@ -185,10 +202,11 @@ end
185202
186203"""
187204 subset_do(
188- set_operator,
189- itrs::Vararg{all__grid_subset};
190- use_nodes=false,
191- )::all__grid_subset
205+ set_operator,
206+ itrs::Vararg{all__grid_subset};
207+ use_nodes=false,
208+
209+ )::all__grid_subset
192210
193211Function to perform any set operation (intersect, union, setdiff etc.) on
194212subset.element to generate a list of elements to go to subset object. If use_nodes is
@@ -204,8 +222,8 @@ function subset_do(
204222 ele_inds = set_operator(
205223 [
206224 union([
207- obj. nodes for obj ∈ get_subset_space (space, subset)
208- ]. ..
225+ obj. nodes for obj ∈ get_subset_space_objects (space, subset)
226+ ]. ..
209227 ) for subset ∈ itrs
210228 ]. .. ,
211229 )
@@ -229,7 +247,7 @@ Returns an array of tuples corresponding to (r,z) coordinates of the center of
229247cells or the center of edges in the subset space.
230248"""
231249function get_subset_centers(space:: all__space , subset:: all__grid_subset )
232- subset_space = get_subset_space (space, subset)
250+ subset_space = get_subset_space_objects (space, subset)
233251 if subset. element[1 ]. object[1 ]. dimension == 1
234252 return [Tuple(obj. geometry) for obj ∈ subset_space]
235253 end
@@ -240,13 +258,24 @@ function get_subset_centers(space::all__space, subset::all__grid_subset)
240258 ]
241259end
242260
261+ """
262+ get_subset_centers(subset::all__grid_subset)
263+
264+ Returns an array of tuples corresponding to (r,z) coordinates of the center of
265+ cells or the center of edges in the subset space.
266+ """
267+ function get_subset_centers(subset:: all__grid_subset )
268+ space = get_space(subset)
269+ return get_subset_centers(space, subset)
270+ end
271+
243272"""
244273 project_prop_on_subset!(
245- prop_arr::AbstractVector{<:all__grid_subset_prop},
246- from_subset::all__grid_subset,
247- to_subset::all__grid_subset,
274+ prop_arr::AbstractVector{<:all__grid_subset_prop}) ,
275+ from_subset::all__grid_subset) ,
276+ to_subset::all__grid_subset) ,
248277 space::all__space,
249- value_field::Symbol=:values;
278+ value_field::Symbol=:values,
250279 TPS_mats::Union{
251280 Nothing,
252281 Tuple{Matrix{U}, Matrix{U}, Matrix{U}, Vector{Tuple{U, U}}},
@@ -291,19 +320,19 @@ to_prop_values: The projected values of the properties added to prop object in a
291320instance
292321"""
293322function project_prop_on_subset!(
294- prop_arr:: AbstractVector {<:all__grid_subset_prop} ,
323+ prop_arr:: IMASdd.IDSvector {<:all__grid_subset_prop} ,
295324 from_subset:: all__grid_subset ,
296325 to_subset:: all__grid_subset ,
297326 space:: all__space ,
298- value_field:: Symbol = :values;
327+ value_field:: Symbol = :values,
299328 TPS_mats:: Union {
300329 Nothing,
301330 Tuple{Matrix{U}, Matrix{U}, Matrix{U}, Vector{Tuple{U, U}}},
302331 }= nothing ,
303332) where {U <: Real }
304333 if from_subset. element[1 ]. object[1 ]. dimension ==
305334 to_subset. element[1 ]. object[1 ]. dimension
306- return project_prop_on_subset!(prop , from_subset, to_subset)
335+ return project_prop_on_subset!(prop_arr , from_subset, to_subset, value_field )
307336 elseif from_subset. element[1 ]. object[1 ]. dimension >
308337 to_subset. element[1 ]. object[1 ]. dimension
309338 if length(prop_arr) < 1
346375
347376"""
348377 project_prop_on_subset!(
349- prop_arr::AbstractVector{<:all__grid_subset_prop},
350- from_subset::all__grid_subset,
351- to_subset::all__grid_subset,
378+ prop_arr::AbstractVector{<:all__grid_subset_prop}) ,
379+ from_subset::all__grid_subset) ,
380+ to_subset::all__grid_subset) ,
352381 value_field::Symbol=:values,
353382 )
354383
@@ -358,7 +387,7 @@ any interpolation or use of space object. The function returns a tuple of indice
358387elements of to_subset and the values of the property in to_subset.
359388"""
360389function project_prop_on_subset!(
361- prop_arr:: AbstractVector {<:all__grid_subset_prop} ,
390+ prop_arr:: IMASdd.IDSvector {<:all__grid_subset_prop} ,
362391 from_subset:: all__grid_subset ,
363392 to_subset:: all__grid_subset ,
364393 value_field:: Symbol = :values,
@@ -566,18 +595,18 @@ end
566595
567596"""
568597 get_prop_with_grid_subset_index(
569- prop ::AbstractVector{<:all__grid_subset_prop},
598+ prop_arr ::AbstractVector{<:all__grid_subset_prop}) ,
570599 grid_subset_index::Int,
571600 )
572601
573602Find the property instance in an array of properties that corresponds to
574603the grid_subset_index provided.
575604"""
576605function get_prop_with_grid_subset_index(
577- prop :: AbstractVector{<:all__grid_subset_prop} ,
606+ prop_arr :: AbstractVector{<:all__grid_subset_prop} ,
578607 grid_subset_index:: Int ,
579608)
580- for p ∈ prop
609+ for p ∈ prop_arr
581610 if p. grid_subset_index == grid_subset_index
582611 return p
583612 end
0 commit comments