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