xref: /petsc/include/petsc/private/dmswarmimpl.h (revision 5ac36cfc0e5eeebdd3eb653b01312f22e8e433fd)
1 
2 #if !defined(_SWARMIMPL_H)
3 #define _SWARMIMPL_H
4 
5 #include <petscvec.h> /*I "petscvec.h" I*/
6 #include <petscmat.h>       /*I      "petscmat.h"          I*/
7 #include <petscdmswarm.h> /*I      "petscdmswarm.h"    I*/
8 #include <petsc/private/dmimpl.h>
9 
10 PETSC_EXTERN PetscLogEvent DMSWARM_Migrate,
11                            DMSWARM_SetSizes, DMSWARM_AddPoints, DMSWARM_RemovePoints,
12                            DMSWARM_Sort,
13                            DMSWARM_DataExchangerTopologySetup,
14                            DMSWARM_DataExchangerBegin, DMSWARM_DataExchangerEnd,
15                            DMSWARM_DataExchangerSendCount, DMSWARM_DataExchangerPack;
16 
17 
18 typedef struct _p_DataField* DataField;
19 typedef struct _p_DataBucket* DataBucket;
20 typedef struct _p_DMSwarmSort* DMSwarmSort;
21 
22 typedef struct {
23   DataBucket db;
24 
25   PetscBool field_registration_initialized;
26   PetscBool field_registration_finalized;
27   /* DMSwarmProjectMethod *swarm_project;*/ /* swarm, geometry, result */
28 
29   /* PetscInt overlap; */
30   /* PetscErrorCode (*update_overlap)(void); */
31 
32   char      vec_field_name[PETSC_MAX_PATH_LEN];
33   PetscBool vec_field_set;
34   PetscInt  vec_field_bs,vec_field_nlocal;
35 
36   PetscBool          issetup;
37   DMSwarmType        swarm_type;
38   DMSwarmMigrateType migrate_type;
39   DMSwarmCollectType collect_type;
40 
41   DM        dmcell;
42 
43   PetscBool migrate_error_on_missing_point;
44 
45   PetscBool collect_view_active;
46   PetscInt  collect_view_reset_nlocal;
47   DMSwarmSort sort_context;
48 } DM_Swarm;
49 
50 typedef struct {
51   PetscInt point_index;
52   PetscInt cell_index;
53 } SwarmPoint;
54 
55 struct _p_DMSwarmSort {
56   PetscBool isvalid;
57   PetscInt ncells,npoints;
58   PetscInt *pcell_offsets;
59   SwarmPoint *list;
60 };
61 
62 
63 PETSC_INTERN PetscErrorCode DMSwarmMigrate_Push_Basic(DM, PetscBool);
64 PETSC_INTERN PetscErrorCode DMSwarmMigrate_CellDMScatter(DM,PetscBool);
65 PETSC_INTERN PetscErrorCode DMSwarmMigrate_CellDMExact(DM,PetscBool);
66 
67 #endif /* _SWARMIMPL_H */
68