lib/App/SeismicUnixGui/sunix/model/normray.pm untested

filter: Statementstmt 0.0% 0 / 181 Branchbran 0.0% 0 / 42 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 29 Podpod 0.0% 0 / 25 totaltotal 0.0% 0 / 277 CC 22 SCAR 16.8
CC
22
Cov
0%
angle
6.0
ashift
6.0
caustic
6.0
CRAP 5.4
1 package App::SeismicUnixGui::sunix::model::normray;
2  
3 =head2 SYNOPSIS
4  
5 PERL PROGRAM NAME:
6  
7 AUTHOR: Juan Lorenzo (Perl module only)
8  
9 DATE:
10  
11 DESCRIPTION:
12  
13 Version:
14  
15 =head2 USE
16  
17 =head3 NOTES
18  
19 =head4 Examples
20  
21 =head2 SYNOPSIS
22  
23 =head3 SEISMIC UNIX NOTES
24 NORMRAY - dynamic ray tracing for normal incidence rays in a sloth model
25  
26  
27  
28 normray <modelfile >rayends [optional parameters]
29  
30  
31  
32 Optional Parameters:
33  
34 caustic= 0: show all rays 1: show only caustic rays
35  
36 nonsurface= 0: show rays which reach surface 1: show all rays
37  
38 surface= 0: shot ray from subsurface 1: from surface
39  
40 nrays= number of location to shoot rays
41  
42 dangle= increment of ray angle for one location
43  
44 nangle= number of rays shot from one location
45  
46 ashift= shift first taking off angle
47  
48 xs1= x of shooting location
49  
50 zs1= z of shooting location
51  
52 nangle=101 number of takeoff angles
53  
54 fangle=-45 first takeoff angle (in degrees)
55  
56 rayfile file of ray x,z coordinates of ray-edge intersections
57  
58 nxz=101 number of (x,z) in optional rayfile (see notes below)
59  
60 wavefile= file of ray x,z coordinates uniformly sampled in time
61  
62 nt=101 number of (x,z) in optional wavefile (see notes below)
63  
64 infofile= ASCII-file to store useful information
65  
66 fresnelfile= used if you want to plot the fresnel volumes.
67  
68 default is <fresnelfile.bin>
69  
70 outparfile= contains parameters for the plotting software.
71  
72 default is <outpar>
73  
74 krecord= if specified, only rays incident at interface with index
75  
76 krecord are displayed and stored
77  
78 prim =1, only single-reflected rays are plotted ",
79  
80 =0, only direct hits are displayed
81  
82 ffreq=-1 FresnelVolume frequency
83  
84 refseq=1,0,0 index of reflector followed by sequence of reflection (1)
85  
86 transmission(0) or ray stops(-1).
87  
88 The default rayend is at the model boundary.
89  
90 NOTE:refseq must be defined for each reflector
91  
92 NOTES:
93  
94 The rayends file contains ray parameters for the locations at which
95  
96 the rays terminate.
97  
98  
99  
100 The rayfile is useful for making plots of ray paths.
101  
102 nxz should be larger than twice the number of triangles intersected
103  
104 by the rays.
105  
106  
107  
108 The wavefile is useful for making plots of wavefronts.
109  
110 The time sampling interval in the wavefile is tmax/(nt-1),
111  
112 where tmax is the maximum time for all rays.
113  
114  
115  
116 The infofile is useful for collecting information along the
117  
118 individual rays. The fresnelfile contains data used to plot
119  
120 the Fresnel volumes. The outparfile stores information used
121  
122 for the plotting software.
123  
124  
125  
126  
127  
128  
129  
130 Author: Dave Hale, Colorado School of Mines, 02/16/91
131  
132 MODIFIED: Andreas Rueger, Colorado School of Mines, 08/12/93
133  
134 Modifications include: functions writeFresnel, checkIfSourceIsOnEdge;
135  
136 options refseq=, krecord=, prim=, infofile=;
137  
138 computation of reflection/transmission losses, attenuation.
139  
140 MODIFIED: Boyi Ou, Colorado School of Mines, 4/14/95
141  
142  
143  
144 Notes:
145  
146 This code can shoot rays from specified interface by users, normally you
147  
148 need to use gbmodel2 to generate interface parameters for this code, both
149  
150 code have a parameter named nrays, it should be same. If you just want to
151  
152 shoot rays from one specified location, you need to specify xs1,zs1,
153  
154 otherwise, leave them alone. If you want to shoot rays from surface, you need
155  
156 to define surface equal to 1. The rays from one location will be
157  
158 approximately symmetric with direction Normal_direction - ashift.(if nangle is
159  
160 odd, it is symmetric, even, almost symmetric. The formula for the first take
161  
162 off angle is: angle=normal_direction-nangle/2*dangle-ashift. If you only want to
163  
164 see caustics, you specify caustic=1, if you want to see rays which does not
165  
166 reach surface, you specify nonsurface=1.
167  
168 /
169  
170 =head2 User's notes (Juan Lorenzo)
171 untested
172  
173 =cut
174  
175  
176 =head2 CHANGES and their DATES
177  
178 =cut
179  
180 use Moose;
181 our $VERSION = '0.0.1';
182  
183  
184 =head2 Import packages
185  
186 =cut
187  
188 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
189  
190 use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin);
191 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
192  
193  
194 =head2 instantiation of packages
195  
196 =cut
197  
198 my $get = L_SU_global_constants->new();
199 my $Project = Project_config->new();
200 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
201 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
202 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
203  
204 my $var = $get->var();
205 my $on = $var->{_on};
206 my $off = $var->{_off};
207 my $true = $var->{_true};
208 my $false = $var->{_false};
209 my $empty_string = $var->{_empty_string};
210  
211 =head2 Encapsulated
212 hash of private variables
213  
214 =cut
215  
216 my $normray = {
217 _angle => '',
218 _ashift => '',
219 _caustic => '',
220 _dangle => '',
221 _fangle => '',
222 _ffreq => '',
223 _fresnelfile => '',
224 _infofile => '',
225 _krecord => '',
226 _nangle => '',
227 _nonsurface => '',
228 _nrays => '',
229 _nt => '',
230 _nxz => '',
231 _outparfile => '',
232 _prim => '',
233 _refseq => '',
234 _surface => '',
235 _wavefile => '',
236 _xs1 => '',
237 _zs1 => '',
238 _Step => '',
239 _note => '',
240  
241 };
242  
243 =head2 sub Step
244  
245 collects switches and assembles bash instructions
246 by adding the program name
247  
248 =cut
249  
250 sub Step {
251  
252 $normray->{_Step} = 'normray'.$normray->{_Step};
253 return ( $normray->{_Step} );
254  
255 }
256  
257  
258 =head2 sub note
259  
260 collects switches and assembles bash instructions
261 by adding the program name
262  
263 =cut
264  
265 sub note {
266  
267 $normray->{_note} = 'normray'.$normray->{_note};
268 return ( $normray->{_note} );
269  
270 }
271  
272  
273  
274 =head2 sub clear
275  
276 =cut
277  
278 sub clear {
279  
280 $normray->{_angle} = '';
281 $normray->{_ashift} = '';
282 $normray->{_caustic} = '';
283 $normray->{_dangle} = '';
284 $normray->{_fangle} = '';
285 $normray->{_ffreq} = '';
286 $normray->{_fresnelfile} = '';
287 $normray->{_infofile} = '';
288 $normray->{_krecord} = '';
289 $normray->{_nangle} = '';
290 $normray->{_nonsurface} = '';
291 $normray->{_nrays} = '';
292 $normray->{_nt} = '';
293 $normray->{_nxz} = '';
294 $normray->{_outparfile} = '';
295 $normray->{_prim} = '';
296 $normray->{_refseq} = '';
297 $normray->{_surface} = '';
298 $normray->{_wavefile} = '';
299 $normray->{_xs1} = '';
300 $normray->{_zs1} = '';
301 $normray->{_Step} = '';
302 $normray->{_note} = '';
303 }
304  
305  
306 =head2 sub angle
307  
308  
309 =cut
310  
311 sub angle {
312  
313 my ( $self,$angle ) = @_;
314 if ( $angle ne $empty_string ) {
315  
316 $normray->{_angle} = $angle;
317 $normray->{_note} = $normray->{_note}.' angle='.$normray->{_angle};
318 $normray->{_Step} = $normray->{_Step}.' angle='.$normray->{_angle};
319  
320 } else {
321 print("normray, angle, missing angle,\n");
322 }
323 }
324  
325  
326 =head2 sub ashift
327  
328  
329 =cut
330  
331 sub ashift {
332  
333 my ( $self,$ashift ) = @_;
334 if ( $ashift ne $empty_string ) {
335  
336 $normray->{_ashift} = $ashift;
337 $normray->{_note} = $normray->{_note}.' ashift='.$normray->{_ashift};
338 $normray->{_Step} = $normray->{_Step}.' ashift='.$normray->{_ashift};
339  
340 } else {
341 print("normray, ashift, missing ashift,\n");
342 }
343 }
344  
345  
346 =head2 sub caustic
347  
348  
349 =cut
350  
351 sub caustic {
352  
353 my ( $self,$caustic ) = @_;
354 if ( $caustic ne $empty_string ) {
355  
356 $normray->{_caustic} = $caustic;
357 $normray->{_note} = $normray->{_note}.' caustic='.$normray->{_caustic};
358 $normray->{_Step} = $normray->{_Step}.' caustic='.$normray->{_caustic};
359  
360 } else {
361 print("normray, caustic, missing caustic,\n");
362 }
363 }
364  
365  
366 =head2 sub dangle
367  
368  
369 =cut
370  
371 sub dangle {
372  
373 my ( $self,$dangle ) = @_;
374 if ( $dangle ne $empty_string ) {
375  
376 $normray->{_dangle} = $dangle;
377 $normray->{_note} = $normray->{_note}.' dangle='.$normray->{_dangle};
378 $normray->{_Step} = $normray->{_Step}.' dangle='.$normray->{_dangle};
379  
380 } else {
381 print("normray, dangle, missing dangle,\n");
382 }
383 }
384  
385  
386 =head2 sub fangle
387  
388  
389 =cut
390  
391 sub fangle {
392  
393 my ( $self,$fangle ) = @_;
394 if ( $fangle ne $empty_string ) {
395  
396 $normray->{_fangle} = $fangle;
397 $normray->{_note} = $normray->{_note}.' fangle='.$normray->{_fangle};
398 $normray->{_Step} = $normray->{_Step}.' fangle='.$normray->{_fangle};
399  
400 } else {
401 print("normray, fangle, missing fangle,\n");
402 }
403 }
404  
405  
406 =head2 sub ffreq
407  
408  
409 =cut
410  
411 sub ffreq {
412  
413 my ( $self,$ffreq ) = @_;
414 if ( $ffreq ne $empty_string ) {
415  
416 $normray->{_ffreq} = $ffreq;
417 $normray->{_note} = $normray->{_note}.' ffreq='.$normray->{_ffreq};
418 $normray->{_Step} = $normray->{_Step}.' ffreq='.$normray->{_ffreq};
419  
420 } else {
421 print("normray, ffreq, missing ffreq,\n");
422 }
423 }
424  
425  
426 =head2 sub fresnelfile
427  
428  
429 =cut
430  
431 sub fresnelfile {
432  
433 my ( $self,$fresnelfile ) = @_;
434 if ( $fresnelfile ne $empty_string ) {
435  
436 $normray->{_fresnelfile} = $fresnelfile;
437 $normray->{_note} = $normray->{_note}.' fresnelfile='.$normray->{_fresnelfile};
438 $normray->{_Step} = $normray->{_Step}.' fresnelfile='.$normray->{_fresnelfile};
439  
440 } else {
441 print("normray, fresnelfile, missing fresnelfile,\n");
442 }
443 }
444  
445  
446 =head2 sub infofile
447  
448  
449 =cut
450  
451 sub infofile {
452  
453 my ( $self,$infofile ) = @_;
454 if ( $infofile ne $empty_string ) {
455  
456 $normray->{_infofile} = $infofile;
457 $normray->{_note} = $normray->{_note}.' infofile='.$normray->{_infofile};
458 $normray->{_Step} = $normray->{_Step}.' infofile='.$normray->{_infofile};
459  
460 } else {
461 print("normray, infofile, missing infofile,\n");
462 }
463 }
464  
465  
466 =head2 sub krecord
467  
468  
469 =cut
470  
471 sub krecord {
472  
473 my ( $self,$krecord ) = @_;
474 if ( $krecord ne $empty_string ) {
475  
476 $normray->{_krecord} = $krecord;
477 $normray->{_note} = $normray->{_note}.' krecord='.$normray->{_krecord};
478 $normray->{_Step} = $normray->{_Step}.' krecord='.$normray->{_krecord};
479  
480 } else {
481 print("normray, krecord, missing krecord,\n");
482 }
483 }
484  
485  
486 =head2 sub nangle
487  
488  
489 =cut
490  
491 sub nangle {
492  
493 my ( $self,$nangle ) = @_;
494 if ( $nangle ne $empty_string ) {
495  
496 $normray->{_nangle} = $nangle;
497 $normray->{_note} = $normray->{_note}.' nangle='.$normray->{_nangle};
498 $normray->{_Step} = $normray->{_Step}.' nangle='.$normray->{_nangle};
499  
500 } else {
501 print("normray, nangle, missing nangle,\n");
502 }
503 }
504  
505  
506 =head2 sub nonsurface
507  
508  
509 =cut
510  
511 sub nonsurface {
512  
513 my ( $self,$nonsurface ) = @_;
514 if ( $nonsurface ne $empty_string ) {
515  
516 $normray->{_nonsurface} = $nonsurface;
517 $normray->{_note} = $normray->{_note}.' nonsurface='.$normray->{_nonsurface};
518 $normray->{_Step} = $normray->{_Step}.' nonsurface='.$normray->{_nonsurface};
519  
520 } else {
521 print("normray, nonsurface, missing nonsurface,\n");
522 }
523 }
524  
525  
526 =head2 sub nrays
527  
528  
529 =cut
530  
531 sub nrays {
532  
533 my ( $self,$nrays ) = @_;
534 if ( $nrays ne $empty_string ) {
535  
536 $normray->{_nrays} = $nrays;
537 $normray->{_note} = $normray->{_note}.' nrays='.$normray->{_nrays};
538 $normray->{_Step} = $normray->{_Step}.' nrays='.$normray->{_nrays};
539  
540 } else {
541 print("normray, nrays, missing nrays,\n");
542 }
543 }
544  
545  
546 =head2 sub nt
547  
548  
549 =cut
550  
551 sub nt {
552  
553 my ( $self,$nt ) = @_;
554 if ( $nt ne $empty_string ) {
555  
556 $normray->{_nt} = $nt;
557 $normray->{_note} = $normray->{_note}.' nt='.$normray->{_nt};
558 $normray->{_Step} = $normray->{_Step}.' nt='.$normray->{_nt};
559  
560 } else {
561 print("normray, nt, missing nt,\n");
562 }
563 }
564  
565  
566 =head2 sub nxz
567  
568  
569 =cut
570  
571 sub nxz {
572  
573 my ( $self,$nxz ) = @_;
574 if ( $nxz ne $empty_string ) {
575  
576 $normray->{_nxz} = $nxz;
577 $normray->{_note} = $normray->{_note}.' nxz='.$normray->{_nxz};
578 $normray->{_Step} = $normray->{_Step}.' nxz='.$normray->{_nxz};
579  
580 } else {
581 print("normray, nxz, missing nxz,\n");
582 }
583 }
584  
585  
586 =head2 sub outparfile
587  
588  
589 =cut
590  
591 sub outparfile {
592  
593 my ( $self,$outparfile ) = @_;
594 if ( $outparfile ne $empty_string ) {
595  
596 $normray->{_outparfile} = $outparfile;
597 $normray->{_note} = $normray->{_note}.' outparfile='.$normray->{_outparfile};
598 $normray->{_Step} = $normray->{_Step}.' outparfile='.$normray->{_outparfile};
599  
600 } else {
601 print("normray, outparfile, missing outparfile,\n");
602 }
603 }
604  
605  
606 =head2 sub prim
607  
608  
609 =cut
610  
611 sub prim {
612  
613 my ( $self,$prim ) = @_;
614 if ( $prim ne $empty_string ) {
615  
616 $normray->{_prim} = $prim;
617 $normray->{_note} = $normray->{_note}.' prim='.$normray->{_prim};
618 $normray->{_Step} = $normray->{_Step}.' prim='.$normray->{_prim};
619  
620 } else {
621 print("normray, prim, missing prim,\n");
622 }
623 }
624  
625  
626 =head2 sub refseq
627  
628  
629 =cut
630  
631 sub refseq {
632  
633 my ( $self,$refseq ) = @_;
634 if ( $refseq ne $empty_string ) {
635  
636 $normray->{_refseq} = $refseq;
637 $normray->{_note} = $normray->{_note}.' refseq='.$normray->{_refseq};
638 $normray->{_Step} = $normray->{_Step}.' refseq='.$normray->{_refseq};
639  
640 } else {
641 print("normray, refseq, missing refseq,\n");
642 }
643 }
644  
645  
646 =head2 sub surface
647  
648  
649 =cut
650  
651 sub surface {
652  
653 my ( $self,$surface ) = @_;
654 if ( $surface ne $empty_string ) {
655  
656 $normray->{_surface} = $surface;
657 $normray->{_note} = $normray->{_note}.' surface='.$normray->{_surface};
658 $normray->{_Step} = $normray->{_Step}.' surface='.$normray->{_surface};
659  
660 } else {
661 print("normray, surface, missing surface,\n");
662 }
663 }
664  
665  
666 =head2 sub wavefile
667  
668  
669 =cut
670  
671 sub wavefile {
672  
673 my ( $self,$wavefile ) = @_;
674 if ( $wavefile ne $empty_string ) {
675  
676 $normray->{_wavefile} = $wavefile;
677 $normray->{_note} = $normray->{_note}.' wavefile='.$normray->{_wavefile};
678 $normray->{_Step} = $normray->{_Step}.' wavefile='.$normray->{_wavefile};
679  
680 } else {
681 print("normray, wavefile, missing wavefile,\n");
682 }
683 }
684  
685  
686 =head2 sub xs1
687  
688  
689 =cut
690  
691 sub xs1 {
692  
693 my ( $self,$xs1 ) = @_;
694 if ( $xs1 ne $empty_string ) {
695  
696 $normray->{_xs1} = $xs1;
697 $normray->{_note} = $normray->{_note}.' xs1='.$normray->{_xs1};
698 $normray->{_Step} = $normray->{_Step}.' xs1='.$normray->{_xs1};
699  
700 } else {
701 print("normray, xs1, missing xs1,\n");
702 }
703 }
704  
705  
706 =head2 sub zs1
707  
708  
709 =cut
710  
711 sub zs1 {
712  
713 my ( $self,$zs1 ) = @_;
714 if ( $zs1 ne $empty_string ) {
715  
716 $normray->{_zs1} = $zs1;
717 $normray->{_note} = $normray->{_note}.' zs1='.$normray->{_zs1};
718 $normray->{_Step} = $normray->{_Step}.' zs1='.$normray->{_zs1};
719  
720 } else {
721 print("normray, zs1, missing zs1,\n");
722 }
723 }
724  
725  
726 =head2 sub get_max_index
727  
728 max index = number of input variables -1
729
730 =cut
731
732 sub get_max_index {
733 my ($self) = @_;
734 my $max_index = 20;
735  
736 return($max_index);
737 }
738
739
740 1;