Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
3f24325
Updated isothermal slab scale height with the factor of 2 for consist…
Apr 5, 2026
85864fa
Updated SlabSL method to have a 'self_consistent' flag
Apr 5, 2026
db8878b
Comment updates only
Apr 5, 2026
3d55d75
Added cache versioning
Apr 5, 2026
aeb39a2
Added compile-time version string parsing for future development work
Apr 5, 2026
c8af8b3
Use compile-time version info to toggle warning message
Apr 5, 2026
a5149ed
Remove unnecessary preprocessor variable
Apr 5, 2026
5cffd92
Added test example for internal version parser
Apr 5, 2026
ca731d4
Updated name of version struction to prevent variable name conflicts
Apr 5, 2026
08fc515
stdout changes only
Apr 5, 2026
bd75f99
Update src/SlabSL.cc
The9Cat Apr 5, 2026
69a25c4
Update src/SlabSL.H
The9Cat Apr 5, 2026
f23f427
Update src/SlabSL.H
The9Cat Apr 5, 2026
4d7f43b
Update exputil/SLGridMP2.cc
The9Cat Apr 5, 2026
c84a843
Update exputil/SLGridMP2.cc
The9Cat Apr 5, 2026
7e45975
Update include/EXPversion.H
The9Cat Apr 5, 2026
a3aaefe
Update output message for parsed version integers
The9Cat Apr 5, 2026
b7ed7eb
Fix remaining 'octet of integers' wording in version_test.cc comment
Copilot Apr 5, 2026
875571d
Comments only [no ci]
Apr 5, 2026
09b429c
Merge branch 'slabUpdate' of github.com:EXP-code/EXP into slabUpdate
Apr 5, 2026
1c8a6d4
Require SLGridSlab to have a non-default cachename for consistency wi…
Apr 10, 2026
0efa0b3
Preliminary implemenation of covariance for SlabSL; compiles but unte…
Apr 20, 2026
4452ee4
Merge branch 'devel' into slabUpdate
Apr 22, 2026
e327ca3
Merge branch 'slabUpdate' into slabCovar
Apr 22, 2026
626973e
Update for main-bug merge
Apr 22, 2026
37f6071
Clean up covariance tensor storage allocation in Cube and Slab
Apr 30, 2026
c883db1
Comments only
May 1, 2026
7c487bc
Fix option tags
May 1, 2026
dc2ae45
Use linear map on table by default
May 1, 2026
f7e7be4
Update orthogonality and Poisson check
May 1, 2026
a5a780b
Added cmap variable to Slab basis in both EXP and pyEXP
May 1, 2026
bab8d36
Some updates for covariance cuda code; untested but compiling
May 1, 2026
86baa99
Use mass, not mass scaled for biorthogonal function accumulation, for…
May 1, 2026
3766f97
Allow check to use all the coordinate mappings for testing
May 2, 2026
f047d3e
Add numz as a variable
May 2, 2026
8e25b53
Missing parameter parsing for cmap
May 2, 2026
f036c51
Add periodic box wrapping to cuda implementation for testing
May 2, 2026
e39cfc8
Potential fix for pull request finding
The9Cat May 3, 2026
6590d59
Potential fix for pull request finding
The9Cat May 3, 2026
a111a90
Potential fix for pull request finding
The9Cat May 3, 2026
7b4f5d7
Document nint and samplesz subsampling params in SlabSL YAML docstring
Copilot May 3, 2026
d87a355
Potential fix for pull request finding
The9Cat May 3, 2026
5e9e60b
Potential fix for pull request finding
The9Cat May 3, 2026
5dbe30a
Remove unused outer orthoMat declaration in orthochk.cc case 4
Copilot May 3, 2026
0cc1bc5
Fix SlabSL.ortho diagnostic gate, CoordMap safety, and bonnerebert -V…
Copilot May 3, 2026
227e859
Consistency fixes between CPU and GPU
May 3, 2026
8ff45d1
Fix up some missing variables and type mismatches introduced by signa…
May 3, 2026
5e3b42f
Miswritten 'assign' members for Slab and Cube
May 3, 2026
c0a233a
Sign error in force table folding
May 4, 2026
ec6e853
Correct the mass prefactor for the biorthogonal projection
May 4, 2026
f871e26
Correct the biorthogonal prefactor and update ui for Cube and Slab co…
May 4, 2026
dd0280b
Fix 4*pi factors in slab normalization
May 4, 2026
ac21815
Restored previous 4*pi factors which were correct
May 5, 2026
11beb18
Fix 4*pi factors in slab normalization, 2nd try
May 5, 2026
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
69 changes: 69 additions & 0 deletions expui/BiorthBasis.H
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,9 @@ namespace BasisClasses
//! SLGridSlab mesh size
int ngrid = 1000;

