:orphan:
# PetscHMapIJSetWithMode
Set a (key,value) entry in the hash table according to an `InsertMode` 
## Synopsis
```
#include <petsc/private/hashmapij.h>
PetscErrorCode PetscHMapIJSetWithMode(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscScalar 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 to `PetscHMapIJSet()`.
- `ADD_VALUES`\: if `key` is found `val` is added to the current entry, otherwise (`key`, `value`)
is inserted into `ht` as-if-by `INSERT_VALUES`.
- `MAX_VALUES`\: if `key` is found the current value is replaced by the maximum of `val` and the
current entry, otherwise (`key`, `value`) is inserted into `ht` as-if-by
`INSERT_VALUES`.
- `MIN_VALUES`\: if `key` is found the current value is replaced by the minimum of `val` and the
current entry, otherwise (`key`, `value`) is inserted into `ht` as-if-by
`INSERT_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_HMAPIJ_HAVE_EXTENDED_API` to
`1`.


## See Also
 `PetscHMapIJSet()`, `PetscHMapIJGet()`, `PetscHMapIJGetWithDefault()`,
`PetscHMapIJIterSet()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petsc/private/generated_khash.h.html#PetscHMapIJSetWithMode">include/petsc/private/generated_khash.h</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petsc/private/generated_khash.h)


[Index of all PetscH routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
