Lines Matching refs:sw

50 static PetscErrorCode CreateSwarm(DM dm, DM *sw, AppCtx *user)  in CreateSwarm()  argument
65 PetscCall(DMCreate(PETSC_COMM_WORLD, sw)); in CreateSwarm()
67 PetscCall(DMSetType(*sw, DMSWARM)); in CreateSwarm()
68 PetscCall(DMSetDimension(*sw, dim)); in CreateSwarm()
69 PetscCall(DMSwarmSetType(*sw, DMSWARM_PIC)); in CreateSwarm()
70 PetscCall(DMSwarmSetCellDM(*sw, dm)); in CreateSwarm()
71 PetscCall(DMSwarmFinalizeFieldRegister(*sw)); in CreateSwarm()
72 PetscCall(DMSwarmSetLocalSizes(*sw, rank == 0 ? particleInitSize : 0, 0)); in CreateSwarm()
73 PetscCall(DMSetFromOptions(*sw)); in CreateSwarm()
74 PetscCall(DMSwarmGetCellDMActive(*sw, &celldm)); in CreateSwarm()
77 …PetscCheck(Nfc == 1, PetscObjectComm((PetscObject)sw), PETSC_ERR_SUP, "We only support a single co… in CreateSwarm()
78 PetscCall(DMSwarmGetField(*sw, coordFields[0], NULL, NULL, (void **)&coords)); in CreateSwarm()
79 PetscCall(DMSwarmGetField(*sw, cellid, NULL, NULL, (void **)&swarm_cellid)); in CreateSwarm()
80 PetscCall(DMSwarmGetLocalSize(*sw, &Np)); in CreateSwarm()
86 PetscCall(DMSwarmRestoreField(*sw, coordFields[0], NULL, NULL, (void **)&coords)); in CreateSwarm()
87 PetscCall(DMSwarmRestoreField(*sw, cellid, NULL, NULL, (void **)&swarm_cellid)); in CreateSwarm()
88 PetscCall(DMViewFromOptions(*sw, NULL, "-sw_view")); in CreateSwarm()
96 static PetscErrorCode CheckMigrate(DM sw) in CheckMigrate() argument
103 PetscCall(DMSwarmCreateGlobalVectorFromField(sw, DMSwarmPICField_coor, &tmp)); in CheckMigrate()
106 PetscCall(DMSwarmDestroyGlobalVectorFromField(sw, DMSwarmPICField_coor, &tmp)); in CheckMigrate()
107 PetscCall(DMSwarmMigrate(sw, PETSC_TRUE)); in CheckMigrate()
108 PetscCall(DMSwarmCreateGlobalVectorFromField(sw, DMSwarmPICField_coor, &tmp)); in CheckMigrate()
111 PetscCall(DMSwarmDestroyGlobalVectorFromField(sw, DMSwarmPICField_coor, &tmp)); in CheckMigrate()
127 static PetscErrorCode CheckPointInsertion(DM sw) in CheckPointInsertion() argument
138 PetscCall(DMSwarmGetSize(sw, &Np_pre)); in CheckPointInsertion()
139 if (rank == 0) PetscCall(DMSwarmAddPoint(sw)); in CheckPointInsertion()
140 PetscCall(DMSwarmGetSize(sw, &Np_post)); in CheckPointInsertion()
142 PetscCall(CheckMigrate(sw)); in CheckPointInsertion()
154 static PetscErrorCode CheckPointInsertion_Boundary(DM sw) in CheckPointInsertion_Boundary() argument
167 PetscCall(DMSwarmGetCellDM(sw, &cdm)); in CheckPointInsertion_Boundary()
179 PetscCall(DMSwarmAddPoint(sw)); in CheckPointInsertion_Boundary()
180 PetscCall(DMSwarmGetLocalSize(sw, &Np)); in CheckPointInsertion_Boundary()
181 PetscCall(DMSwarmGetField(sw, DMSwarmPICField_coor, NULL, NULL, (void **)&coords)); in CheckPointInsertion_Boundary()
184 PetscCall(DMSwarmRestoreField(sw, DMSwarmPICField_coor, NULL, NULL, (void **)&coords)); in CheckPointInsertion_Boundary()
186 PetscCall(DMSwarmGetLocalSize(sw, &Np_loc_pre)); in CheckPointInsertion_Boundary()
187 PetscCall(CheckMigrate(sw)); in CheckPointInsertion_Boundary()
188 PetscCall(DMSwarmGetLocalSize(sw, &Np_loc_post)); in CheckPointInsertion_Boundary()
197 DM dm, sw; in main() local
205 PetscCall(CreateSwarm(dm, &sw, &user)); in main()
206 PetscCall(CheckMigrate(sw)); in main()
207 PetscCall(CheckPointInsertion(sw)); in main()
208 PetscCall(CheckPointInsertion_Boundary(sw)); in main()
209 PetscCall(DMDestroy(&sw)); in main()