Skip to content

Commit 56e3f0c

Browse files
authored
Merge pull request #606 from gridap/misc_renamings
Misc renamings
2 parents 9bbf922 + 6dd6abb commit 56e3f0c

11 files changed

+26
-24
lines changed

NEWS.md

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
- The default quadrature rule for tets has changed. Since PR [#578](https://github.com/gridap/Gridap.jl/pull/578).
1818
- Refactoring in `SparseMatrixAssembler` to make it more extensible and efficient. Since PR [#568](https://github.com/gridap/Gridap.jl/pull/568).
1919
- Renamed `get_free_values` -> `get_free_dof_values`. Since PR [#567](https://github.com/gridap/Gridap.jl/pull/567).
20+
- Renamed `get_dirichlet_values` -> `get_dirichlet_dof_values`. Since PR [#606](https://github.com/gridap/Gridap.jl/pull/606).
21+
- Renamed `object` -> `value` the variable in `ConstantField`. Since PR [#606](https://github.com/gridap/Gridap.jl/pull/606).
2022
- Miscellaneous changes in the FE assembly to allow the solution of mixed dimensional problems. Since PR [#567](https://github.com/gridap/Gridap.jl/pull/567).
2123
- Renamed `get_cell_shapefuns` by `get_fe_basis`. Since PR [#579](https://github.com/gridap/Gridap.jl/pull/579).
2224
- Renamed `get_cell_shapefuns_trial` by `get_trial_fe_basis`. Since PR [#579](https://github.com/gridap/Gridap.jl/pull/579).

src/Exports.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ using Gridap.CellData: ∫; export ∫
140140
@publish FESpaces AffineFEOperator
141141
@publish FESpaces LinearFESolver
142142
@publish FESpaces get_free_dof_values
143-
@publish FESpaces get_dirichlet_values
143+
@publish FESpaces get_dirichlet_dof_values
144144
@publish FESpaces num_dirichlet_dofs
145145
@publish FESpaces num_free_dofs
146146
@publish FESpaces num_dirichlet_tags

src/FESpaces/DivConformingFESpaces.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function get_cell_shapefuns(model::DiscreteModel,
4141
lazy_map(_transform_rt_shapefuns,
4242
cell_reffe,
4343
get_cell_map(Triangulation(model)),
44-
lazy_map(Broadcasting(ConstantField), sign_flip))
44+
lazy_map(Broadcasting(constant_field), sign_flip))
4545
end
4646

4747
struct SignFlipMap{T} <: Map

src/FESpaces/FESpaces.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export gather_dirichlet_values!
9797
export gather_free_values
9898
export gather_free_values!
9999
export test_single_field_fe_space
100-
export get_dirichlet_values
100+
export get_dirichlet_dof_values
101101
export interpolate
102102
export interpolate!
103103
export interpolate_everywhere

src/FESpaces/FESpacesWithLinearConstraints.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ function _setup_ddof_to_tag!(
332332
end
333333
end
334334

335-
function get_dirichlet_values(f::FESpaceWithLinearConstraints)
336-
ddof_to_tag = get_dirichlet_values(f.space)
335+
function get_dirichlet_dof_values(f::FESpaceWithLinearConstraints)
336+
ddof_to_tag = get_dirichlet_dof_values(f.space)
337337
dmdof_to_tag = zeros(eltype(ddof_to_tag),num_dirichlet_dofs(f))
338338
_setup_ddof_to_tag!(
339339
dmdof_to_tag,

src/FESpaces/SingleFieldFESpaces.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ end
176176

177177
"""
178178
"""
179-
function get_dirichlet_values(f::SingleFieldFESpace)
179+
function get_dirichlet_dof_values(f::SingleFieldFESpace)
180180
zero_dirichlet_values(f)
181181
end
182182

@@ -269,7 +269,7 @@ end
269269
fs::SingleFieldFESpace, free_values::AbstractVector, dirichlet_values::AbstractVector)
270270
271271
The resulting FEFunction will be in the space if and only if `dirichlet_values`
272-
are the ones provided by `get_dirichlet_values(fs)`
272+
are the ones provided by `get_dirichlet_dof_values(fs)`
273273
"""
274274
function FEFunction(
275275
fs::SingleFieldFESpace, free_values::AbstractVector, dirichlet_values::AbstractVector)
@@ -279,7 +279,7 @@ function FEFunction(
279279
end
280280

281281
function FEFunction(fe::SingleFieldFESpace, free_values)
282-
diri_values = get_dirichlet_values(fe)
282+
diri_values = get_dirichlet_dof_values(fe)
283283
FEFunction(fe,free_values,diri_values)
284284
end
285285

src/FESpaces/TrialFESpaces.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ end
3535
"""
3636
"""
3737
function TrialFESpace!(space::TrialFESpace,objects)
38-
dir_values = get_dirichlet_values(space)
38+
dir_values = get_dirichlet_dof_values(space)
3939
dir_values_scratch = zero_dirichlet_values(space)
4040
dir_values = compute_dirichlet_values_for_tags!(dir_values,dir_values_scratch,space,objects)
4141
space
@@ -69,7 +69,7 @@ end
6969

7070
# Genuine functions
7171

72-
get_dirichlet_values(f::TrialFESpace) = f.dirichlet_values
72+
get_dirichlet_dof_values(f::TrialFESpace) = f.dirichlet_values
7373

7474
# Delegated functions
7575

src/FESpaces/ZeroMeanFESpaces.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ get_cell_isconstrained(f::ZeroMeanFESpace) = get_cell_isconstrained(f.space)
7272

7373
get_cell_constraints(f::ZeroMeanFESpace) = get_cell_constraints(f.space)
7474

75-
get_dirichlet_values(f::ZeroMeanFESpace) = get_dirichlet_values(f.space)
75+
get_dirichlet_dof_values(f::ZeroMeanFESpace) = get_dirichlet_dof_values(f.space)
7676

7777
get_fe_basis(f::ZeroMeanFESpace) = get_fe_basis(f.space)
7878

src/Fields/FieldsInterfaces.jl

+6-6
Original file line numberDiff line numberDiff line change
@@ -235,20 +235,20 @@ end
235235
# I think it is conceptually better to have ConstantField as struct otherwise we break the invariant
236236
# "for any object wrapped in a GenericField we can assume that it implements the Field interface"
237237
struct ConstantField{T<:Number} <: Field
238-
object::T
238+
value::T
239239
end
240240

241241
@inline constant_field(a) = ConstantField(a)
242242

243243
Base.zero(::Type{ConstantField{T}}) where T = ConstantField(zero(T))
244244

245245
@inline function evaluate!(c,f::ConstantField,x::Point)
246-
f.object
246+
f.value
247247
end
248248

249249
function return_cache(f::ConstantField,x::AbstractArray{<:Point})
250250
nx = size(x)
251-
c = fill(f.object,nx)
251+
c = fill(f.value,nx)
252252
CachedArray(c)
253253
end
254254

@@ -258,19 +258,19 @@ function evaluate!(c,f::ConstantField,x::AbstractArray{<:Point})
258258
# in the same array and we try to reuse cache between them.
259259
#if size(c) != nx
260260
setsize!(c,nx)
261-
fill!(c.array,f.object)
261+
fill!(c.array,f.value)
262262
#end
263263
c.array
264264
end
265265

266266
@inline function return_cache(f::FieldGradient{N,<:ConstantField},x::Point) where N
267-
gradient(f.object.object,Val(N))(x)
267+
gradient(f.object.value,Val(N))(x)
268268
end
269269

270270
@inline evaluate!(c,f::FieldGradient{N,<:ConstantField},x::Point) where N = c
271271

272272
@inline function return_cache(f::FieldGradient{N,<:ConstantField},x::AbstractArray{<:Point}) where N
273-
CachedArray(gradient(f.object.object,Val(N)).(x))
273+
CachedArray(gradient(f.object.value,Val(N)).(x))
274274
end
275275

276276
function evaluate!(c,f::FieldGradient{N,<:ConstantField},x::AbstractArray{<:Point}) where N

test/FESpacesTests/DirichletFESpacesTests.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ op_ff = AffineFEOperator(a,l,Uf,Vf)
4141
op_fd = AffineFEOperator(a,l,Ud,Vf)
4242
op_df = AffineFEOperator(a,l,Uf,Vd)
4343

44-
xd = get_dirichlet_values(Uf)
44+
xd = get_dirichlet_dof_values(Uf)
4545

4646
@test maximum(abs.(get_vector(op_ff) + get_matrix(op_fd)*xd)) < 1.0e-10
4747

test/FESpacesTests/TrialFESpacesTests.jl

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ matdata = ([],[],[])
3333
vecdata = ([],[])
3434
test_single_field_fe_space(U,matvecdata,matdata,vecdata)
3535

36-
@test get_dirichlet_values(U) == [4.0, 3.0, 3.0, 3.0, 3.0, 3.0]
36+
@test get_dirichlet_dof_values(U) == [4.0, 3.0, 3.0, 3.0, 3.0, 3.0]
3737
TrialFESpace!(U,[1,2])
38-
@test get_dirichlet_values(U) == [1.0, 2.0, 2.0, 2.0, 2.0, 2.0]
38+
@test get_dirichlet_dof_values(U) == [1.0, 2.0, 2.0, 2.0, 2.0, 2.0]
3939

4040
U0 = HomogeneousTrialFESpace(V)
41-
@test get_dirichlet_values(U0) == zeros(6)
41+
@test get_dirichlet_dof_values(U0) == zeros(6)
4242

4343
U0 = HomogeneousTrialFESpace!(v,V)
44-
@test v === get_dirichlet_values(U0)
44+
@test v === get_dirichlet_dof_values(U0)
4545
@test v == zeros(6)
46-
@test get_dirichlet_values(U0) == zeros(6)
46+
@test get_dirichlet_dof_values(U0) == zeros(6)
4747

4848
u(x) = x[1]
4949
U = TrialFESpace(V,u)
@@ -66,7 +66,7 @@ cell_dofs = get_cell_dof_ids(U,cellidsS)
6666
@test isa(cell_dofs[1],ArrayBlock)
6767

6868
U0 = HomogeneousTrialFESpace(U)
69-
@test get_dirichlet_values(U0) == zeros(6)
69+
@test get_dirichlet_dof_values(U0) == zeros(6)
7070

7171
#trian = get_triangulation(model)
7272
#

0 commit comments

Comments
 (0)