Date: 2013-07-02T14:40:23+00:00

Actual source code: petsc-isimpl.h
petsc-3.4.2 2013-07-02

      1: /*
      2:     Index sets for scatter-gather type operations in vectors
      3: and matrices.

      5: */

      7: #if !defined(_IS_H)
      8: #define _IS_H

     10: #include <petscis.h>
     11: #include <petsc-private/petscimpl.h>

     13: struct _ISOps {
     14:   PetscErrorCode (*getsize)(IS,PetscInt*);
     15:   PetscErrorCode (*getlocalsize)(IS,PetscInt*);
     16:   PetscErrorCode (*getindices)(IS,const PetscInt*[]);
     17:   PetscErrorCode (*restoreindices)(IS,const PetscInt*[]);
     18:   PetscErrorCode (*invertpermutation)(IS,PetscInt,IS*);
     19:   PetscErrorCode (*sort)(IS);
     20:   PetscErrorCode (*sorted)(IS,PetscBool*);
     21:   PetscErrorCode (*duplicate)(IS,IS*);
     22:   PetscErrorCode (*destroy)(IS);
     23:   PetscErrorCode (*view)(IS,PetscViewer);
     24:   PetscErrorCode (*identity)(IS,PetscBool*);
     25:   PetscErrorCode (*copy)(IS,IS);
     26:   PetscErrorCode (*togeneral)(IS);
     27:   PetscErrorCode (*oncomm)(IS,MPI_Comm,PetscCopyMode,IS*);
     28:   PetscErrorCode (*setblocksize)(IS,PetscInt);
     29:   PetscErrorCode (*contiguous)(IS,PetscInt,PetscInt,PetscInt*,PetscBool*);
     30: };

     32: struct _p_IS {
     33:   PETSCHEADER(struct _ISOps);
     34:   PetscBool    isperm;          /* if is a permutation */
     35:   PetscInt     max,min;         /* range of possible values */
     36:   PetscInt     bs;              /* block size */
     37:   void         *data;
     38:   PetscBool    isidentity;
     39:   PetscInt     *total, *nonlocal;   /* local representation of ALL indices across the comm as well as the nonlocal part. */
     40:   PetscInt     local_offset;        /* offset to the local part within the total index set */
     41:   IS           complement;          /* IS wrapping nonlocal indices. */
     42: };

     44: struct _p_ISLocalToGlobalMapping{
     45:   PETSCHEADER(int);
     46:   PetscInt n;                  /* number of local indices */
     47:   PetscInt *indices;           /* global index of each local index */
     48:   PetscInt globalstart;        /* first global referenced in indices */
     49:   PetscInt globalend;          /* last + 1 global referenced in indices */
     50:   PetscInt *globals;           /* local index for each global index between start and end */
     51: };

     53: /* ----------------------------------------------------------------------------*/
     54: typedef struct _n_PetscUniformSection *PetscUniformSection;
     55: struct _n_PetscUniformSection {
     56:   MPI_Comm comm;
     57:   PetscInt pStart, pEnd; /* The chart: all points are contained in [pStart, pEnd) */
     58:   PetscInt numDof;       /* Describes layout of storage, point --> (constant # of values, (p - pStart)*constant # of values) */
     59: };

     61: struct _p_PetscSection {
     62:   PETSCHEADER(int);
     63:   struct _n_PetscUniformSection atlasLayout;  /* Layout for the atlas */
     64:   PetscInt                     *atlasDof;     /* Describes layout of storage, point --> # of values */
     65:   PetscInt                     *atlasOff;     /* Describes layout of storage, point --> offset into storage */
     66:   PetscInt                      maxDof;       /* Maximum dof on any point */
     67:   PetscSection                  bc;           /* Describes constraints, point --> # local dofs which are constrained */
     68:   PetscInt                     *bcIndices;    /* Local indices for constrained dofs */
     69:   PetscBool                     setup;

     71:   PetscInt                      numFields;    /* The number of fields making up the degrees of freedom */
     72:   const char                  **fieldNames;   /* The field names */
     73:   PetscInt                     *numFieldComponents; /* The number of components in each field */
     74:   PetscSection                 *field;        /* A section describing the layout and constraints for each field */
     75: };

     78: #endif