src/IntRank2/IntRank2A.cc
/* Users may find it convenient to define a spatial tensor with Cartesian
   components.  This can either be the three PAS components { Axx, Ayy, Azz }
   or the five components that represent the tensor in some arbitrary 
   orientation { Axx, Axy, Axz, Ayy, Ayz, Azz }. If the former is used (i.e.
   Axy, Axz, and Ayz are not specified) the we can directly set the asymmetry
   fro the three values { Axx, Ayy, Azz } and look elsewhere for any 
   specification of the tensor orientation. If the latter is used then we have
   a more complicated situation on our hands because the orientation and the
   asymmetry are both tied into the same set of values.  In that case they must
   both be determined at the same time from Axx, Axy, Axz, Ayy, Ayz, Azz }. 
   In a general casel this will demand an iterative proceedure to determine
   the Euler angles.

   A few more items worthy of mention. First, all parameters will be prefixed
   with Pbase so that derived classes may use their own naming convention.
   The default Pbase here is "IR2A" for this class which means typical
   parameter names would be IR2Axx, IR2Axy, etc. Second, the functions do not
   discriminate between reducible and irreducible components. They do not 
   care if Axx + Ayy + Azz = 0 or not, thus allowing for use in derived
   classes that may have an isotropic component.                             */
Users may find it convenient to define a spatial tensor with Cartesian
components.  This can either be the three PAS components { Axx, Ayy, Azz }
or the five components that represent the tensor in some arbitrary
orientation { Axx, Axy, Axz, Ayy, Ayz, Azz }. If the former is used  the we can directly set the asymmetry
fro the three values { Axx, Ayy, Azz } and look elsewhere for any
specification of the tensor orientation. If the latter is used then we have
a more complicated situation on our hands because the orientation and the
asymmetry are both tied into the same set of values.  In that case they must
both be determined at the same time from Axx, Axy, Axz, Ayy, Ayz, Azz }.
In a general casel this will demand an iterative proceedure to determine
the Euler angles.

A few more items worthy of mention. First, all parameters will be prefixed
with Pbase so that derived classes may use their own naming convention.
The default Pbase here is "IR2A" for this class which means typical
parameter names would be IR2Axx, IR2Axy, etc. Second, the functions do not
discriminate between reducible and irreducible components. They do not
care if Axx + Ayy + Azz = 0 or not, thus allowing for use in derived
classes that may have an isotropic component.
Users may find it convenient to define a spatial tensor with Cartesian components . This can either be the three PAS components { Axx Ayy Azz } or the five components that represent the tensor in some arbitrary orientation { Axx Axy Axz Ayy Ayz Azz } . If the former is used the we can directly set the asymmetry fro the three values { Axx Ayy Azz } and look elsewhere for any specification of the tensor orientation . If the latter is used then we have a more complicated situation on our hands because the orientation and the asymmetry are both tied into the same set of values . In that case they must both be determined at the same time from Axx Axy Axz Ayy Ayz Azz } . In a general casel this will demand an iterative proceedure to determine the Euler angles . A few more items worthy of mention . First all parameters will be prefixed with Pbase so that derived classes may use their own naming convention . The default Pbase here is " IR2A " for this class which means typical parameter names would be IR2Axx IR2Axy etc . Second the functions do not discriminate between reducible and irreducible components . They do not care if Axx + Ayy + Azz = 0 or not thus allowing for use in derived classes that may have an isotropic component .
int IntRank2A::getAxAyAz(const ParameterSet& pset, const string& A,
                              coord& Axyz, int idxI, int idxS, bool warn) const
  {
  string Nidx("");				
  if(idxI >= 0)					
    {						
    Nidx  = string("(") + Gdec(idxI);	        
    if(idxS > 0) 				
      Nidx += string(",")+Gdec(idxS); 		
    Nidx += string(")");			
    }
  int cnt = 0;					
  double x=0,y=0,z=0;                           
  string pstate;				
  ParameterSet::const_iterator item;         
  string pn = A + string("xx") + Nidx;		
  item = pset.seek(pn);				
  if(item == pset.end()) 			
    { if(warn) IR2Aerror(111,pn,1); } 		
  else						
    { (*item).parse(pn,x,pstate); cnt++; } 	
  pn = A + string("yy") + Nidx;			
  item = pset.seek(pn);				
  if(item == pset.end()) 			
    { if(warn) IR2Aerror(111,pn,1); } 		
  else						
    { (*item).parse(pn,y,pstate); cnt++; } 	
  pn = A + string("zz") + Nidx;			
  item = pset.seek(pn);				
  if(item == pset.end()) 			
    { if(warn) IR2Aerror(111,pn,1); }		
  else						
    { (*item).parse(pn,z,pstate); cnt++; } 	
  if(!cnt)					
    {						
    pn = A + "x" + A + "y" + A + "z" + Nidx;	
    item = pset.seek(pn);			
    if(item == pset.end()) 			
      { if(warn) IR2Aerror(111,pn,1); } 	
    else					
      {						
      Axyz = coord(*item);			
      return 3;
      }
    }
  Axyz = coord(x,y,z);				
  return cnt;					
  }
