• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CSMMLab / KiT-RT / #95

28 May 2025 02:06AM UTC coverage: 46.655% (-11.1%) from 57.728%
#95

push

travis-ci

web-flow
Release 2025 (#44)

* New neural models (#30)

* extend kitrt script

* added new neural models

* extend to m3 models

* added M3_2D models

* added M2 and M4 models

* configure ml optimizer for high order models

* added configuration for high order models

* add option for rotation postprcessing in neural networks. remove unneccessary python scripts

* started rotational symmetric postprocessing

* added rotational invariance postprocessing for m2 and m1 models

* fix post merge bugs

* created hohlraum mesh

* add hohlraum tes case

* add hohlraum test case

* add hohlraum cfg filees

* fixed hohlraum testcase

* add hohlraum cfg files

* changed hohlraum cfg

* changed hohlraum testcase to isotropic inflow source boundary condition

* added ghost cell bonudary for hohlraum testcase

* update readme and linesource mesh creator

* added proper scaling for linesource reference solution

* regularized newton debugging

* Data generator with reduced objective functional (#33)

* added reduced optimizer for sampling

* remove old debugging comments

* mesh acceleration (#38)

* added new ansatz (#36)

* added new ansatz

* debug new ansatz

* branch should be abandoned here

* debug new ansatz

* fix scaling error new ansatz

* fix config errors

* temporarily fixed dynamic ansatz rotation bug

* fix inheritance error for new ansatz

* mesh acceleration

* add structured hohlraum

* Mesh acc (#41)

* mesh acceleration

* added floor value for starmap moment methods

* enable accelleration

* delete minimum value starmap

* Update README.md

* Spherical harmonics nn (#40)

* added new ansatz

* debug new ansatz

* branch should be abandoned here

* debug new ansatz

* fix scaling error new ansatz

* fix config errors

* temporarily fixed dynamic ansatz rotation bug

* fix inheritance error for new ansatz

* mesh acceleration

* add structured hohlraum

* added sph... (continued)

767 of 3019 new or added lines in 51 files covered. (25.41%)

131 existing lines in 8 files now uncovered.

4422 of 9478 relevant lines covered (46.66%)

57163.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

59.15
/src/common/optionstructure.cpp
1
/*!
2
 * \file config.cpp
3
 * \brief Classes for different Optiontypes in rtsn
4
 * \author S. Schotthoefer
5
 *
6
 * Disclaimer: This class structure was copied and modifed with open source permission from SU2 v7.0.3 https://su2code.github.io/
7
 */
8

9
#include "common/optionstructure.hpp"
10

11
// --- Members of OptionBase ----
12

13
OptionBase::~OptionBase() {}
1,944✔
14

×
15
std::vector<std::string> OptionBase::GetValue() { return _value; }
1,944✔
16

17
std::string OptionBase::SetValue( std::vector<std::string> value ) {
5,946✔
18
    this->_value = value;
19
    return "";
1,020✔
20
}
1,020✔
21

1,020✔
22
std::string OptionBase::OptionCheckMultipleValues( std::vector<std::string>& option_value, std::string type_id, std::string option_name ) {
23
    if( option_value.size() != 1 ) {
24
        std::string newString;
936✔
25
        newString.append( option_name );
936✔
26
        newString.append( ": multiple values for type " );
×
27
        newString.append( type_id );
×
28
        return newString;
×
29
    }
×
30
    return "";
×
31
}
32

936✔
33
std::string OptionBase::BadValue( std::vector<std::string>& option_value, std::string type_id, std::string option_name ) {
34
    std::string newString;
35
    newString.append( option_name );
×
36
    newString.append( ": improper option value for type " );
×
37
    newString.append( type_id );
×
38
    newString.append( ". Value chosen: " );
×
39
    for( unsigned i = 0; i < option_value.size(); i++ ) {
×
40
        newString.append( option_value[i] );
×
41
    }
×
42
    return newString;
×
43
}
44

×
45
// ---- Memebers of OptionDouble
46

47
OptionDouble::OptionDouble( std::string option_field_name, double& option_field, double default_value ) : _field( option_field ) {
48
    this->_def  = default_value;
49
    this->_name = option_field_name;
2,150✔
50
}
2,150✔
51

2,150✔
52
std::string OptionDouble::SetValue( std::vector<std::string> option_value ) {
2,150✔
53
    OptionBase::SetValue( option_value );
54
    // check if there is more than one value
142✔
55
    std::string out = OptionCheckMultipleValues( option_value, "double", this->_name );
142✔
56
    if( out.compare( "" ) != 0 ) {
57
        return out;
426✔
58
    }
142✔
59
    std::istringstream is( option_value[0] );
×
60
    double val;
61
    if( is >> val ) {
284✔
62
        this->_field = val;
63
        return "";
142✔
64
    }
142✔
65
    return BadValue( option_value, "double", this->_name );
142✔
66
}
67

×
68
void OptionDouble::SetDefault() { this->_field = this->_def; }
69

70
// ---- Members of OptionString
2,008✔
71

72
OptionString::OptionString( std::string option_field_name, std::string& option_field, std::string default_value ) : _field( option_field ) {
73
    this->_def  = default_value;
74
    this->_name = option_field_name;
860✔
75
}
860✔
76

860✔
77
std::string OptionString::SetValue( std::vector<std::string> option_value ) {
860✔
78
    OptionBase::SetValue( option_value );
79
    // check if there is more than one value
332✔
80
    std::string out = OptionCheckMultipleValues( option_value, "double", this->_name );
332✔
81
    if( out.compare( "" ) != 0 ) {
82
        return out;
996✔
83
    }
332✔
84
    this->_field.assign( option_value[0] );
×
85
    return "";
86
}
332✔
87

332✔
88
void OptionString::SetDefault() { this->_field = this->_def; }
89

90
// --- Members of OptionInt
528✔
91

92
OptionInt::OptionInt( std::string option_field_name, int& option_field, int default_value ) : _field( option_field ) {
93
    this->_def  = default_value;
94
    this->_name = option_field_name;
×
95
}
×
96

×
97
std::string OptionInt::SetValue( std::vector<std::string> option_value ) {
98
    OptionBase::SetValue( option_value );
99
    std::string out = OptionCheckMultipleValues( option_value, "int", this->_name );
×
100
    if( out.compare( "" ) != 0 ) {
×
101
        return out;
×
102
    }
×
103
    std::istringstream is( option_value[0] );
×
104
    int val;
105
    if( is >> val ) {
×
106
        this->_field = val;
107
        return "";
×
108
    }
×
109
    return BadValue( option_value, "int", this->_name );
×
110
}
111
void OptionInt::SetDefault() { this->_field = this->_def; }
×
112

113
// ---- Members of OptionULong
×
114

115
OptionULong::OptionULong( std::string option_field_name, unsigned long& option_field, unsigned long default_value ) : _field( option_field ) {
116
    this->_def  = default_value;
117
    this->_name = option_field_name;
430✔
118
}
430✔
119

430✔
120
std::string OptionULong::SetValue( std::vector<std::string> option_value ) {
430✔
121
    OptionBase::SetValue( option_value );
122
    std::string out = OptionCheckMultipleValues( option_value, "unsigned long", this->_name );
46✔
123
    if( out.compare( "" ) != 0 ) {
46✔
124
        return out;
138✔
125
    }
46✔
126
    std::istringstream is( option_value[0] );
×
127
    unsigned long val;
128
    if( is >> val ) {
92✔
129
        this->_field = val;
130
        return "";
46✔
131
    }
46✔
132
    return BadValue( option_value, "unsigned long", this->_name );
46✔
133
}
134

×
135
void OptionULong::SetDefault() { this->_field = this->_def; }
136

137
// ---- Members of OptionUShort
384✔
138

139
OptionUShort::OptionUShort( std::string option_field_name, unsigned short& option_field, unsigned short default_value ) : _field( option_field ) {
140
    this->_def  = default_value;
141
    this->_name = option_field_name;
1,032✔
142
}
1,032✔
143

1,032✔
144
std::string OptionUShort::SetValue( std::vector<std::string> option_value ) {
1,032✔
145
    OptionBase::SetValue( option_value );
146
    std::string out = OptionCheckMultipleValues( option_value, "unsigned short", this->_name );
140✔
147
    if( out.compare( "" ) != 0 ) {
140✔
148
        return out;
420✔
149
    }
140✔
150
    std::istringstream is( option_value[0] );
×
151
    unsigned short val;
152
    if( is >> val ) {
280✔
153
        this->_field = val;
154
        return "";
140✔
155
    }
140✔
156
    return BadValue( option_value, "unsigned short", this->_name );
140✔
157
}
158

×
159
void OptionUShort::SetDefault() { this->_field = this->_def; }
160

161
// ---- Members of OptionLong
892✔
162

163
OptionLong::OptionLong( std::string option_field_name, long& option_field, long default_value ) : _field( option_field ) {
164
    this->_def  = default_value;
165
    this->_name = option_field_name;
×
166
}
×
167

×
168
std::string OptionLong::SetValue( std::vector<std::string> option_value ) {
169
    OptionBase::SetValue( option_value );
170
    std::string out = OptionCheckMultipleValues( option_value, "long", this->_name );
×
171
    if( out.compare( "" ) != 0 ) {
×
172
        return out;
×
173
    }
×
174
    std::istringstream is( option_value[0] );
×
175
    long val;
176
    if( is >> val ) {
×
177
        this->_field = val;
178
        return "";
×
179
    }
×
180
    return BadValue( option_value, "long", this->_name );
×
181
}
182

×
183
void OptionLong::SetDefault() { this->_field = this->_def; }
184

185
// ---- Members of OptionBool
×
186

187
OptionBool::OptionBool( std::string option_field_name, bool& option_field, bool default_value ) : _field( option_field ) {
188
    this->_def  = default_value;
189
    this->_name = option_field_name;
1,204✔
190
}
1,204✔
191

1,204✔
192
std::string OptionBool::SetValue( std::vector<std::string> option_value ) {
1,204✔
193
    OptionBase::SetValue( option_value );
194
    // check if there is more than one value
82✔
195
    std::string out = OptionCheckMultipleValues( option_value, "bool", this->_name );
82✔
196
    if( out.compare( "" ) != 0 ) {
197
        return out;
246✔
198
    }
82✔
199
    if( option_value[0].compare( "YES" ) == 0 ) {
×
200
        this->_field = true;
201
        return "";
82✔
202
    }
54✔
203
    if( option_value[0].compare( "NO" ) == 0 ) {
54✔
204
        this->_field = false;
205
        return "";
28✔
206
    }
28✔
207
    return BadValue( option_value, "bool", this->_name );
28✔
208
}
209

×
210
void OptionBool::SetDefault() { this->_field = this->_def; }
211

212
// --- members of OptionStringList
1,122✔
213

214
OptionStringList::OptionStringList( std::string option_field_name, unsigned short& list_size, std::vector<std::string>& option_field )
215
    : _field( option_field ), _size( list_size ) {
216
    this->_name = option_field_name;
172✔
217
}
172✔
218

172✔
219
std::string OptionStringList::SetValue( std::vector<std::string> option_value ) {
172✔
220
    OptionBase::SetValue( option_value );
221
    // The size is the length of option_value
50✔
222
    unsigned short option_size = option_value.size();
50✔
223
    if( option_size == 1 && option_value[0].compare( "NONE" ) == 0 ) {
224
        this->_size = 0;
50✔
225
        return "";
50✔
226
    }
×
227
    this->_size = option_size;
×
228

229
    // Parse all of the options
50✔
230
    this->_field.resize( this->_size );
231
    for( unsigned long i = 0; i < option_size; i++ ) {
232
        this->_field.at( i ) = option_value[i];
50✔
233
    }
110✔
234
    return "";
60✔
235
}
236

50✔
237
void OptionStringList::SetDefault() {
238
    this->_size = 0;    // There is no default value for list
239
}
122✔
240

122✔
241
// --- members of OptionDoubleList
122✔
242

243
OptionDoubleList::OptionDoubleList( std::string option_field_name, unsigned short& list_size, std::vector<double>& option_field )
244
    : _field( option_field ), _size( list_size ) {
245
    this->_name = option_field_name;
172✔
246
}
172✔
247

172✔
248
std::string OptionDoubleList::SetValue( std::vector<std::string> option_value ) {
172✔
249
    OptionBase::SetValue( option_value );
NEW
250
    // The size is the length of option_value
×
NEW
251
    unsigned short option_size = option_value.size();
×
252
    if( option_size == 1 && option_value[0].compare( "NONE" ) == 0 ) {
NEW
253
        this->_size = 0;
×
NEW
254
        return "";
×
NEW
255
    }
×
NEW
256
    this->_size = option_size;
×
257

NEW
258
    // Parse all of the options
×
259
    this->_field.resize( this->_size );
260
    for( unsigned long i = 0; i < option_size; i++ ) {
NEW
261
        std::istringstream is( option_value[i] );
×
NEW
262
        double val;
×
NEW
263
        if( is >> val ) {
×
264
            this->_field.at( i ) = val;
NEW
265
        }
×
NEW
266
    }
×
267
    return "";
268
}
NEW
269

×
270
void OptionDoubleList::SetDefault() {
271
    this->_size = 0;    // There is no default value for list
272
}
172✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc