Actual source code: generated_khash.h
1: /* SUBMANSEC = PetscH */
3: This file is processed by make allmanpages in $PETSC_DIR/makefile to create manual pages
4: for the types and macros created by PETSC_HASH_SET(). For example, PetscHSetIJ.
6: /*S
7: PetscHSetI - Hash set with a key of PetscInt
9: Level: developer
11: .seealso: `PETSC_HASH_SET()`, `PetscHSetICreate()`, `PetscHSetIDestroy()`, `PetscHSetIQueryAdd()`, `PetscHSetIDel()`,
12: `PetscHSetIAdd()`, `PetscHSetIReset()`, `PETSC_HASH_MAP()`, `PetscHMapICreate()`, `PetscHSetI`
13: S*/
14: typedef struct _PetscHashI PetscHSetI;
16: /*MC
17: PetscHSetICreate - Create a hash set
19: Synopsis:
20: #include <petsc/private/hashseti.h>
21: PetscErrorCode PetscHSetICreate(PetscHSetI *ht)
23: Output Parameter:
24: . ht - The hash set
26: Level: developer
28: .seealso: `PetscHSetIDestroy()`
29: M*/
31: /*MC
32: PetscHSetIDestroy - Destroy a hash set
34: Synopsis:
35: #include <petsc/private/hashseti.h>
36: PetscErrorCode PetscHSetIDestroy(PetscHSetI *ht)
38: Input Parameter:
39: . ht - The hash set
41: Level: developer
43: .seealso: `PetscHSetICreate()`
44: M*/
46: /*MC
47: PetscHSetIReset - Reset a hash set
49: Synopsis:
50: #include <petsc/private/hashseti.h>
51: PetscErrorCode PetscHSetIReset(PetscHSetI ht)
53: Input Parameter:
54: . ht - The hash set
56: Level: developer
58: .seealso: `PetscHSetIClear()`
59: M*/
61: /*MC
62: PetscHSetIDuplicate - Duplicate a hash set
64: Synopsis:
65: #include <petsc/private/hashseti.h>
66: PetscErrorCode PetscHSetIDuplicate(PetscHSetI ht,PetscHSetI *hd)
68: Input Parameter:
69: . ht - The source hash set
71: Output Parameter:
72: . ht - The duplicated hash set
74: Level: developer
76: .seealso: `PetscHSetICreate()`
77: M*/
79: /*MC
80: PetscHSetIUpdate - Add entries from a has set to another
82: Synopsis:
83: #include <petsc/private/hashseti.h>
84: PetscErrorCode PetscHSetIUpdate(PetscHSetI ht,PetscHSetI hda)
86: Input Parameters:
87: + ht - The hash set to which elements are added
88: - hta - The hash set from which the elements are retrieved
90: Output Parameter:
91: . ht - The hash set filled with the elements from the other hash set
93: Level: developer
95: .seealso: `PetscHSetICreate()`, `PetscHSetIDuplicate()`
96: M*/
98: /*MC
99: PetscHSetIClear - Clear a hash set
101: Synopsis:
102: #include <petsc/private/hashseti.h>
103: PetscErrorCode PetscHSetIClear(PetscHSetI ht)
105: Input Parameter:
106: . ht - The hash set
108: Level: developer
110: .seealso: `PetscHSetIReset()`
111: M*/
113: /*MC
114: PetscHSetIResize - Set the number of buckets in a hash set
116: Synopsis:
117: #include <petsc/private/hashseti.h>
118: PetscErrorCode PetscHSetIResize(PetscHSetI ht,PetscInt nb)
120: Input Parameters:
121: + ht - The hash set
122: - nb - The number of buckets
124: Level: developer
126: .seealso: `PetscHSetICreate()`
127: M*/
129: /*MC
130: PetscHSetIGetSize - Get the number of entries in a hash set
132: Synopsis:
133: #include <petsc/private/hashseti.h>
134: PetscErrorCode PetscHSetIGetSize(PetscHSetI ht,PetscInt *n)
136: Input Parameter:
137: . ht - The hash set
139: Output Parameter:
140: . n - The number of entries
142: Level: developer
144: .seealso: `PetscHSetIResize()`
145: M*/
147: /*MC
148: PetscHSetIGetCapacity - Get the current size of the array in the hash set
150: Synopsis:
151: #include <petsc/private/hashseti.h>
152: PetscErrorCode PetscHSetIGetCapacity(PetscHSetI ht,PetscInt *n)
154: Input Parameter:
155: . ht - The hash set
157: Output Parameter:
158: . n - The capacity
160: Level: developer
162: .seealso: `PetscHSetIResize()`, `PetscHSetIGetSize()`
163: M*/
165: /*MC
166: PetscHSetIHas - Query for an entry in the hash set
168: Synopsis:
169: #include <petsc/private/hashseti.h>
170: PetscErrorCode PetscHSetIHas(PetscHSetI ht, PetscInt key, PetscBool *has)
172: Input Parameters:
173: + ht - The hash set
174: - key - The entry
176: Output Parameter:
177: . has - Boolean indicating whether the entry is in the hash set
179: Level: developer
181: .seealso: `PetscHSetIAdd()`, `PetscHSetIDel()`, `PetscHSetIQueryAdd()`
182: M*/
184: /*MC
185: PetscHSetIAdd - Set an entry in the hash set
187: Synopsis:
188: #include <petsc/private/hashseti.h>
189: PetscErrorCode PetscHSetIAdd(PetscHSetI ht, PetscInt key)
191: Input Parameters:
192: + ht - The hash set
193: - key - The entry
195: Level: developer
197: .seealso: `PetscHSetIDel()`, `PetscHSetIHas()`, `PetscHSetIQueryAdd()`
198: M*/
200: /*MC
201: PetscHSetIDel - Remove an entry from the hash set
203: Synopsis:
204: #include <petsc/private/hashseti.h>
205: PetscErrorCode PetscHSetIDel(PetscHSetI ht, PetscInt key)
207: Input Parameters:
208: + ht - The hash set
209: - key - The entry
211: Level: developer
213: .seealso: `PetscHSetIAdd()`, `PetscHSetIHas()`
214: M*/
216: /*MC
217: PetscHSetIQueryAdd - Query and add an entry in the hash set
219: Synopsis:
220: #include <petsc/private/hashseti.h>
221: PetscErrorCode PetscHSetIQueryAdd(PetscHSetI ht, PetscInt key, PetscBool *missing)
223: Input Parameters:
224: + ht - The hash set
225: - key - The entry
227: Output Parameter:
228: . missing - Boolean indicating whether the entry was missing
230: Level: developer
232: .seealso: `PetscHSetIQueryDel()`, `PetscHSetIAdd()`, `PetscHSetIHas()`
233: M*/
235: /*MC
236: PetscHSetIQueryDel - Query and remove an entry from the hash set
238: Synopsis:
239: #include <petsc/private/hashseti.h>
240: PetscErrorCode PetscHSetIQueryDel(PetscHSetI ht, PetscInt key, PetscBool *present)
242: Input Parameters:
243: + ht - The hash set
244: - key - The entry
246: Output Parameter:
247: . present - Boolean indicating whether the entry was present
249: Level: developer
251: .seealso: `PetscHSetIQueryAdd()`, `PetscHSetIDel()`
252: M*/
254: /*MC
255: PetscHSetIGetElems - Get all entries from a hash set
257: Synopsis:
258: #include <petsc/private/hashseti.h>
259: PetscErrorCode PetscHSetIGetElems(PetscHSetI ht, PetscInt *off, PetscInt array[])
261: Input Parameters:
262: + ht - The hash set
263: . off - Input offset in array (usually zero)
264: - array - Array to put hash set entries in
266: Output Parameters:
267: + off - Output offset in array (output offset = input offset + hash set size)
268: - array - Array filled with the hash set entries
270: Level: developer
272: .seealso: `PetscHSetIGetSize()`
273: M*/
275: This file is processed by make allmanpages in $PETSC_DIR/makefile to create manual pages
276: for the types and macros created by PETSC_HASH_SET(). For example, PetscHSetIJ.
278: /*S
279: PetscHSetIJ - Hash set with a key of struct {PetscInt i, j;}
281: Level: developer
283: .seealso: `PETSC_HASH_SET()`, `PetscHSetIJCreate()`, `PetscHSetIJDestroy()`, `PetscHSetIJQueryAdd()`, `PetscHSetIJDel()`,
284: `PetscHSetIJAdd()`, `PetscHSetIJReset()`, `PETSC_HASH_MAP()`, `PetscHMapIJCreate()`, `PetscHSetIJ`
285: S*/
286: typedef struct _PetscHashIJ PetscHSetIJ;
288: /*MC
289: PetscHSetIJCreate - Create a hash set
291: Synopsis:
292: #include <petsc/private/hashsetij.h>
293: PetscErrorCode PetscHSetIJCreate(PetscHSetIJ *ht)
295: Output Parameter:
296: . ht - The hash set
298: Level: developer
300: .seealso: `PetscHSetIJDestroy()`
301: M*/
303: /*MC
304: PetscHSetIJDestroy - Destroy a hash set
306: Synopsis:
307: #include <petsc/private/hashsetij.h>
308: PetscErrorCode PetscHSetIJDestroy(PetscHSetIJ *ht)
310: Input Parameter:
311: . ht - The hash set
313: Level: developer
315: .seealso: `PetscHSetIJCreate()`
316: M*/
318: /*MC
319: PetscHSetIJReset - Reset a hash set
321: Synopsis:
322: #include <petsc/private/hashsetij.h>
323: PetscErrorCode PetscHSetIJReset(PetscHSetIJ ht)
325: Input Parameter:
326: . ht - The hash set
328: Level: developer
330: .seealso: `PetscHSetIJClear()`
331: M*/
333: /*MC
334: PetscHSetIJDuplicate - Duplicate a hash set
336: Synopsis:
337: #include <petsc/private/hashsetij.h>
338: PetscErrorCode PetscHSetIJDuplicate(PetscHSetIJ ht,PetscHSetIJ *hd)
340: Input Parameter:
341: . ht - The source hash set
343: Output Parameter:
344: . ht - The duplicated hash set
346: Level: developer
348: .seealso: `PetscHSetIJCreate()`
349: M*/
351: /*MC
352: PetscHSetIJUpdate - Add entries from a has set to another
354: Synopsis:
355: #include <petsc/private/hashsetij.h>
356: PetscErrorCode PetscHSetIJUpdate(PetscHSetIJ ht,PetscHSetIJ hda)
358: Input Parameters:
359: + ht - The hash set to which elements are added
360: - hta - The hash set from which the elements are retrieved
362: Output Parameter:
363: . ht - The hash set filled with the elements from the other hash set
365: Level: developer
367: .seealso: `PetscHSetIJCreate()`, `PetscHSetIJDuplicate()`
368: M*/
370: /*MC
371: PetscHSetIJClear - Clear a hash set
373: Synopsis:
374: #include <petsc/private/hashsetij.h>
375: PetscErrorCode PetscHSetIJClear(PetscHSetIJ ht)
377: Input Parameter:
378: . ht - The hash set
380: Level: developer
382: .seealso: `PetscHSetIJReset()`
383: M*/
385: /*MC
386: PetscHSetIJResize - Set the number of buckets in a hash set
388: Synopsis:
389: #include <petsc/private/hashsetij.h>
390: PetscErrorCode PetscHSetIJResize(PetscHSetIJ ht,PetscInt nb)
392: Input Parameters:
393: + ht - The hash set
394: - nb - The number of buckets
396: Level: developer
398: .seealso: `PetscHSetIJCreate()`
399: M*/
401: /*MC
402: PetscHSetIJGetSize - Get the number of entries in a hash set
404: Synopsis:
405: #include <petsc/private/hashsetij.h>
406: PetscErrorCode PetscHSetIJGetSize(PetscHSetIJ ht,PetscInt *n)
408: Input Parameter:
409: . ht - The hash set
411: Output Parameter:
412: . n - The number of entries
414: Level: developer
416: .seealso: `PetscHSetIJResize()`
417: M*/
419: /*MC
420: PetscHSetIJGetCapacity - Get the current size of the array in the hash set
422: Synopsis:
423: #include <petsc/private/hashsetij.h>
424: PetscErrorCode PetscHSetIJGetCapacity(PetscHSetIJ ht,PetscInt *n)
426: Input Parameter:
427: . ht - The hash set
429: Output Parameter:
430: . n - The capacity
432: Level: developer
434: .seealso: `PetscHSetIJResize()`, `PetscHSetIJGetSize()`
435: M*/
437: /*MC
438: PetscHSetIJHas - Query for an entry in the hash set
440: Synopsis:
441: #include <petsc/private/hashsetij.h>
442: PetscErrorCode PetscHSetIJHas(PetscHSetIJ ht, struct {PetscInt i, j;} key, PetscBool *has)
444: Input Parameters:
445: + ht - The hash set
446: - key - The entry
448: Output Parameter:
449: . has - Boolean indicating whether the entry is in the hash set
451: Level: developer
453: .seealso: `PetscHSetIJAdd()`, `PetscHSetIJDel()`, `PetscHSetIJQueryAdd()`
454: M*/
456: /*MC
457: PetscHSetIJAdd - Set an entry in the hash set
459: Synopsis:
460: #include <petsc/private/hashsetij.h>
461: PetscErrorCode PetscHSetIJAdd(PetscHSetIJ ht, struct {PetscInt i, j;} key)
463: Input Parameters:
464: + ht - The hash set
465: - key - The entry
467: Level: developer
469: .seealso: `PetscHSetIJDel()`, `PetscHSetIJHas()`, `PetscHSetIJQueryAdd()`
470: M*/
472: /*MC
473: PetscHSetIJDel - Remove an entry from the hash set
475: Synopsis:
476: #include <petsc/private/hashsetij.h>
477: PetscErrorCode PetscHSetIJDel(PetscHSetIJ ht, struct {PetscInt i, j;} key)
479: Input Parameters:
480: + ht - The hash set
481: - key - The entry
483: Level: developer
485: .seealso: `PetscHSetIJAdd()`, `PetscHSetIJHas()`
486: M*/
488: /*MC
489: PetscHSetIJQueryAdd - Query and add an entry in the hash set
491: Synopsis:
492: #include <petsc/private/hashsetij.h>
493: PetscErrorCode PetscHSetIJQueryAdd(PetscHSetIJ ht, struct {PetscInt i, j;} key, PetscBool *missing)
495: Input Parameters:
496: + ht - The hash set
497: - key - The entry
499: Output Parameter:
500: . missing - Boolean indicating whether the entry was missing
502: Level: developer
504: .seealso: `PetscHSetIJQueryDel()`, `PetscHSetIJAdd()`, `PetscHSetIJHas()`
505: M*/
507: /*MC
508: PetscHSetIJQueryDel - Query and remove an entry from the hash set
510: Synopsis:
511: #include <petsc/private/hashsetij.h>
512: PetscErrorCode PetscHSetIJQueryDel(PetscHSetIJ ht, struct {PetscInt i, j;} key, PetscBool *present)
514: Input Parameters:
515: + ht - The hash set
516: - key - The entry
518: Output Parameter:
519: . present - Boolean indicating whether the entry was present
521: Level: developer
523: .seealso: `PetscHSetIJQueryAdd()`, `PetscHSetIJDel()`
524: M*/
526: /*MC
527: PetscHSetIJGetElems - Get all entries from a hash set
529: Synopsis:
530: #include <petsc/private/hashsetij.h>
531: PetscErrorCode PetscHSetIJGetElems(PetscHSetIJ ht, PetscInt *off, struct {PetscInt i, j;} array[])
533: Input Parameters:
534: + ht - The hash set
535: . off - Input offset in array (usually zero)
536: - array - Array to put hash set entries in
538: Output Parameters:
539: + off - Output offset in array (output offset = input offset + hash set size)
540: - array - Array filled with the hash set entries
542: Level: developer
544: .seealso: `PetscHSetIJGetSize()`
545: M*/
546: This file is processed by make allmanpages in $PETSC_DIR/makefile to create manual pages
547: for the types and macros created by PETSC_HASH_MAP(). For example, PetscHMAPIJ.
549: /*S
550: PetscHMapI - Hash table map with a key of PetscInt
552: Synopsis:
553: typedef khash_t(HMapI) *PetscHMapI;
555: Level: developer
557: .seealso: `PETSC_HASH_MAP()`, `PetscHMapICreate()`, `PETSC_HASH_SET()`, `PetscHSetICreate()`
558: S*/
559: typedef struct _PetscHashI PetscHMapI;
561: /*MC
562: PetscHMapICreate - Create a hash table
564: Synopsis:
565: #include <petsc/private/hashmapi.h>
566: PetscErrorCode PetscHMapICreate(PetscHMapI *ht)
568: Output Parameter:
569: . ht - The hash table
571: Level: developer
573: .seealso: `PetscHMapICreateWithSize()`, `PetscHMapIDestroy()`
574: M*/
576: /*MC
577: PetscHMapICreateWithSize - Create a hash table with a given initial size
579: Synopsis:
580: #include <petsc/private/hashmapi.h>
581: PetscErrorCode PetscHMapICreateWithSize(PetscInt n, PetscHMapI *ht)
583: Input Parameter:
584: . n - The size of the hash table
586: Output Parameter:
587: . ht - The hash table
589: Level: developer
591: Note:
592: `n` must be non-negative.
594: .seealso: `PetscHMapICreate()`, `PetscHMapIDestroy()`
595: M*/
597: /*MC
598: PetscHMapIDestroy - Destroy a hash table
600: Synopsis:
601: #include <petsc/private/hashmapi.h>
602: PetscErrorCode PetscHMapIDestroy(PetscHMapI *ht)
604: Input Parameter:
605: . ht - The hash table
607: Level: developer
609: .seealso: `PetscHMapICreate()`, `PetscHMapICreateWithSize()`
610: M*/
612: /*MC
613: PetscHMapIReset - Reset a hash table
615: Synopsis:
616: #include <petsc/private/hashmapi.h>
617: PetscErrorCode PetscHMapIReset(PetscHMapI ht)
619: Input Parameter:
620: . ht - The hash table
622: Level: developer
624: .seealso: `PetscHMapIClear()`
625: M*/
627: /*MC
628: PetscHMapIDuplicate - Duplicate a hash table
630: Synopsis:
631: #include <petsc/private/hashmapi.h>
632: PetscErrorCode PetscHMapIDuplicate(PetscHMapI ht, PetscHMapI *hd)
634: Input Parameter:
635: . ht - The source hash table
637: Output Parameter:
638: . ht - The duplicated hash table
640: Level: developer
642: .seealso: `PetscHMapICreate()`
643: M*/
645: /*MC
646: PetscHMapIClear - Clear a hash table
648: Synopsis:
649: #include <petsc/private/hashmapi.h>
650: PetscErrorCode PetscHMapIClear(PetscHMapI ht)
652: Input Parameter:
653: . ht - The hash table
655: Level: developer
657: .seealso: `PetscHMapIReset()`
658: M*/
660: /*MC
661: PetscHMapIResize - Set the number of buckets in a hash table
663: Synopsis:
664: #include <petsc/private/hashmapi.h>
665: PetscErrorCode PetscHMapIResize(PetscHMapI ht, PetscInt nb)
667: Input Parameters:
668: + ht - The hash table
669: - nb - The number of buckets
671: Level: developer
673: .seealso: `PetscHMapICreate()`
674: M*/
676: /*MC
677: PetscHMapIGetSize - Get the number of entries in a hash table
679: Synopsis:
680: #include <petsc/private/hashmapi.h>
681: PetscErrorCode PetscHMapIGetSize(PetscHMapI ht, PetscInt *n)
683: Input Parameter:
684: . ht - The hash table
686: Output Parameter:
687: . n - The number of entries
689: Level: developer
691: .seealso: `PetscHMapIResize()`
692: M*/
694: /*MC
695: PetscHMapIGetCapacity - Get the current size of the array in the hash table
697: Synopsis:
698: #include <petsc/private/hashmapi.h>
699: PetscErrorCode PetscHMapIGetCapacity(PetscHMapI ht, PetscInt *n)
701: Input Parameter:
702: . ht - The hash table
704: Output Parameter:
705: . n - The capacity
707: Level: developer
709: .seealso: `PetscHMapIResize()`, `PetscHMapIGetSize()`
710: M*/
712: /*MC
713: PetscHMapIHas - Query for a key in the hash table
715: Synopsis:
716: #include <petsc/private/hashmapi.h>
717: PetscErrorCode PetscHMapIHas(PetscHMapI ht, PetscInt key, PetscBool *has)
719: Input Parameters:
720: + ht - The hash table
721: - key - The key
723: Output Parameter:
724: . has - Boolean indicating whether key is in the hash table
726: Level: developer
728: .seealso: `PetscHMapIGet()`, `PetscHMapIGetWithDefault()`, `PetscHMapISet()`,
729: `PetscHMapISetWithMode()`, `PetscHMapIFind()`
730: M*/
732: /*MC
733: PetscHMapIGet - Get the value for a key in the hash table
735: Synopsis:
736: #include <petsc/private/hashmapi.h>
737: PetscErrorCode PetscHMapIGet(PetscHMapI ht, PetscInt key, PetscInt *val)
739: Input Parameters:
740: + ht - The hash table
741: - key - The key
743: Output Parameter:
744: . val - The value
746: Level: developer
748: .seealso: `PetscHMapISet()`, `PetscHMapISetWithMode()`, `PetscHMapIIterGet()`,
749: `PetscHMapIGetWithDefault()`
750: M*/
752: /*MC
753: PetscHMapIGetWithDefault - Get the value for a key in the hash table but override the default
754: value returned if the key was not found
756: Synopsis:
757: #include <petsc/private/hashmapi.h>
758: PetscErrorCode PetscHMapIGetWithDefault(PetscHMapI ht, PetscInt key, PetscInt default_val, PetscInt *val)
760: Input Parameters:
761: + ht - The hash table
762: . key - The key
763: - default_val - The default value to set `val` to if `key` was not found
765: Output Parameter:
766: . val - The value
768: Level: developer
770: .seealso: `PetscHMapIGet()`, `PetscHMapISet()`, `PetscHMapISetWithMode()`, `PetscHMapIIterGet()`
771: M*/
774: /*MC
775: PetscHMapISet - Set a (key,value) entry in the hash table
777: Synopsis:
778: #include <petsc/private/hashmapi.h>
779: PetscErrorCode PetscHMapISet(PetscHMapI ht, PetscInt key, PetscInt val)
781: Input Parameters:
782: + ht - The hash table
783: . key - The key
784: - val - The value
786: Level: developer
788: .seealso: `PetscHMapIGet()`, `PetscHMapISetWithMode()`, `PetscHMapIGetWithDefault()`,
789: `PetscHMapIIterSet()`
790: M*/
792: /*MC
793: PetscHMapISetWithMode - Set a (key,value) entry in the hash table according to an `InsertMode`
795: Synopsis:
796: #include <petsc/private/hashmapi.h>
797: PetscErrorCode PetscHMapISetWithMode(PetscHMapI ht, PetscInt key, PetscInt val, InsertMode mode)
799: Input Parameters:
800: + ht - The hash table
801: . key - The key
802: . val - The value
803: - mode - The insertion mode
805: Level: developer
807: Notes:
808: `mode` may be any of the following\:
809: - `INSERT_VALUES`\: this routine behaves identically to `PetscHMapISet()`.
810: - `ADD_VALUES`\: if `key` is found `val` is added to the current entry, otherwise (`key`, `value`)
811: is inserted into `ht` as-if-by `INSERT_VALUES`.
812: - `MAX_VALUES`\: if `key` is found the current value is replaced by the maximum of `val` and the
813: current entry, otherwise (`key`, `value`) is inserted into `ht` as-if-by
814: `INSERT_VALUES`.
815: - `MIN_VALUES`\: if `key` is found the current value is replaced by the minimum of `val` and the
816: current entry, otherwise (`key`, `value`) is inserted into `ht` as-if-by
817: `INSERT_VALUES`.
819: All other `InsertMode` values raise an error.
821: Since this routine relies on `+`, `<`, and `>` being well-formed for a particular type
822: it is not available by default for all PETSc hash table instantiations. If a particular
823: instantiation supports this routine it must define `PETSC_HMAPI_HAVE_EXTENDED_API` to
824: `1`.
826: .seealso: `PetscHMapISet()`, `PetscHMapIGet()`, `PetscHMapIGetWithDefault()`,
827: `PetscHMapIIterSet()`
828: M*/
830: /*MC
831: PetscHMapIDel - Remove a key and its value from the hash table
833: Synopsis:
834: #include <petsc/private/hashmapi.h>
835: PetscErrorCode PetscHMapIDel(PetscHMapI ht,PetscInt key)
837: Input Parameters:
838: + ht - The hash table
839: - key - The key
841: Level: developer
843: .seealso: `PetscHMapIHas()`, `PetscHMapIIterDel()`
844: M*/
846: /*MC
847: PetscHMapIQuerySet - Query and set a (key,value) entry in the hash table
849: Synopsis:
850: #include <petsc/private/hashmapi.h>
851: PetscErrorCode PetscHMapIQuerySet(PetscHMapI ht, PetscInt key, PetscInt val, PetscBool *missing)
853: Input Parameters:
854: + ht - The hash table
855: . key - The key
856: - val - The value
858: Output Parameter:
859: . missing - Boolean indicating whether the key was missing
861: Level: developer
863: .seealso: `PetscHMapIQueryDel()`, `PetscHMapISet()`, `PetscHMapISetWithMode()`
864: M*/
866: /*MC
867: PetscHMapIQueryDel - Query and remove a (key,value) entry from the hash table
869: Synopsis:
870: #include <petsc/private/hashmapi.h>
871: PetscErrorCode PetscHMapIQueryDel(PetscHMapI ht, PetscInt key, PetscBool *present)
873: Input Parameters:
874: + ht - The hash table
875: - key - The key
877: Output Parameter:
878: . present - Boolean indicating whether the key was present
880: Level: developer
882: .seealso: `PetscHMapIQuerySet()`, `PetscHMapIDel()`
883: M*/
885: /*MC
886: PetscHMapIFind - Query for key in the hash table
888: Synopsis:
889: #include <petsc/private/hashmapi.h>
890: PetscErrorCode PetscHMapIFind(PetscHMapI ht, PetscInt key, PetscHashIter *iter, PetscBool *found)
892: Input Parameters:
893: + ht - The hash table
894: - key - The key
896: Output Parameters:
897: + iter - Iterator referencing the value for key
898: - found - Boolean indicating whether the key was present
900: Level: developer
902: .seealso: `PetscHMapIIterGet()`, `PetscHMapIIterDel()`
903: M*/
905: /*MC
906: PetscHMapIPut - Set a key in the hash table
908: Synopsis:
909: #include <petsc/private/hashmapi.h>
910: PetscErrorCode PetscHMapIPut(PetscHMapI ht, PetscInt key, PetscHashIter *iter, PetscBool *missing)
912: Input Parameters:
913: + ht - The hash table
914: - key - The key
916: Output Parameters:
917: + iter - Iterator referencing the value for key
918: - missing - Boolean indicating whether the key was missing
920: Level: developer
922: .seealso: `PetscHMapIIterSet()`, `PetscHMapIQuerySet()`, `PetscHMapISet()`,
923: `PetscHMapISetWithMode()`
924: M*/
926: /*MC
927: PetscHMapIIterGet - Get the value referenced by an iterator in the hash table
929: Synopsis:
930: #include <petsc/private/hashmapi.h>
931: PetscErrorCode PetscHMapIIterGet(PetscHMapI ht, PetscHashIter iter, PetscInt *val)
933: Input Parameters:
934: + ht - The hash table
935: - iter - The iterator
937: Output Parameter:
938: . val - The value
940: Level: developer
942: .seealso: `PetscHMapIFind()`, `PetscHMapIGet()`, `PetscHMapIGetWithDefault()`
943: M*/
945: /*MC
946: PetscHMapIIterSet - Set the value referenced by an iterator in the hash
948: Synopsis:
949: #include <petsc/private/hashmapi.h>
950: PetscErrorCode PetscHMapIIterSet(PetscHMapI ht, PetscHashIter iter, PetscInt val)
952: Input Parameters:
953: + ht - The hash table
954: . iter - The iterator
955: - val - The value
957: Level: developer
959: .seealso: `PetscHMapIPut()`, `PetscHMapIQuerySet()`, `PetscHMapISet()`,
960: `PetscHMapISetWithMode()`
961: M*/
963: /*MC
964: PetscHMapIIterDel - Remove the (key,value) referenced by an iterator from the hash table
966: Synopsis:
967: #include <petsc/private/hashmapi.h>
968: PetscErrorCode PetscHMapIIterDel(PetscHMapI ht, PetscHashIter iter)
970: Input Parameters:
971: + ht - The hash table
972: - iter - The iterator
974: Level: developer
976: .seealso: `PetscHMapIFind()`, `PetscHMapIQueryDel()`, `PetscHMapIDel()`
977: M*/
979: /*MC
980: PetscHMapIGetKeys - Get all keys from a hash table
982: Synopsis:
983: #include <petsc/private/hashmapi.h>
984: PetscErrorCode PetscHMapIGetKeys(PetscHMapI ht, PetscInt *off, PetscInt array[])
986: Input Parameters:
987: + ht - The hash table
988: . off - Input offset in array (usually zero)
989: - array - Array to put hash table keys in
991: Output Parameters:
992: + off - Output offset in array (output offset = input offset + hash table size)
993: - array - Array filled with the hash table keys
995: Level: developer
997: .seealso: `PetscHSetIGetSize()`, `PetscHMapIGetVals()`
998: M*/
1000: /*MC
1001: PetscHMapIGetVals - Get all values from a hash table
1003: Synopsis:
1004: #include <petsc/private/hashmapi.h>
1005: PetscErrorCode PetscHMapIGetVals(PetscHMapI ht, PetscInt *off, PetscInt array[])
1007: Input Parameters:
1008: + ht - The hash table
1009: . off - Input offset in array (usually zero)
1010: - array - Array to put hash table values in
1012: Output Parameters:
1013: + off - Output offset in array (output offset = input offset + hash table size)
1014: - array - Array filled with the hash table values
1016: Level: developer
1018: .seealso: `PetscHSetIGetSize()`, `PetscHMapIGetKeys()`
1019: M*/
1021: /*MC
1022: PetscHMapIGetPairs - Get all (key,value) pairs from a hash table
1024: Synopsis:
1025: #include <petsc/private/hashmapi.h>
1026: PetscErrorCode PetscHMapIGetPairs(PetscHMapI ht, PetscInt *off, PetscInt karray[], PetscInt varray[])
1028: Input Parameters:
1029: + ht - The hash table
1030: . off - Input offset in array (usually zero)
1031: . karray - Array to put hash table keys in
1032: - varray - Array to put hash table values in
1034: Output Parameters:
1035: + off - Output offset in array (output offset = input offset + hash table size)
1036: . karray - Array filled with the hash table keys
1037: - varray - Array filled with the hash table values
1039: Level: developer
1041: .seealso: `PetscHSetIGetSize()`, `PetscHMapIGetKeys()`, `PetscHMapIGetVals()`
1042: M*/
1043: This file is processed by make allmanpages in $PETSC_DIR/makefile to create manual pages
1044: for the types and macros created by PETSC_HASH_MAP(). For example, PetscHMAPIJ.
1046: /*S
1047: PetscHMapIJ - Hash table map with a key of struct {PetscInt i, j;}
1049: Synopsis:
1050: typedef khash_t(HMapIJ) *PetscHMapIJ;
1052: Level: developer
1054: .seealso: `PETSC_HASH_MAP()`, `PetscHMapIJCreate()`, `PETSC_HASH_SET()`, `PetscHSetIJCreate()`
1055: S*/
1056: typedef struct _PetscHashIJ PetscHMapIJ;
1058: /*MC
1059: PetscHMapIJCreate - Create a hash table
1061: Synopsis:
1062: #include <petsc/private/hashmapij.h>
1063: PetscErrorCode PetscHMapIJCreate(PetscHMapIJ *ht)
1065: Output Parameter:
1066: . ht - The hash table
1068: Level: developer
1070: .seealso: `PetscHMapIJCreateWithSize()`, `PetscHMapIJDestroy()`
1071: M*/
1073: /*MC
1074: PetscHMapIJCreateWithSize - Create a hash table with a given initial size
1076: Synopsis:
1077: #include <petsc/private/hashmapij.h>
1078: PetscErrorCode PetscHMapIJCreateWithSize(PetscInt n, PetscHMapIJ *ht)
1080: Input Parameter:
1081: . n - The size of the hash table
1083: Output Parameter:
1084: . ht - The hash table
1086: Level: developer
1088: Note:
1089: `n` must be non-negative.
1091: .seealso: `PetscHMapIJCreate()`, `PetscHMapIJDestroy()`
1092: M*/
1094: /*MC
1095: PetscHMapIJDestroy - Destroy a hash table
1097: Synopsis:
1098: #include <petsc/private/hashmapij.h>
1099: PetscErrorCode PetscHMapIJDestroy(PetscHMapIJ *ht)
1101: Input Parameter:
1102: . ht - The hash table
1104: Level: developer
1106: .seealso: `PetscHMapIJCreate()`, `PetscHMapIJCreateWithSize()`
1107: M*/
1109: /*MC
1110: PetscHMapIJReset - Reset a hash table
1112: Synopsis:
1113: #include <petsc/private/hashmapij.h>
1114: PetscErrorCode PetscHMapIJReset(PetscHMapIJ ht)
1116: Input Parameter:
1117: . ht - The hash table
1119: Level: developer
1121: .seealso: `PetscHMapIJClear()`
1122: M*/
1124: /*MC
1125: PetscHMapIJDuplicate - Duplicate a hash table
1127: Synopsis:
1128: #include <petsc/private/hashmapij.h>
1129: PetscErrorCode PetscHMapIJDuplicate(PetscHMapIJ ht, PetscHMapIJ *hd)
1131: Input Parameter:
1132: . ht - The source hash table
1134: Output Parameter:
1135: . ht - The duplicated hash table
1137: Level: developer
1139: .seealso: `PetscHMapIJCreate()`
1140: M*/
1142: /*MC
1143: PetscHMapIJClear - Clear a hash table
1145: Synopsis:
1146: #include <petsc/private/hashmapij.h>
1147: PetscErrorCode PetscHMapIJClear(PetscHMapIJ ht)
1149: Input Parameter:
1150: . ht - The hash table
1152: Level: developer
1154: .seealso: `PetscHMapIJReset()`
1155: M*/
1157: /*MC
1158: PetscHMapIJResize - Set the number of buckets in a hash table
1160: Synopsis:
1161: #include <petsc/private/hashmapij.h>
1162: PetscErrorCode PetscHMapIJResize(PetscHMapIJ ht, PetscInt nb)
1164: Input Parameters:
1165: + ht - The hash table
1166: - nb - The number of buckets
1168: Level: developer
1170: .seealso: `PetscHMapIJCreate()`
1171: M*/
1173: /*MC
1174: PetscHMapIJGetSize - Get the number of entries in a hash table
1176: Synopsis:
1177: #include <petsc/private/hashmapij.h>
1178: PetscErrorCode PetscHMapIJGetSize(PetscHMapIJ ht, PetscInt *n)
1180: Input Parameter:
1181: . ht - The hash table
1183: Output Parameter:
1184: . n - The number of entries
1186: Level: developer
1188: .seealso: `PetscHMapIJResize()`
1189: M*/
1191: /*MC
1192: PetscHMapIJGetCapacity - Get the current size of the array in the hash table
1194: Synopsis:
1195: #include <petsc/private/hashmapij.h>
1196: PetscErrorCode PetscHMapIJGetCapacity(PetscHMapIJ ht, PetscInt *n)
1198: Input Parameter:
1199: . ht - The hash table
1201: Output Parameter:
1202: . n - The capacity
1204: Level: developer
1206: .seealso: `PetscHMapIJResize()`, `PetscHMapIJGetSize()`
1207: M*/
1209: /*MC
1210: PetscHMapIJHas - Query for a key in the hash table
1212: Synopsis:
1213: #include <petsc/private/hashmapij.h>
1214: PetscErrorCode PetscHMapIJHas(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscBool *has)
1216: Input Parameters:
1217: + ht - The hash table
1218: - key - The key
1220: Output Parameter:
1221: . has - Boolean indicating whether key is in the hash table
1223: Level: developer
1225: .seealso: `PetscHMapIJGet()`, `PetscHMapIJGetWithDefault()`, `PetscHMapIJSet()`,
1226: `PetscHMapIJSetWithMode()`, `PetscHMapIJFind()`
1227: M*/
1229: /*MC
1230: PetscHMapIJGet - Get the value for a key in the hash table
1232: Synopsis:
1233: #include <petsc/private/hashmapij.h>
1234: PetscErrorCode PetscHMapIJGet(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscInt *val)
1236: Input Parameters:
1237: + ht - The hash table
1238: - key - The key
1240: Output Parameter:
1241: . val - The value
1243: Level: developer
1245: .seealso: `PetscHMapIJSet()`, `PetscHMapIJSetWithMode()`, `PetscHMapIJIterGet()`,
1246: `PetscHMapIJGetWithDefault()`
1247: M*/
1249: /*MC
1250: PetscHMapIJGetWithDefault - Get the value for a key in the hash table but override the default
1251: value returned if the key was not found
1253: Synopsis:
1254: #include <petsc/private/hashmapij.h>
1255: PetscErrorCode PetscHMapIJGetWithDefault(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscInt default_val, PetscInt *val)
1257: Input Parameters:
1258: + ht - The hash table
1259: . key - The key
1260: - default_val - The default value to set `val` to if `key` was not found
1262: Output Parameter:
1263: . val - The value
1265: Level: developer
1267: .seealso: `PetscHMapIJGet()`, `PetscHMapIJSet()`, `PetscHMapIJSetWithMode()`, `PetscHMapIJIterGet()`
1268: M*/
1271: /*MC
1272: PetscHMapIJSet - Set a (key,value) entry in the hash table
1274: Synopsis:
1275: #include <petsc/private/hashmapij.h>
1276: PetscErrorCode PetscHMapIJSet(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscInt val)
1278: Input Parameters:
1279: + ht - The hash table
1280: . key - The key
1281: - val - The value
1283: Level: developer
1285: .seealso: `PetscHMapIJGet()`, `PetscHMapIJSetWithMode()`, `PetscHMapIJGetWithDefault()`,
1286: `PetscHMapIJIterSet()`
1287: M*/
1289: /*MC
1290: PetscHMapIJSetWithMode - Set a (key,value) entry in the hash table according to an `InsertMode`
1292: Synopsis:
1293: #include <petsc/private/hashmapij.h>
1294: PetscErrorCode PetscHMapIJSetWithMode(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscInt val, InsertMode mode)
1296: Input Parameters:
1297: + ht - The hash table
1298: . key - The key
1299: . val - The value
1300: - mode - The insertion mode
1302: Level: developer
1304: Notes:
1305: `mode` may be any of the following\:
1306: - `INSERT_VALUES`\: this routine behaves identically to `PetscHMapIJSet()`.
1307: - `ADD_VALUES`\: if `key` is found `val` is added to the current entry, otherwise (`key`, `value`)
1308: is inserted into `ht` as-if-by `INSERT_VALUES`.
1309: - `MAX_VALUES`\: if `key` is found the current value is replaced by the maximum of `val` and the
1310: current entry, otherwise (`key`, `value`) is inserted into `ht` as-if-by
1311: `INSERT_VALUES`.
1312: - `MIN_VALUES`\: if `key` is found the current value is replaced by the minimum of `val` and the
1313: current entry, otherwise (`key`, `value`) is inserted into `ht` as-if-by
1314: `INSERT_VALUES`.
1316: All other `InsertMode` values raise an error.
1318: Since this routine relies on `+`, `<`, and `>` being well-formed for a particular type
1319: it is not available by default for all PETSc hash table instantiations. If a particular
1320: instantiation supports this routine it must define `PETSC_HMAPIJ_HAVE_EXTENDED_API` to
1321: `1`.
1323: .seealso: `PetscHMapIJSet()`, `PetscHMapIJGet()`, `PetscHMapIJGetWithDefault()`,
1324: `PetscHMapIJIterSet()`
1325: M*/
1327: /*MC
1328: PetscHMapIJDel - Remove a key and its value from the hash table
1330: Synopsis:
1331: #include <petsc/private/hashmapij.h>
1332: PetscErrorCode PetscHMapIJDel(PetscHMapIJ ht,struct {PetscInt i, j;} key)
1334: Input Parameters:
1335: + ht - The hash table
1336: - key - The key
1338: Level: developer
1340: .seealso: `PetscHMapIJHas()`, `PetscHMapIJIterDel()`
1341: M*/
1343: /*MC
1344: PetscHMapIJQuerySet - Query and set a (key,value) entry in the hash table
1346: Synopsis:
1347: #include <petsc/private/hashmapij.h>
1348: PetscErrorCode PetscHMapIJQuerySet(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscInt val, PetscBool *missing)
1350: Input Parameters:
1351: + ht - The hash table
1352: . key - The key
1353: - val - The value
1355: Output Parameter:
1356: . missing - Boolean indicating whether the key was missing
1358: Level: developer
1360: .seealso: `PetscHMapIJQueryDel()`, `PetscHMapIJSet()`, `PetscHMapIJSetWithMode()`
1361: M*/
1363: /*MC
1364: PetscHMapIJQueryDel - Query and remove a (key,value) entry from the hash table
1366: Synopsis:
1367: #include <petsc/private/hashmapij.h>
1368: PetscErrorCode PetscHMapIJQueryDel(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscBool *present)
1370: Input Parameters:
1371: + ht - The hash table
1372: - key - The key
1374: Output Parameter:
1375: . present - Boolean indicating whether the key was present
1377: Level: developer
1379: .seealso: `PetscHMapIJQuerySet()`, `PetscHMapIJDel()`
1380: M*/
1382: /*MC
1383: PetscHMapIJFind - Query for key in the hash table
1385: Synopsis:
1386: #include <petsc/private/hashmapij.h>
1387: PetscErrorCode PetscHMapIJFind(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscHashIter *iter, PetscBool *found)
1389: Input Parameters:
1390: + ht - The hash table
1391: - key - The key
1393: Output Parameters:
1394: + iter - Iterator referencing the value for key
1395: - found - Boolean indicating whether the key was present
1397: Level: developer
1399: .seealso: `PetscHMapIJIterGet()`, `PetscHMapIJIterDel()`
1400: M*/
1402: /*MC
1403: PetscHMapIJPut - Set a key in the hash table
1405: Synopsis:
1406: #include <petsc/private/hashmapij.h>
1407: PetscErrorCode PetscHMapIJPut(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscHashIter *iter, PetscBool *missing)
1409: Input Parameters:
1410: + ht - The hash table
1411: - key - The key
1413: Output Parameters:
1414: + iter - Iterator referencing the value for key
1415: - missing - Boolean indicating whether the key was missing
1417: Level: developer
1419: .seealso: `PetscHMapIJIterSet()`, `PetscHMapIJQuerySet()`, `PetscHMapIJSet()`,
1420: `PetscHMapIJSetWithMode()`
1421: M*/
1423: /*MC
1424: PetscHMapIJIterGet - Get the value referenced by an iterator in the hash table
1426: Synopsis:
1427: #include <petsc/private/hashmapij.h>
1428: PetscErrorCode PetscHMapIJIterGet(PetscHMapIJ ht, PetscHashIter iter, PetscInt *val)
1430: Input Parameters:
1431: + ht - The hash table
1432: - iter - The iterator
1434: Output Parameter:
1435: . val - The value
1437: Level: developer
1439: .seealso: `PetscHMapIJFind()`, `PetscHMapIJGet()`, `PetscHMapIJGetWithDefault()`
1440: M*/
1442: /*MC
1443: PetscHMapIJIterSet - Set the value referenced by an iterator in the hash
1445: Synopsis:
1446: #include <petsc/private/hashmapij.h>
1447: PetscErrorCode PetscHMapIJIterSet(PetscHMapIJ ht, PetscHashIter iter, PetscInt val)
1449: Input Parameters:
1450: + ht - The hash table
1451: . iter - The iterator
1452: - val - The value
1454: Level: developer
1456: .seealso: `PetscHMapIJPut()`, `PetscHMapIJQuerySet()`, `PetscHMapIJSet()`,
1457: `PetscHMapIJSetWithMode()`
1458: M*/
1460: /*MC
1461: PetscHMapIJIterDel - Remove the (key,value) referenced by an iterator from the hash table
1463: Synopsis:
1464: #include <petsc/private/hashmapij.h>
1465: PetscErrorCode PetscHMapIJIterDel(PetscHMapIJ ht, PetscHashIter iter)
1467: Input Parameters:
1468: + ht - The hash table
1469: - iter - The iterator
1471: Level: developer
1473: .seealso: `PetscHMapIJFind()`, `PetscHMapIJQueryDel()`, `PetscHMapIJDel()`
1474: M*/
1476: /*MC
1477: PetscHMapIJGetKeys - Get all keys from a hash table
1479: Synopsis:
1480: #include <petsc/private/hashmapij.h>
1481: PetscErrorCode PetscHMapIJGetKeys(PetscHMapIJ ht, PetscInt *off, struct {PetscInt i, j;} array[])
1483: Input Parameters:
1484: + ht - The hash table
1485: . off - Input offset in array (usually zero)
1486: - array - Array to put hash table keys in
1488: Output Parameters:
1489: + off - Output offset in array (output offset = input offset + hash table size)
1490: - array - Array filled with the hash table keys
1492: Level: developer
1494: .seealso: `PetscHSetIJGetSize()`, `PetscHMapIJGetVals()`
1495: M*/
1497: /*MC
1498: PetscHMapIJGetVals - Get all values from a hash table
1500: Synopsis:
1501: #include <petsc/private/hashmapij.h>
1502: PetscErrorCode PetscHMapIJGetVals(PetscHMapIJ ht, PetscInt *off, PetscInt array[])
1504: Input Parameters:
1505: + ht - The hash table
1506: . off - Input offset in array (usually zero)
1507: - array - Array to put hash table values in
1509: Output Parameters:
1510: + off - Output offset in array (output offset = input offset + hash table size)
1511: - array - Array filled with the hash table values
1513: Level: developer
1515: .seealso: `PetscHSetIJGetSize()`, `PetscHMapIJGetKeys()`
1516: M*/
1518: /*MC
1519: PetscHMapIJGetPairs - Get all (key,value) pairs from a hash table
1521: Synopsis:
1522: #include <petsc/private/hashmapij.h>
1523: PetscErrorCode PetscHMapIJGetPairs(PetscHMapIJ ht, PetscInt *off, struct {PetscInt i, j;} karray[], PetscInt varray[])
1525: Input Parameters:
1526: + ht - The hash table
1527: . off - Input offset in array (usually zero)
1528: . karray - Array to put hash table keys in
1529: - varray - Array to put hash table values in
1531: Output Parameters:
1532: + off - Output offset in array (output offset = input offset + hash table size)
1533: . karray - Array filled with the hash table keys
1534: - varray - Array filled with the hash table values
1536: Level: developer
1538: .seealso: `PetscHSetIJGetSize()`, `PetscHMapIJGetKeys()`, `PetscHMapIJGetVals()`
1539: M*/
1540: This file is processed by make allmanpages in $PETSC_DIR/makefile to create manual pages
1541: for the types and macros created by PETSC_HASH_MAP(). For example, PetscHMAPIJ.
1543: /*S
1544: PetscHMapIJ - Hash table map with a key of struct {PetscInt i, j;}
1546: Synopsis:
1547: typedef khash_t(HMapIJ) *PetscHMapIJ;
1549: Level: developer
1551: .seealso: `PETSC_HASH_MAP()`, `PetscHMapIJCreate()`, `PETSC_HASH_SET()`, `PetscHSetIJCreate()`
1552: S*/
1553: typedef struct _PetscHashIJ PetscHMapIJ;
1555: /*MC
1556: PetscHMapIJCreate - Create a hash table
1558: Synopsis:
1559: #include <petsc/private/hashmapij.h>
1560: PetscErrorCode PetscHMapIJCreate(PetscHMapIJ *ht)
1562: Output Parameter:
1563: . ht - The hash table
1565: Level: developer
1567: .seealso: `PetscHMapIJCreateWithSize()`, `PetscHMapIJDestroy()`
1568: M*/
1570: /*MC
1571: PetscHMapIJCreateWithSize - Create a hash table with a given initial size
1573: Synopsis:
1574: #include <petsc/private/hashmapij.h>
1575: PetscErrorCode PetscHMapIJCreateWithSize(PetscInt n, PetscHMapIJ *ht)
1577: Input Parameter:
1578: . n - The size of the hash table
1580: Output Parameter:
1581: . ht - The hash table
1583: Level: developer
1585: Note:
1586: `n` must be non-negative.
1588: .seealso: `PetscHMapIJCreate()`, `PetscHMapIJDestroy()`
1589: M*/
1591: /*MC
1592: PetscHMapIJDestroy - Destroy a hash table
1594: Synopsis:
1595: #include <petsc/private/hashmapij.h>
1596: PetscErrorCode PetscHMapIJDestroy(PetscHMapIJ *ht)
1598: Input Parameter:
1599: . ht - The hash table
1601: Level: developer
1603: .seealso: `PetscHMapIJCreate()`, `PetscHMapIJCreateWithSize()`
1604: M*/
1606: /*MC
1607: PetscHMapIJReset - Reset a hash table
1609: Synopsis:
1610: #include <petsc/private/hashmapij.h>
1611: PetscErrorCode PetscHMapIJReset(PetscHMapIJ ht)
1613: Input Parameter:
1614: . ht - The hash table
1616: Level: developer
1618: .seealso: `PetscHMapIJClear()`
1619: M*/
1621: /*MC
1622: PetscHMapIJDuplicate - Duplicate a hash table
1624: Synopsis:
1625: #include <petsc/private/hashmapij.h>
1626: PetscErrorCode PetscHMapIJDuplicate(PetscHMapIJ ht, PetscHMapIJ *hd)
1628: Input Parameter:
1629: . ht - The source hash table
1631: Output Parameter:
1632: . ht - The duplicated hash table
1634: Level: developer
1636: .seealso: `PetscHMapIJCreate()`
1637: M*/
1639: /*MC
1640: PetscHMapIJClear - Clear a hash table
1642: Synopsis:
1643: #include <petsc/private/hashmapij.h>
1644: PetscErrorCode PetscHMapIJClear(PetscHMapIJ ht)
1646: Input Parameter:
1647: . ht - The hash table
1649: Level: developer
1651: .seealso: `PetscHMapIJReset()`
1652: M*/
1654: /*MC
1655: PetscHMapIJResize - Set the number of buckets in a hash table
1657: Synopsis:
1658: #include <petsc/private/hashmapij.h>
1659: PetscErrorCode PetscHMapIJResize(PetscHMapIJ ht, PetscInt nb)
1661: Input Parameters:
1662: + ht - The hash table
1663: - nb - The number of buckets
1665: Level: developer
1667: .seealso: `PetscHMapIJCreate()`
1668: M*/
1670: /*MC
1671: PetscHMapIJGetSize - Get the number of entries in a hash table
1673: Synopsis:
1674: #include <petsc/private/hashmapij.h>
1675: PetscErrorCode PetscHMapIJGetSize(PetscHMapIJ ht, PetscInt *n)
1677: Input Parameter:
1678: . ht - The hash table
1680: Output Parameter:
1681: . n - The number of entries
1683: Level: developer
1685: .seealso: `PetscHMapIJResize()`
1686: M*/
1688: /*MC
1689: PetscHMapIJGetCapacity - Get the current size of the array in the hash table
1691: Synopsis:
1692: #include <petsc/private/hashmapij.h>
1693: PetscErrorCode PetscHMapIJGetCapacity(PetscHMapIJ ht, PetscInt *n)
1695: Input Parameter:
1696: . ht - The hash table
1698: Output Parameter:
1699: . n - The capacity
1701: Level: developer
1703: .seealso: `PetscHMapIJResize()`, `PetscHMapIJGetSize()`
1704: M*/
1706: /*MC
1707: PetscHMapIJHas - Query for a key in the hash table
1709: Synopsis:
1710: #include <petsc/private/hashmapij.h>
1711: PetscErrorCode PetscHMapIJHas(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscBool *has)
1713: Input Parameters:
1714: + ht - The hash table
1715: - key - The key
1717: Output Parameter:
1718: . has - Boolean indicating whether key is in the hash table
1720: Level: developer
1722: .seealso: `PetscHMapIJGet()`, `PetscHMapIJGetWithDefault()`, `PetscHMapIJSet()`,
1723: `PetscHMapIJSetWithMode()`, `PetscHMapIJFind()`
1724: M*/
1726: /*MC
1727: PetscHMapIJGet - Get the value for a key in the hash table
1729: Synopsis:
1730: #include <petsc/private/hashmapij.h>
1731: PetscErrorCode PetscHMapIJGet(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscScalar *val)
1733: Input Parameters:
1734: + ht - The hash table
1735: - key - The key
1737: Output Parameter:
1738: . val - The value
1740: Level: developer
1742: .seealso: `PetscHMapIJSet()`, `PetscHMapIJSetWithMode()`, `PetscHMapIJIterGet()`,
1743: `PetscHMapIJGetWithDefault()`
1744: M*/
1746: /*MC
1747: PetscHMapIJGetWithDefault - Get the value for a key in the hash table but override the default
1748: value returned if the key was not found
1750: Synopsis:
1751: #include <petsc/private/hashmapij.h>
1752: PetscErrorCode PetscHMapIJGetWithDefault(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscScalar default_val, PetscScalar *val)
1754: Input Parameters:
1755: + ht - The hash table
1756: . key - The key
1757: - default_val - The default value to set `val` to if `key` was not found
1759: Output Parameter:
1760: . val - The value
1762: Level: developer
1764: .seealso: `PetscHMapIJGet()`, `PetscHMapIJSet()`, `PetscHMapIJSetWithMode()`, `PetscHMapIJIterGet()`
1765: M*/
1768: /*MC
1769: PetscHMapIJSet - Set a (key,value) entry in the hash table
1771: Synopsis:
1772: #include <petsc/private/hashmapij.h>
1773: PetscErrorCode PetscHMapIJSet(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscScalar val)
1775: Input Parameters:
1776: + ht - The hash table
1777: . key - The key
1778: - val - The value
1780: Level: developer
1782: .seealso: `PetscHMapIJGet()`, `PetscHMapIJSetWithMode()`, `PetscHMapIJGetWithDefault()`,
1783: `PetscHMapIJIterSet()`
1784: M*/
1786: /*MC
1787: PetscHMapIJSetWithMode - Set a (key,value) entry in the hash table according to an `InsertMode`
1789: Synopsis:
1790: #include <petsc/private/hashmapij.h>
1791: PetscErrorCode PetscHMapIJSetWithMode(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscScalar val, InsertMode mode)
1793: Input Parameters:
1794: + ht - The hash table
1795: . key - The key
1796: . val - The value
1797: - mode - The insertion mode
1799: Level: developer
1801: Notes:
1802: `mode` may be any of the following\:
1803: - `INSERT_VALUES`\: this routine behaves identically to `PetscHMapIJSet()`.
1804: - `ADD_VALUES`\: if `key` is found `val` is added to the current entry, otherwise (`key`, `value`)
1805: is inserted into `ht` as-if-by `INSERT_VALUES`.
1806: - `MAX_VALUES`\: if `key` is found the current value is replaced by the maximum of `val` and the
1807: current entry, otherwise (`key`, `value`) is inserted into `ht` as-if-by
1808: `INSERT_VALUES`.
1809: - `MIN_VALUES`\: if `key` is found the current value is replaced by the minimum of `val` and the
1810: current entry, otherwise (`key`, `value`) is inserted into `ht` as-if-by
1811: `INSERT_VALUES`.
1813: All other `InsertMode` values raise an error.
1815: Since this routine relies on `+`, `<`, and `>` being well-formed for a particular type
1816: it is not available by default for all PETSc hash table instantiations. If a particular
1817: instantiation supports this routine it must define `PETSC_HMAPIJ_HAVE_EXTENDED_API` to
1818: `1`.
1820: .seealso: `PetscHMapIJSet()`, `PetscHMapIJGet()`, `PetscHMapIJGetWithDefault()`,
1821: `PetscHMapIJIterSet()`
1822: M*/
1824: /*MC
1825: PetscHMapIJDel - Remove a key and its value from the hash table
1827: Synopsis:
1828: #include <petsc/private/hashmapij.h>
1829: PetscErrorCode PetscHMapIJDel(PetscHMapIJ ht,struct {PetscInt i, j;} key)
1831: Input Parameters:
1832: + ht - The hash table
1833: - key - The key
1835: Level: developer
1837: .seealso: `PetscHMapIJHas()`, `PetscHMapIJIterDel()`
1838: M*/
1840: /*MC
1841: PetscHMapIJQuerySet - Query and set a (key,value) entry in the hash table
1843: Synopsis:
1844: #include <petsc/private/hashmapij.h>
1845: PetscErrorCode PetscHMapIJQuerySet(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscScalar val, PetscBool *missing)
1847: Input Parameters:
1848: + ht - The hash table
1849: . key - The key
1850: - val - The value
1852: Output Parameter:
1853: . missing - Boolean indicating whether the key was missing
1855: Level: developer
1857: .seealso: `PetscHMapIJQueryDel()`, `PetscHMapIJSet()`, `PetscHMapIJSetWithMode()`
1858: M*/
1860: /*MC
1861: PetscHMapIJQueryDel - Query and remove a (key,value) entry from the hash table
1863: Synopsis:
1864: #include <petsc/private/hashmapij.h>
1865: PetscErrorCode PetscHMapIJQueryDel(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscBool *present)
1867: Input Parameters:
1868: + ht - The hash table
1869: - key - The key
1871: Output Parameter:
1872: . present - Boolean indicating whether the key was present
1874: Level: developer
1876: .seealso: `PetscHMapIJQuerySet()`, `PetscHMapIJDel()`
1877: M*/
1879: /*MC
1880: PetscHMapIJFind - Query for key in the hash table
1882: Synopsis:
1883: #include <petsc/private/hashmapij.h>
1884: PetscErrorCode PetscHMapIJFind(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscHashIter *iter, PetscBool *found)
1886: Input Parameters:
1887: + ht - The hash table
1888: - key - The key
1890: Output Parameters:
1891: + iter - Iterator referencing the value for key
1892: - found - Boolean indicating whether the key was present
1894: Level: developer
1896: .seealso: `PetscHMapIJIterGet()`, `PetscHMapIJIterDel()`
1897: M*/
1899: /*MC
1900: PetscHMapIJPut - Set a key in the hash table
1902: Synopsis:
1903: #include <petsc/private/hashmapij.h>
1904: PetscErrorCode PetscHMapIJPut(PetscHMapIJ ht, struct {PetscInt i, j;} key, PetscHashIter *iter, PetscBool *missing)
1906: Input Parameters:
1907: + ht - The hash table
1908: - key - The key
1910: Output Parameters:
1911: + iter - Iterator referencing the value for key
1912: - missing - Boolean indicating whether the key was missing
1914: Level: developer
1916: .seealso: `PetscHMapIJIterSet()`, `PetscHMapIJQuerySet()`, `PetscHMapIJSet()`,
1917: `PetscHMapIJSetWithMode()`
1918: M*/
1920: /*MC
1921: PetscHMapIJIterGet - Get the value referenced by an iterator in the hash table
1923: Synopsis:
1924: #include <petsc/private/hashmapij.h>
1925: PetscErrorCode PetscHMapIJIterGet(PetscHMapIJ ht, PetscHashIter iter, PetscScalar *val)
1927: Input Parameters:
1928: + ht - The hash table
1929: - iter - The iterator
1931: Output Parameter:
1932: . val - The value
1934: Level: developer
1936: .seealso: `PetscHMapIJFind()`, `PetscHMapIJGet()`, `PetscHMapIJGetWithDefault()`
1937: M*/
1939: /*MC
1940: PetscHMapIJIterSet - Set the value referenced by an iterator in the hash
1942: Synopsis:
1943: #include <petsc/private/hashmapij.h>
1944: PetscErrorCode PetscHMapIJIterSet(PetscHMapIJ ht, PetscHashIter iter, PetscScalar val)
1946: Input Parameters:
1947: + ht - The hash table
1948: . iter - The iterator
1949: - val - The value
1951: Level: developer
1953: .seealso: `PetscHMapIJPut()`, `PetscHMapIJQuerySet()`, `PetscHMapIJSet()`,
1954: `PetscHMapIJSetWithMode()`
1955: M*/
1957: /*MC
1958: PetscHMapIJIterDel - Remove the (key,value) referenced by an iterator from the hash table
1960: Synopsis:
1961: #include <petsc/private/hashmapij.h>
1962: PetscErrorCode PetscHMapIJIterDel(PetscHMapIJ ht, PetscHashIter iter)
1964: Input Parameters:
1965: + ht - The hash table
1966: - iter - The iterator
1968: Level: developer
1970: .seealso: `PetscHMapIJFind()`, `PetscHMapIJQueryDel()`, `PetscHMapIJDel()`
1971: M*/
1973: /*MC
1974: PetscHMapIJGetKeys - Get all keys from a hash table
1976: Synopsis:
1977: #include <petsc/private/hashmapij.h>
1978: PetscErrorCode PetscHMapIJGetKeys(PetscHMapIJ ht, PetscInt *off, struct {PetscInt i, j;} array[])
1980: Input Parameters:
1981: + ht - The hash table
1982: . off - Input offset in array (usually zero)
1983: - array - Array to put hash table keys in
1985: Output Parameters:
1986: + off - Output offset in array (output offset = input offset + hash table size)
1987: - array - Array filled with the hash table keys
1989: Level: developer
1991: .seealso: `PetscHSetIJGetSize()`, `PetscHMapIJGetVals()`
1992: M*/
1994: /*MC
1995: PetscHMapIJGetVals - Get all values from a hash table
1997: Synopsis:
1998: #include <petsc/private/hashmapij.h>
1999: PetscErrorCode PetscHMapIJGetVals(PetscHMapIJ ht, PetscInt *off, PetscScalar array[])
2001: Input Parameters:
2002: + ht - The hash table
2003: . off - Input offset in array (usually zero)
2004: - array - Array to put hash table values in
2006: Output Parameters:
2007: + off - Output offset in array (output offset = input offset + hash table size)
2008: - array - Array filled with the hash table values
2010: Level: developer
2012: .seealso: `PetscHSetIJGetSize()`, `PetscHMapIJGetKeys()`
2013: M*/
2015: /*MC
2016: PetscHMapIJGetPairs - Get all (key,value) pairs from a hash table
2018: Synopsis:
2019: #include <petsc/private/hashmapij.h>
2020: PetscErrorCode PetscHMapIJGetPairs(PetscHMapIJ ht, PetscInt *off, struct {PetscInt i, j;} karray[], PetscScalar varray[])
2022: Input Parameters:
2023: + ht - The hash table
2024: . off - Input offset in array (usually zero)
2025: . karray - Array to put hash table keys in
2026: - varray - Array to put hash table values in
2028: Output Parameters:
2029: + off - Output offset in array (output offset = input offset + hash table size)
2030: . karray - Array filled with the hash table keys
2031: - varray - Array filled with the hash table values
2033: Level: developer
2035: .seealso: `PetscHSetIJGetSize()`, `PetscHMapIJGetKeys()`, `PetscHMapIJGetVals()`
2036: M*/
2037: This file is processed by make allmanpages in $PETSC_DIR/makefile to create manual pages
2038: for the types and macros created by PETSC_HASH_MAP(). For example, PetscHMAPIJ.
2040: /*S
2041: PetscHMapIV - Hash table map with a key of PetscInt
2043: Synopsis:
2044: typedef khash_t(HMapIV) *PetscHMapIV;
2046: Level: developer
2048: .seealso: `PETSC_HASH_MAP()`, `PetscHMapIVCreate()`, `PETSC_HASH_SET()`, `PetscHSetIVCreate()`
2049: S*/
2050: typedef struct _PetscHashIV PetscHMapIV;
2052: /*MC
2053: PetscHMapIVCreate - Create a hash table
2055: Synopsis:
2056: #include <petsc/private/hashmapiv.h>
2057: PetscErrorCode PetscHMapIVCreate(PetscHMapIV *ht)
2059: Output Parameter:
2060: . ht - The hash table
2062: Level: developer
2064: .seealso: `PetscHMapIVCreateWithSize()`, `PetscHMapIVDestroy()`
2065: M*/
2067: /*MC
2068: PetscHMapIVCreateWithSize - Create a hash table with a given initial size
2070: Synopsis:
2071: #include <petsc/private/hashmapiv.h>
2072: PetscErrorCode PetscHMapIVCreateWithSize(PetscInt n, PetscHMapIV *ht)
2074: Input Parameter:
2075: . n - The size of the hash table
2077: Output Parameter:
2078: . ht - The hash table
2080: Level: developer
2082: Note:
2083: `n` must be non-negative.
2085: .seealso: `PetscHMapIVCreate()`, `PetscHMapIVDestroy()`
2086: M*/
2088: /*MC
2089: PetscHMapIVDestroy - Destroy a hash table
2091: Synopsis:
2092: #include <petsc/private/hashmapiv.h>
2093: PetscErrorCode PetscHMapIVDestroy(PetscHMapIV *ht)
2095: Input Parameter:
2096: . ht - The hash table
2098: Level: developer
2100: .seealso: `PetscHMapIVCreate()`, `PetscHMapIVCreateWithSize()`
2101: M*/
2103: /*MC
2104: PetscHMapIVReset - Reset a hash table
2106: Synopsis:
2107: #include <petsc/private/hashmapiv.h>
2108: PetscErrorCode PetscHMapIVReset(PetscHMapIV ht)
2110: Input Parameter:
2111: . ht - The hash table
2113: Level: developer
2115: .seealso: `PetscHMapIVClear()`
2116: M*/
2118: /*MC
2119: PetscHMapIVDuplicate - Duplicate a hash table
2121: Synopsis:
2122: #include <petsc/private/hashmapiv.h>
2123: PetscErrorCode PetscHMapIVDuplicate(PetscHMapIV ht, PetscHMapIV *hd)
2125: Input Parameter:
2126: . ht - The source hash table
2128: Output Parameter:
2129: . ht - The duplicated hash table
2131: Level: developer
2133: .seealso: `PetscHMapIVCreate()`
2134: M*/
2136: /*MC
2137: PetscHMapIVClear - Clear a hash table
2139: Synopsis:
2140: #include <petsc/private/hashmapiv.h>
2141: PetscErrorCode PetscHMapIVClear(PetscHMapIV ht)
2143: Input Parameter:
2144: . ht - The hash table
2146: Level: developer
2148: .seealso: `PetscHMapIVReset()`
2149: M*/
2151: /*MC
2152: PetscHMapIVResize - Set the number of buckets in a hash table
2154: Synopsis:
2155: #include <petsc/private/hashmapiv.h>
2156: PetscErrorCode PetscHMapIVResize(PetscHMapIV ht, PetscInt nb)
2158: Input Parameters:
2159: + ht - The hash table
2160: - nb - The number of buckets
2162: Level: developer
2164: .seealso: `PetscHMapIVCreate()`
2165: M*/
2167: /*MC
2168: PetscHMapIVGetSize - Get the number of entries in a hash table
2170: Synopsis:
2171: #include <petsc/private/hashmapiv.h>
2172: PetscErrorCode PetscHMapIVGetSize(PetscHMapIV ht, PetscInt *n)
2174: Input Parameter:
2175: . ht - The hash table
2177: Output Parameter:
2178: . n - The number of entries
2180: Level: developer
2182: .seealso: `PetscHMapIVResize()`
2183: M*/
2185: /*MC
2186: PetscHMapIVGetCapacity - Get the current size of the array in the hash table
2188: Synopsis:
2189: #include <petsc/private/hashmapiv.h>
2190: PetscErrorCode PetscHMapIVGetCapacity(PetscHMapIV ht, PetscInt *n)
2192: Input Parameter:
2193: . ht - The hash table
2195: Output Parameter:
2196: . n - The capacity
2198: Level: developer
2200: .seealso: `PetscHMapIVResize()`, `PetscHMapIVGetSize()`
2201: M*/
2203: /*MC
2204: PetscHMapIVHas - Query for a key in the hash table
2206: Synopsis:
2207: #include <petsc/private/hashmapiv.h>
2208: PetscErrorCode PetscHMapIVHas(PetscHMapIV ht, PetscInt key, PetscBool *has)
2210: Input Parameters:
2211: + ht - The hash table
2212: - key - The key
2214: Output Parameter:
2215: . has - Boolean indicating whether key is in the hash table
2217: Level: developer
2219: .seealso: `PetscHMapIVGet()`, `PetscHMapIVGetWithDefault()`, `PetscHMapIVSet()`,
2220: `PetscHMapIVSetWithMode()`, `PetscHMapIVFind()`
2221: M*/
2223: /*MC
2224: PetscHMapIVGet - Get the value for a key in the hash table
2226: Synopsis:
2227: #include <petsc/private/hashmapiv.h>
2228: PetscErrorCode PetscHMapIVGet(PetscHMapIV ht, PetscInt key, PetscScalar *val)
2230: Input Parameters:
2231: + ht - The hash table
2232: - key - The key
2234: Output Parameter:
2235: . val - The value
2237: Level: developer
2239: .seealso: `PetscHMapIVSet()`, `PetscHMapIVSetWithMode()`, `PetscHMapIVIterGet()`,
2240: `PetscHMapIVGetWithDefault()`
2241: M*/
2243: /*MC
2244: PetscHMapIVGetWithDefault - Get the value for a key in the hash table but override the default
2245: value returned if the key was not found
2247: Synopsis:
2248: #include <petsc/private/hashmapiv.h>
2249: PetscErrorCode PetscHMapIVGetWithDefault(PetscHMapIV ht, PetscInt key, PetscScalar default_val, PetscScalar *val)
2251: Input Parameters:
2252: + ht - The hash table
2253: . key - The key
2254: - default_val - The default value to set `val` to if `key` was not found
2256: Output Parameter:
2257: . val - The value
2259: Level: developer
2261: .seealso: `PetscHMapIVGet()`, `PetscHMapIVSet()`, `PetscHMapIVSetWithMode()`, `PetscHMapIVIterGet()`
2262: M*/
2265: /*MC
2266: PetscHMapIVSet - Set a (key,value) entry in the hash table
2268: Synopsis:
2269: #include <petsc/private/hashmapiv.h>
2270: PetscErrorCode PetscHMapIVSet(PetscHMapIV ht, PetscInt key, PetscScalar val)
2272: Input Parameters:
2273: + ht - The hash table
2274: . key - The key
2275: - val - The value
2277: Level: developer
2279: .seealso: `PetscHMapIVGet()`, `PetscHMapIVSetWithMode()`, `PetscHMapIVGetWithDefault()`,
2280: `PetscHMapIVIterSet()`
2281: M*/
2283: /*MC
2284: PetscHMapIVSetWithMode - Set a (key,value) entry in the hash table according to an `InsertMode`
2286: Synopsis:
2287: #include <petsc/private/hashmapiv.h>
2288: PetscErrorCode PetscHMapIVSetWithMode(PetscHMapIV ht, PetscInt key, PetscScalar val, InsertMode mode)
2290: Input Parameters:
2291: + ht - The hash table
2292: . key - The key
2293: . val - The value
2294: - mode - The insertion mode
2296: Level: developer
2298: Notes:
2299: `mode` may be any of the following\:
2300: - `INSERT_VALUES`\: this routine behaves identically to `PetscHMapIVSet()`.
2301: - `ADD_VALUES`\: if `key` is found `val` is added to the current entry, otherwise (`key`, `value`)
2302: is inserted into `ht` as-if-by `INSERT_VALUES`.
2303: - `MAX_VALUES`\: if `key` is found the current value is replaced by the maximum of `val` and the
2304: current entry, otherwise (`key`, `value`) is inserted into `ht` as-if-by
2305: `INSERT_VALUES`.
2306: - `MIN_VALUES`\: if `key` is found the current value is replaced by the minimum of `val` and the
2307: current entry, otherwise (`key`, `value`) is inserted into `ht` as-if-by
2308: `INSERT_VALUES`.
2310: All other `InsertMode` values raise an error.
2312: Since this routine relies on `+`, `<`, and `>` being well-formed for a particular type
2313: it is not available by default for all PETSc hash table instantiations. If a particular
2314: instantiation supports this routine it must define `PETSC_HMAPIV_HAVE_EXTENDED_API` to
2315: `1`.
2317: .seealso: `PetscHMapIVSet()`, `PetscHMapIVGet()`, `PetscHMapIVGetWithDefault()`,
2318: `PetscHMapIVIterSet()`
2319: M*/
2321: /*MC
2322: PetscHMapIVDel - Remove a key and its value from the hash table
2324: Synopsis:
2325: #include <petsc/private/hashmapiv.h>
2326: PetscErrorCode PetscHMapIVDel(PetscHMapIV ht,PetscInt key)
2328: Input Parameters:
2329: + ht - The hash table
2330: - key - The key
2332: Level: developer
2334: .seealso: `PetscHMapIVHas()`, `PetscHMapIVIterDel()`
2335: M*/
2337: /*MC
2338: PetscHMapIVQuerySet - Query and set a (key,value) entry in the hash table
2340: Synopsis:
2341: #include <petsc/private/hashmapiv.h>
2342: PetscErrorCode PetscHMapIVQuerySet(PetscHMapIV ht, PetscInt key, PetscScalar val, PetscBool *missing)
2344: Input Parameters:
2345: + ht - The hash table
2346: . key - The key
2347: - val - The value
2349: Output Parameter:
2350: . missing - Boolean indicating whether the key was missing
2352: Level: developer
2354: .seealso: `PetscHMapIVQueryDel()`, `PetscHMapIVSet()`, `PetscHMapIVSetWithMode()`
2355: M*/
2357: /*MC
2358: PetscHMapIVQueryDel - Query and remove a (key,value) entry from the hash table
2360: Synopsis:
2361: #include <petsc/private/hashmapiv.h>
2362: PetscErrorCode PetscHMapIVQueryDel(PetscHMapIV ht, PetscInt key, PetscBool *present)
2364: Input Parameters:
2365: + ht - The hash table
2366: - key - The key
2368: Output Parameter:
2369: . present - Boolean indicating whether the key was present
2371: Level: developer
2373: .seealso: `PetscHMapIVQuerySet()`, `PetscHMapIVDel()`
2374: M*/
2376: /*MC
2377: PetscHMapIVFind - Query for key in the hash table
2379: Synopsis:
2380: #include <petsc/private/hashmapiv.h>
2381: PetscErrorCode PetscHMapIVFind(PetscHMapIV ht, PetscInt key, PetscHashIter *iter, PetscBool *found)
2383: Input Parameters:
2384: + ht - The hash table
2385: - key - The key
2387: Output Parameters:
2388: + iter - Iterator referencing the value for key
2389: - found - Boolean indicating whether the key was present
2391: Level: developer
2393: .seealso: `PetscHMapIVIterGet()`, `PetscHMapIVIterDel()`
2394: M*/
2396: /*MC
2397: PetscHMapIVPut - Set a key in the hash table
2399: Synopsis:
2400: #include <petsc/private/hashmapiv.h>
2401: PetscErrorCode PetscHMapIVPut(PetscHMapIV ht, PetscInt key, PetscHashIter *iter, PetscBool *missing)
2403: Input Parameters:
2404: + ht - The hash table
2405: - key - The key
2407: Output Parameters:
2408: + iter - Iterator referencing the value for key
2409: - missing - Boolean indicating whether the key was missing
2411: Level: developer
2413: .seealso: `PetscHMapIVIterSet()`, `PetscHMapIVQuerySet()`, `PetscHMapIVSet()`,
2414: `PetscHMapIVSetWithMode()`
2415: M*/
2417: /*MC
2418: PetscHMapIVIterGet - Get the value referenced by an iterator in the hash table
2420: Synopsis:
2421: #include <petsc/private/hashmapiv.h>
2422: PetscErrorCode PetscHMapIVIterGet(PetscHMapIV ht, PetscHashIter iter, PetscScalar *val)
2424: Input Parameters:
2425: + ht - The hash table
2426: - iter - The iterator
2428: Output Parameter:
2429: . val - The value
2431: Level: developer
2433: .seealso: `PetscHMapIVFind()`, `PetscHMapIVGet()`, `PetscHMapIVGetWithDefault()`
2434: M*/
2436: /*MC
2437: PetscHMapIVIterSet - Set the value referenced by an iterator in the hash
2439: Synopsis:
2440: #include <petsc/private/hashmapiv.h>
2441: PetscErrorCode PetscHMapIVIterSet(PetscHMapIV ht, PetscHashIter iter, PetscScalar val)
2443: Input Parameters:
2444: + ht - The hash table
2445: . iter - The iterator
2446: - val - The value
2448: Level: developer
2450: .seealso: `PetscHMapIVPut()`, `PetscHMapIVQuerySet()`, `PetscHMapIVSet()`,
2451: `PetscHMapIVSetWithMode()`
2452: M*/
2454: /*MC
2455: PetscHMapIVIterDel - Remove the (key,value) referenced by an iterator from the hash table
2457: Synopsis:
2458: #include <petsc/private/hashmapiv.h>
2459: PetscErrorCode PetscHMapIVIterDel(PetscHMapIV ht, PetscHashIter iter)
2461: Input Parameters:
2462: + ht - The hash table
2463: - iter - The iterator
2465: Level: developer
2467: .seealso: `PetscHMapIVFind()`, `PetscHMapIVQueryDel()`, `PetscHMapIVDel()`
2468: M*/
2470: /*MC
2471: PetscHMapIVGetKeys - Get all keys from a hash table
2473: Synopsis:
2474: #include <petsc/private/hashmapiv.h>
2475: PetscErrorCode PetscHMapIVGetKeys(PetscHMapIV ht, PetscInt *off, PetscInt array[])
2477: Input Parameters:
2478: + ht - The hash table
2479: . off - Input offset in array (usually zero)
2480: - array - Array to put hash table keys in
2482: Output Parameters:
2483: + off - Output offset in array (output offset = input offset + hash table size)
2484: - array - Array filled with the hash table keys
2486: Level: developer
2488: .seealso: `PetscHSetIVGetSize()`, `PetscHMapIVGetVals()`
2489: M*/
2491: /*MC
2492: PetscHMapIVGetVals - Get all values from a hash table
2494: Synopsis:
2495: #include <petsc/private/hashmapiv.h>
2496: PetscErrorCode PetscHMapIVGetVals(PetscHMapIV ht, PetscInt *off, PetscScalar array[])
2498: Input Parameters:
2499: + ht - The hash table
2500: . off - Input offset in array (usually zero)
2501: - array - Array to put hash table values in
2503: Output Parameters:
2504: + off - Output offset in array (output offset = input offset + hash table size)
2505: - array - Array filled with the hash table values
2507: Level: developer
2509: .seealso: `PetscHSetIVGetSize()`, `PetscHMapIVGetKeys()`
2510: M*/
2512: /*MC
2513: PetscHMapIVGetPairs - Get all (key,value) pairs from a hash table
2515: Synopsis:
2516: #include <petsc/private/hashmapiv.h>
2517: PetscErrorCode PetscHMapIVGetPairs(PetscHMapIV ht, PetscInt *off, PetscInt karray[], PetscScalar varray[])
2519: Input Parameters:
2520: + ht - The hash table
2521: . off - Input offset in array (usually zero)
2522: . karray - Array to put hash table keys in
2523: - varray - Array to put hash table values in
2525: Output Parameters:
2526: + off - Output offset in array (output offset = input offset + hash table size)
2527: . karray - Array filled with the hash table keys
2528: - varray - Array filled with the hash table values
2530: Level: developer
2532: .seealso: `PetscHSetIVGetSize()`, `PetscHMapIVGetKeys()`, `PetscHMapIVGetVals()`
2533: M*/
2534: This file is processed by make allmanpages in $PETSC_DIR/makefile to create manual pages
2535: for the types and macros created by PETSC_HASH_MAP(). For example, PetscHMAPIJ.
2537: /*S
2538: PetscHMapObj - Hash table map with a key of PetscInt64
2540: Synopsis:
2541: typedef khash_t(HMapObj) *PetscHMapObj;
2543: Level: developer
2545: .seealso: `PETSC_HASH_MAP()`, `PetscHMapObjCreate()`, `PETSC_HASH_SET()`, `PetscHSetObjCreate()`
2546: S*/
2547: typedef struct _PetscHashObj PetscHMapObj;
2549: /*MC
2550: PetscHMapObjCreate - Create a hash table
2552: Synopsis:
2553: #include <petsc/private/hashmapobj.h>
2554: PetscErrorCode PetscHMapObjCreate(PetscHMapObj *ht)
2556: Output Parameter:
2557: . ht - The hash table
2559: Level: developer
2561: .seealso: `PetscHMapObjCreateWithSize()`, `PetscHMapObjDestroy()`
2562: M*/
2564: /*MC
2565: PetscHMapObjCreateWithSize - Create a hash table with a given initial size
2567: Synopsis:
2568: #include <petsc/private/hashmapobj.h>
2569: PetscErrorCode PetscHMapObjCreateWithSize(PetscInt n, PetscHMapObj *ht)
2571: Input Parameter:
2572: . n - The size of the hash table
2574: Output Parameter:
2575: . ht - The hash table
2577: Level: developer
2579: Note:
2580: `n` must be non-negative.
2582: .seealso: `PetscHMapObjCreate()`, `PetscHMapObjDestroy()`
2583: M*/
2585: /*MC
2586: PetscHMapObjDestroy - Destroy a hash table
2588: Synopsis:
2589: #include <petsc/private/hashmapobj.h>
2590: PetscErrorCode PetscHMapObjDestroy(PetscHMapObj *ht)
2592: Input Parameter:
2593: . ht - The hash table
2595: Level: developer
2597: .seealso: `PetscHMapObjCreate()`, `PetscHMapObjCreateWithSize()`
2598: M*/
2600: /*MC
2601: PetscHMapObjReset - Reset a hash table
2603: Synopsis:
2604: #include <petsc/private/hashmapobj.h>
2605: PetscErrorCode PetscHMapObjReset(PetscHMapObj ht)
2607: Input Parameter:
2608: . ht - The hash table
2610: Level: developer
2612: .seealso: `PetscHMapObjClear()`
2613: M*/
2615: /*MC
2616: PetscHMapObjDuplicate - Duplicate a hash table
2618: Synopsis:
2619: #include <petsc/private/hashmapobj.h>
2620: PetscErrorCode PetscHMapObjDuplicate(PetscHMapObj ht, PetscHMapObj *hd)
2622: Input Parameter:
2623: . ht - The source hash table
2625: Output Parameter:
2626: . ht - The duplicated hash table
2628: Level: developer
2630: .seealso: `PetscHMapObjCreate()`
2631: M*/
2633: /*MC
2634: PetscHMapObjClear - Clear a hash table
2636: Synopsis:
2637: #include <petsc/private/hashmapobj.h>
2638: PetscErrorCode PetscHMapObjClear(PetscHMapObj ht)
2640: Input Parameter:
2641: . ht - The hash table
2643: Level: developer
2645: .seealso: `PetscHMapObjReset()`
2646: M*/
2648: /*MC
2649: PetscHMapObjResize - Set the number of buckets in a hash table
2651: Synopsis:
2652: #include <petsc/private/hashmapobj.h>
2653: PetscErrorCode PetscHMapObjResize(PetscHMapObj ht, PetscInt nb)
2655: Input Parameters:
2656: + ht - The hash table
2657: - nb - The number of buckets
2659: Level: developer
2661: .seealso: `PetscHMapObjCreate()`
2662: M*/
2664: /*MC
2665: PetscHMapObjGetSize - Get the number of entries in a hash table
2667: Synopsis:
2668: #include <petsc/private/hashmapobj.h>
2669: PetscErrorCode PetscHMapObjGetSize(PetscHMapObj ht, PetscInt *n)
2671: Input Parameter:
2672: . ht - The hash table
2674: Output Parameter:
2675: . n - The number of entries
2677: Level: developer
2679: .seealso: `PetscHMapObjResize()`
2680: M*/
2682: /*MC
2683: PetscHMapObjGetCapacity - Get the current size of the array in the hash table
2685: Synopsis:
2686: #include <petsc/private/hashmapobj.h>
2687: PetscErrorCode PetscHMapObjGetCapacity(PetscHMapObj ht, PetscInt *n)
2689: Input Parameter:
2690: . ht - The hash table
2692: Output Parameter:
2693: . n - The capacity
2695: Level: developer
2697: .seealso: `PetscHMapObjResize()`, `PetscHMapObjGetSize()`
2698: M*/
2700: /*MC
2701: PetscHMapObjHas - Query for a key in the hash table
2703: Synopsis:
2704: #include <petsc/private/hashmapobj.h>
2705: PetscErrorCode PetscHMapObjHas(PetscHMapObj ht, PetscInt64 key, PetscBool *has)
2707: Input Parameters:
2708: + ht - The hash table
2709: - key - The key
2711: Output Parameter:
2712: . has - Boolean indicating whether key is in the hash table
2714: Level: developer
2716: .seealso: `PetscHMapObjGet()`, `PetscHMapObjGetWithDefault()`, `PetscHMapObjSet()`,
2717: `PetscHMapObjSetWithMode()`, `PetscHMapObjFind()`
2718: M*/
2720: /*MC
2721: PetscHMapObjGet - Get the value for a key in the hash table
2723: Synopsis:
2724: #include <petsc/private/hashmapobj.h>
2725: PetscErrorCode PetscHMapObjGet(PetscHMapObj ht, PetscInt64 key, PetscObject *val)
2727: Input Parameters:
2728: + ht - The hash table
2729: - key - The key
2731: Output Parameter:
2732: . val - The value
2734: Level: developer
2736: .seealso: `PetscHMapObjSet()`, `PetscHMapObjSetWithMode()`, `PetscHMapObjIterGet()`,
2737: `PetscHMapObjGetWithDefault()`
2738: M*/
2740: /*MC
2741: PetscHMapObjGetWithDefault - Get the value for a key in the hash table but override the default
2742: value returned if the key was not found
2744: Synopsis:
2745: #include <petsc/private/hashmapobj.h>
2746: PetscErrorCode PetscHMapObjGetWithDefault(PetscHMapObj ht, PetscInt64 key, PetscObject default_val, PetscObject *val)
2748: Input Parameters:
2749: + ht - The hash table
2750: . key - The key
2751: - default_val - The default value to set `val` to if `key` was not found
2753: Output Parameter:
2754: . val - The value
2756: Level: developer
2758: .seealso: `PetscHMapObjGet()`, `PetscHMapObjSet()`, `PetscHMapObjSetWithMode()`, `PetscHMapObjIterGet()`
2759: M*/
2762: /*MC
2763: PetscHMapObjSet - Set a (key,value) entry in the hash table
2765: Synopsis:
2766: #include <petsc/private/hashmapobj.h>
2767: PetscErrorCode PetscHMapObjSet(PetscHMapObj ht, PetscInt64 key, PetscObject val)
2769: Input Parameters:
2770: + ht - The hash table
2771: . key - The key
2772: - val - The value
2774: Level: developer
2776: .seealso: `PetscHMapObjGet()`, `PetscHMapObjSetWithMode()`, `PetscHMapObjGetWithDefault()`,
2777: `PetscHMapObjIterSet()`
2778: M*/
2780: /*MC
2781: PetscHMapObjSetWithMode - Set a (key,value) entry in the hash table according to an `InsertMode`
2783: Synopsis:
2784: #include <petsc/private/hashmapobj.h>
2785: PetscErrorCode PetscHMapObjSetWithMode(PetscHMapObj ht, PetscInt64 key, PetscObject val, InsertMode mode)
2787: Input Parameters:
2788: + ht - The hash table
2789: . key - The key
2790: . val - The value
2791: - mode - The insertion mode
2793: Level: developer
2795: Notes:
2796: `mode` may be any of the following\:
2797: - `INSERT_VALUES`\: this routine behaves identically to `PetscHMapObjSet()`.
2798: - `ADD_VALUES`\: if `key` is found `val` is added to the current entry, otherwise (`key`, `value`)
2799: is inserted into `ht` as-if-by `INSERT_VALUES`.
2800: - `MAX_VALUES`\: if `key` is found the current value is replaced by the maximum of `val` and the
2801: current entry, otherwise (`key`, `value`) is inserted into `ht` as-if-by
2802: `INSERT_VALUES`.
2803: - `MIN_VALUES`\: if `key` is found the current value is replaced by the minimum of `val` and the
2804: current entry, otherwise (`key`, `value`) is inserted into `ht` as-if-by
2805: `INSERT_VALUES`.
2807: All other `InsertMode` values raise an error.
2809: Since this routine relies on `+`, `<`, and `>` being well-formed for a particular type
2810: it is not available by default for all PETSc hash table instantiations. If a particular
2811: instantiation supports this routine it must define `PETSC_HMAPObj_HAVE_EXTENDED_API` to
2812: `1`.
2814: .seealso: `PetscHMapObjSet()`, `PetscHMapObjGet()`, `PetscHMapObjGetWithDefault()`,
2815: `PetscHMapObjIterSet()`
2816: M*/
2818: /*MC
2819: PetscHMapObjDel - Remove a key and its value from the hash table
2821: Synopsis:
2822: #include <petsc/private/hashmapobj.h>
2823: PetscErrorCode PetscHMapObjDel(PetscHMapObj ht,PetscInt64 key)
2825: Input Parameters:
2826: + ht - The hash table
2827: - key - The key
2829: Level: developer
2831: .seealso: `PetscHMapObjHas()`, `PetscHMapObjIterDel()`
2832: M*/
2834: /*MC
2835: PetscHMapObjQuerySet - Query and set a (key,value) entry in the hash table
2837: Synopsis:
2838: #include <petsc/private/hashmapobj.h>
2839: PetscErrorCode PetscHMapObjQuerySet(PetscHMapObj ht, PetscInt64 key, PetscObject val, PetscBool *missing)
2841: Input Parameters:
2842: + ht - The hash table
2843: . key - The key
2844: - val - The value
2846: Output Parameter:
2847: . missing - Boolean indicating whether the key was missing
2849: Level: developer
2851: .seealso: `PetscHMapObjQueryDel()`, `PetscHMapObjSet()`, `PetscHMapObjSetWithMode()`
2852: M*/
2854: /*MC
2855: PetscHMapObjQueryDel - Query and remove a (key,value) entry from the hash table
2857: Synopsis:
2858: #include <petsc/private/hashmapobj.h>
2859: PetscErrorCode PetscHMapObjQueryDel(PetscHMapObj ht, PetscInt64 key, PetscBool *present)
2861: Input Parameters:
2862: + ht - The hash table
2863: - key - The key
2865: Output Parameter:
2866: . present - Boolean indicating whether the key was present
2868: Level: developer
2870: .seealso: `PetscHMapObjQuerySet()`, `PetscHMapObjDel()`
2871: M*/
2873: /*MC
2874: PetscHMapObjFind - Query for key in the hash table
2876: Synopsis:
2877: #include <petsc/private/hashmapobj.h>
2878: PetscErrorCode PetscHMapObjFind(PetscHMapObj ht, PetscInt64 key, PetscHashIter *iter, PetscBool *found)
2880: Input Parameters:
2881: + ht - The hash table
2882: - key - The key
2884: Output Parameters:
2885: + iter - Iterator referencing the value for key
2886: - found - Boolean indicating whether the key was present
2888: Level: developer
2890: .seealso: `PetscHMapObjIterGet()`, `PetscHMapObjIterDel()`
2891: M*/
2893: /*MC
2894: PetscHMapObjPut - Set a key in the hash table
2896: Synopsis:
2897: #include <petsc/private/hashmapobj.h>
2898: PetscErrorCode PetscHMapObjPut(PetscHMapObj ht, PetscInt64 key, PetscHashIter *iter, PetscBool *missing)
2900: Input Parameters:
2901: + ht - The hash table
2902: - key - The key
2904: Output Parameters:
2905: + iter - Iterator referencing the value for key
2906: - missing - Boolean indicating whether the key was missing
2908: Level: developer
2910: .seealso: `PetscHMapObjIterSet()`, `PetscHMapObjQuerySet()`, `PetscHMapObjSet()`,
2911: `PetscHMapObjSetWithMode()`
2912: M*/
2914: /*MC
2915: PetscHMapObjIterGet - Get the value referenced by an iterator in the hash table
2917: Synopsis:
2918: #include <petsc/private/hashmapobj.h>
2919: PetscErrorCode PetscHMapObjIterGet(PetscHMapObj ht, PetscHashIter iter, PetscObject *val)
2921: Input Parameters:
2922: + ht - The hash table
2923: - iter - The iterator
2925: Output Parameter:
2926: . val - The value
2928: Level: developer
2930: .seealso: `PetscHMapObjFind()`, `PetscHMapObjGet()`, `PetscHMapObjGetWithDefault()`
2931: M*/
2933: /*MC
2934: PetscHMapObjIterSet - Set the value referenced by an iterator in the hash
2936: Synopsis:
2937: #include <petsc/private/hashmapobj.h>
2938: PetscErrorCode PetscHMapObjIterSet(PetscHMapObj ht, PetscHashIter iter, PetscObject val)
2940: Input Parameters:
2941: + ht - The hash table
2942: . iter - The iterator
2943: - val - The value
2945: Level: developer
2947: .seealso: `PetscHMapObjPut()`, `PetscHMapObjQuerySet()`, `PetscHMapObjSet()`,
2948: `PetscHMapObjSetWithMode()`
2949: M*/
2951: /*MC
2952: PetscHMapObjIterDel - Remove the (key,value) referenced by an iterator from the hash table
2954: Synopsis:
2955: #include <petsc/private/hashmapobj.h>
2956: PetscErrorCode PetscHMapObjIterDel(PetscHMapObj ht, PetscHashIter iter)
2958: Input Parameters:
2959: + ht - The hash table
2960: - iter - The iterator
2962: Level: developer
2964: .seealso: `PetscHMapObjFind()`, `PetscHMapObjQueryDel()`, `PetscHMapObjDel()`
2965: M*/
2967: /*MC
2968: PetscHMapObjGetKeys - Get all keys from a hash table
2970: Synopsis:
2971: #include <petsc/private/hashmapobj.h>
2972: PetscErrorCode PetscHMapObjGetKeys(PetscHMapObj ht, PetscInt *off, PetscInt64 array[])
2974: Input Parameters:
2975: + ht - The hash table
2976: . off - Input offset in array (usually zero)
2977: - array - Array to put hash table keys in
2979: Output Parameters:
2980: + off - Output offset in array (output offset = input offset + hash table size)
2981: - array - Array filled with the hash table keys
2983: Level: developer
2985: .seealso: `PetscHSetObjGetSize()`, `PetscHMapObjGetVals()`
2986: M*/
2988: /*MC
2989: PetscHMapObjGetVals - Get all values from a hash table
2991: Synopsis:
2992: #include <petsc/private/hashmapobj.h>
2993: PetscErrorCode PetscHMapObjGetVals(PetscHMapObj ht, PetscInt *off, PetscObject array[])
2995: Input Parameters:
2996: + ht - The hash table
2997: . off - Input offset in array (usually zero)
2998: - array - Array to put hash table values in
3000: Output Parameters:
3001: + off - Output offset in array (output offset = input offset + hash table size)
3002: - array - Array filled with the hash table values
3004: Level: developer
3006: .seealso: `PetscHSetObjGetSize()`, `PetscHMapObjGetKeys()`
3007: M*/
3009: /*MC
3010: PetscHMapObjGetPairs - Get all (key,value) pairs from a hash table
3012: Synopsis:
3013: #include <petsc/private/hashmapobj.h>
3014: PetscErrorCode PetscHMapObjGetPairs(PetscHMapObj ht, PetscInt *off, PetscInt64 karray[], PetscObject varray[])
3016: Input Parameters:
3017: + ht - The hash table
3018: . off - Input offset in array (usually zero)
3019: . karray - Array to put hash table keys in
3020: - varray - Array to put hash table values in
3022: Output Parameters:
3023: + off - Output offset in array (output offset = input offset + hash table size)
3024: . karray - Array filled with the hash table keys
3025: - varray - Array filled with the hash table values
3027: Level: developer
3029: .seealso: `PetscHSetObjGetSize()`, `PetscHMapObjGetKeys()`, `PetscHMapObjGetVals()`
3030: M*/