Skip to content

Commit

Permalink
Additional patches to have a working 3D code
Browse files Browse the repository at this point in the history
print statement debugging replaced by @debug macros
Tests passing in 2D and 3D
  • Loading branch information
amartinhuertas committed Aug 7, 2023
1 parent 508b82b commit 2899f84
Show file tree
Hide file tree
Showing 8 changed files with 216 additions and 345 deletions.
6 changes: 3 additions & 3 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ version = "1.5.3"

[[deps.DataStructures]]
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "cf25ccb972fec4e4817764d01c82386ae94f77b4"
git-tree-sha1 = "3dbd312d370723b6bb43ba9d02fc36abade4518d"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.18.14"
version = "0.18.15"

[[deps.Dates]]
deps = ["Printf"]
Expand Down Expand Up @@ -275,7 +275,7 @@ version = "0.17.17"

[[deps.GridapDistributed]]
deps = ["FillArrays", "Gridap", "LinearAlgebra", "MPI", "PartitionedArrays", "SparseArrays", "SparseMatricesCSR", "WriteVTK"]
git-tree-sha1 = "607da91f5f5dc635a59ce9918201482c36460568"
git-tree-sha1 = "0daf5dd8686681f72d43d5a29fc4f196aa000eae"
repo-rev = "fixing_psparse_matrix_assembly_col_partition"
repo-url = "https://github.com/gridap/GridapDistributed.jl"
uuid = "f9701e48-63b3-45aa-9a63-9bc6c271f355"
Expand Down
25 changes: 12 additions & 13 deletions src/FESpaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ function _generate_constraints!(Df,
# Go over dofs of ocell_lface
for (ifdof, icdof) in enumerate(face_dofs[ocell_lface])
pifdof = node_permutations[oface_dim][pindex][ifdof]
println("XXXX: $(ifdof) $(pifdof)")
ldof_coarse = face_dofs[ocell_lface][pifdof]
coeffs[ifdof] =
ref_constraints[face_subface_ldof_to_cell_ldof[oface_dim][ocell_lface_within_dim][subface][ldof_subface], ldof_coarse]
Expand All @@ -213,9 +212,9 @@ function _generate_constraints!(Df,
end
end
end
println("sDOF_to_dof [$(Df)]= $(sDOF_to_dof)")
println("sDOF_to_dofs [$(Df)]= $(sDOF_to_dofs)")
println("sDOF_to_coeffs [$(Df)]= $(sDOF_to_coeffs)")
@debug "sDOF_to_dof [$(Df)]= $(sDOF_to_dof)"
@debug "sDOF_to_dofs [$(Df)]= $(sDOF_to_dofs)"
@debug "sDOF_to_coeffs [$(Df)]= $(sDOF_to_coeffs)"
end

# count how many different owner faces
Expand Down Expand Up @@ -249,8 +248,7 @@ function _compute_owner_faces_pindex_and_lids(Df,
end
end
end

println("%%%: $(owner_faces_lids)")
@debug "owner_faces_lids: $(owner_faces_lids)"

num_face_vertices = length(first(lface_to_cvertices))
owner_face_vertex_ids = Vector{Int}(undef, num_face_vertices * num_owner_faces)
Expand All @@ -272,8 +270,7 @@ function _compute_owner_faces_pindex_and_lids(Df,
end
end
end

println("???: $(owner_face_vertex_ids)")
@debug "owner_face_vertex_ids: $(owner_face_vertex_ids)"

owner_faces_pindex = Vector{Int}(undef, num_owner_faces)
for owner_face in keys(owner_faces_lids)
Expand Down Expand Up @@ -305,6 +302,8 @@ function _compute_owner_faces_pindex_and_lids(Df,
end
@assert pindexfound "Valid pindex not found"
end
@debug "owner_faces_pindex: $(owner_faces_pindex)"

owner_faces_pindex, owner_faces_lids
end

Expand All @@ -322,11 +321,11 @@ function generate_constraints(dmodel::OctreeDistributedDiscreteModel{Dc},
Tuple(Gridap.Geometry.get_faces(topo, Dc, d) for d = 0:Dc-1)
end
num_regular_faces = map(non_conforming_glue) do ncglue
println("regular= ", Tuple(ncglue.num_regular_faces[d] for d = 1:Dc))
@debug "num_regular_faces=$(Tuple(ncglue.num_regular_faces[d] for d = 1:Dc))"
Tuple(ncglue.num_regular_faces[d] for d = 1:Dc)
end
num_hanging_faces = map(non_conforming_glue) do ncglue
println("hanging= ", Tuple(ncglue.num_hanging_faces[d] for d = 1:Dc))
@debug "num_hanging_faces=$(Tuple(ncglue.num_hanging_faces[d] for d = 1:Dc))"
Tuple(ncglue.num_hanging_faces[d] for d = 1:Dc)
end
hanging_faces_glue = map(non_conforming_glue) do ncglue
Expand Down Expand Up @@ -590,15 +589,15 @@ function Gridap.FESpaces.FESpace(model::OctreeDistributedDiscreteModel{Dc}, reff

local_cell_dof_ids = map(spaces_w_constraints,sDOF_to_dof) do Vc,sDOF_to_dof
result = fe_space_with_linear_constraints_cell_dof_ids(Vc,sDOF_to_dof)
println("result=", result)
@debug "fe_space_with_linear_constraints_cell_dof_ids=$(result)"
result
end
nldofs = map(num_free_dofs,spaces_w_constraints)
cell_gids = get_cell_gids(model)
gids=GridapDistributed.generate_gids(cell_gids,local_cell_dof_ids,nldofs)
map(partition(gids)) do indices
println("[$(part_id(indices))]: l2g=$(local_to_global(indices))")
println("[$(part_id(indices))]: l2o=$(local_to_owner(indices))")
@debug "[$(part_id(indices))]: l2g_cell_gids=$(local_to_global(indices))"
@debug "[$(part_id(indices))]: l2o_cell_gids=$(local_to_owner(indices))"
end
vector_type = GridapDistributed._find_vector_type(spaces_w_constraints,gids)
GridapDistributed.DistributedSingleFieldFESpace(spaces_w_constraints,gids,vector_type)
Expand Down
1 change: 1 addition & 0 deletions src/GridapP4est.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module GridapP4est

export UniformlyRefinedForestOfOctreesDiscreteModel
export OctreeDistributedDiscreteModel
export adapt
export refine
export coarsen
export redistribute
Expand Down
Loading

0 comments on commit 2899f84

Please sign in to comment.