int IntRank2A :: getAxAyAz ( const ParameterSet & pset , const string & A , coord & Axyz , int idxI , int idxS , bool warn ) const { string Nidx ( " " ) ; if ( idxI >= 0 ) { Nidx = string ( " " ) + Gdec ( idxI ) ; if ( idxS > 0 ) Nidx += string ( " " ) + Gdec ( idxS ) ; Nidx += string ( " " ) ; } int cnt = 0 ; double x = 0 , y = 0 , z = 0 ; string pstate ; ParameterSet :: const_iterator item ; string pn = A + string ( " " ) + Nidx ; item = pset . seek ( pn ) ; if ( item == pset . end ( ) ) { if ( warn ) IR2Aerror ( 111 , pn , 1 ) ; } else { ( * item ) . parse ( pn , x , pstate ) ; cnt ++ ; } pn = A + string ( " " ) + Nidx ; item = pset . seek ( pn ) ; if ( item == pset . end ( ) ) { if ( warn ) IR2Aerror ( 111 , pn , 1 ) ; } else { ( * item ) . parse ( pn , y , pstate ) ; cnt ++ ; } pn = A + string ( " " ) + Nidx ; item = pset . seek ( pn ) ; if ( item == pset . end ( ) ) { if ( warn ) IR2Aerror ( 111 , pn , 1 ) ; } else { ( * item ) . parse ( pn , z , pstate ) ; cnt ++ ; } if ( ! cnt ) { pn = A + " " + A + " " + A + " " + Nidx ; item = pset . seek ( pn ) ; if ( item == pset . end ( ) ) { if ( warn ) IR2Aerror ( 111 , pn , 1 ) ; } else { Axyz = coord ( * item ) ; return 3 ; } } Axyz = coord ( x , y , z ) ; return cnt ; }
Users may find it convenient to define a spatial tensor with Cartesian
components.
Users may find it convenient to define a spatial tensor with Cartesian components .
// Parameter name suffix // Suffix only if idxI > -1 //   Add idxI index to name //   as (# //   If idxS > 0 add it to //   to suffix as ,# (#,# //   Finish suffix (#) or (#,#) // Count the values found // Temp storage of cmpts // Temp string for parameter // A pix into parameter list // Parameter name for Axx // Seek Axx parameter in pset // If not found, warn if // desired // If found, get Axx value // set it to x and count it // Parameter name for Ayy // Seek Ayy parameter in pset // If not found, warn if // desired // If found, get Ayy value // set it to y and count it // Parameter name for Azz // Seek Azz parameter in pset // If not found, warn if // desired // If found, get Azz value // set it to z and count it // If we have not found any // Auu values, try for all 3 // using coord AxAyAz //   Seek AxAyAz in pset //   If not found, warn if //   desired //   If found, get 3 Auu //   directly as coordinate  //   Return we found all 3 // Put results into Axyz // Set cnt of {Axx,Ayy,Azz}