partshell.c (cfd92c66bdae16b66d27a6336fb90fa54c459cc4) partshell.c (a4e35b1925eceef64945ea472b84f2bf06a67b5e)
1#include <petsc/private/partitionerimpl.h> /*I "petscpartitioner.h" I*/
2
3typedef struct {
4 PetscSection section; /* Sizes for each partition */
5 IS partition; /* Points in each partition */
6 PetscBool random; /* Flag for a random partition */
7} PetscPartitioner_Shell;
8

--- 145 unchanged lines hidden (view full) ---

154. sizes - array of length size (or `NULL`) providing the number of points in each partition
155- points - array of length sum(sizes) (may be `NULL` iff sizes is `NULL`), a permutation of the points that groups those assigned to each partition in order (i.e., partition 0 first, partition 1 next, etc.)
156
157 Level: developer
158
159 Note:
160 It is safe to free the sizes and points arrays after use in this routine.
161
1#include <petsc/private/partitionerimpl.h> /*I "petscpartitioner.h" I*/
2
3typedef struct {
4 PetscSection section; /* Sizes for each partition */
5 IS partition; /* Points in each partition */
6 PetscBool random; /* Flag for a random partition */
7} PetscPartitioner_Shell;
8

--- 145 unchanged lines hidden (view full) ---

154. sizes - array of length size (or `NULL`) providing the number of points in each partition
155- points - array of length sum(sizes) (may be `NULL` iff sizes is `NULL`), a permutation of the points that groups those assigned to each partition in order (i.e., partition 0 first, partition 1 next, etc.)
156
157 Level: developer
158
159 Note:
160 It is safe to free the sizes and points arrays after use in this routine.
161
162.seealso `DMPlexDistribute()`, `PetscPartitionerCreate()`
162.seealso: `DMPlexDistribute()`, `PetscPartitionerCreate()`
163@*/
164PetscErrorCode PetscPartitionerShellSetPartition(PetscPartitioner part, PetscInt size, const PetscInt sizes[], const PetscInt points[])
165{
166 PetscPartitioner_Shell *p = (PetscPartitioner_Shell *)part->data;
167 PetscInt proc, numPoints;
168
169 PetscFunctionBegin;
170 PetscValidHeaderSpecificType(part, PETSCPARTITIONER_CLASSID, 1, PETSCPARTITIONERSHELL);

--- 18 unchanged lines hidden (view full) ---

189 Collective
190
191 Input Parameters:
192+ part - The `PetscPartitioner`
193- random - The flag to use a random partition
194
195 Level: intermediate
196
163@*/
164PetscErrorCode PetscPartitionerShellSetPartition(PetscPartitioner part, PetscInt size, const PetscInt sizes[], const PetscInt points[])
165{
166 PetscPartitioner_Shell *p = (PetscPartitioner_Shell *)part->data;
167 PetscInt proc, numPoints;
168
169 PetscFunctionBegin;
170 PetscValidHeaderSpecificType(part, PETSCPARTITIONER_CLASSID, 1, PETSCPARTITIONERSHELL);

--- 18 unchanged lines hidden (view full) ---

189 Collective
190
191 Input Parameters:
192+ part - The `PetscPartitioner`
193- random - The flag to use a random partition
194
195 Level: intermediate
196
197.seealso `PetscPartitionerShellGetRandom()`, `PetscPartitionerCreate()`
197.seealso: `PetscPartitionerShellGetRandom()`, `PetscPartitionerCreate()`
198@*/
199PetscErrorCode PetscPartitionerShellSetRandom(PetscPartitioner part, PetscBool random)
200{
201 PetscPartitioner_Shell *p = (PetscPartitioner_Shell *)part->data;
202
203 PetscFunctionBegin;
204 PetscValidHeaderSpecificType(part, PETSCPARTITIONER_CLASSID, 1, PETSCPARTITIONERSHELL);
205 p->random = random;

--- 8 unchanged lines hidden (view full) ---

214 Input Parameter:
215. part - The `PetscPartitioner`
216
217 Output Parameter:
218. random - The flag to use a random partition
219
220 Level: intermediate
221
198@*/
199PetscErrorCode PetscPartitionerShellSetRandom(PetscPartitioner part, PetscBool random)
200{
201 PetscPartitioner_Shell *p = (PetscPartitioner_Shell *)part->data;
202
203 PetscFunctionBegin;
204 PetscValidHeaderSpecificType(part, PETSCPARTITIONER_CLASSID, 1, PETSCPARTITIONERSHELL);
205 p->random = random;

--- 8 unchanged lines hidden (view full) ---

214 Input Parameter:
215. part - The `PetscPartitioner`
216
217 Output Parameter:
218. random - The flag to use a random partition
219
220 Level: intermediate
221
222.seealso `PetscPartitionerShellSetRandom()`, `PetscPartitionerCreate()`
222.seealso: `PetscPartitionerShellSetRandom()`, `PetscPartitionerCreate()`
223@*/
224PetscErrorCode PetscPartitionerShellGetRandom(PetscPartitioner part, PetscBool *random)
225{
226 PetscPartitioner_Shell *p = (PetscPartitioner_Shell *)part->data;
227
228 PetscFunctionBegin;
229 PetscValidHeaderSpecificType(part, PETSCPARTITIONER_CLASSID, 1, PETSCPARTITIONERSHELL);
230 PetscAssertPointer(random, 2);
231 *random = p->random;
232 PetscFunctionReturn(PETSC_SUCCESS);
233}
223@*/
224PetscErrorCode PetscPartitionerShellGetRandom(PetscPartitioner part, PetscBool *random)
225{
226 PetscPartitioner_Shell *p = (PetscPartitioner_Shell *)part->data;
227
228 PetscFunctionBegin;
229 PetscValidHeaderSpecificType(part, PETSCPARTITIONER_CLASSID, 1, PETSCPARTITIONERSHELL);
230 PetscAssertPointer(random, 2);
231 *random = p->random;
232 PetscFunctionReturn(PETSC_SUCCESS);
233}