diff --git a/src/FEValues/cell_values.jl b/src/FEValues/cell_values.jl index 953ed36e7b..f2148d3fab 100644 --- a/src/FEValues/cell_values.jl +++ b/src/FEValues/cell_values.jl @@ -285,3 +285,11 @@ function reinit!(cv::CellValues{<:Any, N_t, dNdx_t, dNdĪ¾_t}, x::AbstractVector{ end return nothing end + +function Base.show(io::IO, m::MIME"text/plain", cv::CellValues) + println(io, "CellValues with") + println(io, "- Quadrature rule with ", getnquadpoints(cv), " points") + print(io, "- Function interpolation: "); show(io, m, cv.ip) + println(io) + print(io, "- Geometric interpolation: "); show(io, m, cv.gip) +end \ No newline at end of file diff --git a/src/FEValues/face_values.jl b/src/FEValues/face_values.jl index c0dc14a3f1..5ba510330f 100644 --- a/src/FEValues/face_values.jl +++ b/src/FEValues/face_values.jl @@ -250,3 +250,16 @@ function checkface(fv::FaceValues, face::Int) 0 < face <= nfaces(fv) || error("Face index out of range.") return nothing end + +function Base.show(io::IO, m::MIME"text/plain", fv::FaceValues) + println(io, "FaceValues with") + nqp = getnquadpoints.(fv.qr.face_rules) + if all(n==first(nqp) for n in nqp) + println(io, "- Quadrature rule with ", first(nqp), " points per face") + else + println(io, "- Quadrature rule with ", tuple(nqp...), " points on each face") + end + print(io, "- Function interpolation: "); show(io, m, fv.func_interp) + println(io) + print(io, "- Geometric interpolation: "); show(io, m, fv.geo_interp) +end \ No newline at end of file diff --git a/test/test_cellvalues.jl b/test/test_cellvalues.jl index 9a8dfe64c4..4a5efce1f1 100644 --- a/test/test_cellvalues.jl +++ b/test/test_cellvalues.jl @@ -308,4 +308,12 @@ end end end +@testset "show" begin + # Just smoke test + cv_quad = CellValues(QuadratureRule{RefQuadrilateral}(2), Lagrange{RefQuadrilateral,2}()^2) + cv_wedge = CellValues(QuadratureRule{RefPrism}(2), Lagrange{RefPrism,2}()) + show(stdout, MIME"text/plain"(), cv_quad) + show(stdout, MIME"text/plain"(), cv_wedge) +end + end # of testset diff --git a/test/test_facevalues.jl b/test/test_facevalues.jl index 1ab9ef9594..10deb9a3ca 100644 --- a/test/test_facevalues.jl +++ b/test/test_facevalues.jl @@ -107,4 +107,13 @@ for (scalar_interpol, quad_rule) in ( end end +@testset "show" begin + # Just smoke test to make sure show doesn't error. + fv = FaceValues(FaceQuadratureRule{RefQuadrilateral}(2), Lagrange{RefQuadrilateral,2}()) + show(stdout, MIME"text/plain"(), fv) + fv.qr.face_rules[1] = deepcopy(fv.qr.face_rules[1]) + push!(Ferrite.getweights(fv.qr.face_rules[1]), 1) + show(stdout, MIME"text/plain"(), fv) +end + end # of testset