/usr/include/spooles/IVL/IVL.h is in libspooles-dev 2.2-12build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 | /* IVL.h */
#include "../IV.h"
#include "../cfiles.h"
/*--------------------------------------------------------------------*/
/*
---------------------------------------------------------------------
The IVL object stores and manipulates Lists of Int Vectors,
so the acronym for Integer Vector Lists.
The most common use of an IVL object is to represent a graph
or the adjacency structure of a matrix.
The IVL object supports the following functionality.
1. initialization, # of lists must be known.
2. clearing data and free'ing the object
3. set the size of a list and/or its entries
4. un-setting a list or releasing its data
5. returning the min or max entry in all the lists
6. returning the maximum size of a list
The number of lists is fixed on initialization, but the number
of entries in any list or the total size of the lists need not
be known at initialization. Storage for the lists is handled in
one of three ways.
1. chunked (IVL_CHUNKED = 1)
A chunk of data is allocated by the object and lists point
to data in the chunk. When the free space is not large
enough to contain a new list, another chunk is allocated.
The object keeps track of the chunks and free's all the
storage when requested.
2. solo (IVL_SOLO = 2)
Each list is allocated separately using the IVinit() or
IVinit2() function. When requested, each list is free'd
using the IVfree() function.
3. unknown (IVL_UNKNOWN = 3)
Each list points to storage somewhere but the object does
not keep track of any storage to be free'd. The application
that gave rise to this storage mode has a subgraph "share"
list storage with the larger graph that contains it. it made
no sense to replicate the storage for a very large graph
just to instantiate a subgraph. when the subgraph was free'd,
it did not release any storage owned by the parent graph.
created -- 95sep22, cca
---------------------------------------------------------------------
*/
/*--------------------------------------------------------------------*/
/*
--------------------------------------
typedef for the IVL and Ichunk objects
--------------------------------------
*/
typedef struct _IVL IVL ;
typedef struct _Ichunk Ichunk ;
/*--------------------------------------------------------------------*/
/*
-------------------------------------------------------------
type -- type of integer vector list
IVL_NOTYPE -- no type
IVL_CHUNKED -- list are in possibly many chunks of data
IVL_SOLO -- each list is created using IVinit()
and free'd using IVfree()
IVL_UNKNOWN -- storage for lists unknown,
it is the user's responsibility
maxnlist -- maximum number of lists
nlist -- number of lists
tsize -- total size of the lists
sizes -- vector of list sizes, size nlist
p_vec -- vector of list pointers, size nlist
incr -- increment for chunks, number of entries allocated
when a new chunk is necessary, used only when
type = IVL_CHUNKED
chunk -- first Ichunk structure,
NULL unless type = IVL_CHUNKED
-------------------------------------------------------------
*/
struct _IVL {
int type ;
int maxnlist ;
int nlist ;
int tsize ;
int *sizes ;
int **p_vec ;
int incr ;
Ichunk *chunk ;
} ;
/*
-------------------------------------------------------
the Ichunk object is the data structure
that handles chunks of storage for mode IVL_CHUNKED
size -- number of entries in the chunk,
also the dimension of the array base[]
inuse -- the number of entries in use,
size - inuse is the number of free entries
base -- base address for storage used for list entries
next -- pointer to the next Ichunk object
-------------------------------------------------------
*/
struct _Ichunk {
int size ;
int inuse ;
int *base ;
Ichunk *next ;
} ;
/*--------------------------------------------------------------------*/
/*
----------------------------
definitions for storage type
----------------------------
*/
#define IVL_NOTYPE (-1)
#define IVL_CHUNKED 1
#define IVL_SOLO 2
#define IVL_UNKNOWN 3
#define IVL_INCR 1024
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
--- procedures found in basics.c -----------------------------------
------------------------------------------------------------------------
*/
/*
-----------------------
simplest constructor
created -- 95sep22, cca
-----------------------
*/
IVL *
IVL_new (
void
) ;
/*
-----------------------
set the default fields
created -- 95sep22, cca
-----------------------
*/
void
IVL_setDefaultFields (
IVL *ivl
) ;
/*
--------------------------------------------------
clear the data fields, releasing allocated storage
created -- 95sep22, cca
--------------------------------------------------
*/
void
IVL_clearData (
IVL *ivl
) ;
/*
------------------------------------------
destructor, free's the object and its data
created -- 95sep22, cca
------------------------------------------
*/
IVL *
IVL_free (
IVL *ivl
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
--- procedures found in instance.c ---------------------------------
------------------------------------------------------------------------
*/
/*
-------------------------------------
return the storage type of the object
created -- 96dec06, cca
-------------------------------------
*/
int
IVL_type (
IVL *ivl
) ;
/*
----------------------------------
return the maximum number of lists
created -- 96dec06, cca
----------------------------------
*/
int
IVL_maxnlist (
IVL *ivl
) ;
/*
--------------------------
return the number of lists
created -- 96dec06, cca
--------------------------
*/
int
IVL_nlist (
IVL *ivl
) ;
/*
----------------------------------
return the total size of the lists
created -- 96dec06, cca
----------------------------------
*/
int
IVL_tsize (
IVL *ivl
) ;
/*
----------------------------
return the storage increment
created -- 96dec06, cca
----------------------------
*/
int
IVL_incr (
IVL *ivl
) ;
/*
-------------------------
set the storage increment
created -- 96dec06, cca
-------------------------
*/
void
IVL_setincr (
IVL *ivl,
int incr
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
--- procedures found in init.c -------------------------------------
------------------------------------------------------------------------
*/
/*
------------------------------------------------------
initialize given the type and maximum number of lists.
used for type IVL_CHUNKED, IVL_SOLO or IVL_UNKNOWN
created -- 95sep22, cca
------------------------------------------------------
*/
void
IVL_init1 (
IVL *ivl,
int type,
int maxnlist
) ;
/*
---------------------------------------------------------------
initialize given the type, number of lists and their total size
only used when type is IVL_CHUNKED.
created -- 95sep22, cca
---------------------------------------------------------------
*/
void
IVL_init2 (
IVL *ivl,
int type,
int maxnlist,
int tsize
) ;
/*
--------------------------------------
initialize from a vector of list sizes.
used with IVL_SOLO or IVL_CHUNKED.
created -- 95sep22, cca
--------------------------------------
*/
void
IVL_init3 (
IVL *ivl,
int type,
int maxnlist,
int sizes[]
) ;
/*
------------------------------------------------
this method resizes the maximum number of lists,
replacing the old sizes[] and p_vec[] vectors
as necessary. the nlist value is NOT reset.
created -- 96dec05, cca
------------------------------------------------
*/
void
IVL_setMaxnlist (
IVL *ivl,
int newmaxnlist
) ;
/*
------------------------------------------------
this method resizes the number of lists,
replacing the old sizes[] and p_vec[] vectors
as necessary.
created -- 96dec05, cca
------------------------------------------------
*/
void
IVL_setNlist (
IVL *ivl,
int newnlist
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
--- procedures found in subIVL.c -----------------------------------
------------------------------------------------------------------------
*/
/*
----------------------------------------------------------------
purpose -- initialize subIVL from ivl
if keeplistIV is not NULL then
keeplistIV contains the lists of ivl to be placed in subIVL
else
all lists are placed in subIVL
endif
if keepentriesIV is not NULL then
keepentriesIV contains the entries in the lists to be kept
else
all entries in the kept lists are placed in subIVL
endif
return value ---
1 -- normal return
-1 -- subIVL is NULL
-2 -- ivl is NULL
-3 -- keeplistIV is invalid
created -- 98oct16, cca
----------------------------------------------------------------
*/
int
IVL_initFromSubIVL (
IVL *subIVL,
IVL *ivl,
IV *keeplistIV,
IV *keepentriesIV
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
--- procedures found in listmanip.c --------------------------------
------------------------------------------------------------------------
*/
/*
----------------------------------------------------------------
fills size of and pointer to the entries of a list
set *psize = size of list ilist
set *pivec = base address of list ilist
use as follows :
IVL_listAndSize(ivl, ilist, &isize, &ivec) ;
for ( i = 0 ; i < isize ; i++ ) ;
do something with ivec[i] ;
}
created -- 95sep22, cca
----------------------------------------------------------------
*/
void
IVL_listAndSize (
IVL *ivl,
int ilist,
int *psize,
int **pivec
) ;
/*
----------------------------------------------------
returns a pointer to the first element in list ilist
to be used as a general iterator, e.g.,
for ( pi = IVL_firstInList(ivl, ilist) ;
pi != NULL ;
pi = IVL_nextInList(ivl, ilist, pi) ) ;
do something ;
}
created -- 95sep27, cca
----------------------------------------------------
*/
int *
IVL_firstInList (
IVL *ivl,
int ilist
) ;
/*
----------------------------------------------------
returns a pointer to the next element in list ilist
to be used as a general iterator, e.g.,
for ( pi = IVL_firstInList(ivl, ilist) ;
pi != NULL ;
pi = IVL_nextInList(ivl, ilist, pi) ) ;
do something ;
}
created -- 95sep27, cca
----------------------------------------------------
*/
int *
IVL_nextInList (
IVL *ivl,
int ilist,
int *pi
) ;
/*
-----------------------------------------------------------------
purpose -- to set or reset a list.
ilist -- list id to set or reset
isize -- size of the list
if the present size of list ilist is smaller than isize,
the old list is free'd (if ivl->type = IVL_SOLO)
or lost (if ivl->type = IVL_CHUNKED)
or un-set (if ivl->type = IVL_UNKNOWN)
and new storage is allocated (for IVL_SOLO and IVL_CHUNKED)
ivec -- list vector
if ivl->type is IVL_UNKNOWN then
if ivec != NULL then
we set the ivl list pointer to be ivec
endif
else if ivec != NULL
we copy ivec[] into ivl's storage for the list
endif
created -- 95sep27, cca
last mods -- 95oct06, cca
type = IVL_UNKNOWN, p_vec[ilist] set to ivec
only when ivec is not NULL
bug fixed, ivl->sizes[ilist] = isize ;
-----------------------------------------------------------------
*/
void
IVL_setList (
IVL *ivl,
int ilist,
int isize,
int ivec[]
) ;
/*
----------------------------------------------------------------
set a pointer to a list but don't allocate storage for the list.
this method was needed when we form a subgraph with a boundary.
lists for the interior vertices point into the parent graph,
but lists for the boundary vertices must be allocated and owned.
used only for type = IVL_CHUNKED. at some point in the future we
should rethink the storage semantics for the IVL object.
created -- 95nov11, cca
----------------------------------------------------------------
*/
void
IVL_setPointerToList (
IVL *ivl,
int ilist,
int isize,
int ivec[]
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
--- procedures found in misc.c -------------------------------------
------------------------------------------------------------------------
*/
/*
-----------------------------------------------------------
purpose -- to make and return a 9-point adjacency structure
input --
n1 -- # of grid points in first direction
n2 -- # of grid points in second direction
ncomp -- # of components per grid point
-----------------------------------------------------------
*/
IVL *
IVL_make9P (
int n1,
int n2,
int ncomp
) ;
/*
------------------------------------------------------------
purpose -- to make and return a 27-point adjacency structure
input --
n1 -- # of grid points in first direction
n2 -- # of grid points in second direction
n3 -- # of grid points in second direction
ncomp -- # of components per grid point
------------------------------------------------------------
*/
IVL *
IVL_make27P (
int n1,
int n2,
int n3,
int ncomp
) ;
/*
------------------------------------------------------------
purpose -- to make and return a 13-point adjacency structure
input --
n1 -- # of grid points in first direction
n2 -- # of grid points in second direction
created -- 96feb01
------------------------------------------------------------
*/
IVL *
IVL_make13P (
int n1,
int n2
) ;
/*
-----------------------------------------------------------
purpose -- to make and return a 5-point adjacency structure
input --
n1 -- # of grid points in first direction
n2 -- # of grid points in second direction
created -- 96feb02
-----------------------------------------------------------
*/
IVL *
IVL_make5P (
int n1,
int n2
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
--- procedures found in util.c -------------------------------------
------------------------------------------------------------------------
*/
/*
----------------------------------------------
return the number of bytes taken by the object
created -- 95sep22, cca
----------------------------------------------
*/
int
IVL_sizeOf (
IVL *ivl
) ;
/*
---------------------------------------------------
purpose -- to return the minimum entry in the lists
created -- 95sep22, cca
---------------------------------------------------
*/
int
IVL_min (
IVL *ivl
) ;
/*
---------------------------------------------------
purpose -- to return the maximum entry in the lists
created -- 95sep22, cca
---------------------------------------------------
*/
int
IVL_max (
IVL *ivl
) ;
/*
----------------------------
return the maximum list size
created -- 95sep22, cca
----------------------------
*/
int
IVL_maxListSize (
IVL *ivl
) ;
/*
-------------------------------
return the sum of all the lists
created -- 95sep29, cca
-------------------------------
*/
int
IVL_sum (
IVL *ivl
) ;
/*
-------------------------------------------
sort the adjacency lists in ascending order
created -- 95sep22, cca
-------------------------------------------
*/
void
IVL_sortUp (
IVL *ivl
) ;
/*
-----------------------------------------------------
create an equivalence map
if ( map[j] == map[k] ) then
the lists for j and k are identical
endif
NOTE : each empty list is mapped to a different value
return value -- pointer to map[] vector
created -- 95mar15, cca
-----------------------------------------------------
*/
int *
IVL_equivMap1 (
IVL *ivl
) ;
/*
-----------------------------------------------------
create an equivalence map
if ( map[j] == map[k] ) then
the lists for j and k are identical
endif
NOTE : each empty list is mapped to a different value
return value -- pointer to map IV object
created -- 96mar15, cca
-----------------------------------------------------
*/
IV *
IVL_equivMap2 (
IVL *ivl
) ;
/*
------------------------------------
overwrite each list with new entries
created -- 96oct03, cca
------------------------------------
*/
void
IVL_overwrite (
IVL *ivl,
IV *oldToNewIV
) ;
/*
---------------------------------------------------
given an IVL object and a map from old list entries
to new list entries, create a new IVL object whose
new list entries contain no duplicates.
return value -- pointer to new IVL object
created -- 96nov07, cca
---------------------------------------------------
*/
IVL *
IVL_mapEntries (
IVL *ivl,
IV *mapIV
) ;
/*
----------------------------------------------------------------
IVL object ivl1 absorbs the lists and data from IVL object ivl2.
the lists in ivl2 are mapped into lists in ivl1 using the mapIV
IV object.
created -- 96dec06, cca
----------------------------------------------------------------
*/
void
IVL_absorbIVL (
IVL *ivl1,
IVL *ivl2,
IV *mapIV
) ;
/*
-----------------------------------------------------------------
purpose -- expand the lists in an IVL object.
this method was created in support of a symbolic factorization.
an IVL object is constructed using a compressed graph.
it must be expanded to reflect the compressed graph.
the number of lists does not change (there is one list per front)
but the size of each list may change. so we create a new IVL
object that contains entries for the uncompressed graph.
created -- 97feb13, cca
-----------------------------------------------------------------
*/
IVL *
IVL_expand (
IVL *ivl,
IV *eqmapIV
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
--- procedures found in IO.c ---------------------------------------
------------------------------------------------------------------------
*/
/*
-----------------------------------------------
purpose -- to read in an IVL object from a file
input --
fn -- filename, must be *.ivlb or *.ivlf
return value -- 1 if success, 0 if failure
created -- 95sep29, cca
-----------------------------------------------
*/
int
IVL_readFromFile (
IVL *ivl,
char *fn
) ;
/*
------------------------------------------------------
purpose -- to read an IVL object from a formatted file
return value -- 1 if success, 0 if failure
created -- 95sep29, cca
------------------------------------------------------
*/
int
IVL_readFromFormattedFile (
IVL *ivl,
FILE *fp
) ;
/*
---------------------------------------------------
purpose -- to read an IVL object from a binary file
return value -- 1 if success, 0 if failure
created -- 95sep29, cca
---------------------------------------------------
*/
int
IVL_readFromBinaryFile (
IVL *ivl,
FILE *fp
) ;
/*
-------------------------------------------
purpose -- to write an IVL object to a file
input --
fn -- filename
*.ivlb -- binary
*.ivlf -- formatted
anything else -- for human eye
return value -- 1 if success, 0 otherwise
created -- 95sep29, cca
-------------------------------------------
*/
int
IVL_writeToFile (
IVL *ivl,
char *fn
) ;
/*
-----------------------------------------------------
purpose -- to write an IVL object to a formatted file
return value -- 1 if success, 0 otherwise
created -- 95sep29, cca
-----------------------------------------------------
*/
int
IVL_writeToFormattedFile (
IVL *ivl,
FILE *fp
) ;
/*
--------------------------------------------------
purpose -- to write an IVL object to a binary file
return value -- 1 if success, 0 otherwise
created -- 95sep29, cca
--------------------------------------------------
*/
int
IVL_writeToBinaryFile (
IVL *ivl,
FILE *fp
) ;
/*
-------------------------------------------------
purpose -- to write an IVL object for a human eye
return value -- 1 if success, 0 otherwise
created -- 95sep29, cca
-------------------------------------------------
*/
int
IVL_writeForHumanEye (
IVL *ivl,
FILE *fp
) ;
/*
---------------------------------------------------------
purpose -- to write out the statistics for the IVL object
return value -- 1 if success, 0 otherwise
created -- 95sep29, cca
---------------------------------------------------------
*/
int
IVL_writeStats (
IVL *ivl,
FILE *fp
) ;
/*--------------------------------------------------------------------*/
|