Skip to content

Commit 75ef89f

Browse files
author
Martin D. Weinberg
committed
Merge branch 'devel' into cylheight for upstream consistency.
2 parents c0c0b09 + c50be70 commit 75ef89f

55 files changed

Lines changed: 5219 additions & 676 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 0 additions & 120 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.25) # Needed for CUDA, MPI, and CTest features
22

33
project(
44
EXP
5-
VERSION "7.8.5"
5+
VERSION "7.9.1"
66
HOMEPAGE_URL https://github.com/EXP-code/EXP
77
LANGUAGES C CXX Fortran)
88

INSTALL

Lines changed: 0 additions & 3 deletions
This file was deleted.

INSTALL.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
See the installation guide in the documentation for the most up-to-date instructions on
2+
how to install EXP:
3+
https://exp-docs.readthedocs.io/en/latest/intro/install.html
4+
15
# Configuring and building EXP
26

37
EXP uses CMake for building a configuration.

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,28 @@
44
[![Documentation](https://readthedocs.org/projects/exp-docs/badge/?version=latest)](https://exp-docs.readthedocs.io/)
55
[![DOI](https://joss.theoj.org/papers/10.21105/joss.07302/status.svg)](https://doi.org/10.21105/joss.07302)
66

7+
EXP is a Basis Function Expansion C++ library and Python package for running N-body galactic simulations and dynamical discovery.
78

89
## Repo organization
910

10-
| Files | Description |
11+
| Directory | Description |
1112
| --- | --- |
12-
| README | This file |
13-
| TODO | Wish list of features to add, things to fix, big and small |
14-
| include | Include file for all common classes |
15-
| src | Source for nbody code |
13+
| Paper | The JOSS paper for EXP |
14+
| cmake | Helpers for `cmake` installation process |
15+
| doc | The doxygen documentation for EXP |
16+
| expui | Classes used by Python wrappers and by the nbody code and other standalone utilities for coefficient IO support. |
1617
| exputil | The main EXP function and class library used by both pyEXP and EXP |
17-
| coefs | Source for standalone classes used by Python wrappers and other standalone utilities |
18+
| extern | The directory for external code needed for installation |
19+
| include | Include file for all common classes |
1820
| pyEXP | Source for Python wrappers |
21+
| src | Source for nbody code |
22+
| tests | An assortment of automatic tests for EXP |
1923
| utils | Older but still useful standalone C++ utilities |
2024

2125
## Version reporting
2226

2327
EXP automatically stashes its compile time, git branch, and git commit
24-
hash when `make` is invoked in the src directory. You can see this
28+
hash when `make` is invoked in the src directory (e.g. as part of the `cmake` installation). You can see this info using `pyEXP` using the `pyEXP.util.getVersionInfo()` command. You can also see this
2529
info using the -v flag, i.e. `mpirun -np 1 exp -v` or `exp -v`. Note:
2630
some MPI implementations require the MPI-aware executable to be run
2731
using 'mpirun'. Some recent HPC systems using `slurm` require the use
@@ -30,7 +34,7 @@ resource request.
3034

3135
## Compile hints
3236

33-
See INSTALL.md for a brief synposis.
37+
See INSTALL.md for a brief synposis and pointers to more detailed information.
3438

3539
A few quick additional notes. By default, both the n-body code and the
3640
Python bindings, the pyEXP interface, will be compiled by default.
@@ -54,7 +58,7 @@ We are developing two repositories of examples and tutorials:
5458
| EXP-examples | Each subdirectory contains a full set of body files and configurations to run EXP with with model galaxy |
5559
| pyEXP-examples | Tutorials and example workflows for a variety of envisioned use cases |
5660

57-
Both of these are available from the origin as EXP.
61+
Both of these are available from the [origin as EXP](https://github.com/EXP-code).
5862

5963
## pyEXP
6064

@@ -94,11 +98,9 @@ To provide some context, suppose you want to read some snapshots, make some coef
9498
5. 'newcoefs' and 'disk' can then be passed to the FieldGenerator to provide density, potential, force fields, etc. for the each principal signal
9599

96100
This is only one example of many possible uses. There are many
97-
variants to this work flow, of course, and I expect that you will
101+
variants to this work flow, of course, and we expect that you will
98102
invent some interesting ones.
99103

100104
## Citation
101105

102-
If you use EXP in your research, please cite the following paper:
103-
104-
[![DOI](https://joss.theoj.org/papers/10.21105/joss.07302/status.svg)](https://doi.org/10.21105/joss.07302)
106+
If you use EXP in your research, please cite the [JOSS paper](https://doi.org/10.21105/joss.07302), and consider including other papers from the list in CITATIONS.bib.

doc/exp.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = EXP
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = 7.8.0
51+
PROJECT_NUMBER = 7.9.1
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5454
# for a project that appears at the top of each page and should give viewer a

expui/BasisFactory.H

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ namespace BasisClasses
137137
Eigen::Vector3d currentAccel(double time);
138138

139139
public:
140+
140141
//! The current pseudo acceleration
141142
Eigen::Vector3d pseudo {0, 0, 0};
142143

@@ -249,8 +250,8 @@ namespace BasisClasses
249250

250251
//@{
251252
//! Initialize non-inertial forces
252-
void setNonInertial(int N, Eigen::VectorXd& x, Eigen::MatrixXd& pos);
253-
void setNonInertial(int N, const std::string& orient);
253+
void setNonInertial(int Naccel, const Eigen::VectorXd& x, const Eigen::MatrixXd& pos);
254+
void setNonInertial(int Naccel, const std::string& orient);
254255
//@}
255256

256257
//! Set the current pseudo acceleration
@@ -259,6 +260,16 @@ namespace BasisClasses
259260
if (Naccel > 0) pseudo = currentAccel(time);
260261
}
261262

263+
//! Returns true if non-inertial forces are active
264+
bool usingNonInertial() { return Naccel > 0; }
265+
266+
//! Reset to inertial coordinates
267+
void setInertial()
268+
{
269+
Naccel = 0;
270+
pseudo = {0, 0, 0};
271+
}
272+
262273
//! Get the field label vector
263274
std::vector<std::string> getFieldLabels(void)
264275
{ return getFieldLabels(coordinates); }

expui/BasisFactory.cc

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,16 @@ namespace BasisClasses
283283
return makeFromArray(time);
284284
}
285285

286-
void Basis::setNonInertial(int N, Eigen::VectorXd& t, Eigen::MatrixXd& pos)
286+
void Basis::setNonInertial(int N, const Eigen::VectorXd& t, const Eigen::MatrixXd& pos)
287287
{
288+
// Sanity checks
289+
if (t.size() < 1)
290+
throw std::runtime_error("Basis: setNonInertial: no times in time array");
291+
292+
if (t.size() != pos.rows())
293+
throw std::runtime_error("Basis::setNonInertial: size mismatch in time and position arrays");
294+
295+
// Set the data
288296
Naccel = N;
289297
t_accel = t;
290298
p_accel = pos;
@@ -351,16 +359,31 @@ namespace BasisClasses
351359
{
352360
Eigen::Vector3d ret;
353361

354-
if (time < t_accel(0) || time > t_accel(t_accel.size()-1)) {
355-
std::cout << "ERROR: " << time << " is outside of range of the non-inertial DB"
356-
<< std::endl;
357-
ret.setZero();
358-
return ret;
362+
auto n = t_accel.size();
363+
364+
// Allow a little bit of buffer in the allowable on-grid range but
365+
// otherwise force termination
366+
//
367+
if ( time < t_accel(0 ) - 0.5*(t_accel(1 ) - t_accel(0 )) ||
368+
time > t_accel(n-1) + 0.5*(t_accel(n-1) - t_accel(n-2)) ) {
369+
370+
std::ostringstream msg;
371+
msg << "Basis::currentAccel: " << time
372+
<< " is outside the range of the non-inertial DB ["
373+
<< t_accel(0) << ", " << t_accel(n-1) << "]";
374+
375+
throw std::runtime_error(msg.str());
359376
}
377+
// Do the quadratic interpolation
378+
//
360379
else {
361380
int imin = 0;
362-
int imax = std::lower_bound(t_accel.data(), t_accel.data()+t_accel.size(), time) - t_accel.data();
363-
if (imax > Naccel) imin = imax - Naccel;
381+
int imax = std::lower_bound(t_accel.data(), t_accel.data()+n, time) - t_accel.data();
382+
383+
// Get a range around the current time of approx size Naccel
384+
//
385+
imax = std::min<int>(n-1, imax + Naccel/2);
386+
imin = std::max<int>(imax - Naccel, 0);
364387

365388
int num = imax - imin + 1;
366389
Eigen::VectorXd t(num);

expui/BiorthBasis.H

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ namespace BasisClasses
163163

164164
//! Clear the particle selector callback
165165
void clrSelector() { ftor = nullptr; }
166+
167+
//! Evaluate acceleration in Cartesian coordinates in centered
168+
//! coordinate system
169+
virtual std::vector<double> getAccel(double x, double y, double z) = 0;
166170
};
167171

168172
/**
@@ -307,6 +311,9 @@ namespace BasisClasses
307311
return ret;
308312
}
309313

314+
//! Evaluate acceleration in Cartesian coordinates in centered
315+
//! coordinate system
316+
virtual std::vector<double> getAccel(double x, double y, double z);
310317
};
311318

312319
/**
@@ -542,6 +549,10 @@ namespace BasisClasses
542549
return ret;
543550
}
544551

552+
//! Evaluate acceleration in Cartesian coordinates in centered
553+
//! coordinate system
554+
std::vector<double> getAccel(double x, double y, double z);
555+
545556
};
546557

547558
/**
@@ -693,6 +704,10 @@ namespace BasisClasses
693704
return ret;
694705
}
695706

707+
//! Evaluate acceleration in Cartesian coordinates in centered
708+
//! coordinate system
709+
std::vector<double> getAccel(double x, double y, double z);
710+
696711
};
697712

698713
/**
@@ -841,10 +856,18 @@ namespace BasisClasses
841856
bool orthoTest()
842857
{
843858
auto [ret, worst, lworst] = orthoCompute(sl->orthoCheck());
844-
// For the CTest log
845-
std::cout << "---- Cylindrical::orthoTest: worst=" << worst << std::endl;
859+
if (myid==0) {
860+
// For the CTest log
861+
std::cout << "---- Cylindrical::orthoTest: worst=" << worst
862+
<< std::endl;
863+
}
846864
return ret;
847865
}
866+
867+
//! Evaluate acceleration in Cartesian coordinates in centered
868+
//! coordinate system
869+
std::vector<double> getAccel(double x, double y, double z);
870+
848871
};
849872

850873
/**
@@ -991,6 +1014,10 @@ namespace BasisClasses
9911014
return true;
9921015
}
9931016

1017+
//! Evaluate acceleration in Cartesian coordinates in centered
1018+
//! coordinate system
1019+
std::vector<double> getAccel(double x, double y, double z);
1020+
9941021
};
9951022

9961023
/**
@@ -1113,6 +1140,10 @@ namespace BasisClasses
11131140
return true;
11141141
}
11151142

1143+
//! Evaluate acceleration in Cartesian coordinates in centered
1144+
//! coordinate system
1145+
std::vector<double> getAccel(double x, double y, double z);
1146+
11161147
};
11171148

11181149

0 commit comments

Comments
 (0)