This is a massive update that merges all changes from PsN_2_2_0_patches_serial. It...
[PsN.git] / lib / model / problem / theta_subs.pm
blob1c5d1c6f15d8328708b1bad7534fd45f93d69bd4
1 # {{{ include
3 start include statements
4 use model::problem::record::theta_option;
5 end include statements
7 # }}} include statements
9 # {{{ _add_option
10 start _add_option
12 push( @{$self -> {'options'}},
13 model::problem::record::theta_option ->
14 new ( option_string => $option_string ) );
16 end _add_option
17 # }}} _add_option
19 # {{{ _read_options
21 start _read_options
23 $self -> {'same'} = 0;
24 my @row = ();
25 @{$self -> {'comment'}} = ();
26 if ( defined $self -> {'record_arr'} ) {
27 for ( @{$self -> {'record_arr'}} ) {
28 chomp;
29 s/^\s+//;
30 s/\s+$//;
31 # get rid of $THETA
32 s/^\s*\$\w+//;
33 next unless( length($_) > 0 );
35 if ( /^\s*\;/ ) {
36 # This is a comment row
37 push( @{$self -> {'comment'}}, $_."\n" );
38 } else {
39 # Make sure that the labels and units are in one string
40 s/\;\s+/\;/g;
42 # Get rid of unwanted spaces
43 s/\s*\,\s*/\,/g;
44 s/\s+FIX/FIX/g;
45 s/\s+\)/\)/g;
46 s/\(\s+/\(/g;
48 # Split thetas and labels/units
49 my ( $line, $comment ) = split( ";", $_, 2 );
51 # Split the theta string to see if we have more than one theta.
52 @row = split( " ",$line );
53 if ( $#row <=0 ) {
54 # If we only have one theta, send the whole row to option
55 push( @{$self -> {'options'}},
56 model::problem::record::theta_option ->
57 new ( option_string => $_ ));
58 } else {
59 # If we have more than one theta, send one theta at a time to option
60 for ( @row ) {
61 push( @{$self -> {'options'}},
62 model::problem::record::theta_option ->
63 new ( option_string => $_ ));
64 # foreach my $option ( @{$self->{'options'}}){
65 # print "Option class: ",ref($option),"\n";
66 # print "INIT: ", $option -> init, "\n";
67 # }
74 end _read_options
76 # }}} _read_options