Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix #2402 main_v11.0 sonarqube #2447

Merged
merged 18 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
f19bff8
Per #2402, updating the sonarqube properties to track progress for th…
JohnHalleyGotway Feb 2, 2023
4100841
Per #2402, revert the sonar properties back to what they were. When I…
JohnHalleyGotway Feb 3, 2023
f882d97
Per #2402, reimplement the PiecewiseLinear class using std::vector to…
JohnHalleyGotway Feb 15, 2023
96ab78f
Merge branch 'main_v11.0' into bugfix_2402_main_v11.0_sonarqube
JohnHalleyGotway Feb 16, 2023
4e36503
Per #2402, updates ascii_table.cc by replacing dynamically allocated …
JohnHalleyGotway Feb 16, 2023
909a6b2
Per #2402, update the CRC_Array template class to use stl vectors ins…
JohnHalleyGotway Feb 16, 2023
35c186d
Per #2402, reimplement the TableFlatFile class using std::vector inst…
JohnHalleyGotway Feb 16, 2023
f1e61fe
Per #2402, define and use a new SemiLatLonData::clear() to avoid a So…
JohnHalleyGotway Feb 16, 2023
4b257ea
Per #2402, reimplement FcstObsSet using std::vector instead of dynami…
JohnHalleyGotway Feb 16, 2023
0f24770
Per #2402, update contable.cc to use std::vector instead of dynamical…
JohnHalleyGotway Feb 16, 2023
8f2445a
Per #2402, update the implementation of CgFontCollection to use std::…
JohnHalleyGotway Feb 16, 2023
1a5b076
Per #2402, rollback changes to set.h and set.cc which seem to have ca…
JohnHalleyGotway Feb 16, 2023
a7fb293
Per #2402, ci-run-unit fix CgFontCollection::init_from_scratch() to i…
JohnHalleyGotway Feb 20, 2023
3088da1
Per #2402, correct CgFontCollection::clear() to clear based on the nu…
JohnHalleyGotway Feb 20, 2023
fe03d74
Per #2402, reimplement FcstObsSet using vectors instead of locally ma…
JohnHalleyGotway Feb 20, 2023
e913570
Per #2402, rollback changes to set.h/.cc which continue to cause runt…
JohnHalleyGotway Feb 20, 2023
516eced
Per #2402, fix CRC_Array assign function to just copy the vector inst…
JohnHalleyGotway Feb 21, 2023
93a46dc
Merge branch 'main_v11.0' into bugfix_2402_main_v11.0_sonarqube
JohnHalleyGotway Feb 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
311 changes: 59 additions & 252 deletions src/basic/vx_math/pwl.cc

Large diffs are not rendered by default.

21 changes: 4 additions & 17 deletions src/basic/vx_math/pwl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


#include <iostream>

#include <vector>

////////////////////////////////////////////////////////////////////////

Expand All @@ -39,17 +39,10 @@ class PiecewiseLinear {

protected:

void extend(int);

int N;

int n_alloc;

ConcatString Name;

double * X;
double * Y;

std::vector<double> X;
std::vector<double> Y;

public:

Expand Down Expand Up @@ -95,20 +88,14 @@ class PiecewiseLinear {
////////////////////////////////////////////////////////////////////////


inline int PiecewiseLinear::n_points() const { return ( N ); }
inline int PiecewiseLinear::n_points() const { return ( X.size() ); }

inline const char * PiecewiseLinear::name() const { return ( Name.c_str() ); }


////////////////////////////////////////////////////////////////////////


extern int pwl_interpolate(const double * y, const double * x, int n, double x_in, double & y_out);


////////////////////////////////////////////////////////////////////////


#endif /* __PIECEWISE_LINEAR_H__ */


Expand Down
16 changes: 3 additions & 13 deletions src/basic/vx_util/ascii_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ using namespace std;
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <vector>

#include "vx_log.h"
#include "vx_cal.h"
Expand Down Expand Up @@ -1336,21 +1337,14 @@ if ( Nrows < 0 || Nrows >= INT_MAX ) {

if ( Nrows <= 2 ) return;

int * left = new int [Nrows];
int * right = new int [Nrows];
std::vector<int> left (Nrows, 0);
std::vector<int> right(Nrows, 0);

int r, c, n, k;
int max_left, max_right;
const char fill_char = ' ';
const int r_start = 1; // skip the header row


for (r=0; r<Nrows; ++r) {

left[r] = right[r] = 0;

}

for (c=0; c<Ncols; ++c) {

// get the pad size for that column
Expand Down Expand Up @@ -1386,10 +1380,6 @@ for (c=0; c<Ncols; ++c) {
// done
//

if ( left ) { delete [] left; left = 0; }
if ( right ) { delete [] right; right = 0; }


DecimalPointsAligned = true;

return;
Expand Down
83 changes: 12 additions & 71 deletions src/basic/vx_util/crc_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


#include <iostream>
#include <vector>

#include "num_array.h"
#include "int_array.h"
Expand All @@ -34,27 +35,6 @@
static const int crc_array_alloc_inc = 25;


////////////////////////////////////////////////////////////////////////


template <typename T>

int is_bigger(const void * p1, const void * p2)

{

const T & a = *((T *) p1);
const T & b = *((T *) p2);

if ( a < b ) return ( -1 );
if ( a > b ) return ( 1 );

return ( 0 );

}



////////////////////////////////////////////////////////////////////////


Expand All @@ -69,7 +49,7 @@ class CRC_Array {
void assign(const CRC_Array &);


T * e;
std::vector<T> e;

int Nelements;

Expand Down Expand Up @@ -144,12 +124,6 @@ class CRC_Array {
};


////////////////////////////////////////////////////////////////////////


// static int is_bigger(const void *, const void *);


////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -205,8 +179,6 @@ void CRC_Array<T>::init_from_scratch()

{

e = (T *) 0;

clear();

return;
Expand All @@ -223,7 +195,7 @@ void CRC_Array<T>::clear()

{

if ( e ) { delete [] e; e = (T *) 0; }
e.clear();

Nelements = Nalloc = 0;

Expand All @@ -247,13 +219,7 @@ if ( a.Nelements == 0 ) return;

extend(a.Nelements);

int j;

for (j=0; j<(a.Nelements); ++j) {

e[j] = a.e[j];

}
e = a.e;

Nelements = a.Nelements;

Expand Down Expand Up @@ -286,36 +252,7 @@ if ( ! exact ) {

}

T * u = (T *) 0;

u = new T [len];

if ( !u ) {

mlog << Error << "\nvoid CRC_Array::extend(int, bool) -> "
<< "memory allocation error\n\n";

exit ( 1 );

}

int j;

memset(u, 0, len*sizeof(T));

if ( e ) {

for (j=0; j<Nelements; ++j) {

u[j] = e[j];

}

delete [] e; e = (T *) 0;

}

e = u; u = (T *) 0;
e.reserve( len );

Nalloc = len;

Expand Down Expand Up @@ -533,7 +470,9 @@ void CRC_Array<T>::add(const T & k)

extend(Nelements + 1, false);

e[Nelements++] = k;
e.push_back(k);

Nelements++;

return;

Expand All @@ -555,7 +494,9 @@ int j;

for (j=0; j<(a.Nelements); ++j) {

e[Nelements++] = a.e[j];
e.push_back(a.e[j]);

Nelements++;

}

Expand Down Expand Up @@ -604,7 +545,7 @@ void CRC_Array<T>::sort_increasing()

if ( Nelements <= 1 ) return;

qsort(e, Nelements, sizeof(*e), is_bigger<T>);
std::sort(e.begin(), e.end());

return;

Expand Down
Loading