Пример #1
0
/*
   --------------------------------------------------------------
   sets the maximum numnber of entries.  this methods resizes the
   ivec1[], ivece2[] and dvec[] vectors if newmaxnent != maxnent

   created -- 98jan28, cca
   --------------------------------------------------------------
*/
void   
InpMtx_setMaxnent (
   InpMtx  *inpmtx, 
   int      newmaxnent
) {
/*
   ---------------
   check the input
   ---------------
*/
if ( inpmtx == NULL || newmaxnent < 0 ) {
   fprintf(stderr, "\n fatal error in InpMtx_setMaxnent(%p, %d)"
           "\n bad input\n", inpmtx, newmaxnent) ;
   spoolesFatal();
}
if ( newmaxnent != inpmtx->maxnent ) {
  IV_setMaxsize(&(inpmtx->ivec1IV), newmaxnent) ;
  IV_setMaxsize(&(inpmtx->ivec2IV), newmaxnent) ;
  if ( INPMTX_IS_REAL_ENTRIES(inpmtx) ) {
    DV_setMaxsize(&(inpmtx->dvecDV), newmaxnent) ;
  } else if ( INPMTX_IS_COMPLEX_ENTRIES(inpmtx) ) {
    DV_setMaxsize(&(inpmtx->dvecDV), 2*newmaxnent) ;
  }
}
inpmtx->maxnent = newmaxnent ;

return ; }
Пример #2
0
/*
   --------------------------------------------------
   sets the maximum number of vectors. 
   if newmaxnent != maxnent then this methods resizes 
   the vecids[], sizes[] and offsets[] vectors 

   created  -- 98jan28, cca
   --------------------------------------------------
*/
void   
InpMtx_setMaxnvector (
   InpMtx  *inpmtx, 
   int      newmaxnvector
) {
/*
   ---------------
   check the input
   ---------------
*/
if ( inpmtx == NULL || newmaxnvector < 0 ) {
   fprintf(stderr, "\n fatal error in InpMtx_Maxnvector(%p, %d)"
           "\n bad input\n", inpmtx, newmaxnvector) ;
   spoolesFatal();
}
if ( newmaxnvector != inpmtx->maxnvector ) {
  IV_setMaxsize(&(inpmtx->vecidsIV),  newmaxnvector) ;
  IV_setMaxsize(&(inpmtx->sizesIV),   newmaxnvector) ;
  IV_setMaxsize(&(inpmtx->offsetsIV), newmaxnvector) ;
}
inpmtx->maxnvector = newmaxnvector ;

return ; }
Пример #3
0
/*
   --------------------------
   set the size of the vector

   created -- 96dec08, cca
   --------------------------
*/
void
IV_setSize (
   IV    *iv,
   int   newsize
) {
/*
   ---------------
   check the input
   ---------------
*/
if ( iv == NULL || newsize < 0 ) {
   fprintf(stderr, "\n fatal error in IV_setSize(%p,%d)"
           "\n bad input\n", iv, newsize) ;
   exit(-1) ;
}
if ( 0 < iv->maxsize && iv->maxsize < newsize && iv->owned == 0 ) {
   fprintf(stderr, "\n fatal error in IV_setSize(%p,%d)"
           "\n iv->maxsize = %d, newsize = %d, iv->owned = %d\n", 
           iv, newsize, iv->maxsize, newsize, iv->owned) ;
   exit(-1) ;
}
if ( iv->maxsize < newsize ) {
/*
   -------------------------------------------------------------
   new size requested is more than maxsize, set new maximum size 
   -------------------------------------------------------------
*/
   IV_setMaxsize(iv, newsize) ;
}
iv->size = newsize ;
/*
fprintf(stdout, 
        "\n %% leaving IV_setSize, iv %p, size %d, maxsize %d, entries %p",
        iv, iv->size, iv->maxsize, iv->vec) ;
fflush(stdout) ;
*/

return ; }