//! Coordinate map type for SLGridSlab
std::string cmap = "linear";

//! Target model type for SLGridSlab
std::string type = "isothermal";

Expand Down Expand Up @@ -1255,6 +1258,20 @@ namespace BasisClasses
void computeAccel(double x, double y, double z,
Eigen::Ref<Eigen::Vector3d> vstore);

//@{
//! Covariance structures. First index is T, second is the
//! flattened 3-d k vector
std::vector<Eigen::VectorXcd> meanV;
std::vector<Eigen::MatrixXcd> covrV;
std::vector<Eigen::VectorXcd> dvarV;

void init_covariance();
void zero_covariance();
void writeCovarH5Params(HighFive::File& file);
int sampT = 100;
bool diagcov = true;
//@}

public:

//! Constructor from YAML node
Expand Down Expand Up @@ -1311,6 +1328,58 @@ namespace BasisClasses
return true;
}

//! Write coefficient covariance data to an HDF5 file
virtual void writeCoefCovariance(const std::string& compname, const std::string& runtag, double time=0.0)
{
if (covarStore) {
SubsampleCovariance::CovarData elem;
std::get<0>(elem) = sampleCounts;
std::get<1>(elem) = sampleMasses;

int sampT = meanV.size();
int Nsize = meanV[0].size();

std::get<2>(elem) = SubsampleCovariance::CoefType(sampT, 1, Nsize);
std::get<3>(elem) = SubsampleCovariance::CovrType(sampT, 1, Nsize, Nsize);

for (int T=0; T<sampT; ++T) {
for (int n1=0; n1<Nsize; n1++) {
std::get<2>(elem)(T, 0, n1) = meanV[T](n1);
for (int n2=0; n2<Nsize; n2++) {
std::complex<double> cov = 0.0;
if (diagcov) {
if (n1 == n2) cov = dvarV[T](n1);
} else if (covar && T < covrV.size()) {
cov = covrV[T](n1, n2);
}
std::get<3>(elem)(T, 0, n1, n2) = cov;
}
}
}
covarStore->writeCoefCovariance(compname, runtag, elem, time);
} else {
throw std::runtime_error("Slab::writeCoefCovariance: covariance storage not initialized");
}
}


//! Enable coefficient covariance computation
virtual void enableCoefCovariance(bool pcavar_in, int sampT_in=100,
bool ftype=false,
bool covr_tot=false,
bool covar_in=false)
{
pcavar = pcavar_in;
sampT = sampT_in;
scovr = covr_tot;
covar = covar_in;
if (pcavar) {
init_covariance();
covarStore = std::make_shared<SubsampleCovariance>
([this](HighFive::File& file){this->writeCovarH5Params(file);}, BasisID, ftype, scovr, covar);
}
}

};

