Lines Matching refs:PetscCall

140PetscCall(PetscOptionsString("-fname", "The output mesh file", "ex12.c", options->fname, options->…  in ProcessOptions()
141PetscCall(PetscOptionsBool("-shell", "Use DMShell to wrap sections", "ex12.c", options->shell, &op… in ProcessOptions()
158 PetscCall(PetscInitialize(&argc, &argv, NULL, help)); in main()
159 PetscCall(ProcessOptions(PETSC_COMM_WORLD, &user)); in main()
171 PetscCall(PetscViewerHDF5Open(comm, user.fname, FILE_MODE_WRITE, &viewer)); in main()
179PetscCall(DMPlexCreateBoxMesh(comm, 2, PETSC_FALSE, faces, NULL, NULL, NULL, PETSC_TRUE, 0, PETSC_… in main()
180 PetscCall(DMPlexDistribute(dm, overlap, &sf, &pdm)); in main()
182 PetscCall(DMDestroy(&dm)); in main()
185 PetscCall(PetscSFDestroy(&sf)); in main()
186 PetscCall(PetscObjectSetName((PetscObject)dm, exampleDMPlexName)); in main()
187 PetscCall(PetscViewerPushFormat(viewer, format)); in main()
188 PetscCall(DMPlexTopologyView(dm, viewer)); in main()
189 PetscCall(DMPlexLabelsView(dm, viewer)); in main()
190 PetscCall(PetscViewerPopFormat(viewer)); in main()
193 PetscCall(PetscViewerPushFormat(viewer, format)); in main()
194 PetscCall(DMPlexCoordinatesView(dm, viewer)); in main()
195 PetscCall(PetscViewerPopFormat(viewer)); in main()
206 PetscCall(PetscSectionCreate(comm, &section)); in main()
207 PetscCall(PetscSectionSetNumFields(section, 2)); in main()
208 PetscCall(DMPlexGetChart(dm, &pStart, &pEnd)); in main()
209 PetscCall(PetscSectionSetChart(section, pStart, pEnd)); in main()
212 PetscCall(PetscSectionSetDof(section, 3, 2)); in main()
213 PetscCall(PetscSectionSetDof(section, 12, 3)); in main()
214 PetscCall(PetscSectionSetDof(section, 25, 2)); in main()
215 PetscCall(PetscSectionSetConstraintDof(section, 12, 1)); in main()
216 PetscCall(PetscSectionSetFieldDof(section, 3, 0, 2)); in main()
217 PetscCall(PetscSectionSetFieldDof(section, 12, 0, 2)); in main()
218 PetscCall(PetscSectionSetFieldDof(section, 12, 1, 1)); in main()
219 PetscCall(PetscSectionSetFieldDof(section, 25, 1, 2)); in main()
220 PetscCall(PetscSectionSetFieldConstraintDof(section, 12, 1, 1)); in main()
223 PetscCall(PetscSectionSetDof(section, 0, 2)); in main()
224 PetscCall(PetscSectionSetDof(section, 1, 1)); in main()
225 PetscCall(PetscSectionSetDof(section, 8, 3)); in main()
226 PetscCall(PetscSectionSetDof(section, 20, 2)); in main()
227 PetscCall(PetscSectionSetConstraintDof(section, 8, 1)); in main()
228 PetscCall(PetscSectionSetFieldDof(section, 0, 0, 2)); in main()
229 PetscCall(PetscSectionSetFieldDof(section, 8, 0, 2)); in main()
230 PetscCall(PetscSectionSetFieldDof(section, 1, 1, 1)); in main()
231 PetscCall(PetscSectionSetFieldDof(section, 8, 1, 1)); in main()
232 PetscCall(PetscSectionSetFieldDof(section, 20, 1, 2)); in main()
233 PetscCall(PetscSectionSetFieldConstraintDof(section, 8, 1, 1)); in main()
236 PetscCall(PetscSectionSetUp(section)); in main()
243 PetscCall(PetscSectionSetConstraintIndices(section, 12, indices)); in main()
244 PetscCall(PetscSectionSetFieldConstraintIndices(section, 12, 1, indices1)); in main()
247 PetscCall(PetscSectionSetConstraintIndices(section, 8, indices)); in main()
248 PetscCall(PetscSectionSetFieldConstraintIndices(section, 8, 1, indices1)); in main()
255 PetscCall(DMShellCreate(comm, &sdm)); in main()
256 PetscCall(DMGetPointSF(dm, &sf)); in main()
257 PetscCall(DMSetPointSF(sdm, sf)); in main()
259 PetscCall(DMClone(dm, &sdm)); in main()
261 PetscCall(PetscObjectSetName((PetscObject)sdm, exampleSectionDMName)); in main()
262 PetscCall(DMSetLocalSection(sdm, section)); in main()
263 PetscCall(PetscSectionDestroy(&section)); in main()
264 PetscCall(DMPlexSectionView(dm, viewer, sdm)); in main()
266 PetscCall(DMGetGlobalSection(sdm, &gsection)); in main()
267 PetscCall(PetscSectionGetIncludesConstraints(gsection, &includesConstraints)); in main()
271 PetscCall(VecCreate(comm, &vec)); in main()
272 if (includesConstraints) PetscCall(PetscSectionGetStorageSize(gsection, &n)); in main()
273 else PetscCall(PetscSectionGetConstrainedStorageSize(gsection, &n)); in main()
274 PetscCall(VecSetSizes(vec, n, PETSC_DECIDE)); in main()
275 PetscCall(VecSetUp(vec)); in main()
277 PetscCall(DMGetGlobalVector(sdm, &vec)); in main()
279 PetscCall(PetscObjectSetName((PetscObject)vec, exampleVecName)); in main()
280 PetscCall(VecGetArrayWrite(vec, &array)); in main()
311 PetscCall(VecRestoreArrayWrite(vec, &array)); in main()
312 PetscCall(DMPlexGlobalVectorView(dm, viewer, sdm, vec)); in main()
314 PetscCall(VecDestroy(&vec)); in main()
316 PetscCall(DMRestoreGlobalVector(sdm, &vec)); in main()
318 PetscCall(DMDestroy(&sdm)); in main()
320 PetscCall(PetscViewerDestroy(&viewer)); in main()
321 PetscCall(DMDestroy(&dm)); in main()
332 PetscCall(PetscViewerHDF5Open(comm, user.fname, FILE_MODE_READ, &viewer)); in main()
337 PetscCall(DMCreate(comm, &dm)); in main()
338 PetscCall(DMSetType(dm, DMPLEX)); in main()
339 PetscCall(PetscObjectSetName((PetscObject)dm, exampleDMPlexName)); in main()
343 PetscCall(PetscViewerPushFormat(viewer, format)); in main()
344 PetscCall(DMPlexTopologyLoad(dm, viewer, &sfXB)); in main()
345 PetscCall(PetscViewerPopFormat(viewer)); in main()
351 PetscCall(DMPlexGetPartitioner(dm, &part)); in main()
352 PetscCall(PetscPartitionerSetFromOptions(part)); in main()
356 PetscCall(DMPlexDistribute(dm, overlap, &sfBC, &distributedDM)); in main()
358 PetscCall(DMDestroy(&dm)); in main()
361 PetscCall(PetscObjectSetName((PetscObject)dm, exampleDMPlexName)); in main()
364 PetscCall(PetscSFCompose(sfXB, sfBC, &sfXC)); in main()
365 PetscCall(PetscSFDestroy(&sfXB)); in main()
366 PetscCall(PetscSFDestroy(&sfBC)); in main()
369 PetscCall(PetscViewerPushFormat(viewer, format)); in main()
370 PetscCall(DMPlexLabelsLoad(dm, viewer, sfXC)); in main()
371 PetscCall(PetscViewerPopFormat(viewer)); in main()
373 PetscCall(PetscViewerPushFormat(viewer, format)); in main()
374 PetscCall(DMPlexCoordinatesLoad(dm, viewer, sfXC)); in main()
375 PetscCall(PetscViewerPopFormat(viewer)); in main()
376 PetscCall(PetscObjectSetName((PetscObject)dm, "Load: DM (with coordinates)")); in main()
377 PetscCall(DMViewFromOptions(dm, NULL, "-dm_view")); in main()
378 PetscCall(PetscObjectSetName((PetscObject)dm, exampleDMPlexName)); in main()
391 PetscCall(DMShellCreate(comm, &sdm)); in main()
392 PetscCall(DMGetPointSF(dm, &sf)); in main()
393 PetscCall(DMSetPointSF(sdm, sf)); in main()
395 PetscCall(DMClone(dm, &sdm)); in main()
397 PetscCall(PetscObjectSetName((PetscObject)sdm, exampleSectionDMName)); in main()
398 PetscCall(PetscSectionCreate(comm, &section)); in main()
403 PetscCall(DMPlexGetChart(dm, &pStart, &pEnd)); in main()
404 PetscCall(PetscMalloc1(pEnd - pStart, &pinds)); in main()
410 PetscCall(ISCreateGeneral(comm, pEnd - pStart, pinds, PETSC_OWN_POINTER, &perm)); in main()
412 PetscCall(PetscSectionSetPermutation(section, perm)); in main()
413 PetscCall(ISDestroy(&perm)); in main()
414 PetscCall(DMSetLocalSection(sdm, section)); in main()
415 PetscCall(PetscSectionDestroy(&section)); in main()
416 PetscCall(DMPlexSectionLoad(dm, viewer, sdm, sfXC, &gsf, &lsf)); in main()
418 PetscCall(DMGetLocalSection(sdm, &section)); in main()
419 PetscCall(PetscObjectSetName((PetscObject)section, "Load: local section")); in main()
420 PetscCall(PetscSectionView(section, PETSC_VIEWER_STDOUT_(comm))); in main()
421 PetscCall(PetscSectionGetIncludesConstraints(section, &includesConstraints)); in main()
425 PetscCall(VecCreate(comm, &vec)); in main()
426 if (includesConstraints) PetscCall(PetscSectionGetStorageSize(section, &m)); in main()
427 else PetscCall(PetscSectionGetConstrainedStorageSize(section, &m)); in main()
428 PetscCall(VecSetSizes(vec, m, PETSC_DECIDE)); in main()
429 PetscCall(VecSetUp(vec)); in main()
431 PetscCall(DMGetLocalVector(sdm, &vec)); in main()
433 PetscCall(PetscObjectSetName((PetscObject)vec, exampleVecName)); in main()
434 PetscCall(VecSet(vec, constraintValue)); in main()
435 PetscCall(DMPlexLocalVectorLoad(dm, viewer, sdm, lsf, vec)); in main()
436 PetscCall(PetscSFDestroy(&lsf)); in main()
438 PetscCall(VecView(vec, PETSC_VIEWER_STDOUT_(comm))); in main()
439 PetscCall(VecDestroy(&vec)); in main()
441 PetscCall(DMRestoreLocalVector(sdm, &vec)); in main()
444 PetscCall(DMGetGlobalSection(sdm, &gsection)); in main()
445 PetscCall(PetscObjectSetName((PetscObject)gsection, "Load: global section")); in main()
446 PetscCall(PetscSectionView(gsection, PETSC_VIEWER_STDOUT_(comm))); in main()
447 PetscCall(PetscSectionGetIncludesConstraints(gsection, &includesConstraints)); in main()
451 PetscCall(VecCreate(comm, &vec)); in main()
452 if (includesConstraints) PetscCall(PetscSectionGetStorageSize(gsection, &m)); in main()
453 else PetscCall(PetscSectionGetConstrainedStorageSize(gsection, &m)); in main()
454 PetscCall(VecSetSizes(vec, m, PETSC_DECIDE)); in main()
455 PetscCall(VecSetUp(vec)); in main()
457 PetscCall(DMGetGlobalVector(sdm, &vec)); in main()
459 PetscCall(PetscObjectSetName((PetscObject)vec, exampleVecName)); in main()
460 PetscCall(DMPlexGlobalVectorLoad(dm, viewer, sdm, gsf, vec)); in main()
461 PetscCall(PetscSFDestroy(&gsf)); in main()
462 PetscCall(VecView(vec, PETSC_VIEWER_STDOUT_(comm))); in main()
464 PetscCall(VecDestroy(&vec)); in main()
466 PetscCall(DMRestoreGlobalVector(sdm, &vec)); in main()
468 PetscCall(DMDestroy(&sdm)); in main()
470 PetscCall(PetscViewerDestroy(&viewer)); in main()
471 PetscCall(PetscSFDestroy(&sfXC)); in main()
472 PetscCall(DMDestroy(&dm)); in main()
477 PetscCall(PetscFinalize()); in main()