Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. static unsigned int is_num_laser(particle* particles) {
  2.     singleton_geometry *geometry = get_singleton_geometry();
  3.     unsigned int n = geometry->n;
  4.    
  5.     double x_foc = 50.e-6;
  6.     double y_foc = 100.e-6;
  7.     double rb = 25.e-06;
  8.     unsigned int iter = 0;
  9.    
  10.     for (unsigned int i = 0; i < n; i++) {
  11.         if(particles[i].bnd || particles[i].molten || particles[i].states==INACTIVE) continue;
  12.         double xp = particles[i].px;
  13.         double yp = particles[i].py;
  14.         double r2 = (xp-x_foc)*(xp-x_foc) + (yp-y_foc)*(yp-y_foc);
  15.         double dist = sqrt(r2);
  16.        
  17.         /*
  18.            99% of beam's power will flow through a circle of radius r = 1.52 ⋅ w ( z )
  19.            {\displaystyle r=1.52\cdot w(z)} r=1.52\cdot w(z).[wiki: Gaussian Beam]
  20.         */
  21.  
  22.         if(particles[i].states==LASER && dist<=1.52*rb) iter++;
  23.         //if(particles[i].states==LASER && dist<=rb) iter++;
  24.         //if(particles[i].states==LASER) iter++;
  25.     }
  26.     return iter;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement