Skip to content

Commit 8f22018

Browse files
Merge pull request #81 from pmartorell/distributed
Distributed GridapEmbedded and AgFEM
2 parents c05204e + d3e6079 commit 8f22018

19 files changed

Lines changed: 1524 additions & 14 deletions

Project.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,27 @@ Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
1010
CxxWrap = "1f15a43c-97ca-5a2a-ae31-89f07a497df4"
1111
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
1212
Gridap = "56d4f2e9-7ea1-5844-9cf6-b9c51ca7ce8e"
13+
GridapDistributed = "f9701e48-63b3-45aa-9a63-9bc6c271f355"
1314
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
1415
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
16+
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
1517
MiniQhull = "978d7f02-9e05-4691-894f-ae31a51d76ca"
18+
PartitionedArrays = "5a9dfac6-5c52-46f7-8278-5e2210713be9"
1619
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1720
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1821
algoimWrapper_jll = "3c43aa7b-5398-51f3-8d75-8f051e6faa4d"
1922

2023
[compat]
21-
Algoim = "0.2"
2224
AbstractTrees = "0.3.3, 0.4"
25+
Algoim = "0.2"
2326
Combinatorics = "1"
2427
CxxWrap = "0.14"
2528
FillArrays = "0.10, 0.11, 0.12, 0.13, 1"
29+
GridapDistributed = "0.3, 0.4"
2630
Gridap = "0.17, 0.18"
2731
LightGraphs = "1.3.3"
2832
MiniQhull = "0.1.0, 0.2, 0.3, 0.4"
33+
PartitionedArrays = "0.3.4"
2934
julia = "1.3"
3035

3136
[extras]

src/AgFEM/AgFEMSpaces.jl

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11

2-
function AgFEMSpace(f::SingleFieldFESpace,bgcell_to_bgcellin::AbstractVector,g::SingleFieldFESpace=f)
2+
function AgFEMSpace(
3+
f::SingleFieldFESpace,
4+
bgcell_to_bgcellin::AbstractVector,
5+
g::SingleFieldFESpace=f,
6+
args...)
7+
38
@assert get_triangulation(f) === get_triangulation(g)
4-
AgFEMSpace(f,bgcell_to_bgcellin,get_fe_basis(g),get_fe_dof_basis(g))
9+
AgFEMSpace(f,bgcell_to_bgcellin,get_fe_basis(g),get_fe_dof_basis(g),args...)
510
end
611

712
# Note: cell is in fact bgcell in this function since f will usually be an ExtendedFESpace
813
function AgFEMSpace(
914
f::SingleFieldFESpace,
1015
bgcell_to_bgcellin::AbstractVector,
1116
shfns_g::CellField,
12-
dofs_g::CellDof)
17+
dofs_g::CellDof,
18+
bgcell_to_gcell::AbstractVector=1:length(bgcell_to_bgcellin))
1319

1420
# Triangulation made of active cells
1521
trian_a = get_triangulation(f)
@@ -21,6 +27,7 @@ function AgFEMSpace(
2127
bgcell_to_acell = glue.mface_to_tface
2228
acell_to_bgcellin = lazy_map(Reindex(bgcell_to_bgcellin),acell_to_bgcell)
2329
acell_to_acellin = collect(lazy_map(Reindex(bgcell_to_acell),acell_to_bgcellin))
30+
acell_to_gcell = lazy_map(Reindex(bgcell_to_gcell),acell_to_bgcell)
2431

2532
# Build shape funs of g by replacing local funs in cut cells by the ones at the root
2633
# This needs to be done with shape functions in the physical domain
@@ -41,7 +48,8 @@ function AgFEMSpace(
4148
acell_to_acellin,
4249
acell_to_dof_ids,
4350
acell_to_coeffs,
44-
acell_to_proj)
51+
acell_to_proj,
52+
acell_to_gcell)
4553

4654
FESpaceWithLinearConstraints(aggdof_to_fdof,aggdof_to_dofs,aggdof_to_coeffs,f)
4755
end
@@ -51,7 +59,8 @@ function _setup_agfem_constraints(
5159
acell_to_acellin,
5260
acell_to_dof_ids,
5361
acell_to_coeffs,
54-
acell_to_proj)
62+
acell_to_proj,
63+
acell_to_gcell)
5564

