| section.c (cef0416bfaf3f2eda18a772a528c82211592945c) | section.c (f13dfd9ea68e0ddeee984e65c377a1819eab8a8a) |
|---|---|
| 1/* 2 This file contains routines for basic section object implementation. 3*/ 4 5#include <petsc/private/sectionimpl.h> /*I "petscsection.h" I*/ 6#include <petscsf.h> 7 8PetscClassId PETSC_SECTION_CLASSID; --- 390 unchanged lines hidden (view full) --- 399 PetscCall(PetscStrallocpy(name, (char **)&s->fieldNames[f])); 400 PetscCall(PetscSNPrintf(name, 64, "Component_0")); 401 PetscCall(PetscMalloc1(s->numFieldComponents[f], &s->compNames[f])); 402 PetscCall(PetscStrallocpy(name, (char **)&s->compNames[f][0])); 403 } 404 PetscFunctionReturn(PETSC_SUCCESS); 405} 406 | 1/* 2 This file contains routines for basic section object implementation. 3*/ 4 5#include <petsc/private/sectionimpl.h> /*I "petscsection.h" I*/ 6#include <petscsf.h> 7 8PetscClassId PETSC_SECTION_CLASSID; --- 390 unchanged lines hidden (view full) --- 399 PetscCall(PetscStrallocpy(name, (char **)&s->fieldNames[f])); 400 PetscCall(PetscSNPrintf(name, 64, "Component_0")); 401 PetscCall(PetscMalloc1(s->numFieldComponents[f], &s->compNames[f])); 402 PetscCall(PetscStrallocpy(name, (char **)&s->compNames[f][0])); 403 } 404 PetscFunctionReturn(PETSC_SUCCESS); 405} 406 |
| 407/*@ | 407/*@C |
| 408 PetscSectionGetFieldName - Returns the name of a field in the `PetscSection` 409 410 Not Collective 411 412 Input Parameters: 413+ s - the `PetscSection` 414- field - the field number 415 --- 12 unchanged lines hidden (view full) --- 428 PetscFunctionBegin; 429 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); 430 PetscAssertPointer(fieldName, 3); 431 PetscSectionCheckValidField(field, s->numFields); 432 *fieldName = s->fieldNames[field]; 433 PetscFunctionReturn(PETSC_SUCCESS); 434} 435 | 408 PetscSectionGetFieldName - Returns the name of a field in the `PetscSection` 409 410 Not Collective 411 412 Input Parameters: 413+ s - the `PetscSection` 414- field - the field number 415 --- 12 unchanged lines hidden (view full) --- 428 PetscFunctionBegin; 429 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); 430 PetscAssertPointer(fieldName, 3); 431 PetscSectionCheckValidField(field, s->numFields); 432 *fieldName = s->fieldNames[field]; 433 PetscFunctionReturn(PETSC_SUCCESS); 434} 435 |
| 436/*@ | 436/*@C |
| 437 PetscSectionSetFieldName - Sets the name of a field in the `PetscSection` 438 439 Not Collective 440 441 Input Parameters: 442+ s - the `PetscSection` 443. field - the field number 444- fieldName - the field name --- 11 unchanged lines hidden (view full) --- 456 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); 457 if (fieldName) PetscAssertPointer(fieldName, 3); 458 PetscSectionCheckValidField(field, s->numFields); 459 PetscCall(PetscFree(s->fieldNames[field])); 460 PetscCall(PetscStrallocpy(fieldName, (char **)&s->fieldNames[field])); 461 PetscFunctionReturn(PETSC_SUCCESS); 462} 463 | 437 PetscSectionSetFieldName - Sets the name of a field in the `PetscSection` 438 439 Not Collective 440 441 Input Parameters: 442+ s - the `PetscSection` 443. field - the field number 444- fieldName - the field name --- 11 unchanged lines hidden (view full) --- 456 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); 457 if (fieldName) PetscAssertPointer(fieldName, 3); 458 PetscSectionCheckValidField(field, s->numFields); 459 PetscCall(PetscFree(s->fieldNames[field])); 460 PetscCall(PetscStrallocpy(fieldName, (char **)&s->fieldNames[field])); 461 PetscFunctionReturn(PETSC_SUCCESS); 462} 463 |
| 464/*@ | 464/*@C |
| 465 PetscSectionGetComponentName - Gets the name of a field component in the `PetscSection` 466 467 Not Collective 468 469 Input Parameters: 470+ s - the `PetscSection` 471. field - the field number 472- comp - the component number --- 18 unchanged lines hidden (view full) --- 491 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); 492 PetscAssertPointer(compName, 4); 493 PetscSectionCheckValidField(field, s->numFields); 494 PetscSectionCheckValidFieldComponent(comp, s->numFieldComponents[field]); 495 *compName = s->compNames[field][comp]; 496 PetscFunctionReturn(PETSC_SUCCESS); 497} 498 | 465 PetscSectionGetComponentName - Gets the name of a field component in the `PetscSection` 466 467 Not Collective 468 469 Input Parameters: 470+ s - the `PetscSection` 471. field - the field number 472- comp - the component number --- 18 unchanged lines hidden (view full) --- 491 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); 492 PetscAssertPointer(compName, 4); 493 PetscSectionCheckValidField(field, s->numFields); 494 PetscSectionCheckValidFieldComponent(comp, s->numFieldComponents[field]); 495 *compName = s->compNames[field][comp]; 496 PetscFunctionReturn(PETSC_SUCCESS); 497} 498 |
| 499/*@ | 499/*@C |
| 500 PetscSectionSetComponentName - Sets the name of a field component in the `PetscSection` 501 502 Not Collective 503 504 Input Parameters: 505+ s - the `PetscSection` 506. field - the field number 507. comp - the component number --- 231 unchanged lines hidden (view full) --- 739 } 740 } 741 PetscFunctionReturn(PETSC_SUCCESS); 742} 743 744/*@C 745 PetscSectionGetBlockStarts - Returns a table indicating which points start new blocks 746 | 500 PetscSectionSetComponentName - Sets the name of a field component in the `PetscSection` 501 502 Not Collective 503 504 Input Parameters: 505+ s - the `PetscSection` 506. field - the field number 507. comp - the component number --- 231 unchanged lines hidden (view full) --- 739 } 740 } 741 PetscFunctionReturn(PETSC_SUCCESS); 742} 743 744/*@C 745 PetscSectionGetBlockStarts - Returns a table indicating which points start new blocks 746 |
| 747 Not Collective, No Fortran Support | 747 Not Collective |
| 748 749 Input Parameter: 750. s - the `PetscSection` 751 752 Output Parameter: 753. blockStarts - The `PetscBT` with a 1 for each point that begins a block 754 755 Notes: --- 14 unchanged lines hidden (view full) --- 770 *blockStarts = s->blockStarts; 771 } 772 PetscFunctionReturn(PETSC_SUCCESS); 773} 774 775/*@C 776 PetscSectionSetBlockStarts - Sets a table indicating which points start new blocks 777 | 748 749 Input Parameter: 750. s - the `PetscSection` 751 752 Output Parameter: 753. blockStarts - The `PetscBT` with a 1 for each point that begins a block 754 755 Notes: --- 14 unchanged lines hidden (view full) --- 770 *blockStarts = s->blockStarts; 771 } 772 PetscFunctionReturn(PETSC_SUCCESS); 773} 774 775/*@C 776 PetscSectionSetBlockStarts - Sets a table indicating which points start new blocks 777 |
| 778 Not Collective, No Fortran Support | 778 Not Collective |
| 779 780 Input Parameters: 781+ s - the `PetscSection` 782- blockStarts - The `PetscBT` with a 1 for each point that begins a block 783 784 Level: intermediate 785 786 Notes: --- 1664 unchanged lines hidden (view full) --- 2451 if (s->sym) { 2452 PetscCall(PetscViewerASCIIPushTab(viewer)); 2453 PetscCall(PetscSectionSymView(s->sym, viewer)); 2454 PetscCall(PetscViewerASCIIPopTab(viewer)); 2455 } 2456 PetscFunctionReturn(PETSC_SUCCESS); 2457} 2458 | 779 780 Input Parameters: 781+ s - the `PetscSection` 782- blockStarts - The `PetscBT` with a 1 for each point that begins a block 783 784 Level: intermediate 785 786 Notes: --- 1664 unchanged lines hidden (view full) --- 2451 if (s->sym) { 2452 PetscCall(PetscViewerASCIIPushTab(viewer)); 2453 PetscCall(PetscSectionSymView(s->sym, viewer)); 2454 PetscCall(PetscViewerASCIIPopTab(viewer)); 2455 } 2456 PetscFunctionReturn(PETSC_SUCCESS); 2457} 2458 |
| 2459/*@ | 2459/*@C |
| 2460 PetscSectionViewFromOptions - View the `PetscSection` based on values in the options database 2461 2462 Collective 2463 2464 Input Parameters: 2465+ A - the `PetscSection` object to view 2466. obj - Optional object that provides the options prefix used for the options 2467- name - command line option --- 8 unchanged lines hidden (view full) --- 2476PetscErrorCode PetscSectionViewFromOptions(PetscSection A, PetscObject obj, const char name[]) 2477{ 2478 PetscFunctionBegin; 2479 PetscValidHeaderSpecific(A, PETSC_SECTION_CLASSID, 1); 2480 PetscCall(PetscObjectViewFromOptions((PetscObject)A, obj, name)); 2481 PetscFunctionReturn(PETSC_SUCCESS); 2482} 2483 | 2460 PetscSectionViewFromOptions - View the `PetscSection` based on values in the options database 2461 2462 Collective 2463 2464 Input Parameters: 2465+ A - the `PetscSection` object to view 2466. obj - Optional object that provides the options prefix used for the options 2467- name - command line option --- 8 unchanged lines hidden (view full) --- 2476PetscErrorCode PetscSectionViewFromOptions(PetscSection A, PetscObject obj, const char name[]) 2477{ 2478 PetscFunctionBegin; 2479 PetscValidHeaderSpecific(A, PETSC_SECTION_CLASSID, 1); 2480 PetscCall(PetscObjectViewFromOptions((PetscObject)A, obj, name)); 2481 PetscFunctionReturn(PETSC_SUCCESS); 2482} 2483 |
| 2484/*@ | 2484/*@C |
| 2485 PetscSectionView - Views a `PetscSection` 2486 2487 Collective 2488 2489 Input Parameters: 2490+ s - the `PetscSection` object to view 2491- viewer - the viewer 2492 --- 36 unchanged lines hidden (view full) --- 2529 PetscCall(PetscSectionView_HDF5_Internal(s, viewer)); 2530#else 2531 SETERRQ(PetscObjectComm((PetscObject)s), PETSC_ERR_SUP, "HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5"); 2532#endif 2533 } 2534 PetscFunctionReturn(PETSC_SUCCESS); 2535} 2536 | 2485 PetscSectionView - Views a `PetscSection` 2486 2487 Collective 2488 2489 Input Parameters: 2490+ s - the `PetscSection` object to view 2491- viewer - the viewer 2492 --- 36 unchanged lines hidden (view full) --- 2529 PetscCall(PetscSectionView_HDF5_Internal(s, viewer)); 2530#else 2531 SETERRQ(PetscObjectComm((PetscObject)s), PETSC_ERR_SUP, "HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5"); 2532#endif 2533 } 2534 PetscFunctionReturn(PETSC_SUCCESS); 2535} 2536 |
| 2537/*@ | 2537/*@C |
| 2538 PetscSectionLoad - Loads a `PetscSection` 2539 2540 Collective 2541 2542 Input Parameters: 2543+ s - the `PetscSection` object to load 2544- viewer - the viewer 2545 --- 216 unchanged lines hidden (view full) --- 2762 offset += dim; 2763 cOffset += dim - tDim; 2764 } 2765 } 2766 } 2767 PetscFunctionReturn(PETSC_SUCCESS); 2768} 2769 | 2538 PetscSectionLoad - Loads a `PetscSection` 2539 2540 Collective 2541 2542 Input Parameters: 2543+ s - the `PetscSection` object to load 2544- viewer - the viewer 2545 --- 216 unchanged lines hidden (view full) --- 2762 offset += dim; 2763 cOffset += dim - tDim; 2764 } 2765 } 2766 } 2767 PetscFunctionReturn(PETSC_SUCCESS); 2768} 2769 |
| 2770/*@ | 2770/*@C |
| 2771 PetscSectionHasConstraints - Determine whether a `PetscSection` has constrained dofs 2772 2773 Not Collective 2774 2775 Input Parameter: 2776. s - The `PetscSection` 2777 2778 Output Parameter: --- 26 unchanged lines hidden (view full) --- 2805 2806 Level: intermediate 2807 2808 Fortran Notes: 2809 Use `PetscSectionGetConstraintIndicesF90()` and `PetscSectionRestoreConstraintIndicesF90()` 2810 2811.seealso: [PetscSection](sec_petscsection), `PetscSectionSetConstraintIndices()`, `PetscSectionGetConstraintDof()`, `PetscSection` 2812@*/ | 2771 PetscSectionHasConstraints - Determine whether a `PetscSection` has constrained dofs 2772 2773 Not Collective 2774 2775 Input Parameter: 2776. s - The `PetscSection` 2777 2778 Output Parameter: --- 26 unchanged lines hidden (view full) --- 2805 2806 Level: intermediate 2807 2808 Fortran Notes: 2809 Use `PetscSectionGetConstraintIndicesF90()` and `PetscSectionRestoreConstraintIndicesF90()` 2810 2811.seealso: [PetscSection](sec_petscsection), `PetscSectionSetConstraintIndices()`, `PetscSectionGetConstraintDof()`, `PetscSection` 2812@*/ |
| 2813PetscErrorCode PetscSectionGetConstraintIndices(PetscSection s, PetscInt point, const PetscInt *indices[]) | 2813PetscErrorCode PetscSectionGetConstraintIndices(PetscSection s, PetscInt point, const PetscInt **indices) |
| 2814{ 2815 PetscFunctionBegin; 2816 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); 2817 if (s->bc) { 2818 PetscCall(VecIntGetValuesSection_Private(s->bcIndices, s->bc, point, indices)); 2819 } else *indices = NULL; 2820 PetscFunctionReturn(PETSC_SUCCESS); 2821} 2822 | 2814{ 2815 PetscFunctionBegin; 2816 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); 2817 if (s->bc) { 2818 PetscCall(VecIntGetValuesSection_Private(s->bcIndices, s->bc, point, indices)); 2819 } else *indices = NULL; 2820 PetscFunctionReturn(PETSC_SUCCESS); 2821} 2822 |
| 2823/*@ | 2823/*@C |
| 2824 PetscSectionSetConstraintIndices - Set the point dof numbers, in [0, dof), which are constrained 2825 2826 Not Collective 2827 2828 Input Parameters: 2829+ s - The `PetscSection` 2830. point - The point 2831- indices - The constrained dofs --- 449 unchanged lines hidden (view full) --- 3281{ 3282 PetscFunctionBegin; 3283 PetscAssertPointer(sym, 2); 3284 PetscCall(ISInitializePackage()); 3285 PetscCall(PetscHeaderCreate(*sym, PETSC_SECTION_SYM_CLASSID, "PetscSectionSym", "Section Symmetry", "IS", comm, PetscSectionSymDestroy, PetscSectionSymView)); 3286 PetscFunctionReturn(PETSC_SUCCESS); 3287} 3288 | 2824 PetscSectionSetConstraintIndices - Set the point dof numbers, in [0, dof), which are constrained 2825 2826 Not Collective 2827 2828 Input Parameters: 2829+ s - The `PetscSection` 2830. point - The point 2831- indices - The constrained dofs --- 449 unchanged lines hidden (view full) --- 3281{ 3282 PetscFunctionBegin; 3283 PetscAssertPointer(sym, 2); 3284 PetscCall(ISInitializePackage()); 3285 PetscCall(PetscHeaderCreate(*sym, PETSC_SECTION_SYM_CLASSID, "PetscSectionSym", "Section Symmetry", "IS", comm, PetscSectionSymDestroy, PetscSectionSymView)); 3286 PetscFunctionReturn(PETSC_SUCCESS); 3287} 3288 |
| 3289/*@ | 3289/*@C |
| 3290 PetscSectionSymSetType - Builds a `PetscSectionSym`, for a particular implementation. 3291 3292 Collective 3293 3294 Input Parameters: 3295+ sym - The section symmetry object 3296- method - The name of the section symmetry type 3297 --- 16 unchanged lines hidden (view full) --- 3314 PetscTryTypeMethod(sym, destroy); 3315 sym->ops->destroy = NULL; 3316 3317 PetscCall((*r)(sym)); 3318 PetscCall(PetscObjectChangeTypeName((PetscObject)sym, method)); 3319 PetscFunctionReturn(PETSC_SUCCESS); 3320} 3321 | 3290 PetscSectionSymSetType - Builds a `PetscSectionSym`, for a particular implementation. 3291 3292 Collective 3293 3294 Input Parameters: 3295+ sym - The section symmetry object 3296- method - The name of the section symmetry type 3297 --- 16 unchanged lines hidden (view full) --- 3314 PetscTryTypeMethod(sym, destroy); 3315 sym->ops->destroy = NULL; 3316 3317 PetscCall((*r)(sym)); 3318 PetscCall(PetscObjectChangeTypeName((PetscObject)sym, method)); 3319 PetscFunctionReturn(PETSC_SUCCESS); 3320} 3321 |
| 3322/*@ | 3322/*@C |
| 3323 PetscSectionSymGetType - Gets the section symmetry type name (as a string) from the `PetscSectionSym`. 3324 3325 Not Collective 3326 3327 Input Parameter: 3328. sym - The section symmetry 3329 3330 Output Parameter: --- 10 unchanged lines hidden (view full) --- 3341 PetscAssertPointer(type, 2); 3342 *type = ((PetscObject)sym)->type_name; 3343 PetscFunctionReturn(PETSC_SUCCESS); 3344} 3345 3346/*@C 3347 PetscSectionSymRegister - Registers a new section symmetry implementation 3348 | 3323 PetscSectionSymGetType - Gets the section symmetry type name (as a string) from the `PetscSectionSym`. 3324 3325 Not Collective 3326 3327 Input Parameter: 3328. sym - The section symmetry 3329 3330 Output Parameter: --- 10 unchanged lines hidden (view full) --- 3341 PetscAssertPointer(type, 2); 3342 *type = ((PetscObject)sym)->type_name; 3343 PetscFunctionReturn(PETSC_SUCCESS); 3344} 3345 3346/*@C 3347 PetscSectionSymRegister - Registers a new section symmetry implementation 3348 |
| 3349 Not Collective, No Fortran Support | 3349 Not Collective |
| 3350 3351 Input Parameters: 3352+ sname - The name of a new user-defined creation routine 3353- function - The creation routine itself 3354 3355 Level: developer 3356 3357 Notes: --- 41 unchanged lines hidden (view full) --- 3399 next = link->next; 3400 PetscCall(PetscFree(link)); 3401 } 3402 (*sym)->workin = NULL; 3403 PetscCall(PetscHeaderDestroy(sym)); 3404 PetscFunctionReturn(PETSC_SUCCESS); 3405} 3406 | 3350 3351 Input Parameters: 3352+ sname - The name of a new user-defined creation routine 3353- function - The creation routine itself 3354 3355 Level: developer 3356 3357 Notes: --- 41 unchanged lines hidden (view full) --- 3399 next = link->next; 3400 PetscCall(PetscFree(link)); 3401 } 3402 (*sym)->workin = NULL; 3403 PetscCall(PetscHeaderDestroy(sym)); 3404 PetscFunctionReturn(PETSC_SUCCESS); 3405} 3406 |
| 3407/*@ | 3407/*@C |
| 3408 PetscSectionSymView - Displays a section symmetry 3409 3410 Collective 3411 3412 Input Parameters: 3413+ sym - the index set 3414- viewer - viewer used to display the set, for example `PETSC_VIEWER_STDOUT_SELF`. 3415 --- 115 unchanged lines hidden (view full) --- 3531 PetscSectionGetPointSyms - Get the symmetries for a set of points in a `PetscSection` under specific orientations. 3532 3533 Not Collective 3534 3535 Input Parameters: 3536+ section - the section 3537. numPoints - the number of points 3538- points - an array of size 2 * `numPoints`, containing a list of (point, orientation) pairs. (An orientation is an | 3408 PetscSectionSymView - Displays a section symmetry 3409 3410 Collective 3411 3412 Input Parameters: 3413+ sym - the index set 3414- viewer - viewer used to display the set, for example `PETSC_VIEWER_STDOUT_SELF`. 3415 --- 115 unchanged lines hidden (view full) --- 3531 PetscSectionGetPointSyms - Get the symmetries for a set of points in a `PetscSection` under specific orientations. 3532 3533 Not Collective 3534 3535 Input Parameters: 3536+ section - the section 3537. numPoints - the number of points 3538- points - an array of size 2 * `numPoints`, containing a list of (point, orientation) pairs. (An orientation is an |
| 3539 arbitrary integer: its interpretation is up to sym. Orientations are used by `DM`: for their interpretation in that 3540 context, see `DMPlexGetConeOrientation()`). | 3539 arbitrary integer: its interpretation is up to sym. Orientations are used by `DM`: for their interpretation in that 3540 context, see `DMPlexGetConeOrientation()`). |
| 3541 3542 Output Parameters: 3543+ perms - The permutations for the given orientations (or `NULL` if there is no symmetry or the permutation is the identity). 3544- rots - The field rotations symmetries for the given orientations (or `NULL` if there is no symmetry or the rotations are all 3545 identity). 3546 3547 Example of usage, gathering dofs into a local array (lArray) from a section array (sArray): 3548.vb --- 366 unchanged lines hidden --- | 3541 3542 Output Parameters: 3543+ perms - The permutations for the given orientations (or `NULL` if there is no symmetry or the permutation is the identity). 3544- rots - The field rotations symmetries for the given orientations (or `NULL` if there is no symmetry or the rotations are all 3545 identity). 3546 3547 Example of usage, gathering dofs into a local array (lArray) from a section array (sArray): 3548.vb --- 366 unchanged lines hidden --- |