/**
Expand Down
97 changes: 91 additions & 6 deletions expui/BiorthBasis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3416,11 +3416,14 @@ namespace BasisClasses
"hslab",
"zmax",
"ngrid",
"cmap",
"type",
"knots",
"verbose",
"check",
"method"
"method",
"self_consistent",
"cachename"
};

Slab::Slab(const YAML::Node& CONF) : BiorthBasis(CONF, "slab")
Expand Down Expand Up @@ -3476,11 +3479,14 @@ namespace BasisClasses
if (conf["hslab"]) hslab = conf["hslab"].as<double>();
if (conf["zmax" ]) zmax = conf["zmax" ].as<double>();
if (conf["ngrid"]) ngrid = conf["ngrid"].as<int>();
if (conf["cmap" ]) cmap = conf["cmap" ].as<std::string>();
if (conf["type" ]) type = conf["type" ].as<std::string>();

if (conf["knots"]) knots = conf["knots"].as<int>();

if (conf["check"]) check = conf["check"].as<bool>();

if (conf["cachename"]) cachename = conf["cachename"].as<std::string>();
}
catch (YAML::Exception & error) {
if (myid==0) std::cout << "Error parsing parameter stanza for <"
Expand All @@ -3493,6 +3499,19 @@ namespace BasisClasses
throw std::runtime_error("Slab: error parsing YAML");
}

// Check for non-null cache file name. This must be specified
// to prevent recomputation and unexpected behavior.
//
if (cachename.size() == 0) {
throw std::runtime_error
("SlabSL requires a specified cachename in your YAML config\n"
"for consistency with previous invocations and existing coefficient\n"
"sets. Please add explicitly add 'cachename: name' to your config\n"
"with new 'name' for creating a basis or an existing 'name' for\n"
"reading a previously generated basis cache\n");
}


// Finally, make the basis
//
SLGridSlab::mpi = 0;
Expand All @@ -3502,7 +3521,8 @@ namespace BasisClasses

int nnmax = (nmaxx > nmaxy) ? nmaxx : nmaxy;

ortho = std::make_shared<SLGridSlab>(nnmax, nmaxz, ngrid, zmax, type);
ortho = std::make_shared<SLGridSlab>(nnmax, nmaxz, ngrid, zmax, cachename,
cmap, type);

// Orthogonality sanity check
//
Expand Down Expand Up @@ -3649,10 +3669,8 @@ namespace BasisClasses
ortho->get_pot(zpot, z, iiy, iix);

for (int iz=0; iz<imz; iz++) {
// +--- density in orthogonal series
// | is 4.0*M_PI rho
// v
expcoef(ix, iy, iz) += -4.0*M_PI*mass*facx*facy*zpot[iz];
// Biorthogonality gives a minus sign here
expcoef(ix, iy, iz) += -mass*facx*facy*zpot[iz];
}
}
}
Expand Down Expand Up @@ -3974,6 +3992,57 @@ namespace BasisClasses
"fullCovar"
};

void Slab::init_covariance()
{
if (pcavar) {

int jmax = imx * imy * imz;

meanV.resize(sampT);
for (auto& v : meanV) {
v.resize(jmax);
}

if (covar) {
if (diagcov) {
dvarV.resize(sampT);
for (auto& v : dvarV) {
v.resize(jmax);
}
} else {
covrV.resize(sampT);
for (auto& v : covrV) {
v.resize(jmax, jmax);
}
}
} else {
covrV.clear();
dvarV.clear();
}

sampleCounts.resize(sampT);
sampleMasses.resize(sampT);

zero_covariance();
}
}


void Slab::zero_covariance()
{
for (int T=0; T<sampT; T++) {
meanV[T].setZero();
if (covar) {
if (diagcov) dvarV[T].setZero();
else covrV[T].setZero();
}
}

sampleCounts.setZero();
sampleMasses.setZero();
}


Cube::Cube(const YAML::Node& CONF) : BiorthBasis(CONF, "cube")
{
initialize();
Expand Down Expand Up @@ -4525,6 +4594,8 @@ namespace BasisClasses
coef = std::make_shared<CoefClasses::CylStruct>();
else if (name.compare("flatdisk") == 0)
coef = std::make_shared<CoefClasses::CylStruct>();
else if (name.compare("slab") == 0)
coef = std::make_shared<CoefClasses::SlabStruct>();
else if (name.compare("cube") == 0)
coef = std::make_shared<CoefClasses::CubeStruct>();
else {
Expand Down Expand Up @@ -4590,6 +4661,10 @@ namespace BasisClasses
coefret = std::make_shared<CoefClasses::CylStruct>();
else if (name.compare("flatdisk") == 0)
coefret = std::make_shared<CoefClasses::CylStruct>();
else if (name.compare("slab") == 0)
coefret = std::make_shared<CoefClasses::SlabStruct>();
else if (name.compare("cube") == 0)
coefret = std::make_shared<CoefClasses::CubeStruct>();
else {
std::ostringstream sout;
sout << "Basis::createCoefficients: basis <" << name << "> not recognized"
Expand Down Expand Up @@ -5217,6 +5292,16 @@ namespace BasisClasses
file.createAttribute<double>("rcylmax", HighFive::DataSpace::From(rcylmax)).write(rcylmax);
}

void Slab::writeCovarH5Params(HighFive::File& file)
{
file.createAttribute<int>("nminx", HighFive::DataSpace::From(nminx)).write(nminx);
file.createAttribute<int>("nminy", HighFive::DataSpace::From(nminy)).write(nminy);
file.createAttribute<int>("nminz", HighFive::DataSpace::From(nminz)).write(nminz);
file.createAttribute<int>("nmaxx", HighFive::DataSpace::From(nmaxx)).write(nmaxx);
file.createAttribute<int>("nmaxy", HighFive::DataSpace::From(nmaxy)).write(nmaxy);
file.createAttribute<int>("nmaxz", HighFive::DataSpace::From(nmaxz)).write(nmaxz);
}

void Cube::writeCovarH5Params(HighFive::File& file)
{
file.createAttribute<int>("nminx", HighFive::DataSpace::From(nminx)).write(nminx);
Expand Down
Loading
Loading