Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6672129
Update list of publically installed headers necessary for a Cuda comp…
May 14, 2026
8760ca1
Implement coefficient defined origin by default for getAccel and getF…
May 14, 2026
36bccc8
Comment out downstream change for now
May 14, 2026
c412482
Potential fix for pull request finding
The9Cat May 14, 2026
28885f4
Potential fix for pull request finding
The9Cat May 14, 2026
84318e7
Potential fix for pull request finding
The9Cat May 14, 2026
41f1baa
Potential fix for pull request finding
The9Cat May 14, 2026
f41e050
fix pyexp getAccel docstring typo
Copilot May 14, 2026
fc5a60a
fix remaining getAccel docstring typos
Copilot May 14, 2026
5592209
doc: add ABI-breaking change notes to getFields methods
Copilot May 14, 2026
86337c3
Minor simplyfing updates and improved doctstrings
May 14, 2026
2de3ccd
Fix time varying centering; evaluate() should use (0, 0, 0) as origin
May 15, 2026
7329f3c
Add backward-compatible dispatch in PyBasis trampoline for getFields/…
Copilot May 15, 2026
080818a
Potential fix for pull request finding
The9Cat May 15, 2026
b0f7670
Potential fix for pull request finding
The9Cat May 15, 2026
f91be48
Potential fix for pull request finding
The9Cat May 15, 2026
be7160b
Potential fix for pull request finding
The9Cat May 15, 2026
a368b11
Potential fix for pull request finding
The9Cat May 15, 2026
50ebb05
Potential fix for pull request finding
The9Cat May 15, 2026
d650ae1
Guard Cylindrical::computeAccel against R=0 at coefficient center
Copilot May 15, 2026
83ee34e
Flip defaults to retain previous behavior in 'getFields' calls
May 15, 2026
7ad2ccd
Merge branch 'galaUpdate' of github.com:EXP-code/EXP into galaUpdate
May 15, 2026
161b060
Guard FlatDisk and CBDisk computeAccel against R=0 at coefficient center
Copilot May 15, 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
16 changes: 12 additions & 4 deletions expui/BasisFactory.H
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,25 @@ namespace BasisClasses
const Coord ctype=Coord::Spherical);

//! Evaluate fields at a point
virtual std::vector<double> getFields(double x, double y, double z);
//! @note API change in v7.10.3: Added 'origin' parameter (default=true).
//! This is an ABI-breaking change for external C++ code that
//! subclasses Basis or calls these methods via vtable.
virtual std::vector<double> getFields(double x, double y, double z,
bool origin=true);

//! Evaluate fields at a point for all coefficients sets
//! @note API change in v7.10.3: Added 'origin' parameter (default=true).
//! This is an ABI-breaking change for external C++ code that
//! subclasses Basis or calls these methods via vtable.
virtual std::tuple<std::map<std::string, Eigen::VectorXd>,
Eigen::VectorXd> getFieldsCoefs
(double x, double y, double z, std::shared_ptr<CoefClasses::Coefs> coefs);
(double x, double y, double z, std::shared_ptr<CoefClasses::Coefs> coefs,
bool origin=true);

//! Evaluate fields at a point, and provide field lables
//! Evaluate fields at a point, and provide field labels
virtual std::tuple<std::vector<double>, std::vector<std::string>>
evaluate(double x, double y, double z)
{ return {getFields(x, y, z), getFieldLabels(coordinates)}; }
{ return {getFields(x, y, z, true), getFieldLabels(coordinates)}; }

//! Retrieve the coefficients
virtual CoefClasses::CoefStrPtr getCoefficients()
Expand Down
24 changes: 21 additions & 3 deletions expui/BasisFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,21 @@ namespace BasisClasses
};
}

std::vector<double> Basis::getFields(double x, double y, double z)
std::vector<double> Basis::getFields(double x, double y, double z,
bool origin)
{
if (not origin) {
x -= coefctr(0);
y -= coefctr(1);
z -= coefctr(2);
}
return crt_eval(x, y, z);
}

