#include "petscvec.h" PetscErrorCode PetscSectionGetPointSyms(PetscSection section, PetscInt numPoints, const PetscInt *points, const PetscInt ***perms, const PetscScalar ***rots)Not collective
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()). |
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). |
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);
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);