From 7699c8c4e0772ffa7fb534fc3d323942e58addaa Mon Sep 17 00:00:00 2001 From: Christian Merdon Date: Mon, 5 Feb 2024 15:00:32 +0100 Subject: [PATCH] renamed NodeInParent to NodeParents, added a deprecated warning on this --- Project.toml | 2 +- src/ExtendableGrids.jl | 4 +++- src/deprecated.jl | 8 ++++++++ src/derived.jl | 2 +- src/subgrid.jl | 12 ++++++------ 5 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 src/deprecated.jl diff --git a/Project.toml b/Project.toml index f080e62c..0234c117 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ExtendableGrids" uuid = "cfc395e8-590f-11e8-1f13-43a2532b2fa8" authors = ["Juergen Fuhrmann ", "Christian Merdon ", "Johannes Taraz "] -version = "1.2.3" +version = "1.3.0" [deps] AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" diff --git a/src/ExtendableGrids.jl b/src/ExtendableGrids.jl index 44452a99..3fdf5976 100644 --- a/src/ExtendableGrids.jl +++ b/src/ExtendableGrids.jl @@ -82,7 +82,7 @@ export seemingly_equal, numbers_match include("subgrid.jl") export subgrid export ParentGrid -export NodeInParent, CellParents, FaceParents, BFaceParents, EdgeParents, BEdgeParents +export NodeParents, CellParents, FaceParents, BFaceParents, EdgeParents, BEdgeParents export ParentGridRelation, SubGrid, BoundarySubGrid, RefinedGrid include("shape_specs.jl") @@ -177,6 +177,8 @@ export writeVTK include("seal.jl") +include("deprecated.jl") + @static if !isdefined(Base, :get_extension) function __init__() @require Gmsh="705231aa-382f-11e9-3f0c-b7cb4346fdeb" begin diff --git a/src/deprecated.jl b/src/deprecated.jl new file mode 100644 index 00000000..ea42615b --- /dev/null +++ b/src/deprecated.jl @@ -0,0 +1,8 @@ +## NodeInParent was renamed to NodeParents in v1.3 +abstract type NodeInParent <: AbstractGridIntegerArray1D end +export NodeInParent + +function ExtendableGrids.instantiate(xgrid::ExtendableGrid, ::Type{NodeInParent}) + @warn "NodeInParents is deprecated, use NodeParents instead" + xgrid[NodeParents] +end \ No newline at end of file diff --git a/src/derived.jl b/src/derived.jl index 562c4d4d..892dfe1c 100644 --- a/src/derived.jl +++ b/src/derived.jl @@ -201,7 +201,7 @@ function ExtendableGrids.instantiate(xgrid::ExtendableGrid{Tc,Ti}, ::Type{FaceNo if xgrid[ParentGridRelation] === SubGrid ## get FaceNodes from ParentGrid to keep ordering and orientation pgrid = xgrid[ParentGrid] - pnodes = xgrid[NodeInParent] + pnodes = xgrid[NodeParents] nscells = num_cells(xgrid) PFaceNodes = pgrid[FaceNodes] PCellFaces = deepcopy(pgrid[CellFaces]) diff --git a/src/subgrid.jl b/src/subgrid.jl index 7f14b072..08b64133 100644 --- a/src/subgrid.jl +++ b/src/subgrid.jl @@ -1,9 +1,9 @@ """ $(TYPEDEF) -Grid component key type for storing node in parent array +Grid component key type for storing node parents (=ids of nodes in ParentGrid) in an array """ -abstract type NodeInParent <: AbstractGridIntegerArray1D end +abstract type NodeParents <: AbstractGridIntegerArray1D end """ $(TYPEDEF) @@ -98,7 +98,7 @@ Create subgrid from list of regions. - `project`: project coordinates onto subgrid dimension A subgrid is of type `ExtendableGrid` and stores two additional components: -[`ParentGrid`](@ref) and [`NodeInParent`](@ref) +[`ParentGrid`](@ref) and [`NodeParents`](@ref) """ function subgrid(parent, @@ -195,7 +195,7 @@ function subgrid(parent, subgrid[CellGeometries]=sub_ct subgrid[CellNodes]=tryfix(sub_xnodes) subgrid[ParentGrid]=parent - subgrid[NodeInParent]=sub_nip + subgrid[NodeParents]=sub_nip subgrid[CellParents]=cellparents subgrid[ParentGridRelation]=boundary ? BoundarySubGrid : SubGrid @@ -265,7 +265,7 @@ function subgrid(parent, # Sort nodes of grid for easy plotting X=view(subgrid[Coordinates],1,:) nx=length(X) - I=subgrid[NodeInParent] + I=subgrid[NodeParents] xipairs=[XIPair{Tc,Ti}(X[i],I[i]) for i=1:nx] sort!(xipairs, 1,nx, Base.QuickSort, Base.Forward) for i=1:nx @@ -297,7 +297,7 @@ $(TYPEDSIGNATURES) Create a view of the vector on a subgrid. """ -Base.view(a::AbstractVector,subgrid::ExtendableGrid) = SubgridVectorView(a,subgrid[NodeInParent]) +Base.view(a::AbstractVector,subgrid::ExtendableGrid) = SubgridVectorView(a,subgrid[NodeParents]) ##############################################################################