std::tuple<std::map<std::string, Eigen::VectorXd>, Eigen::VectorXd>
Basis::getFieldsCoefs
(double x, double y, double z, std::shared_ptr<CoefClasses::Coefs> coefs)
(double x, double y, double z, std::shared_ptr<CoefClasses::Coefs> coefs,
bool origin)
{
// Python dictonary for return
std::map<std::string, Eigen::VectorXd> ret;
Expand All @@ -249,9 +256,20 @@ namespace BasisClasses

// Make the return dictionary of arrays
for (int i=0; i<times.size(); i++) {
// Load the coefficients for the current time
set_coefs(coefs->getCoefStruct(times[i]));

double xc = x, yc = y, zc = z;
// Apply centering
if (not origin) {
xc -= coefctr(0);
yc -= coefctr(1);
zc -= coefctr(2);
}

// The field evaluation
auto v = crt_eval(x, y, z);
auto v = crt_eval(xc, yc, zc);

// Pack the fields into the dictionary
for (int j=0; j<fields.size(); j++) ret[fields[j]][i] = v[j];
}
Expand Down
56 changes: 49 additions & 7 deletions expui/BiorthBasis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,11 @@ namespace BasisClasses
void Spherical::computeAccel(double x, double y, double z,
Eigen::Ref<Eigen::Vector3d> acc)
{
// Shift to center
x -= coefctr(0);
y -= coefctr(1);
z -= coefctr(2);

// Get polar coordinates
double R2 = x*x + y*y;
double r2 = R2 + z*z;
Expand Down Expand Up @@ -1804,6 +1809,11 @@ namespace BasisClasses
void Cylindrical::computeAccel(double x, double y, double z,
Eigen::Ref<Eigen::Vector3d> acc)
{
// Shift to center
x -= coefctr(0);
y -= coefctr(1);
z -= coefctr(2);

Comment thread
The9Cat marked this conversation as resolved.
double R = sqrt(x*x + y*y);
double phi = atan2(y, x);

Expand All @@ -1813,8 +1823,12 @@ namespace BasisClasses

tdens = sl->accumulated_dens_eval(R, z, phi, tdens0);

double tpotx = tpotR*x/R - tpotp*y/R ;
double tpoty = tpotR*y/R + tpotp*x/R ;
double tpotx = 0.0;
double tpoty = 0.0;
if (R > 0.0) {
tpotx = tpotR*x/R - tpotp*y/R;
tpoty = tpotR*y/R + tpotp*x/R;
}

// Apply G to forces on return
acc << tpotx*G, tpoty*G, tpotz*G;
Expand Down Expand Up @@ -2481,6 +2495,11 @@ namespace BasisClasses
void FlatDisk::computeAccel(double x, double y, double z,
Eigen::Ref<Eigen::Vector3d> acc)
{
// Shift to center
x -= coefctr(0);
y -= coefctr(1);
z -= coefctr(2);

Comment thread
The9Cat marked this conversation as resolved.
// Get thread id
int tid = omp_get_thread_num();

Expand Down Expand Up @@ -2565,8 +2584,12 @@ namespace BasisClasses
zpot *= -G;
ppot *= -G;

double potx = rpot*x/R - ppot*y/R;
double poty = rpot*y/R + ppot*x/R;
double potx = 0.0;
double poty = 0.0;
if (R > 0.0) {
potx = rpot*x/R - ppot*y/R;
poty = rpot*y/R + ppot*x/R;
}

acc << potx, poty, zpot;
}
Expand Down Expand Up @@ -3270,6 +3293,11 @@ namespace BasisClasses
void CBDisk::computeAccel(double x, double y, double z,
Eigen::Ref<Eigen::Vector3d> acc)
{
// Shift to center
x -= coefctr(0);
y -= coefctr(1);
z -= coefctr(2);

Comment thread
The9Cat marked this conversation as resolved.
// Get thread id
int tid = omp_get_thread_num();

Expand Down Expand Up @@ -3330,8 +3358,12 @@ namespace BasisClasses
rpot *= -G;
ppot *= -G;

double potx = rpot*x/R - ppot*y/R;
double poty = rpot*y/R + ppot*x/R;
double potx = 0.0;
double poty = 0.0;
if (R > 0.0) {
potx = rpot*x/R - ppot*y/R;
poty = rpot*y/R + ppot*x/R;
}

acc << potx, poty, zpot;
}
Expand Down Expand Up @@ -3756,6 +3788,11 @@ namespace BasisClasses
void Slab::computeAccel(double x, double y, double z,
Eigen::Ref<Eigen::Vector3d> acc)
{
// Shift to center
x -= coefctr(0);
y -= coefctr(1);
z -= coefctr(2);

// Loop indices
//
int ix, iy, iz;
Expand Down Expand Up @@ -4328,6 +4365,11 @@ namespace BasisClasses
void Cube::computeAccel(double x, double y, double z,
Eigen::Ref<Eigen::Vector3d> acc)
{
// Shift to center
x -= coefctr(0);
y -= coefctr(1);
z -= coefctr(2);

// Get thread id
int tid = omp_get_thread_num();

Expand Down Expand Up @@ -4781,7 +4823,7 @@ namespace BasisClasses
for (int k=0; k<3; k++) pp(k) = ps(n, k) - ctr(k);
pp = rot * pp;

auto v = basis->getFields(pp(0), pp(1), pp(2));
auto v = basis->getFields(pp(0), pp(1), pp(2), true);

// First 6 fields are density and potential, followed by acceleration
for (int k=0; k<3; k++) accel(n, k) += v[6+k] - basis->pseudo(k);
Expand Down
4 changes: 4 additions & 0 deletions expui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,15 @@ target_sources(expui PUBLIC FILE_SET HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/../include/DiskWithHalo.H
${CMAKE_CURRENT_SOURCE_DIR}/../include/EmpCyl2d.H
${CMAKE_CURRENT_SOURCE_DIR}/../include/EXPmath.H
# ${CMAKE_CURRENT_SOURCE_DIR}/../include/EXPversion.H
${CMAKE_CURRENT_SOURCE_DIR}/../include/libvars.H
${CMAKE_CURRENT_SOURCE_DIR}/../include/Timer.H
${CMAKE_CURRENT_SOURCE_DIR}/../include/coef.H
${CMAKE_CURRENT_SOURCE_DIR}/../include/Covariance.H
${CMAKE_CURRENT_SOURCE_DIR}/../include/ExpDeproj.H
${CMAKE_CURRENT_SOURCE_DIR}/../include/cudaUtil.cuH
${CMAKE_CURRENT_SOURCE_DIR}/../include/cudaParticle.cuH
${CMAKE_CURRENT_SOURCE_DIR}/../include/cudaMappingConstants.cuH
)

install(TARGETS expui FILE_SET HEADERS DESTINATION include/EXP)
Expand Down
10 changes: 3 additions & 7 deletions include/BiorthCube.H
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
#include <yaml-cpp/yaml.h>

#if HAVE_LIBCUDA==1
#include <cudaUtil.cuH>
#include <cudaMappingConstants.cuH>
#include "cudaUtil.cuH"
#include "cudaParticle.cuH"
#include "cudaMappingConstants.cuH"
#endif

// For reading and writing cache file
Expand All @@ -28,11 +29,6 @@
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5Attribute.hpp>

#if HAVE_LIBCUDA==1
#include <cudaParticle.cuH>
#include <cudaMappingConstants.cuH>
#endif

#include "EmpCyl2d.H"

//!! BiorthCube grid class
Expand Down
10 changes: 3 additions & 7 deletions include/BiorthCyl.H
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
#include <yaml-cpp/yaml.h>

#if HAVE_LIBCUDA==1
#include <cudaUtil.cuH>
#include <cudaMappingConstants.cuH>
#include "cudaUtil.cuH"
#include "cudaParticle.cuH"
#include "cudaMappingConstants.cuH"
#endif

// For reading and writing cache file
Expand All @@ -28,11 +29,6 @@
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5Attribute.hpp>

#if HAVE_LIBCUDA==1
#include <cudaParticle.cuH>
#include <cudaMappingConstants.cuH>
#endif

#include "EmpCyl2d.H"

//!! BiorthCyl grid class
Expand Down
4 changes: 2 additions & 2 deletions include/EmpCylSL.H
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include "coef.H"

#if HAVE_LIBCUDA==1
#include <cudaParticle.cuH>
#include <cudaMappingConstants.cuH>
#include "cudaParticle.cuH"
#include "cudaMappingConstants.cuH"
#endif

#include "libvars.H"
Expand Down
4 changes: 2 additions & 2 deletions include/SLGridMP2.H
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
using namespace __EXP__;

#if HAVE_LIBCUDA==1
#include <cudaUtil.cuH>
#include <cudaMappingConstants.cuH>
#include "cudaUtil.cuH"
#include "cudaMappingConstants.cuH"
#endif


Expand Down
6 changes: 3 additions & 3 deletions include/cudaMappingConstants.cuH
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// -*- C++ -*-

#ifndef CUDA_MAPPING_CONSTANTS_H
#define CUDA_MAPPING_CONSTANTS_H

#include <cudaUtil.cuH>
#include "cudaUtil.cuH"

struct cudaMappingConstants
{
Expand All @@ -23,3 +21,5 @@ struct cudaMappingConstants
};

#endif

// -*- C++ -*-
12 changes: 5 additions & 7 deletions include/cudaParticle.cuH
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// -*- C++ -*-

#ifndef PARTICLE_CUH
#define PARTICLE_CUH

Expand All @@ -16,11 +14,9 @@
#include <thrust/host_vector.h>
#include <thrust/sort.h>

#include <config_exp.h>

#include <cudaUtil.cuH>

#include <Particle.H>
#include "config_exp.h"
#include "cudaUtil.cuH"
#include "Particle.H"

//! Simplified particle structure for use in CUDA kernel code
struct cudaParticle
Expand Down Expand Up @@ -125,3 +121,5 @@ struct cuPartToChange
};

#endif

// -*- C++ -*-
Loading
Loading