Commit 4b9370ff authored by Andrew Grace's avatar Andrew Grace
Browse files

Added Debugging code (commented) and proper error checking

parent b05b5618
......@@ -227,7 +227,7 @@ void lineos(TArrayn::DTArray & rho, TArrayn::DTArray & T,
void quadeos(TArrayn::DTArray & rho, TArrayn::DTArray & T);
void eos(const string eos_type, TArrayn::DTArray & rho, TArrayn::DTArray & T, TArrayn::DTArray & S, double T0, double S0);
void eos(const string eos_type, TArrayn::DTArray & rho, TArrayn::DTArray & T, TArrayn::DTArray & S, double T0 = -10, double S0 = -2);
......
......@@ -7,6 +7,7 @@
#include "../Parformer.hpp"
#include "../Sorter.hpp"
#include <numeric>
#include <stdlib.h>
using blitz::Array;
using blitz::cos;
......@@ -15,8 +16,7 @@ using namespace NSIntegrator;
using namespace Transformer;
void eos(const string eos_type, TArrayn::DTArray & rho, TArrayn::DTArray & T, TArrayn::DTArray & S, double T0 = -10, double S0 = -10) {
void eos(const string eos_type, TArrayn::DTArray & rho, TArrayn::DTArray & T, TArrayn::DTArray & S, double T0, double S0) {
bool is_T0_valid = false;
bool is_S0_valid = false;
......@@ -27,28 +27,57 @@ void eos(const string eos_type, TArrayn::DTArray & rho, TArrayn::DTArray & T, TA
is_S0_valid = true;
}
if (eos_type == "QUAD") {
if (eos_type == "QUADEOS") {
//For Debugging purposes
/*
if (master()) {
fprintf(stdout,"You picked the QUADEOS option.\n");
}
MPI_Finalize(); exit(0);
*/
//Call quadeos
quadeos(rho,T);
}
else if (eos_type == "LIN") {
else if (eos_type == "LINEOS") {
if (is_T0_valid & is_S0_valid) {
lineos(rho,T,S,T0,S0);
//For Debugging purposes
/*
if (master()) {
fprintf(stdout,"You picked the LINEOS option.\n");
}
MPI_Finalize(); exit(0);
*/
//Call lineos
lineos(rho,T,S,T0,S0);
}
else {
if (master()) {
fprintf(stderr,"Invalid option for background temperature or salinity\n");
MPI_Finalize(); exit(1);
fprintf(stderr,"Invalid option for background temperature or salinity. Exiting.\n");
}
MPI_Finalize(); exit(0);
}
}
else if (eos_type == "NLEOS") {
nleos(rho,T,S);
//For Debugging purposes
/*
if (master()) {
fprintf(stdout,"You picked the NLEOS option.\n");
}
MPI_Finalize(); exit(0);
*/
//Call nleos
nleos(rho,T,S);
}
else {
if (master()) {
fprintf(stderr,"Invalid option received for eos type\n");
MPI_Finalize(); exit(1);
fprintf(stderr,"Invalid option received for eos type. Exiting.\n");
}
MPI_Finalize(); exit(0);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment