CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced: Re: [FishMonger] Sharing statics variable between Threads: Edit Log

New User

Sep 2, 2013, 1:00 AM

Views: 18283
Re: [FishMonger] Sharing statics variable between Threads

The data comes from an external program which saved the data as a file. So first I must read the data and storing this in a database...

Can you give me an example for defining a variable at the file scope level priority?

Thanks a lot for your replies.

my $maxProc=4; 
my $pm = new Parallel::ForkManager($maxProc);

for(my $idy=0;$idy<=$#ySurf;$idy++)
my $currY = $ySurf[$idy];
for(my $alfaIdx=0;$alfaIdx<=$#alfas;$alfaIdx++)
$pm->start and next;

my $alfa = $alfas[$alfaIdx];

my $norVectX = cos($alfa);
my $norVectY = 0;
my $norVectZ = sin($alfa);

my $norTransf=TransfNorVec($input->{az}, $input->{el}, $norVectX, $norVectY, $norVectZ, $Side);

my $intSurfx = $input->{MiddleX} - $input->{r}*$norVectX;
my $intSurfy = $currY;
my $intSurfz = ($input->{MiddleZ}+$input->{zOffset})-$input->{r}*$norVectZ;

my $center = Divide($input->{w}, $input->{h}, $input->{M}, $input->{N}, $intSurfx, $intSurfy, $intSurfz, $alfa);

my $surf=0;

for(my $idx=0;$idx<$center->{count};$idx++)
my $xT = $center->{Px}[$idx];
my $yT = $center->{Py}[$idx];
my $zT = $center->{Pz}[$idx];

my $xTr = coordSystTransf($input->{az}, $input->{el}, $input->{MiddleX}, $input->{MiddleY}, $input->{MiddleZ}, $input->{ZeroX}, $input->{ZeroY}, $input->{ZeroZ}, $xT, $yT, $zT, $Side);

my $sqDiag = ($input->{w}/$input->{M})**2+($input->{h}/$input->{N})**2;

my $P = new Points();

for(my $dataIdx=0;$dataIdx<$data->{count};$dataIdx++)
my $inSphere = Check($sqDiag, $xTr->{xe}, $xTr->{ye}, $xTr->{ze}, $data->{abs_x}[$dataIdx], $data->{abs_y}[$dataIdx], $data->{abs_z}[$dataIdx]);

if($inSphere == 1)

my $Poynt = new Trans();
if(defined($P->{Px}[0]) && defined($P->{Py}[0]) && defined($P->{Pz}[0]))
$Poynt->{xe} = summe($P->{Px})/$P->{count};
$Poynt->{ye} = summe($P->{Py})/$P->{count};
$Poynt->{ze} = summe($P->{Pz})/$P->{count};

my $innerProd = $Poynt->{xe}*$norTransf->{xe}+$Poynt->{ye}*$norTransf->{ye}+$Poynt->{ze}*$norTransf->{ze};
$surf += ((($input->{w})/$input->{M})*(($input->{h})/$input->{N}))*$innerProd;

print "\ny= ".$currY."; alfa= ".$alfa .";\n";

if($surf == 0)
print 1e-100 ."dB\n";
print sprintf("%.4f", 20*log(abs($surf))) ." dB\n";


(This post was edited by rodeo on Sep 2, 2013, 1:01 AM)

Edit Log:
Post edited by rodeo (New User) on Sep 2, 2013, 1:01 AM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives