PetscHMapISetWithMode#
Set a (key,value) entry in the hash table according to an InsertMode
Synopsis#
#include <petsc/private/hashmapi.h>
PetscErrorCode PetscHMapISetWithMode(PetscHMapI ht, PetscInt key, PetscInt val, InsertMode mode)
Input Parameters#
ht - The hash table
key - The key
val - The value
mode - The insertion mode
Notes#
mode
may be any of the following:
INSERT_VALUES
: this routine behaves identically toPetscHMapISet()
.ADD_VALUES
: ifkey
is foundval
is added to the current entry, otherwise (key
,value
) is inserted intoht
as-if-byINSERT_VALUES
.MAX_VALUES
: ifkey
is found the current value is replaced by the maximum ofval
and the current entry, otherwise (key
,value
) is inserted intoht
as-if-byINSERT_VALUES
.MIN_VALUES
: ifkey
is found the current value is replaced by the minimum ofval
and the current entry, otherwise (key
,value
) is inserted intoht
as-if-byINSERT_VALUES
.
All other InsertMode
s will raise an error if used.
Since this routine relies on +
, <
, and >
being well-formed for a particular type
it is not available by default for all PETSc hash table instantiations. If a particular
instantiation supports this routine it must define PETSC_HMAPI_HAVE_EXTENDED_API
to
1
.
See Also#
PetscHMapISet()
, PetscHMapIGet()
, PetscHMapIGetWithDefault()
,
PetscHMapIIterSet()
Level#
developer
Location#
include/petsc/private/generated_khash.h
Index of all PetscH routines
Table of Contents for all manual pages
Index of all manual pages