Example #1
0
TilePoint Tile::pat_xBond(Point3 p, TileParam& t) {
	TilePattern* pat = t.pattern;

	if (!pat) return TilePoint();

	float edges[4];
	int id = 0;
	int id2 = 0;
	
	// Tile top and bottom
	float rand = 3.14f;
	int row = rowcol(edges[3], edges[1], id, p.y, pat->totalHeight, pat->heights, t.tileHeight, t.tileHeightVar, rand);
	if (row == -1) return TilePoint();

	// Tile sides
	rand = edges[3] * 1.325f + 31.41213f;
	float offset = pat->rows[row].offset * t.tileWidth;
	if (offset < 0) offset *= -id;

	row = rowcol(edges[0], edges[2], id2, p.x + offset, pat->rows[row].totalWidth, pat->rows[row].tiles, t.tileWidth, t.tileWidthVar, rand);		
	if (row == -1) return TilePoint();

	edges[0] -= offset;
	edges[2] -= offset;

	id = generateID(id2, id);

	// Draw it
	return drawTile(p, edges, t, id);	
}
Example #2
0
std::vector<int> get_rowcol_beginnings(
	VectorSparseMatrix const &a,
	int const rowcol)
{
	std::vector<int> abegin;

	// Get beginning of each row in a (including sentinel at end)
//	a.sort(SparseMatrix::SortOrder::ROW_MAJOR);
	int last_row = -1;
	for (auto ai(a.begin()); ; ++ai) {
		if (ai == a.end()) {
			abegin.push_back(ai.position());
			break;
		}
		if (ai.rowcol(rowcol) != last_row) {
			// arow.push_back(ai.rowcol(rowcol));
			abegin.push_back(ai.position());
			last_row = ai.rowcol(rowcol);
		}
	}

	return abegin;
}
Example #3
0
/* ------- begin ---------------------------------summers.c --------- */
double summers(int i, int j, double nne, struct Atom *atom){
  /*   
  
  22-Jun-1994 changes begin P.G.Judge ***************************************

  DENSITY SENSITIVE DIELECTRONIC RECOMBINATION

  the term adi may be multiplied by a density-sensitive factor
  if needed- this is crucial for Li and B-like ions colliding with
  impacting electrons.
  This simple formulation was derived from a study of the dependence of
  the dielectronic "bump" in the figures of Summers 1974 
  (Appleton Laboratory internal memo), and fitting according to the
  parameter Ne / z^7
  This should be accurate to typically +/- 0.1 in log in regions
  where it matters.  Worse case is e.g. C like Neon where it underestimates
  density factor by maybe 0.25 in log.

  June 24, 2006 changes begin P.G.Judge 
  original (pre MAY 2006) code
           define rho = nne/ z^7 where z is charge on recombining ion
         rho=10.^(alog10(nne) - 7.* alog10(charge))
         rho0=2.e3
         if(isos eq 'LI' or isos eq 'NA' or isos eq 'K') then rho0 = 3.e1      
         ne_factor = 1./(1. + rho/rho0)^0.14
         print,'ne_factor',ne_factor

 June 24, 2006, more accurate version. 
 get the row and column of the recombined ion's isoelectronic 
 sequence  in the periodic table
 the following parameters mimic the tables 1-19 of
 H. Summers' Appleton Lab Report 367, 1974

Mar 9 2012 Jorrit Leenaarts: stole routine from Phil Judge's DIPER IDL
package

  */


  double y,zz,rho0,rhoq,x,beta;
  int iz,isoseq,row,col;
  char cseq[ATOM_ID_WIDTH+1];
  
  /* find atomic number of element */
  iz= atomnr(atom->ID);
  if (iz<1 || iz>92) {/*ERROR CODE HERE*/}

  /* Charge of recombining ion */
  zz=atom->stage[j];

  /* find iso-electronic sequence of recombined ion */
  isoseq=iz-atom->stage[i];
  atomnm(isoseq,&cseq[0]);

  /* row and column in periodic table */
  rowcol(isoseq,&row,&col);

  rhoq= nne*pow(CM_TO_M,3)/pow(zz,7);
  x= (0.5*zz + (col-1.0)) * row / 3.0;
  beta = -0.2/log(x+2.71828);
  rho0 = 30.0+50.0*x;
  y=pow(1. + rhoq/rho0,beta);

  /*   printf("summers %e %e %e %e \n",nne*pow(CM_TO_M,3), rho0,rhoq,y); */

  return y;

}