lib/App/SeismicUnixGui/sunix/par/transp.pm untested

filter: Statementstmt 0.0% 0 / 62 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 90 CC 5 SCAR 13.9
CC
5
Cov
0%
n1
6.0
n2
6.0
nbpe
6.0
CRAP 4.0
1 package App::SeismicUnixGui::sunix::par::transp;
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 TRANSP - TRANSPose an n1 by n2 element matrix
25  
26  
27  
28 transp <infile >outfile n1= [optional parameters]
29  
30  
31  
32 Required Parameters:
33  
34 n1 number of elements in 1st (fast) dimension of matrix
35  
36  
37  
38 Optional Parameters:
39  
40 n2=all number of elements in 2nd (slow) dimension of matrix
41  
42 nbpe=sizeof(float) number of bytes per matrix element
43  
44 verbose=0 =1 for diagnostic information
45  
46  
47  
48 =head2 CHANGES and their DATES
49  
50 =cut
51  
52 use Moose;
53 our $VERSION = '0.0.1';
54  
55  
56 =head2 Import packages
57  
58 =cut
59  
60 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
61  
62 use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin);
63 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
64  
65  
66 =head2 instantiation of packages
67  
68 =cut
69  
70 my $get = L_SU_global_constants->new();
71 my $Project = Project_config->new();
72 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
73 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
74 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
75  
76 my $var = $get->var();
77 my $on = $var->{_on};
78 my $off = $var->{_off};
79 my $true = $var->{_true};
80 my $false = $var->{_false};
81 my $empty_string = $var->{_empty_string};
82  
83 =head2 Encapsulated
84 hash of private variables
85  
86 =cut
87  
88 my $transp = {
89 _n1 => '',
90 _n2 => '',
91 _nbpe => '',
92 _verbose => '',
93 _Step => '',
94 _note => '',
95  
96 };
97  
98 =head2 sub Step
99  
100 collects switches and assembles bash instructions
101 by adding the program name
102  
103 =cut
104  
105 sub Step {
106  
107 $transp->{_Step} = 'transp'.$transp->{_Step};
108 return ( $transp->{_Step} );
109  
110 }
111  
112  
113 =head2 sub note
114  
115 collects switches and assembles bash instructions
116 by adding the program name
117  
118 =cut
119  
120 sub note {
121  
122 $transp->{_note} = 'transp'.$transp->{_note};
123 return ( $transp->{_note} );
124  
125 }
126  
127  
128  
129 =head2 sub clear
130  
131 =cut
132  
133 sub clear {
134  
135 $transp->{_n1} = '';
136 $transp->{_n2} = '';
137 $transp->{_nbpe} = '';
138 $transp->{_verbose} = '';
139 $transp->{_Step} = '';
140 $transp->{_note} = '';
141 }
142  
143  
144 =head2 sub n1
145  
146  
147 =cut
148  
149 sub n1 {
150  
151 my ( $self,$n1 ) = @_;
152 if ( $n1 ne $empty_string ) {
153  
154 $transp->{_n1} = $n1;
155 $transp->{_note} = $transp->{_note}.' n1='.$transp->{_n1};
156 $transp->{_Step} = $transp->{_Step}.' n1='.$transp->{_n1};
157  
158 } else {
159 print("transp, n1, missing n1,\n");
160 }
161 }
162  
163  
164 =head2 sub n2
165  
166  
167 =cut
168  
169 sub n2 {
170  
171 my ( $self,$n2 ) = @_;
172 if ( $n2 ne $empty_string ) {
173  
174 $transp->{_n2} = $n2;
175 $transp->{_note} = $transp->{_note}.' n2='.$transp->{_n2};
176 $transp->{_Step} = $transp->{_Step}.' n2='.$transp->{_n2};
177  
178 } else {
179 print("transp, n2, missing n2,\n");
180 }
181 }
182  
183  
184 =head2 sub nbpe
185  
186  
187 =cut
188  
189 sub nbpe {
190  
191 my ( $self,$nbpe ) = @_;
192 if ( $nbpe ne $empty_string ) {
193  
194 $transp->{_nbpe} = $nbpe;
195 $transp->{_note} = $transp->{_note}.' nbpe='.$transp->{_nbpe};
196 $transp->{_Step} = $transp->{_Step}.' nbpe='.$transp->{_nbpe};
197  
198 } else {
199 print("transp, nbpe, missing nbpe,\n");
200 }
201 }
202  
203  
204 =head2 sub verbose
205  
206  
207 =cut
208  
209 sub verbose {
210  
211 my ( $self,$verbose ) = @_;
212 if ( $verbose ne $empty_string ) {
213  
214 $transp->{_verbose} = $verbose;
215 $transp->{_note} = $transp->{_note}.' verbose='.$transp->{_verbose};
216 $transp->{_Step} = $transp->{_Step}.' verbose='.$transp->{_verbose};
217  
218 } else {
219 print("transp, verbose, missing verbose,\n");
220 }
221 }
222  
223  
224 =head2 sub get_max_index
225  
226 max index = number of input variables -1
227
228 =cut
229
230 sub get_max_index {
231 my ($self) = @_;
232 my $max_index = 3;
233  
234 return($max_index);
235 }
236
237
238 1;