Skip to content

Commit

Permalink
revert import mistake and fix MonomialBasis name conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoinemarteau committed Jan 3, 2025
1 parent f7a6ad0 commit 1d3a571
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/ReferenceFEs/CDLagrangianRefFEs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ end
if active_faces[offset+iface]
face = Polytope{d}(p,iface)
face_ref_x = get_vertex_coordinates(face)
face_prebasis = MonomialBasis(Float64,face,1)
face_prebasis = monomial_basis(Float64,face,1)
change = inv(evaluate(face_prebasis,face_ref_x))
face_shapefuns = linear_combination(change,face_prebasis)
face_vertex_ids = get_faces(p,d,0)[iface]
Expand Down
10 changes: 5 additions & 5 deletions src/ReferenceFEs/CLagrangianRefFEs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ function _lagrangian_ref_fe(::Type{T},p::Polytope{D},orders) where {T,D}

end

function MonomialBasis(::Type{T},p::Polytope,orders) where T
function monomial_basis(::Type{T},p::Polytope,orders) where T
compute_monomial_basis(T,p,orders)
end

Expand Down Expand Up @@ -369,9 +369,9 @@ function LagrangianRefFE(::Type{T},p::Polytope{D},order::Int;space::Symbol=_defa
LagrangianRefFE(T,p,orders;space=space)
end

function MonomialBasis(::Type{T},p::Polytope{D},order::Int) where {D,T}
function monomial_basis(::Type{T},p::Polytope{D},order::Int) where {D,T}
orders = tfill(order,Val{D}())
MonomialBasis(T,p,orders)
monomial_basis(T,p,orders)
end

function LagrangianDofBasis(::Type{T},p::Polytope{D},order::Int) where {T,D}
Expand Down Expand Up @@ -508,7 +508,7 @@ end
for iface in 1:num_faces(p,d)
face = Polytope{d}(p,iface)
face_ref_x = get_vertex_coordinates(face)
face_prebasis = MonomialBasis(Float64,face,1)
face_prebasis = monomial_basis(Float64,face,1)
change = inv(evaluate(face_prebasis,face_ref_x))
face_shapefuns = linear_combination(change,face_prebasis)
face_vertex_ids = get_faces(p,d,0)[iface]
Expand Down Expand Up @@ -538,7 +538,7 @@ _compute_node_permutations(::Polytope{0}, interior_nodes) = [[1]]

function _compute_node_permutations(p, interior_nodes)
vertex_to_coord = get_vertex_coordinates(p)
lbasis = MonomialBasis(Float64,p,1)
lbasis = monomial_basis(Float64,p,1)
change = inv(evaluate(lbasis,vertex_to_coord))
lshapefuns = linear_combination(change,lbasis)
perms = get_vertex_permutations(p)
Expand Down
2 changes: 2 additions & 0 deletions src/ReferenceFEs/ReferenceFEs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import Gridap.Fields: evaluate
import Gridap.Fields: lazy_map
import Gridap.Fields: linear_combination

import Gridap.Polynomials: get_order
import Gridap.Polynomials: get_orders
import Gridap.Polynomials: _compute_filter_mask
import Gridap.Polynomials: _define_terms, _sort_by_nfaces!

Expand Down
2 changes: 1 addition & 1 deletion src/ReferenceFEs/deprecated/NedelecRefFEs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function _Nedelec_edge_values(p,et,order)
c_eips, ecips, ewips = _nfaces_evaluation_points_weights(p, egeomap, cips, wips)

# Edge moments, i.e., M(Ei)_{ab} = q_RE^a(xgp_REi^b) w_Fi^b t_Ei ⋅ ()
eshfs = MonomialBasis(et,ep,order)
eshfs = monomial_basis(et,ep,order)
emoments = _Nedelec_edge_moments(p, eshfs, c_eips, ecips, ewips)

return ecips, emoments
Expand Down
12 changes: 7 additions & 5 deletions test/ReferenceFEsTests/CLagrangianRefFEsTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,25 @@ using Gridap.Polynomials
using Gridap.ReferenceFEs
using JSON

using Gridap.ReferenceFEs: monomial_basis

orders = (2,3)
b = MonomialBasis(Float64,QUAD,orders)
b = monomial_basis(Float64,QUAD,orders)
r = [(0,0), (1,0), (2,0), (0,1), (1,1), (2,1), (0,2), (1,2), (2,2), (0,3), (1,3), (2,3)]
@test get_exponents(b) == r

orders = (1,1,2)
b = MonomialBasis(Float64,WEDGE,orders)
b = monomial_basis(Float64,WEDGE,orders)
r = [(0,0,0), (1,0,0), (0,1,0), (0,0,1), (1,0,1), (0,1,1), (0,0,2), (1,0,2), (0,1,2)]
@test get_exponents(b) == r

orders = (1,1,1)
b = MonomialBasis(Float64,PYRAMID,orders)
b = monomial_basis(Float64,PYRAMID,orders)
r = [(0,0,0), (1,0,0), (0,1,0), (1,1, 0), (0,0,1)]
@test get_exponents(b) == r

orders = (1,1,1)
b = MonomialBasis(Float64,TET,orders)
b = monomial_basis(Float64,TET,orders)
r = [(0,0,0), (1,0,0), (0,1,0), (0,0,1)]
@test get_exponents(b) == r

Expand Down Expand Up @@ -71,7 +73,7 @@ dofs = LagrangianDofBasis(SymTensorValue{2,Int},VERTEX,())
dofs = LagrangianDofBasis(SymTracelessTensorValue{2,Int},VERTEX,())
@test dofs.node_and_comp_to_dof == SymTracelessTensorValue{2,Int}[(1,2)]

b = MonomialBasis(VectorValue{2,Int},VERTEX,())
b = monomial_basis(VectorValue{2,Int},VERTEX,())
@test length(b) == 2
@test evaluate(b,Point{0,Int}[(),()]) == VectorValue{2,Int}[(1, 0) (0, 1); (1, 0) (0, 1)]

Expand Down

0 comments on commit 1d3a571

Please sign in to comment.