PETSc version 3.17.0
Fix/Edit manual page

# PetscHSetT

Hash table set

### Synopsis

    /*MC
      PetscHSetTCreate - Create a hash table

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTCreate(PetscHSetT *ht)

      Output Parameter:
    . ht - The hash table

    .seealso: PetscHSetTDestroy()
    M*/

    /*MC
      PetscHSetTDestroy - Destroy a hash table

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTDestroy(PetscHSetT *ht)

      Input Parameter:
    . ht - The hash table

    .seealso: PetscHSetTCreate()
    M*/

    /*MC
      PetscHSetTReset - Reset a hash table

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTReset(PetscHSetT ht)

      Input Parameter:
    . ht - The hash table

    .seealso: PetscHSetTClear()
    M*/

    /*MC
      PetscHSetTDuplicate - Duplicate a hash table

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTDuplicate(PetscHSetT ht,PetscHSetT *hd)

      Input Parameter:
    . ht - The source hash table

      Output Parameter:
    . ht - The duplicated hash table

    .seealso: PetscHSetTCreate()
    M*/

    /*MC
      PetscHSetTUpdate - Add entries from a hash table to another

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTUpdate(PetscHSetT ht,PetscHSetT hda)

      Input Parameters:
    + ht - The hash table to which elements are added
    - hta - The hash table from which the elements are retrieved

      Output Parameter:
    . ht - The hash table filled with the elements from the other hash table

    .seealso: PetscHSetTCreate(), PetscHSetTDuplicate()
    M*/

    /*MC
      PetscHSetTClear - Clear a hash table

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTClear(PetscHSetT ht)

      Input Parameter:
    . ht - The hash table

    .seealso: PetscHSetTReset()
    M*/

    /*MC
      PetscHSetTResize - Set the number of buckets in a hash table

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTResize(PetscHSetT ht,PetscInt nb)

      Input Parameters:
    + ht - The hash table
    - nb - The number of buckets

    .seealso: PetscHSetTCreate()
    M*/

    /*MC
      PetscHSetTGetSize - Get the number of entries in a hash table

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTGetSize(PetscHSetT ht,PetscInt *n)

      Input Parameter:
    . ht - The hash table

      Output Parameter:
    . n - The number of entries

    .seealso: PetscHSetTResize()
    M*/

    /*MC
      PetscHSetTGetCapacity - Get the current size of the array in the hash table

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTGetCapacity(PetscHSetT ht,PetscInt *n)

      Input Parameter:
    . ht - The hash table

      Output Parameter:
    . n - The capacity

    .seealso: PetscHSetTResize(), PetscHSetTGetSize()
    M*/

    /*MC
      PetscHSetTHas - Query for an entry in the hash table

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTHas(PetscHSetT ht,KeyType key,PetscBool *has)

      Input Parameters:
    + ht  - The hash table
    - key - The entry

      Output Parameter:
    . has - Boolean indicating whether the entry is in the hash table

    .seealso:  PetscHSetTAdd(), PetscHSetTDel()
    M*/

    /*MC
      PetscHSetTAdd - Set an entry in the hash table

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTAdd(PetscHSetT ht,KeyType key)

      Input Parameters:
    + ht  - The hash table
    - key - The entry

    .seealso: PetscHSetTDel(), PetscHSetTHas()
    M*/

    /*MC
      PetscHSetTDel - Remove an entry from the hash table

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTDel(PetscHSetT ht,KeyType key)

      Input Parameters:
    + ht  - The hash table
    - key - The entry

    .seealso: PetscHSetTAdd(), PetscHSetTHas()
    M*/

    /*MC
      PetscHSetTQueryAdd - Query and add an entry in the hash table

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTQueryAdd(PetscHSetT ht,KeyType key,PetscBool *missing)

      Input Parameters:
    + ht  - The hash table
    - key - The entry

      Output Parameter:
    . missing - Boolean indicating whether the entry was missing

    .seealso: PetscHSetTQueryDel(), PetscHSetTAdd()
    M*/

    /*MC
      PetscHSetTQueryDel - Query and remove an entry from the hash table

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTQueryDel(PetscHSetT ht,KeyType key,PetscBool *present)

      Input Parameters:
    + ht  - The hash table
    - key - The entry

      Output Parameter:
    . present - Boolean indicating whether the entry was present

    .seealso: PetscHSetTQueryAdd(), PetscHSetTDel()
    M*/

    /*MC
      PetscHSetTGetElems - Get all entries from a hash table

      Synopsis:
      #include <petsc/private/hashset.h>
      PetscErrorCode PetscHSetTGetElems(PetscHSetT ht,PetscInt *off,KeyType array[])

      Input Parameters:
    + ht    - The hash table
    . off   - Input offset in array (usually zero)
    - array - Array where to put hash table entries into

      Output Parameters:
    + off   - Output offset in array (output offset = input offset + hash table size)
    - array - Array filled with the hash table entries

    .seealso: PetscHSetTGetSize()
    M*/

    #define PETSC_HASH_SET(HashT, KeyType, HashFunc, EqualFunc)                                          \
                                                                                                         \
    KHASH_INIT(HashT, KeyType, char, 0, HashFunc, EqualFunc)                                             \
                                                                                                         \
    typedef khash_t(HashT) *Pet.c.html##HashT;

### Synopsis

    typedef khash_t(HSetT) *PetscHSetT;

### See Also

PETSC_HASH_SET(), PetscHSetTCreate()

### Level

developer

### Location

include/petsc/private/hashset.h
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages