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

nasa / cml / 29777181804

20 Jul 2026 08:41PM UTC coverage: 85.517% (+0.2%) from 85.284%
29777181804

Pull #51

github

web-flow
Merge 9177babb3 into 783b48963
Pull Request #51: Fix all compiler warnings and treat them as errors

7833 of 8923 branches covered (87.78%)

Branch coverage included in aggregate %.

310 of 539 new or added lines in 196 files covered. (57.51%)

6 existing lines in 6 files now uncovered.

17930 of 21203 relevant lines covered (84.56%)

110707.49 hits per line

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

88.89
/models/utilities/table_interp_cpp/include/generic_multi_input_table.hh
1
/*******************************TRICK HEADER***********************************
2
 PURPOSE:
3
    (definitions for the single-variable and multi-variable
4
      n-dimensional lookup tables and for the base class from which
5
      they derive.)
6

7
 LIBRARY DEPENDENCY:
8
    ((../src/generic_multi_input_table.cc)
9
    )
10

11
 PROGRAMMERS:
12
   (((Gary Turner) (OSR) (dec 2015) (Antares) (initial version))
13
    ((Bingquan Wang) (OSR) (Aug 2017) (Antares) (IVV code cleanup and refactored))
14
   )
15
*******************************************************************************/
16
#ifndef CML_GENERIC_MULTI_INPUT_TABLE_HH
17
#define CML_GENERIC_MULTI_INPUT_TABLE_HH
18

19
#include <list>
20
#include <string> // std::string
21
#include "cml/models/utilities/cml_message/include/cml_message.hh"
22

23
#include "table_independent_variable.hh"
24
#include "table_type_defs.hh"
25

26

27
/*****************************************************************************
28
GenericMultiInputTable
29
Purpose:
30
  (Generic representation of a table of fixed data.  The table can:
31
   - utilize any (positive) number of inputs, including 1.
32
   - represent any number of dependent variables as long as they depend on
33
     the same independent variables in the same way.
34
*****************************************************************************/
35
class GenericMultiInputTable
36
{
37
 friend class SingleInputTableVarDeriv;
38
 protected:
39
  bool trivial_case; /* (--)
40
       Blocks the table-lookup when all independents have only one value.
41
       Default: true, usually modified to false internally. */
42
  bool output_ptrs_set;    /* (--)
43
       Flag to indicate the output pointers have been assigned and checked for
44
       NULL. */
45
  bool data_loaded; /* (--) internal flag indicating that data-load succeeded. */
46
  bool initialized; /* (--) set to true internal at successful initialization. */
47

48
  DoubleVec  data; /* (--)
49
       The externally defined dependent variable data. Because the number
50
       of dimensions is ambiguous, these data are stored in a 1-dimensional
51
       vector and the model contains the logic necessary to access the
52
       correct locations.*/
53
  SizeVec    size_of_dimension; /* (--)
54
       Specified number of data elements in each dimension. */
55
  DoubleVec  data_point_weight; /* (--)
56
       The weighting of each data point involved in the interpolation.
57
       Generated from the independent-variable fraction values.*/
58
  SizeVec    data_point_index; /* (--)
59
       The index of each data point involved in the interpolation. */
60
  SizeVec  num_data_elements_per_increment_of_index; /* (--)
61
       When the index ticks up on this dimension, this value specifies how
62
       many elements get skipped over in the data vector.*/
63

64
  DoublePtrVec output; /* (--)
65
       STL-vector of pointers to the variables to be populated by the lookup.*/
66
  IndepPairVec independents; /* (--)
67
       Collection of the independent variables used as inputs, coupled with the
68
       interpretation of how to use the values of the independent variables.*/
69
 public:
70
  GenericMultiInputTable();
71
  GenericMultiInputTable( double *dependent_variables,
72
                          size_t num_vars);
73
  explicit GenericMultiInputTable( double & dependent_var);
74
  explicit GenericMultiInputTable( const DoublePtrVec & dependent_variables);
NEW
75
  virtual ~GenericMultiInputTable() = default;
×
76

77
  //the first element of dim_list is the number of dependent variables and
78
  //the rest are the size of each dimension of dependent variable
79
  bool load_data( const double *data_in,
80
                  const SizeVec &dim_list);
81
  bool load_data( const DoubleVec & data_in,
82
                  const SizeVec &dim_list);
83

84
  void add_dependent( double & dependent);
85
  void append_dependent_data( double & dependent,
86
                              const DoubleVec & data_in,
87
                              const SizeVec &dim_list);
88
  void add_independent( TableIndependentVariable & var,
89
                        TableIndependentVariable::LookupMethod lookup_method=
90
                                             TableIndependentVariable::Interp);
91
  void add_independent( TableIndependentVariable & var,
92
                        size_t index,
93
                        TableIndependentVariable::LookupMethod lookup_method=
94
                                             TableIndependentVariable::Interp);
95
  virtual bool initialize();
96
  virtual bool update();
97

98
  // getters and setters:
99
  void set_output(const DoublePtrVec &variables) { populate_output(variables); }
100
  void populate_output(const DoublePtrVec &var_ptr_list);
101
  bool is_initialized() const { return initialized; }
102
  bool is_data_loaded() const { return data_loaded; }
108✔
103
  const IndepPairVec & get_independents() const {return independents;}
351✔
104
  size_t get_num_dep_vars() const { return output.size();}
255✔
105
  size_t get_data_size() const { return data.size();}
106
  double* get_dependent_variable_ptr(size_t index) {return output.at(index);}
706✔
107

108
  void bias_data(double bias, size_t idx1, size_t idx2);
109
  void bias_data(double bias, size_t idx) { bias_data( bias, idx, idx);}
36✔
110
  void bias_data(double bias) {bias_data( bias, 0, data.size()-1);}
111
  void scale_data(double scale, size_t idx1, size_t idx2);
112
  void scale_data(double scale, size_t idx) { scale_data( scale, idx, idx);}
113
  void scale_data(double scale) {scale_data( scale, 0, data.size()-1);}
114

115
  void revert_initialization() {independents.clear();
5✔
116
                                initialized = false;}
5✔
117

118
 protected:
119
  virtual bool generate_output();
120
  bool precheck_output();
121
  void generate_trivial_output();
122
  bool index_checks(size_t & idx1, size_t & idx2, std::string func);
123

124
 private:
125
  bool load_data_internal_check( const SizeVec &dim_list );
126
  bool copy_data(const double * data_in);
127
  bool copy_data(const DoubleVec & data_in);
128
  size_t configure_internal_data_structure();
129
  void configure_support_arrays();
130
  virtual void generate_base_values();
131
  size_t generate_interp_index(size_t interp_pt);
132
  size_t generate_lookup_index();
133

134
  // Disable the copy/assignment operators
135
  GenericMultiInputTable (const GenericMultiInputTable&);
136
  GenericMultiInputTable& operator = (const GenericMultiInputTable&);
137
};
138
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc