@@ -191,19 +191,20 @@ function _setup_face_gids!(dmodel::GenericDistributedDiscreteModel{Dc},dim) wher
191191end
192192
193193# CartesianDiscreteModel
194- struct DistributedCartesianDescriptor{A,B,C}
194+ struct DistributedCartesianDescriptor{A,B,C,D }
195195 ranks:: A
196196 mesh_partition:: B
197197 descriptor:: C
198+ ghost:: D
198199 function DistributedCartesianDescriptor (
199200 ranks:: AbstractArray{<:Integer} ,
200201 mesh_partition:: NTuple{Dc,<:Integer} ,
201- descriptor:: CartesianDescriptor{Dc}
202+ descriptor:: CartesianDescriptor{Dc} ,
203+ ghost = map (i -> true , mesh_partition)
202204 ) where Dc
203- A = typeof (ranks)
204- B = typeof (mesh_partition)
205- C = typeof (descriptor)
206- new {A,B,C} (ranks,mesh_partition,descriptor)
205+ A, B = typeof (ranks), typeof (mesh_partition)
206+ C, D = typeof (descriptor), typeof (ghost)
207+ new {A,B,C,D} (ranks,mesh_partition,descriptor,ghost)
207208 end
208209end
209210
@@ -223,44 +224,47 @@ function emit_cartesian_descriptor(
223224 new_mesh_partition
224225) where Dc
225226 f (a) = Tuple (PartitionedArrays. getany (emit (a)))
226- a, b, c, d = map (new_ranks) do rank
227+ a, b, c, d, e = map (new_ranks) do rank
227228 if rank == 1
228229 desc = pdesc. descriptor
229230 @assert desc. map === identity
230- Float64[desc. origin. data... ], Float64[desc. sizes... ], Int[desc. partition... ], Bool[desc. isperiodic... ]
231+ Float64[desc. origin. data... ], Float64[desc. sizes... ], Int[desc. partition... ], Bool[desc. isperiodic... ], Int16[pdesc . ghost ... ]
231232 else
232- Float64[], Float64[], Int[], Bool[]
233+ Float64[], Float64[], Int[], Bool[], Int16[]
233234 end
234235 end |> tuple_of_arrays
235- origin, sizes, partition, isperiodic = VectorValue (f (a)... ), f (b), f (c), f (d)
236+ origin, sizes, partition, isperiodic, ghost = VectorValue (f (a)... ), f (b), f (c), f (d), f (e )
236237 new_desc = CartesianDescriptor (origin,sizes,partition;isperiodic)
237- return DistributedCartesianDescriptor (new_ranks,new_mesh_partition,new_desc)
238+ return DistributedCartesianDescriptor (new_ranks,new_mesh_partition,new_desc,ghost )
238239end
239240
240241const DistributedCartesianDiscreteModel{Dc,Dp,A,B,C} =
241242 GenericDistributedDiscreteModel{Dc,Dp,<: AbstractArray{<:CartesianDiscreteModel} ,B,<: DistributedCartesianDescriptor }
242243
243244function Geometry. CartesianDiscreteModel (
244- ranks:: AbstractArray{<:Integer} ,parts:: NTuple{N,<:Integer} ,args... ;kwargs...
245+ ranks:: AbstractArray{<:Integer} , # Distributed array with the rank IDs
246+ parts:: NTuple{N,<:Integer} , # Number of ranks (parts) in each direction
247+ args... ; ghost = map (i -> true , parts), kwargs...
245248) where N
246249 desc = CartesianDescriptor (args... ;kwargs... )
247250 @check N == length (desc. partition)
248251 @check prod (parts) == length (ranks)
249- pdesc = DistributedCartesianDescriptor (ranks,parts,desc)
252+ pdesc = DistributedCartesianDescriptor (ranks,parts,desc,ghost )
250253 return CartesianDiscreteModel (pdesc)
251254end
252255
253256function Geometry. CartesianDiscreteModel (pdesc:: DistributedCartesianDescriptor )
254257 desc = pdesc. descriptor
255258 isperiodic = desc. isperiodic
256259 if any (isperiodic)
260+ @notimplementedif pdesc. ghost != map (i-> true ,pdesc. mesh_partition)
257261 models, cell_indices = _cartesian_model_with_periodic_bcs (pdesc)
258262 else
259263 nc = desc. partition
260264 ranks = pdesc. ranks
261265 parts = pdesc. mesh_partition
262- ghost = map (i -> true ,parts)
263- cell_indices = uniform_partition (ranks,parts,nc,ghost,isperiodic)
266+ ghost = pdesc . ghost
267+ cell_indices = _uniform_partition (ranks,parts,nc,ghost,isperiodic)
264268 gcids = CartesianIndices (nc)
265269 models = map (cell_indices) do cell_indices
266270 cmin = gcids[first (cell_indices)]
0 commit comments