Skip to content

Commit

Permalink
More fixes for the CTests branch divergence blunder. Most be close.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin D. Weinberg committed Dec 29, 2023
1 parent 2771cc3 commit c9bc3ab
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions coefs/BiorthBasis.H
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <BiorthCyl.H>
#include <EmpCylSL.H>
#include <localmpi.H>
#include <exputils.H>

namespace Field
{
Expand Down
24 changes: 19 additions & 5 deletions exputil/orthoTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@
#include <localmpi.H> // MPI support
#include <libvars.H> // For orthoTol

void orthoTest(const std::vector<Eigen::MatrixXd>& tests,
const std::string& classname, const std::string& indexname)
// Compute the orthogonality of a list of matrices and gather stats
//
std::tuple<bool, double, std::vector<double>>
orthoCompute(const std::vector<Eigen::MatrixXd>& tests)
{
// Number of possible threads
int nthrds = omp_get_max_threads();

// Worst so far
std::vector<double> worst(nthrds), lworst(tests.size());

// Rank
int nmax = tests[0].rows();

Expand Down Expand Up @@ -51,8 +53,21 @@ void orthoTest(const std::vector<Eigen::MatrixXd>& tests,
// END: harmonic order loop

double worst_ever = *std::max_element(lworst.begin(), lworst.end());
bool good = true;
if (worst_ever > __EXP__::orthoTol) good = false;

return {good, worst_ever, lworst};
}

if (worst_ever > __EXP__::orthoTol) {
// Digest the stats from orthoCompute and report
//
void orthoTest(const std::vector<Eigen::MatrixXd>& tests,
const std::string& classname, const std::string& indexname)
{

auto [good, worst, lworst] = orthoCompute(tests);

if (not good) {
std::cout << classname << ": orthogonality failure" << std::endl
<< std::right
<< std::setw(4) << indexname
Expand All @@ -67,4 +82,3 @@ void orthoTest(const std::vector<Eigen::MatrixXd>& tests,
std::cout << classname + ": biorthogonal check passed" << std::endl;
}
}

3 changes: 3 additions & 0 deletions include/exputils.H
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#include <string>
#include <Eigen/Eigen>

std::tuple<bool, double, std::vector<double>>
orthoCompute(const std::vector<Eigen::MatrixXd>& tests);

void orthoTest(const std::vector<Eigen::MatrixXd>& tests,
const std::string& classname, const std::string& indexname);

Expand Down

0 comments on commit c9bc3ab

Please sign in to comment.