src/Level1/coord_vec.cc
/* These functions set up specific aspects of a coordinate vector.  Since
   they make assumptions about the order in which the vector is set up, the
   functions MUST be private, their misuse may make an inconsistent vector.  */
These functions set up specific aspects of a coordinate vector.  Since
they make assumptions about the order in which the vector is set up, the
functions MUST be private, their misuse may make an inconsistent vector.
These functions set up specific aspects of a coordinate vector . Since they make assumptions about the order in which the vector is set up the functions MUST be private their misuse may make an inconsistent vector .
int coord_vec::SetNPoints(const ParameterSet& pset, int warn)
  {
  string pstate;
  int npts;
  ParameterSet::const_iterator item;		
  string pname = string("NCoords");		
  item = pset.seek(pname);			
  if(item != pset.end())			
    {
    (*item).parse(pname,npts,pstate);
    *this = coord_vec(npts);		
    return 1;
    }
  pname = string("NSpins"); 
  item = pset.seek(pname);		 for NSpins
  if(item != pset.end())		
    {
    (*item).parse(pname,npts,pstate);
    *this = coord_vec(npts);		
    return 1;
    }
  if(warn)
    {
    CVerror(26,0);			
    CVerror(27);			
    }
  coord pt;				
  int nc = 0;				
  while(pt.read(pset,nc,0))		
  nc++;					
  if(!nc)				
    {					
    if(warn) 				
      {
      CVerror(7, 1);			
      if(warn > 1) CVfatality(3);	
      else         CVerror(3);		
      }
    return 0;
    }
  if(warn) CVerror(20);			
  *this = coord_vec(nc);		
  return 1;
  }
int coord_vec :: SetNPoints ( const ParameterSet & pset , int warn ) { string pstate ; int npts ; ParameterSet :: const_iterator item ; string pname = string ( " " ) ; item = pset . seek ( pname ) ; if ( item != pset . end ( ) ) { ( * item ) . parse ( pname , npts , pstate ) ; * this = coord_vec ( npts ) ; return 1 ; } pname = string ( " " ) ; item = pset . seek ( pname ) ; if ( item != pset . end ( ) ) { ( * item ) . parse ( pname , npts , pstate ) ; * this = coord_vec ( npts ) ; return 1 ; } if ( warn ) { CVerror ( 26 , 0 ) ; CVerror ( 27 ) ; } coord pt ; int nc = 0 ; while ( pt . read ( pset , nc , 0 ) ) nc ++ ; if ( ! nc ) { if ( warn ) { CVerror ( 7 , 1 ) ; if ( warn > 1 ) CVfatality ( 3 ) ; else CVerror ( 3 ) ; } return 0 ; } if ( warn ) CVerror ( 20 ) ; * this = coord_vec ( nc ) ; return 1 ; }
These functions set up specific aspects of a coordinate vector.
These functions set up specific aspects of a coordinate vector .
// Input		cvec	: A Coordinate vector(this) // 			pset	: A parameter set //			warn	: Warning level //                                      0 = no warning //                                      1 = warning, non-fatal //                                     >1 = fatal // Output		none 	: Coord. vector # of points is set //				  from parameters in pset // Note				: If # points read, returns TRUE //				  whether or not points actually exist /* ----------------------------------------------------------------------
-           Try & Read The Number Of Points In The Coordinate Vector 	-
-                                                                       -
-  Only two parameter names are currently acceptable:			-
-                                                                       -
-                         NCoords and NSpins				-
-                                                                       -
- The former will be read preferentially.  Both are read as integers.	-
-                                                                       -
-           Ncoords    (0) : 4   - Number of coordinates		-
-                                                                       -
- It neither NCoords or NSpins are found, it will attempt to read 	-
- individual coordinates (e.g. Coord(0)) beginning at index 0. If	-
- found it will set the number at the first one missing.		-
-                                                                       -
-----------------------------------------------------------------------*/ // Pix in parameter list // # coordinates par name // Try & find NCoords par // Retrieve the number of coordinates //    We Can't Find NCoords, Look For NSpins As An Alternative Parameter Name // Pix in parameter list for NSpins // Retrieve the number of spins // Can't Find NCoords Or NSpins. This Will Evoke Non-Fatal Warnings If Desired. //       Then We'll Try & Just Count The Coordinates In The Parameter // Can't read NCoords // Please set NCoords! // A dummy coordinate // A dummy index, start at 0 // Try and read Coord(nc) // until cant read one // If cant find any coordinates // then we must issue warnings // & perhaps die as desired! // Can't read any coordinates // Can't make any vector, quit // Can't make cvec from parameters // We've counted the coordinates // Please set NCoords Or NSpins