5665
n_acells = length(acell_to_acellin)
5766
fdof_to_isagg = fill(true,n_fdofs)
@@ -62,12 +71,16 @@ function _setup_agfem_constraints(
6271
acellin = acell_to_acellin[acell]
6372
iscut = acell != acellin
6473
dofs = getindex!(cache,acell_to_dof_ids,acell)
74+
gcell = acell_to_gcell[acell]
6575
for (ldof,dof) in enumerate(dofs)
6676
if dof > 0
6777
fdof = dof
68-
fdof_to_isagg[fdof] = iscut && fdof_to_isagg[fdof]
69-
fdof_to_acell[fdof] = acell
70-
fdof_to_ldof[fdof] = ldof
78+
acell_dof = fdof_to_acell[fdof]
79+
if acell_dof == 0 || gcell > acell_to_gcell[acell_dof]
80+
fdof_to_acell[fdof] = acell
81+
fdof_to_isagg[fdof] = iscut && fdof_to_isagg[fdof]
82+
fdof_to_ldof[fdof] = ldof
83+
end
7184
end
7285
end
7386
end

src/Distributed/Distributed.jl

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
module Distributed
2+
3+
using Gridap
4+
using GridapDistributed
5+
using PartitionedArrays
6+
using FillArrays
7+
8+
using Gridap.Arrays
9+
using Gridap.CellData
10+
using Gridap.Geometry
11+
using Gridap.Helpers
12+
using Gridap.ReferenceFEs
13+
14+
using GridapEmbedded.CSG
15+
using GridapEmbedded.LevelSetCutters
16+
using GridapEmbedded.Interfaces
17+
using GridapEmbedded.Interfaces: Cutter
18+
using GridapEmbedded.Interfaces: ActiveInOrOut
19+
using GridapEmbedded.Interfaces: SubFacetTriangulation
20+
using GridapEmbedded.Interfaces: SubCellData
21+
using GridapEmbedded.Interfaces: SubFacetData
22+
using GridapEmbedded.Interfaces: AbstractEmbeddedDiscretization
23+
using GridapEmbedded.AgFEM: _touch_aggregated_cells!
24+
using GridapEmbedded.AgFEM: AggregateCutCellsByThreshold
25+
using GridapEmbedded.MomentFittedQuadratures: MomentFitted
26+
using Gridap.Geometry: AppendedTriangulation
27+
using Gridap.Geometry: get_face_to_parent_face
28+
using GridapDistributed: DistributedDiscreteModel
29+
using GridapDistributed: DistributedTriangulation
30+
using GridapDistributed: DistributedFESpace
31+
using GridapDistributed: DistributedSingleFieldFESpace
32+
using GridapDistributed: DistributedMeasure
33+
using GridapDistributed: add_ghost_cells
34+
using GridapDistributed: generate_gids
35+
using GridapDistributed: generate_cell_gids
36+
using GridapDistributed: _find_vector_type
37+
38+
import GridapEmbedded.AgFEM: aggregate
39+
import GridapEmbedded.AgFEM: AgFEMSpace
40+
import GridapEmbedded.Interfaces: cut
41+
import GridapEmbedded.Interfaces: cut_facets
42+
import GridapEmbedded.Interfaces: EmbeddedBoundary
43+
import GridapEmbedded.Interfaces: compute_bgfacet_to_inoutcut
44+
import GridapEmbedded.Interfaces: compute_bgcell_to_inoutcut
45+
import GridapEmbedded.CSG: get_geometry
46+
import Gridap.Geometry: Triangulation
47+
import Gridap.Geometry: SkeletonTriangulation
48+
import Gridap.Geometry: BoundaryTriangulation
49+
import Gridap.Geometry: get_background_model
50+
import GridapDistributed: local_views
51+
import GridapDistributed: remove_ghost_cells
52+
53+
include("DistributedDiscretizations.jl")
54+
55+
include("DistributedAgFEM.jl")
56+
57+
include("DistributedQuadratures.jl")
58+
59+
end # module

0 commit comments

Comments
 (0)