@@ -260,19 +260,20 @@ function _setup_face_gids!(dmodel::GenericDistributedDiscreteModel{Dc},dim) wher
260260end
261261
262262# CartesianDiscreteModel
263- struct DistributedCartesianDescriptor{A,B,C}
263+ struct DistributedCartesianDescriptor{A,B,C,D }
264264 ranks:: A
265265 mesh_partition:: B
266266 descriptor:: C
267+ ghost:: D
267268 function DistributedCartesianDescriptor (
268269 ranks:: AbstractArray{<:Integer} ,
269270 mesh_partition:: NTuple{Dc,<:Integer} ,
270- descriptor:: CartesianDescriptor{Dc}
271+ descriptor:: CartesianDescriptor{Dc} ,
272+ ghost = map (i -> true , mesh_partition)
271273 ) where Dc
272- A = typeof (ranks)
273- B = typeof (mesh_partition)
274- C = typeof (descriptor)
275- new {A,B,C} (ranks,mesh_partition,descriptor)
274+ A, B = typeof (ranks), typeof (mesh_partition)
275+ C, D = typeof (descriptor), typeof (ghost)
276+ new {A,B,C,D} (ranks,mesh_partition,descriptor,ghost)
276277 end
277278end
278279
@@ -292,44 +293,47 @@ function emit_cartesian_descriptor(
292293 new_mesh_partition
293294) where Dc
294295 f (a) = Tuple (PartitionedArrays. getany (emit (a)))
295- a, b, c, d = map (new_ranks) do rank
296+ a, b, c, d, e = map (new_ranks) do rank
296297 if rank == 1
297298 desc = pdesc. descriptor
298299 @assert desc. map === identity
299- Float64[desc. origin. data... ], Float64[desc. sizes... ], Int[desc. partition... ], Bool[desc. isperiodic... ]
300+ Float64[desc. origin. data... ], Float64[desc. sizes... ], Int[desc. partition... ], Bool[desc. isperiodic... ], Int16[pdesc . ghost ... ]
300301 else
301- Float64[], Float64[], Int[], Bool[]
302+ Float64[], Float64[], Int[], Bool[], Int16[]
302303 end
303304 end |> tuple_of_arrays
304- origin, sizes, partition, isperiodic = VectorValue (f (a)... ), f (b), f (c), f (d)
305+ origin, sizes, partition, isperiodic, ghost = VectorValue (f (a)... ), f (b), f (c), f (d), f (e )
305306 new_desc = CartesianDescriptor (origin,sizes,partition;isperiodic)
306- return DistributedCartesianDescriptor (new_ranks,new_mesh_partition,new_desc)
307+ return DistributedCartesianDescriptor (new_ranks,new_mesh_partition,new_desc,ghost )
307308end
308309
309310const DistributedCartesianDiscreteModel{Dc,Dp,A,B,C} =
310311 GenericDistributedDiscreteModel{Dc,Dp,<: AbstractArray{<:CartesianDiscreteModel} ,B,<: DistributedCartesianDescriptor }
311312
312313function Geometry. CartesianDiscreteModel (
313- ranks:: AbstractArray{<:Integer} ,parts:: NTuple{N,<:Integer} ,args... ;kwargs...
314+ ranks:: AbstractArray{<:Integer} , # Distributed array with the rank IDs
315+ parts:: NTuple{N,<:Integer} , # Number of ranks (parts) in each direction
316+ args... ; ghost = map (i -> true , parts), kwargs...
314317) where N
315318 desc = CartesianDescriptor (args... ;kwargs... )
316319 @check N == length (desc. partition)
317320 @check prod (parts) == length (ranks)
318- pdesc = DistributedCartesianDescriptor (ranks,parts,desc)
321+ pdesc = DistributedCartesianDescriptor (ranks,parts,desc,ghost )
319322 return CartesianDiscreteModel (pdesc)
320323end
321324
322325function Geometry. CartesianDiscreteModel (pdesc:: DistributedCartesianDescriptor )
323326 desc = pdesc. descriptor
324327 isperiodic = desc. isperiodic
325328 if any (isperiodic)
329+ @notimplementedif pdesc. ghost != map (i-> true ,pdesc. mesh_partition)
326330 models, cell_indices = _cartesian_model_with_periodic_bcs (pdesc)
327331 else
328332 nc = desc. partition
329333 ranks = pdesc. ranks
330334 parts = pdesc. mesh_partition
331- ghost = map (i -> true ,parts)
332- cell_indices = uniform_partition (ranks,parts,nc,ghost,isperiodic)
335+ ghost = pdesc . ghost
336+ cell_indices = _uniform_partition (ranks,parts,nc,ghost,isperiodic)
333337 gcids = CartesianIndices (nc)
334338 models = map (cell_indices) do cell_indices
335339 cmin = gcids[first (cell_indices)]
0 commit comments