From fde7577114a222fcecaa2a9f8541e731185e7a48 Mon Sep 17 00:00:00 2001 From: Eric Neiva Date: Thu, 4 Jul 2024 18:19:02 +0200 Subject: [PATCH 1/4] [distributed] fix unsorted local DOFs issues when Dirichlet BCs Todo: figure out how to remove duplication of _dof_to_DOF and _DOF_to_dof --- src/Distributed/DistributedAgFEM.jl | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Distributed/DistributedAgFEM.jl b/src/Distributed/DistributedAgFEM.jl index 1441c2a..7691792 100644 --- a/src/Distributed/DistributedAgFEM.jl +++ b/src/Distributed/DistributedAgFEM.jl @@ -474,16 +474,35 @@ function cell_ldof_to_mdof( map(cell_ldof_to_mdof,spaces,cell_to_cellin) end +function _dof_to_DOF(dof,n_fdofs) + if dof > 0 + DOF = dof + else + DOF = n_fdofs - dof + end +end + +function _DOF_to_dof(DOF,n_fdofs) + if DOF > n_fdofs + dof = -(DOF-n_fdofs) + else + dof = DOF + end +end + function cell_ldof_to_mdof( space::FESpaceWithLinearConstraints, cell_to_cellin::AbstractVector) DOF_to_mDOFs = space.DOF_to_mDOFs cell_ldof_to_dof = space.cell_to_ldof_to_dof + n_fdofs = space.n_fdofs + n_fmdofs = space.n_fmdofs cell_ldof_to_mdof = map(cell_ldof_to_dof) do ldof_to_dof map(ldof_to_dof) do dof - mDOFs = DOF_to_mDOFs[dof] - length(mDOFs) == 1 ? mDOFs[1] : zero(eltype(mDOFs)) + DOF = _dof_to_DOF(dof,n_fdofs) + mDOFs = DOF_to_mDOFs[DOF] + length(mDOFs) == 1 ? _DOF_to_dof(mDOFs[1],n_fmdofs) : zero(eltype(mDOFs)) end end for (cell,ldof_to_mdof) in enumerate(cell_ldof_to_mdof) From a5ab7d444895418fa4dd9e9a229c4a485c73e6a1 Mon Sep 17 00:00:00 2001 From: Eric Neiva Date: Fri, 5 Jul 2024 17:47:33 +0200 Subject: [PATCH 2/4] Import aux funs for cell_ldof_to_mdof --- src/Distributed/Distributed.jl | 1 + src/Distributed/DistributedAgFEM.jl | 16 ---------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/Distributed/Distributed.jl b/src/Distributed/Distributed.jl index 444e27a..c68af9a 100644 --- a/src/Distributed/Distributed.jl +++ b/src/Distributed/Distributed.jl @@ -28,6 +28,7 @@ using GridapEmbedded.MomentFittedQuadratures: MomentFitted using Gridap.Geometry: AppendedTriangulation using Gridap.Geometry: get_face_to_parent_face using Gridap.FESpaces: FESpaceWithLinearConstraints +using Gridap.FESpaces: _dof_to_DOF, _DOF_to_dof using GridapDistributed: DistributedDiscreteModel using GridapDistributed: DistributedTriangulation using GridapDistributed: DistributedFESpace diff --git a/src/Distributed/DistributedAgFEM.jl b/src/Distributed/DistributedAgFEM.jl index 7691792..88d57b9 100644 --- a/src/Distributed/DistributedAgFEM.jl +++ b/src/Distributed/DistributedAgFEM.jl @@ -474,22 +474,6 @@ function cell_ldof_to_mdof( map(cell_ldof_to_mdof,spaces,cell_to_cellin) end -function _dof_to_DOF(dof,n_fdofs) - if dof > 0 - DOF = dof - else - DOF = n_fdofs - dof - end -end - -function _DOF_to_dof(DOF,n_fdofs) - if DOF > n_fdofs - dof = -(DOF-n_fdofs) - else - dof = DOF - end -end - function cell_ldof_to_mdof( space::FESpaceWithLinearConstraints, cell_to_cellin::AbstractVector) From e88e5c84ed04f67a91d55e114d6736aa37138a36 Mon Sep 17 00:00:00 2001 From: Eric Neiva Date: Fri, 5 Jul 2024 17:47:53 +0200 Subject: [PATCH 3/4] Delete obsolete function --- src/Distributed/DistributedAgFEM.jl | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Distributed/DistributedAgFEM.jl b/src/Distributed/DistributedAgFEM.jl index 88d57b9..89c6ab2 100644 --- a/src/Distributed/DistributedAgFEM.jl +++ b/src/Distributed/DistributedAgFEM.jl @@ -497,14 +497,6 @@ function cell_ldof_to_mdof( cell_ldof_to_mdof end -function _remove_improper_cell_ldofs!(cell_to_ldofs,cell_to_cellin) - for cell in 1:length(cell_to_ldofs) - cell_to_cellin[cell] != cell || continue - cell_to_ldofs[cell] = empty!(cell_to_ldofs[cell]) - end - cell_to_ldofs -end - function _local_aggregates(cell_to_gcellin,gids::PRange) map(_local_aggregates,cell_to_gcellin,global_to_local(gids)) end From 4a623dc238f29cbbd9561838e1e04882769afd56 Mon Sep 17 00:00:00 2001 From: Eric Neiva Date: Fri, 5 Jul 2024 17:51:19 +0200 Subject: [PATCH 4/4] Update NEWS.md --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index d1852b9..8fe85a9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Unused `name` keywork argument in `square` and `quadrilateral` analytical geometries. Since PR [#86](https://github.com/gridap/GridapEmbedded.jl/pull/86). +- Gluing of the remote root cells to the local+ghost mesh. Since PR [#91](https://github.com/gridap/GridapEmbedded.jl/pull/91). ## [0.9.3] - 2024-05-20