Eliminated "sortAlgoritms" from the tests in favor of std::sort
This commit is contained in:
parent
4cdac9a90f
commit
e887d2fbbc
23 changed files with 134 additions and 508 deletions
|
|
@ -129,7 +129,7 @@ CompileAndTest('HMW_dupl_test',
|
||||||
CompileAndTest('HMW_graph_CpvT',
|
CompileAndTest('HMW_graph_CpvT',
|
||||||
pjoin('cathermo', 'HMW_graph_CpvT'),
|
pjoin('cathermo', 'HMW_graph_CpvT'),
|
||||||
'HMW_graph_CpvT', 'output_blessed.txt',
|
'HMW_graph_CpvT', 'output_blessed.txt',
|
||||||
extensions=['^HMW_graph_CpvT.cpp', '^sortAlgorithms.cpp'],
|
extensions=['^HMW_graph_CpvT.cpp'],
|
||||||
arguments='HMW_NaCl_sp1977_alt.xml')
|
arguments='HMW_NaCl_sp1977_alt.xml')
|
||||||
CompileAndTest('HMW_graph_GvI',
|
CompileAndTest('HMW_graph_GvI',
|
||||||
pjoin('cathermo', 'HMW_graph_GvI'),
|
pjoin('cathermo', 'HMW_graph_GvI'),
|
||||||
|
|
@ -141,17 +141,17 @@ CompileAndTest('HMW_graph_GvI',
|
||||||
CompileAndTest('HMW_graph_GvT',
|
CompileAndTest('HMW_graph_GvT',
|
||||||
pjoin('cathermo', 'HMW_graph_GvT'),
|
pjoin('cathermo', 'HMW_graph_GvT'),
|
||||||
'HMW_graph_GvT', 'output_blessed.txt',
|
'HMW_graph_GvT', 'output_blessed.txt',
|
||||||
extensions=['^HMW_graph_GvT.cpp', '^sortAlgorithms.cpp'],
|
extensions=['^HMW_graph_GvT.cpp'],
|
||||||
arguments='HMW_NaCl_sp1977_alt.xml')
|
arguments='HMW_NaCl_sp1977_alt.xml')
|
||||||
CompileAndTest('HMW_graph_HvT',
|
CompileAndTest('HMW_graph_HvT',
|
||||||
pjoin('cathermo', 'HMW_graph_HvT'),
|
pjoin('cathermo', 'HMW_graph_HvT'),
|
||||||
'HMW_graph_HvT', 'output_blessed.txt',
|
'HMW_graph_HvT', 'output_blessed.txt',
|
||||||
extensions=['^HMW_graph_HvT.cpp', '^sortAlgorithms.cpp'],
|
extensions=['^HMW_graph_HvT.cpp'],
|
||||||
arguments='HMW_NaCl_sp1977_alt.xml')
|
arguments='HMW_NaCl_sp1977_alt.xml')
|
||||||
CompileAndTest('HMW_graph_VvT',
|
CompileAndTest('HMW_graph_VvT',
|
||||||
pjoin('cathermo', 'HMW_graph_VvT'),
|
pjoin('cathermo', 'HMW_graph_VvT'),
|
||||||
'HMW_graph_VvT', 'output_blessed.txt',
|
'HMW_graph_VvT', 'output_blessed.txt',
|
||||||
extensions=['^HMW_graph_VvT.cpp', '^sortAlgorithms.cpp'],
|
extensions=['^HMW_graph_VvT.cpp'],
|
||||||
arguments='HMW_NaCl_sp1977_alt.xml')
|
arguments='HMW_NaCl_sp1977_alt.xml')
|
||||||
CompileAndTest('HMW_test_1',
|
CompileAndTest('HMW_test_1',
|
||||||
pjoin('cathermo', 'HMW_test_1'),
|
pjoin('cathermo', 'HMW_test_1'),
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#ifndef TEMPERATURE_TABLE_H
|
#ifndef TEMPERATURE_TABLE_H
|
||||||
#define TEMPERATURE_TABLE_H
|
#define TEMPERATURE_TABLE_H
|
||||||
#include "sortAlgorithms.h"
|
|
||||||
//#include "mdp_allo.h"
|
//#include "mdp_allo.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
@ -75,10 +74,7 @@ public:
|
||||||
}
|
}
|
||||||
NPoints += numAdded;
|
NPoints += numAdded;
|
||||||
}
|
}
|
||||||
|
std::sort(T.begin(), T.end());
|
||||||
sort_dbl_1(DATA_PTR(T), NPoints);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* @file sortAlgorithms.h
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
|
||||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
|
||||||
* retains certain rights in this software.
|
|
||||||
* See file License.txt for licensing information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sortAlgorithms.h"
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
void sort_dbl_1(double * const x, const int n) {
|
|
||||||
double rra;
|
|
||||||
int ll = n/2;
|
|
||||||
int iret = n - 1;
|
|
||||||
while (1 > 0) {
|
|
||||||
if (ll > 0) {
|
|
||||||
ll--;
|
|
||||||
rra = x[ll];
|
|
||||||
} else {
|
|
||||||
rra = x[iret];
|
|
||||||
x[iret] = x[0];
|
|
||||||
iret--;
|
|
||||||
if (iret == 0) {
|
|
||||||
x[0] = rra;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int i = ll;
|
|
||||||
int j = ll + ll + 1;
|
|
||||||
while (j <= iret) {
|
|
||||||
if (j < iret) {
|
|
||||||
if (x[j] < x[j+1])
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
if (rra < x[j]) {
|
|
||||||
x[i] = x[j];
|
|
||||||
i = j;
|
|
||||||
j = j + j + 1;
|
|
||||||
} else {
|
|
||||||
j = iret + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x[i] = rra;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*****************************************************/
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* @file sortAlgorithms.h
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
|
||||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
|
||||||
* retains certain rights in this software.
|
|
||||||
* See file License.txt for licensing information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SORTALGORITHMS_H
|
|
||||||
#define SORTALGORITHMS_H
|
|
||||||
|
|
||||||
|
|
||||||
void sort_dbl_1(double * const x, const int n);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
123
test_problems/cathermo/HMW_graph_CpVT/TemperatureTable.h
Normal file
123
test_problems/cathermo/HMW_graph_CpVT/TemperatureTable.h
Normal file
|
|
@ -0,0 +1,123 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
||||||
|
* DE-AC04-94AL85000, there is a non-exclusive license for use of this
|
||||||
|
* work by or on behalf of the U.S. Government. Export of this program
|
||||||
|
* may require a license from the United States Government.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TEMPERATURE_TABLE_H
|
||||||
|
#define TEMPERATURE_TABLE_H
|
||||||
|
//#include "mdp_allo.h"
|
||||||
|
#include <vector>
|
||||||
|
using std::vector;
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/***********************************************************************/
|
||||||
|
/***********************************************************************/
|
||||||
|
/**
|
||||||
|
* This Class constructs a vector of temperature from which to make
|
||||||
|
* a table.
|
||||||
|
*/
|
||||||
|
class TemperatureTable {
|
||||||
|
|
||||||
|
public:
|
||||||
|
int NPoints;
|
||||||
|
bool Include298;
|
||||||
|
double Tlow; //!< Min temperature for thermo data fit
|
||||||
|
double Thigh; //!< Max temperature for thermo table
|
||||||
|
double DeltaT;
|
||||||
|
vector<double> T;
|
||||||
|
int numAddedTs;
|
||||||
|
vector<double> AddedTempVector;
|
||||||
|
public:
|
||||||
|
/*
|
||||||
|
* Default constructor for TemperatureTable()
|
||||||
|
*/
|
||||||
|
TemperatureTable(const int nPts = 14,
|
||||||
|
const bool inc298 = true,
|
||||||
|
const double tlow = 300.,
|
||||||
|
const double deltaT = 100.,
|
||||||
|
const int numAdded = 0,
|
||||||
|
const double *addedTempVector = 0) :
|
||||||
|
NPoints(nPts),
|
||||||
|
Include298(inc298),
|
||||||
|
Tlow(tlow),
|
||||||
|
DeltaT(deltaT),
|
||||||
|
T(0),
|
||||||
|
numAddedTs(numAdded) {
|
||||||
|
/****************************/
|
||||||
|
int i;
|
||||||
|
// AddedTempVector = mdp_alloc_dbl_1(numAdded, 0.0);
|
||||||
|
AddedTempVector.resize(numAdded, 0.0);
|
||||||
|
for (int i = 0; i < numAdded; i++) {
|
||||||
|
AddedTempVector[i] = addedTempVector[i];
|
||||||
|
}
|
||||||
|
//mdp_copy_dbl_1(AddedTempVector, addedTempVector, numAdded);
|
||||||
|
// T = mdp_alloc_dbl_1(NPoints, 0.0);
|
||||||
|
T.resize(NPoints, 0.0);
|
||||||
|
double TCurrent = Tlow;
|
||||||
|
for (i = 0; i < NPoints; i++) {
|
||||||
|
T[i] = TCurrent;
|
||||||
|
TCurrent += DeltaT;
|
||||||
|
}
|
||||||
|
if (Include298) {
|
||||||
|
T.push_back(298.15);
|
||||||
|
//mdp_realloc_dbl_1(&T, NPoints+1, NPoints, 298.15);
|
||||||
|
NPoints++;
|
||||||
|
}
|
||||||
|
if (numAdded > 0) {
|
||||||
|
//mdp_realloc_dbl_1(&T, NPoints+numAdded, NPoints, 0.0);
|
||||||
|
T.resize( NPoints+numAdded, 0.0);
|
||||||
|
for (i = 0; i < numAdded; i++) {
|
||||||
|
T[i+NPoints] = addedTempVector[i];
|
||||||
|
}
|
||||||
|
NPoints += numAdded;
|
||||||
|
}
|
||||||
|
std::sort(T.begin(), T.end());
|
||||||
|
}
|
||||||
|
/***********************************************************************/
|
||||||
|
/***********************************************************************/
|
||||||
|
/***********************************************************************/
|
||||||
|
/*
|
||||||
|
* Destructor
|
||||||
|
*/
|
||||||
|
~TemperatureTable() {
|
||||||
|
//mdp_safe_free((void **) &AddedTempVector);
|
||||||
|
// mdp_safe_free((void **) &T);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/***********************************************************************/
|
||||||
|
/***********************************************************************/
|
||||||
|
/*
|
||||||
|
* Overloaded operator[]
|
||||||
|
*
|
||||||
|
* return the array value in the vector
|
||||||
|
*/
|
||||||
|
double operator[](const int i) {
|
||||||
|
return T[i];
|
||||||
|
}
|
||||||
|
/***********************************************************************/
|
||||||
|
/***********************************************************************/
|
||||||
|
/***********************************************************************/
|
||||||
|
/*
|
||||||
|
* size()
|
||||||
|
*/
|
||||||
|
int size() {
|
||||||
|
return NPoints;
|
||||||
|
}
|
||||||
|
/***********************************************************************/
|
||||||
|
/***********************************************************************/
|
||||||
|
/***********************************************************************/
|
||||||
|
/*
|
||||||
|
* Block assignment and copy constructors: not needed.
|
||||||
|
*/
|
||||||
|
private:
|
||||||
|
TemperatureTable(const TemperatureTable &);
|
||||||
|
TemperatureTable& operator=(const TemperatureTable&);
|
||||||
|
};
|
||||||
|
/***********************************************************************/
|
||||||
|
/***********************************************************************/
|
||||||
|
/***********************************************************************/
|
||||||
|
#endif
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#ifndef TEMPERATURE_TABLE_H
|
#ifndef TEMPERATURE_TABLE_H
|
||||||
#define TEMPERATURE_TABLE_H
|
#define TEMPERATURE_TABLE_H
|
||||||
#include "sortAlgorithms.h"
|
|
||||||
//#include "mdp_allo.h"
|
//#include "mdp_allo.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
@ -75,10 +74,7 @@ public:
|
||||||
}
|
}
|
||||||
NPoints += numAdded;
|
NPoints += numAdded;
|
||||||
}
|
}
|
||||||
|
std::sort(T.begin(), T.end());
|
||||||
sort_dbl_1(DATA_PTR(T), NPoints);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* @file sortAlgorithms.h
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
|
||||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
|
||||||
* retains certain rights in this software.
|
|
||||||
* See file License.txt for licensing information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sortAlgorithms.h"
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
void sort_dbl_1(double * const x, const int n) {
|
|
||||||
double rra;
|
|
||||||
int ll = n/2;
|
|
||||||
int iret = n - 1;
|
|
||||||
while (1 > 0) {
|
|
||||||
if (ll > 0) {
|
|
||||||
ll--;
|
|
||||||
rra = x[ll];
|
|
||||||
} else {
|
|
||||||
rra = x[iret];
|
|
||||||
x[iret] = x[0];
|
|
||||||
iret--;
|
|
||||||
if (iret == 0) {
|
|
||||||
x[0] = rra;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int i = ll;
|
|
||||||
int j = ll + ll + 1;
|
|
||||||
while (j <= iret) {
|
|
||||||
if (j < iret) {
|
|
||||||
if (x[j] < x[j+1])
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
if (rra < x[j]) {
|
|
||||||
x[i] = x[j];
|
|
||||||
i = j;
|
|
||||||
j = j + j + 1;
|
|
||||||
} else {
|
|
||||||
j = iret + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x[i] = rra;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*****************************************************/
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* @file sortAlgorithms.h
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
|
||||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
|
||||||
* retains certain rights in this software.
|
|
||||||
* See file License.txt for licensing information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SORTALGORITHMS_H
|
|
||||||
#define SORTALGORITHMS_H
|
|
||||||
|
|
||||||
|
|
||||||
void sort_dbl_1(double * const x, const int n);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#ifndef TEMPERATURE_TABLE_H
|
#ifndef TEMPERATURE_TABLE_H
|
||||||
#define TEMPERATURE_TABLE_H
|
#define TEMPERATURE_TABLE_H
|
||||||
#include "sortAlgorithms.h"
|
|
||||||
//#include "mdp_allo.h"
|
//#include "mdp_allo.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
@ -75,10 +74,7 @@ public:
|
||||||
}
|
}
|
||||||
NPoints += numAdded;
|
NPoints += numAdded;
|
||||||
}
|
}
|
||||||
|
std::sort(T.begin(), T.end());
|
||||||
sort_dbl_1(DATA_PTR(T), NPoints);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* @file sortAlgorithms.h
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
|
||||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
|
||||||
* retains certain rights in this software.
|
|
||||||
* See file License.txt for licensing information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sortAlgorithms.h"
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
void sort_dbl_1(double * const x, const int n) {
|
|
||||||
double rra;
|
|
||||||
int ll = n/2;
|
|
||||||
int iret = n - 1;
|
|
||||||
while (1 > 0) {
|
|
||||||
if (ll > 0) {
|
|
||||||
ll--;
|
|
||||||
rra = x[ll];
|
|
||||||
} else {
|
|
||||||
rra = x[iret];
|
|
||||||
x[iret] = x[0];
|
|
||||||
iret--;
|
|
||||||
if (iret == 0) {
|
|
||||||
x[0] = rra;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int i = ll;
|
|
||||||
int j = ll + ll + 1;
|
|
||||||
while (j <= iret) {
|
|
||||||
if (j < iret) {
|
|
||||||
if (x[j] < x[j+1])
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
if (rra < x[j]) {
|
|
||||||
x[i] = x[j];
|
|
||||||
i = j;
|
|
||||||
j = j + j + 1;
|
|
||||||
} else {
|
|
||||||
j = iret + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x[i] = rra;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*****************************************************/
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* @file sortAlgorithms.h
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
|
||||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
|
||||||
* retains certain rights in this software.
|
|
||||||
* See file License.txt for licensing information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SORTALGORITHMS_H
|
|
||||||
#define SORTALGORITHMS_H
|
|
||||||
|
|
||||||
|
|
||||||
void sort_dbl_1(double * const x, const int n);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#ifndef TEMPERATURE_TABLE_H
|
#ifndef TEMPERATURE_TABLE_H
|
||||||
#define TEMPERATURE_TABLE_H
|
#define TEMPERATURE_TABLE_H
|
||||||
#include "sortAlgorithms.h"
|
|
||||||
//#include "mdp_allo.h"
|
//#include "mdp_allo.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
@ -75,10 +74,7 @@ public:
|
||||||
}
|
}
|
||||||
NPoints += numAdded;
|
NPoints += numAdded;
|
||||||
}
|
}
|
||||||
|
std::sort(T.begin(), T.end());
|
||||||
sort_dbl_1(DATA_PTR(T), NPoints);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* @file sortAlgorithms.h
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
|
||||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
|
||||||
* retains certain rights in this software.
|
|
||||||
* See file License.txt for licensing information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sortAlgorithms.h"
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
void sort_dbl_1(double * const x, const int n) {
|
|
||||||
double rra;
|
|
||||||
int ll = n/2;
|
|
||||||
int iret = n - 1;
|
|
||||||
while (1 > 0) {
|
|
||||||
if (ll > 0) {
|
|
||||||
ll--;
|
|
||||||
rra = x[ll];
|
|
||||||
} else {
|
|
||||||
rra = x[iret];
|
|
||||||
x[iret] = x[0];
|
|
||||||
iret--;
|
|
||||||
if (iret == 0) {
|
|
||||||
x[0] = rra;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int i = ll;
|
|
||||||
int j = ll + ll + 1;
|
|
||||||
while (j <= iret) {
|
|
||||||
if (j < iret) {
|
|
||||||
if (x[j] < x[j+1])
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
if (rra < x[j]) {
|
|
||||||
x[i] = x[j];
|
|
||||||
i = j;
|
|
||||||
j = j + j + 1;
|
|
||||||
} else {
|
|
||||||
j = iret + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x[i] = rra;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*****************************************************/
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* @file sortAlgorithms.h
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
|
||||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
|
||||||
* retains certain rights in this software.
|
|
||||||
* See file License.txt for licensing information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SORTALGORITHMS_H
|
|
||||||
#define SORTALGORITHMS_H
|
|
||||||
|
|
||||||
|
|
||||||
void sort_dbl_1(double * const x, const int n);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#ifndef TEMPERATURE_TABLE_H
|
#ifndef TEMPERATURE_TABLE_H
|
||||||
#define TEMPERATURE_TABLE_H
|
#define TEMPERATURE_TABLE_H
|
||||||
#include "sortAlgorithms.h"
|
|
||||||
//#include "mdp_allo.h"
|
//#include "mdp_allo.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
@ -75,10 +74,7 @@ public:
|
||||||
}
|
}
|
||||||
NPoints += numAdded;
|
NPoints += numAdded;
|
||||||
}
|
}
|
||||||
|
std::sort(T.begin(), T.end());
|
||||||
sort_dbl_1(DATA_PTR(T), NPoints);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* @file sortAlgorithms.h
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
|
||||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
|
||||||
* retains certain rights in this software.
|
|
||||||
* See file License.txt for licensing information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sortAlgorithms.h"
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
void sort_dbl_1(double * const x, const int n) {
|
|
||||||
double rra;
|
|
||||||
int ll = n/2;
|
|
||||||
int iret = n - 1;
|
|
||||||
while (1 > 0) {
|
|
||||||
if (ll > 0) {
|
|
||||||
ll--;
|
|
||||||
rra = x[ll];
|
|
||||||
} else {
|
|
||||||
rra = x[iret];
|
|
||||||
x[iret] = x[0];
|
|
||||||
iret--;
|
|
||||||
if (iret == 0) {
|
|
||||||
x[0] = rra;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int i = ll;
|
|
||||||
int j = ll + ll + 1;
|
|
||||||
while (j <= iret) {
|
|
||||||
if (j < iret) {
|
|
||||||
if (x[j] < x[j+1])
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
if (rra < x[j]) {
|
|
||||||
x[i] = x[j];
|
|
||||||
i = j;
|
|
||||||
j = j + j + 1;
|
|
||||||
} else {
|
|
||||||
j = iret + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x[i] = rra;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*****************************************************/
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* @file sortAlgorithms.h
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
|
||||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
|
||||||
* retains certain rights in this software.
|
|
||||||
* See file License.txt for licensing information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SORTALGORITHMS_H
|
|
||||||
#define SORTALGORITHMS_H
|
|
||||||
|
|
||||||
|
|
||||||
void sort_dbl_1(double * const x, const int n);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#ifndef TEMPERATURE_TABLE_H
|
#ifndef TEMPERATURE_TABLE_H
|
||||||
#define TEMPERATURE_TABLE_H
|
#define TEMPERATURE_TABLE_H
|
||||||
#include "sortAlgorithms.h"
|
|
||||||
//#include "mdp_allo.h"
|
//#include "mdp_allo.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
@ -75,10 +74,7 @@ public:
|
||||||
}
|
}
|
||||||
NPoints += numAdded;
|
NPoints += numAdded;
|
||||||
}
|
}
|
||||||
|
std::sort(T.begin(), T.end());
|
||||||
sort_dbl_1(DATA_PTR(T), NPoints);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* @file sortAlgorithms.h
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
|
||||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
|
||||||
* retains certain rights in this software.
|
|
||||||
* See file License.txt for licensing information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sortAlgorithms.h"
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
void sort_dbl_1(double * const x, const int n) {
|
|
||||||
double rra;
|
|
||||||
int ll = n/2;
|
|
||||||
int iret = n - 1;
|
|
||||||
while (1 > 0) {
|
|
||||||
if (ll > 0) {
|
|
||||||
ll--;
|
|
||||||
rra = x[ll];
|
|
||||||
} else {
|
|
||||||
rra = x[iret];
|
|
||||||
x[iret] = x[0];
|
|
||||||
iret--;
|
|
||||||
if (iret == 0) {
|
|
||||||
x[0] = rra;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int i = ll;
|
|
||||||
int j = ll + ll + 1;
|
|
||||||
while (j <= iret) {
|
|
||||||
if (j < iret) {
|
|
||||||
if (x[j] < x[j+1])
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
if (rra < x[j]) {
|
|
||||||
x[i] = x[j];
|
|
||||||
i = j;
|
|
||||||
j = j + j + 1;
|
|
||||||
} else {
|
|
||||||
j = iret + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x[i] = rra;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*****************************************************/
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* @file sortAlgorithms.h
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
|
||||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
|
||||||
* retains certain rights in this software.
|
|
||||||
* See file License.txt for licensing information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SORTALGORITHMS_H
|
|
||||||
#define SORTALGORITHMS_H
|
|
||||||
|
|
||||||
|
|
||||||
void sort_dbl_1(double * const x, const int n);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#ifndef TEMPERATURE_TABLE_H
|
#ifndef TEMPERATURE_TABLE_H
|
||||||
#define TEMPERATURE_TABLE_H
|
#define TEMPERATURE_TABLE_H
|
||||||
#include "sortAlgorithms.h"
|
|
||||||
//#include "mdp_allo.h"
|
//#include "mdp_allo.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
@ -75,10 +74,7 @@ public:
|
||||||
}
|
}
|
||||||
NPoints += numAdded;
|
NPoints += numAdded;
|
||||||
}
|
}
|
||||||
|
std::sort(T.begin(), T.end());
|
||||||
sort_dbl_1(DATA_PTR(T), NPoints);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* @file sortAlgorithms.h
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
|
||||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
|
||||||
* retains certain rights in this software.
|
|
||||||
* See file License.txt for licensing information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sortAlgorithms.h"
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
void sort_dbl_1(double * const x, const int n) {
|
|
||||||
double rra;
|
|
||||||
int ll = n/2;
|
|
||||||
int iret = n - 1;
|
|
||||||
while (1 > 0) {
|
|
||||||
if (ll > 0) {
|
|
||||||
ll--;
|
|
||||||
rra = x[ll];
|
|
||||||
} else {
|
|
||||||
rra = x[iret];
|
|
||||||
x[iret] = x[0];
|
|
||||||
iret--;
|
|
||||||
if (iret == 0) {
|
|
||||||
x[0] = rra;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int i = ll;
|
|
||||||
int j = ll + ll + 1;
|
|
||||||
while (j <= iret) {
|
|
||||||
if (j < iret) {
|
|
||||||
if (x[j] < x[j+1])
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
if (rra < x[j]) {
|
|
||||||
x[i] = x[j];
|
|
||||||
i = j;
|
|
||||||
j = j + j + 1;
|
|
||||||
} else {
|
|
||||||
j = iret + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x[i] = rra;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*****************************************************/
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* @file sortAlgorithms.h
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
|
||||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
|
||||||
* retains certain rights in this software.
|
|
||||||
* See file License.txt for licensing information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SORTALGORITHMS_H
|
|
||||||
#define SORTALGORITHMS_H
|
|
||||||
|
|
||||||
|
|
||||||
void sort_dbl_1(double * const x, const int n);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Loading…
Add table
Reference in a new issue