GalerkinToolkit.jl icon indicating copy to clipboard operation
GalerkinToolkit.jl copied to clipboard

Type instable `maps` in `generate_dof_ids_step_1`

Open Cmurilochem opened this issue 11 months ago • 1 comments
trafficstars

As a result of our profiling experiments, I am now looking into generate_dof_ids_step_1. It looks like that all the maps used lead to undetermined-type Vectors. One example is:

https://github.com/GalerkinToolkit/GalerkinToolkit.jl/blob/c6fa31e81f5e8261051880138dd3d1e36b3e0914/src/interpolation.jl#L385-L386

To check this, I use:

n = 10
mesh = GT.cartesian_mesh((0, 1, 0, 1, 0, 1), (n, n, n))
Ω = GT.interior(mesh)
Γd = GT.boundary(mesh)
params[:integration_degree] = 1
interpolation_degree = 2*params[:integration_degree]

V = GT.lagrange_space(Ω,interpolation_degree;dirichlet_boundary=Γd)

@code_warntype GT.generate_dof_ids_step_1(V)

which results in d_to_ndfaces::Vector as opposed to, e.g., d_to_ndfaces::Vector{Int64}.

After investigating further, I realized that the topology itself is not well determined by julia, being composed of a undetermined Tuple topology::GalerkinToolkit.GenericMeshTopology{Matrix{PartitionedArrays.JaggedArray{Int32, Int32}}, Vector{Vector{Int32}}, Matrix{PartitionedArrays.JaggedArray{Int32, Int32}}, D} where D<:Tuple.

This problem pointed me out to another function topology_from_mesh which is used by topology = mesh |> GT.topology .

There, we have another map: https://github.com/GalerkinToolkit/GalerkinToolkit.jl/blob/c6fa31e81f5e8261051880138dd3d1e36b3e0914/src/mesh.jl#L1242

which gives rise to an undefined tuple my_reference_faces::Tuple (instead of my_reference_faces::Tuple{....}). I am suspecting that this is the origin of the above problem.

@fverdugo, do you have any clue on how could we solve this ?

Cmurilochem avatar Dec 04 '24 07:12 Cmurilochem