MCPcopy Create free account
hub / github.com/FreeFem/FreeFem-sources / intdphase

Function intdphase

plugin/seq/vortextools.cpp:364–390  ·  view source on GitHub ↗

Search vortices in a 2D complex field: Inputs: pTh, pu: mesh and complex P1 field representing the wavefunction Outputs: ppoints: array storing vortex coordinates pucharge: P0 function: =1 in triangles containing a vortex point, =0 otherwise pdmin: minimum distance between the vortices Returns: nbc: number of vortices

Source from the content-addressed store, hash-verified

362// Returns:
363// nbc: number of vortices
364double intdphase(bool bb,Complex const & a,Complex const & b,double const & eps)
365{
366 const double twopi = 2.*Pi;
367 double zz = bb ? 1. : -1.;
368 zz=0; // in test !!!! FH.
369 // zero entra ua et ub => 0 phase ???
370 Complex ab(b-a);
371 if (abs(ab)<eps) return zz*100;
372 // 0= a + l ab => l = -a/ab
373 Complex l= -a / ab;
374
375 if( abs(l.imag())<eps) {
376 // cout << " intdphase "<< l << " " << arg(a/b) << " " << a/b << endl;
377 // l est real ???
378 // verif si l in [0,1]
379 double lr = l.imag();
380 if( lr> -eps && lr < 1+eps ) {
381 // zero sur a,b
382 return zz*10;
383 } else return zz*20;
384 }
385 static int count =0;
386 double dw =arg(b/a)/twopi;
387 // if(count++<100) cout << dw << endl;
388 return dw;
389
390}
391
392double ChargeF(int i1,int i2,int i3,Complex u[3], double const & eps)
393{

Callers 2

ChargeFFunction · 0.85
uZero2D1Function · 0.85

Calls 1

absFunction · 0.50

Tested by

no test coverage detected