PETSc version 3.17.4
Fix/Edit manual page

# PetscSectionGetPointSyms

Get the symmetries for a set of points in a PetscSection under specific orientations.

### Synopsis

    #include "petscsection.h"
    PetscErrorCode PetscSectionGetPointSyms(PetscSection section, PetscInt numPoints, const PetscInt *points, const PetscInt ***perms, const PetscScalar ***rots)

Not Collective

### Input Parameters

| section | - the section
| numPoints | - the number of points
| points | - an array of size 2 * numPoints, containing a list of (point, orientation) pairs. (An orientation is an arbitrary integer: its interpretation is up to sym. Orientations are used by DM: for their interpretation in that context, see DMPlexGetConeOrientation()).

### Output Parameters

| perms | - The permutations for the given orientations (or NULL if there is no symmetry or the permutation is the identity).
| rots | - The field rotations symmetries for the given orientations (or NULL if there is no symmetry or the rotations are all identity).

### Example of usage, gathering dofs into a local array (lArray) from a section array (sArray)

         const PetscInt    **perms;
         const PetscScalar **rots;
         PetscInt            lOffset;

         PetscSectionGetPointSyms(section,numPoints,points,&perms,&rots);
         for (i = 0, lOffset = 0; i < numPoints; i++) {
           PetscInt           point = points[2*i], dof, sOffset;
           const PetscInt    *perm  = perms ? perms[i] : NULL;
           const PetscScalar *rot   = rots  ? rots[i]  : NULL;

           PetscSectionGetDof(section,point,&dof);
           PetscSectionGetOffset(section,point,&sOffset);

           if (perm) {for (j = 0; j < dof; j++) {lArray[lOffset + perm[j]]  = sArray[sOffset + j];}}
           else      {for (j = 0; j < dof; j++) {lArray[lOffset +      j ]  = sArray[sOffset + j];}}
           if (rot)  {for (j = 0; j < dof; j++) {lArray[lOffset +      j ] *= rot[j];             }}
           lOffset += dof;
         }
         PetscSectionRestorePointSyms(section,numPoints,points,&perms,&rots);

### Example of usage, adding dofs into a section array (sArray) from a local array (lArray)

         const PetscInt    **perms;
         const PetscScalar **rots;
         PetscInt            lOffset;

         PetscSectionGetPointSyms(section,numPoints,points,&perms,&rots);
         for (i = 0, lOffset = 0; i < numPoints; i++) {
           PetscInt           point = points[2*i], dof, sOffset;
           const PetscInt    *perm  = perms ? perms[i] : NULL;
           const PetscScalar *rot   = rots  ? rots[i]  : NULL;

           PetscSectionGetDof(section,point,&dof);
           PetscSectionGetOffset(section,point,&sOff);

           if (perm) {for (j = 0; j < dof; j++) {sArray[sOffset + j] += lArray[lOffset + perm[j]] * (rot ? PetscConj(rot[perm[j]]) : 1.);}}
           else      {for (j = 0; j < dof; j++) {sArray[sOffset + j] += lArray[lOffset +      j ] * (rot ? PetscConj(rot[     j ]) : 1.);}}
           offset += dof;
         }
         PetscSectionRestorePointSyms(section,numPoints,points,&perms,&rots);

### See Also

PetscSectionRestorePointSyms(), PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetSym()

### Level

developer

### Location

src/vec/is/section/interface/section.c
Index of all PetscSection routines
Table of Contents for all manual pages
Index of all manual pages