« lib/App/SeismicUnixGui/specs/statsMath/suhrot_spec.pm
↑ Summary
lib/App/SeismicUnixGui/specs/statsMath/sumix_spec.pm »
| 1 | package App::SeismicUnixGui::specs::statsMath::suinterp_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::statsMath::suinterp'; | ||
| 9 | |||
| 10 | my $get = L_SU_global_constants->new(); | ||
| 11 | my $Project = Project_config->new(); | ||
| 12 | my $suinterp = suinterp->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 = $suinterp->get_max_index(); | ||
| 25 | |||
| 26 | my $suinterp_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 => $false, | ||
| 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 | $suinterp_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 | $suinterp_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 | $suinterp_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 ( $suinterp_spec->{_binding_index_aref} ) { | ||
| 121 | |||
| 122 | my $index_aref = $suinterp_spec->{_binding_index_aref}; | ||
| 123 | return ($index_aref); | ||
| 124 | |||
| 125 | } | ||
| 126 | else { | ||
| 127 | print( | ||
| 128 | "suinterp_spec, get_binding_index_aref, missing binding_index_aref\n" | ||
| 129 | ); | ||
| 130 | return (); | ||
| 131 | } | ||
| 132 | |||
| 133 | my $index_aref = $suinterp_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 ( $suinterp_spec->{_binding_index_aref} ) { | ||
| 145 | |||
| 146 | my $binding_length = scalar @{ $suinterp_spec->{_binding_index_aref} }; | ||
| 147 | return ($binding_length); | ||
| 148 | |||
| 149 | } | ||
| 150 | else { | ||
| 151 | print("suinterp_spec, get_binding_length, missing binding_length\n"); | ||
| 152 | return (); | ||
| 153 | } | ||
| 154 | |||
| 155 | return (); | ||
| 156 | } | ||
| 157 | |||
| 158 | =head2 sub get_file_dialog_type_aref | ||
| 159 | |||
| 160 | =cut | ||
| 161 | |||
| 162 | sub get_file_dialog_type_aref { | ||
| 163 | |||
| 164 | my ($self) = @_; | ||
| 165 | if ( $suinterp_spec->{_file_dialog_type_aref} ) { | ||
| 166 | |||
| 167 | my $index_aref = $suinterp_spec->{_file_dialog_type_aref}; | ||
| 168 | return ($index_aref); | ||
| 169 | |||
| 170 | } | ||
| 171 | else { | ||
| 172 | print( | ||
| 173 | "suinterp_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n" | ||
| 174 | ); | ||
| 175 | return (); | ||
| 176 | } | ||
| 177 | |||
| 178 | return (); | ||
| 179 | } | ||
| 180 | |||
| 181 | =head2 sub get_flow_type_aref | ||
| 182 | |||
| 183 | =cut | ||
| 184 | |||
| 185 | sub get_flow_type_aref { | ||
| 186 | |||
| 187 | my ($self) = @_; | ||
| 188 | |||
| 189 | if ( $suinterp_spec->{_flow_type_aref} ) { | ||
| 190 | |||
| 191 | my $index_aref = $suinterp_spec->{_flow_type_aref}; | ||
| 192 | return ($index_aref); | ||
| 193 | |||
| 194 | } | ||
| 195 | else { | ||
| 196 | print("suinterp_spec, get_flow_type_aref, missing flow_type_aref\n"); | ||
| 197 | return (); | ||
| 198 | } | ||
| 199 | |||
| 200 | } | ||
| 201 | |||
| 202 | =head2 sub get_incompatibles | ||
| 203 | |||
| 204 | =cut | ||
| 205 | |||
| 206 | sub get_incompatibles { | ||
| 207 | |||
| 208 | my ($self) = @_; | ||
| 209 | my @needed; | ||
| 210 | |||
| 211 | my @_need_both; | ||
| 212 | |||
| 213 | my @_need_only_1; | ||
| 214 | |||
| 215 | my @_none_needed; | ||
| 216 | |||
| 217 | my @_all_needed; | ||
| 218 | |||
| 219 | my $params = { | ||
| 220 | |||
| 221 | _need_both => \@_need_both, | ||
| 222 | _need_only_1 => \@_need_only_1, | ||
| 223 | _none_needed => \@_none_needed, | ||
| 224 | _all_needed => \@_all_needed, | ||
| 225 | |||
| 226 | }; | ||
| 227 | |||
| 228 | my @of_two = ( 'xx', 'yy' ); | ||
| 229 | push @{ $params->{_need_only_1} }, \@of_two; | ||
| 230 | |||
| 231 | my $len_1_needed = scalar @{ $params->{_need_only_1} }; | ||
| 232 | |||
| 233 | if ( $len_1_needed >= 1 ) { | ||
| 234 | |||
| 235 | for ( my $i = 0 ; $i < $len_1_needed ; $i++ ) { | ||
| 236 | |||
| 237 | print( | ||
| 238 | "suinterp, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n" | ||
| 239 | ); | ||
| 240 | |||
| 241 | } | ||
| 242 | |||
| 243 | } | ||
| 244 | else { | ||
| 245 | print("get_incompatibles, no incompatibles\n"); | ||
| 246 | } | ||
| 247 | |||
| 248 | return ($params); | ||
| 249 | |||
| 250 | } | ||
| 251 | |||
| 252 | =head2 sub get_prefix_aref | ||
| 253 | |||
| 254 | =cut | ||
| 255 | |||
| 256 | sub get_prefix_aref { | ||
| 257 | |||
| 258 | my ($self) = @_; | ||
| 259 | |||
| 260 | if ( $suinterp_spec->{_prefix_aref} ) { | ||
| 261 | |||
| 262 | my $prefix_aref = $suinterp_spec->{_prefix_aref}; | ||
| 263 | return ($prefix_aref); | ||
| 264 | |||
| 265 | } | ||
| 266 | else { | ||
| 267 | print("suinterp_spec, get_prefix_aref, missing prefix_aref\n"); | ||
| 268 | return (); | ||
| 269 | } | ||
| 270 | |||
| 271 | return (); | ||
| 272 | } | ||
| 273 | |||
| 274 | =head2 sub get_suffix_aref | ||
| 275 | |||
| 276 | =cut | ||
| 277 | |||
| 278 | sub get_suffix_aref { | ||
| 279 | |||
| 280 | my ($self) = @_; | ||
| 281 | |||
| 282 | if ( $suinterp_spec->{_suffix_aref} ) { | ||
| 283 | |||
| 284 | my $suffix_aref = $suinterp_spec->{_suffix_aref}; | ||
| 285 | return ($suffix_aref); | ||
| 286 | |||
| 287 | } | ||
| 288 | else { | ||
| 289 | print("$suinterp_spec, get_suffix_aref, missing suffix_aref\n"); | ||
| 290 | return (); | ||
| 291 | } | ||
| 292 | |||
| 293 | return (); | ||
| 294 | } | ||
| 295 | |||
| 296 | =head2 sub prefix_aref | ||
| 297 | |||
| 298 | Include in the Set up | ||
| 299 | sections of an output Poop flow. | ||
| 300 | |||
| 301 | prefixes and suffixes to parameter labels | ||
| 302 | are filtered by sunix_pl | ||
| 303 | |||
| 304 | =cut | ||
| 305 | |||
| 306 | sub prefix_aref { | ||
| 307 | |||
| 308 | my ($self) = @_; | ||
| 309 | |||
| 310 | my @prefix; | ||
| 311 | |||
| 312 | for ( my $i = 0 ; $i < $max_index ; $i++ ) { | ||
| 313 | |||
| 314 | $prefix[$i] = $empty_string; | ||
| 315 | |||
| 316 | } | ||
| 317 | $suinterp_spec->{_prefix_aref} = \@prefix; | ||
| 318 | return (); | ||
| 319 | |||
| 320 | } | ||
| 321 | |||
| 322 | =head2 sub suffix_aref | ||
| 323 | |||
| 324 | Initialize suffixes as empty | ||
| 325 | Assign specific suffixes to parameter | ||
| 326 | values | ||
| 327 | |||
| 328 | =cut | ||
| 329 | |||
| 330 | sub suffix_aref { | ||
| 331 | |||
| 332 | my ($self) = @_; | ||
| 333 | |||
| 334 | my @suffix; | ||
| 335 | |||
| 336 | for ( my $i = 0 ; $i < $max_index ; $i++ ) { | ||
| 337 | |||
| 338 | $suffix[$i] = $empty_string; | ||
| 339 | |||
| 340 | } | ||
| 341 | $suinterp_spec->{_suffix_aref} = \@suffix; | ||
| 342 | return (); | ||
| 343 | |||
| 344 | } | ||
| 345 | |||
| 346 | =head2 sub variables | ||
| 347 | |||
| 348 | return a hash array | ||
| 349 | with definitions | ||
| 350 | |||
| 351 | =cut | ||
| 352 | |||
| 353 | sub variables { | ||
| 354 | my $self = @_; | ||
| 355 | my $hash_ref = $suinterp_spec; | ||
| 356 | return ($hash_ref); | ||
| 357 | } | ||
| 358 | |||
| 359 | 1; |