« lib/App/SeismicUnixGui/specs/transform/sugabor_spec.pm
↑ Summary
lib/App/SeismicUnixGui/specs/transform/suifft_spec.pm »
| 1 | package App::SeismicUnixGui::specs::transform::suicepstrum_spec; | ||
| 2 | use Moose; | ||
| 3 | our $VERSION = '0.0.1'; | ||
| 4 | |||
| 5 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 6 | use App::SeismicUnixGui::misc::SeismicUnix qw($su $suffix_su); | ||
| 7 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 8 | use aliased 'App::SeismicUnixGui::sunix::transform::suicepstrum'; | ||
| 9 | |||
| 10 | my $get = L_SU_global_constants->new(); | ||
| 11 | my $Project = Project_config->new(); | ||
| 12 | my $suicepstrum = suicepstrum->new(); | ||
| 13 | |||
| 14 | my $var = $get->var(); | ||
| 15 | |||
| 16 | my $empty_string = $var->{_empty_string}; | ||
| 17 | my $true = $var->{_true}; | ||
| 18 | my $false = $var->{_false}; | ||
| 19 | my $file_dialog_type = $get->file_dialog_type_href(); | ||
| 20 | my $flow_type = $get->flow_type_href(); | ||
| 21 | |||
| 22 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); # output data directory | ||
| 23 | my $PL_SEISMIC = $Project->PL_SEISMIC(); | ||
| 24 | my $max_index = $suicepstrum->get_max_index(); | ||
| 25 | |||
| 26 | my $suicepstrum_spec = { | ||
| 27 | _CONFIG => $PL_SEISMIC, | ||
| 28 | _DATA_DIR_IN => $DATA_SEISMIC_SU, | ||
| 29 | _DATA_DIR_OUT => $DATA_SEISMIC_SU, | ||
| 30 | _binding_index_aref => '', | ||
| 31 | _suffix_type_in => $su, | ||
| 32 | _data_suffix_in => $suffix_su, | ||
| 33 | _suffix_type_out => $su, | ||
| 34 | _data_suffix_out => $suffix_su, | ||
| 35 | _file_dialog_type_aref => '', | ||
| 36 | _flow_type_aref => '', | ||
| 37 | _has_infile => $true, | ||
| 38 | _has_pipe_in => $true, | ||
| 39 | _has_outpar => $false, | ||
| 40 | _has_pipe_out => $true, | ||
| 41 | _has_redirect_in => $true, | ||
| 42 | _has_redirect_out => $true, | ||
| 43 | _has_subin_in => $false, | ||
| 44 | _has_subin_out => $false, | ||
| 45 | _is_data => $false, | ||
| 46 | _is_first_of_2 => $true, | ||
| 47 | _is_first_of_3or_more => $true, | ||
| 48 | _is_first_of_4or_more => $true, | ||
| 49 | _is_last_of_2 => $false, | ||
| 50 | _is_last_of_3or_more => $false, | ||
| 51 | _is_last_of_4or_more => $false, | ||
| 52 | _is_suprog => $true, | ||
| 53 | _is_superflow => $false, | ||
| 54 | _max_index => $max_index, | ||
| 55 | }; | ||
| 56 | |||
| 57 | =head2 sub binding_index_aref | ||
| 58 | |||
| 59 | =cut | ||
| 60 | |||
| 61 | sub binding_index_aref { | ||
| 62 | |||
| 63 | my ($self) = @_; | ||
| 64 | |||
| 65 | my @index; | ||
| 66 | |||
| 67 | $index[0] = 0; | ||
| 68 | |||
| 69 | $suicepstrum_spec->{_binding_index_aref} = \@index; | ||
| 70 | return (); | ||
| 71 | |||
| 72 | } | ||
| 73 | |||
| 74 | =head2 sub file_dialog_type_aref | ||
| 75 | |||
| 76 | type of dialog (Data, Flow, SaveAs) is needed by binding | ||
| 77 | one type of dialog for each index | ||
| 78 | |||
| 79 | =cut | ||
| 80 | |||
| 81 | sub file_dialog_type_aref { | ||
| 82 | |||
| 83 | my ($self) = @_; | ||
| 84 | |||
| 85 | my @type; | ||
| 86 | |||
| 87 | $type[0] = ''; | ||
| 88 | |||
| 89 | $suicepstrum_spec->{_file_dialog_type_aref} = \@type; | ||
| 90 | return (); | ||
| 91 | |||
| 92 | } | ||
| 93 | |||
| 94 | =head2 sub flow_type_aref | ||
| 95 | |||
| 96 | =cut | ||
| 97 | |||
| 98 | sub flow_type_aref { | ||
| 99 | |||
| 100 | my ($self) = @_; | ||
| 101 | |||
| 102 | my @type; | ||
| 103 | |||
| 104 | $type[0] = $flow_type->{_user_built}; | ||
| 105 | |||
| 106 | $suicepstrum_spec->{_flow_type_aref} = \@type; | ||
| 107 | return (); | ||
| 108 | |||
| 109 | } | ||
| 110 | |||
| 111 | =head2 sub get_binding_index_aref | ||
| 112 | |||
| 113 | =cut | ||
| 114 | |||
| 115 | sub get_binding_index_aref { | ||
| 116 | |||
| 117 | my ($self) = @_; | ||
| 118 | my @index; | ||
| 119 | |||
| 120 | if ( $suicepstrum_spec->{_binding_index_aref} ) { | ||
| 121 | |||
| 122 | my $index_aref = $suicepstrum_spec->{_binding_index_aref}; | ||
| 123 | return ($index_aref); | ||
| 124 | |||
| 125 | } | ||
| 126 | else { | ||
| 127 | print( | ||
| 128 | "suicepstrum_spec, get_binding_index_aref, missing binding_index_aref\n" | ||
| 129 | ); | ||
| 130 | return (); | ||
| 131 | } | ||
| 132 | |||
| 133 | my $index_aref = $suicepstrum_spec->{_binding_index_aref}; | ||
| 134 | } | ||
| 135 | |||
| 136 | =head2 sub get_binding_length | ||
| 137 | |||
| 138 | =cut | ||
| 139 | |||
| 140 | sub get_binding_length { | ||
| 141 | |||
| 142 | my ($self) = @_; | ||
| 143 | |||
| 144 | if ( $suicepstrum_spec->{_binding_index_aref} ) { | ||
| 145 | |||
| 146 | my $binding_length = | ||
| 147 | scalar @{ $suicepstrum_spec->{_binding_index_aref} }; | ||
| 148 | return ($binding_length); | ||
| 149 | |||
| 150 | } | ||
| 151 | else { | ||
| 152 | print("suicepstrum_spec, get_binding_length, missing binding_length\n"); | ||
| 153 | return (); | ||
| 154 | } | ||
| 155 | |||
| 156 | return (); | ||
| 157 | } | ||
| 158 | |||
| 159 | =head2 sub get_file_dialog_type_aref | ||
| 160 | |||
| 161 | =cut | ||
| 162 | |||
| 163 | sub get_file_dialog_type_aref { | ||
| 164 | |||
| 165 | my ($self) = @_; | ||
| 166 | if ( $suicepstrum_spec->{_file_dialog_type_aref} ) { | ||
| 167 | |||
| 168 | my $index_aref = $suicepstrum_spec->{_file_dialog_type_aref}; | ||
| 169 | return ($index_aref); | ||
| 170 | |||
| 171 | } | ||
| 172 | else { | ||
| 173 | print( | ||
| 174 | "suicepstrum_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n" | ||
| 175 | ); | ||
| 176 | return (); | ||
| 177 | } | ||
| 178 | |||
| 179 | return (); | ||
| 180 | } | ||
| 181 | |||
| 182 | =head2 sub get_flow_type_aref | ||
| 183 | |||
| 184 | =cut | ||
| 185 | |||
| 186 | sub get_flow_type_aref { | ||
| 187 | |||
| 188 | my ($self) = @_; | ||
| 189 | |||
| 190 | if ( $suicepstrum_spec->{_flow_type_aref} ) { | ||
| 191 | |||
| 192 | my $index_aref = $suicepstrum_spec->{_flow_type_aref}; | ||
| 193 | return ($index_aref); | ||
| 194 | |||
| 195 | } | ||
| 196 | else { | ||
| 197 | print("suicepstrum_spec, get_flow_type_aref, missing flow_type_aref\n"); | ||
| 198 | return (); | ||
| 199 | } | ||
| 200 | |||
| 201 | } | ||
| 202 | |||
| 203 | =head2 sub get_incompatibles | ||
| 204 | |||
| 205 | =cut | ||
| 206 | |||
| 207 | sub get_incompatibles { | ||
| 208 | |||
| 209 | my ($self) = @_; | ||
| 210 | my @needed; | ||
| 211 | |||
| 212 | my @_need_both; | ||
| 213 | |||
| 214 | my @_need_only_1; | ||
| 215 | |||
| 216 | my @_none_needed; | ||
| 217 | |||
| 218 | my @_all_needed; | ||
| 219 | |||
| 220 | my $params = { | ||
| 221 | |||
| 222 | _need_both => \@_need_both, | ||
| 223 | _need_only_1 => \@_need_only_1, | ||
| 224 | _none_needed => \@_none_needed, | ||
| 225 | _all_needed => \@_all_needed, | ||
| 226 | |||
| 227 | }; | ||
| 228 | |||
| 229 | my @of_two = ( 'xx', 'yy' ); | ||
| 230 | push @{ $params->{_need_only_1} }, \@of_two; | ||
| 231 | |||
| 232 | my $len_1_needed = scalar @{ $params->{_need_only_1} }; | ||
| 233 | |||
| 234 | if ( $len_1_needed >= 1 ) { | ||
| 235 | |||
| 236 | for ( my $i = 0 ; $i < $len_1_needed ; $i++ ) { | ||
| 237 | |||
| 238 | print( | ||
| 239 | "suicepstrum, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n" | ||
| 240 | ); | ||
| 241 | |||
| 242 | } | ||
| 243 | |||
| 244 | } | ||
| 245 | else { | ||
| 246 | print("get_incompatibles, no incompatibles\n"); | ||
| 247 | } | ||
| 248 | |||
| 249 | return ($params); | ||
| 250 | |||
| 251 | } | ||
| 252 | |||
| 253 | =head2 sub get_prefix_aref | ||
| 254 | |||
| 255 | =cut | ||
| 256 | |||
| 257 | sub get_prefix_aref { | ||
| 258 | |||
| 259 | my ($self) = @_; | ||
| 260 | |||
| 261 | if ( $suicepstrum_spec->{_prefix_aref} ) { | ||
| 262 | |||
| 263 | my $prefix_aref = $suicepstrum_spec->{_prefix_aref}; | ||
| 264 | return ($prefix_aref); | ||
| 265 | |||
| 266 | } | ||
| 267 | else { | ||
| 268 | print("suicepstrum_spec, get_prefix_aref, missing prefix_aref\n"); | ||
| 269 | return (); | ||
| 270 | } | ||
| 271 | |||
| 272 | return (); | ||
| 273 | } | ||
| 274 | |||
| 275 | =head2 sub get_suffix_aref | ||
| 276 | |||
| 277 | =cut | ||
| 278 | |||
| 279 | sub get_suffix_aref { | ||
| 280 | |||
| 281 | my ($self) = @_; | ||
| 282 | |||
| 283 | if ( $suicepstrum_spec->{_suffix_aref} ) { | ||
| 284 | |||
| 285 | my $suffix_aref = $suicepstrum_spec->{_suffix_aref}; | ||
| 286 | return ($suffix_aref); | ||
| 287 | |||
| 288 | } | ||
| 289 | else { | ||
| 290 | print("$suicepstrum_spec, get_suffix_aref, missing suffix_aref\n"); | ||
| 291 | return (); | ||
| 292 | } | ||
| 293 | |||
| 294 | return (); | ||
| 295 | } | ||
| 296 | |||
| 297 | =head2 sub prefix_aref | ||
| 298 | |||
| 299 | Include in the Set up | ||
| 300 | sections of an output Poop flow. | ||
| 301 | |||
| 302 | prefixes and suffixes to parameter labels | ||
| 303 | are filtered by sunix_pl | ||
| 304 | |||
| 305 | =cut | ||
| 306 | |||
| 307 | sub prefix_aref { | ||
| 308 | |||
| 309 | my ($self) = @_; | ||
| 310 | |||
| 311 | my @prefix; | ||
| 312 | |||
| 313 | for ( my $i = 0 ; $i < $max_index ; $i++ ) { | ||
| 314 | |||
| 315 | $prefix[$i] = $empty_string; | ||
| 316 | |||
| 317 | } | ||
| 318 | $suicepstrum_spec->{_prefix_aref} = \@prefix; | ||
| 319 | return (); | ||
| 320 | |||
| 321 | } | ||
| 322 | |||
| 323 | =head2 sub suffix_aref | ||
| 324 | |||
| 325 | Initialize suffixes as empty | ||
| 326 | Assign specific suffixes to parameter | ||
| 327 | values | ||
| 328 | |||
| 329 | =cut | ||
| 330 | |||
| 331 | sub suffix_aref { | ||
| 332 | |||
| 333 | my ($self) = @_; | ||
| 334 | |||
| 335 | my @suffix; | ||
| 336 | |||
| 337 | for ( my $i = 0 ; $i < $max_index ; $i++ ) { | ||
| 338 | |||
| 339 | $suffix[$i] = $empty_string; | ||
| 340 | |||
| 341 | } | ||
| 342 | $suicepstrum_spec->{_suffix_aref} = \@suffix; | ||
| 343 | return (); | ||
| 344 | |||
| 345 | } | ||
| 346 | |||
| 347 | =head2 sub variables | ||
| 348 | |||
| 349 | return a hash array | ||
| 350 | with definitions | ||
| 351 | |||
| 352 | =cut | ||
| 353 | |||
| 354 | sub variables { | ||
| 355 | my $self = @_; | ||
| 356 | my $hash_ref = $suicepstrum_spec; | ||
| 357 | return ($hash_ref); | ||
| 358 | } | ||
| 359 | |||
| 360 | 1; |