Class Tracks3D

Inheritance Relationships

Base Type

  • public std::enable_shared_from_this< Tracks3D >

Class Documentation

class Tracks3D : public std::enable_shared_from_this<Tracks3D>

A class representing a 3D set of stellar tracks.

Every query at a given [Fe/H] (starLifetime(), getIsochrone(), etc.) evaluates a lazily-evaluated slice of the tracks at that [Fe/H], built afresh for that one query – see interp::Mesh3DInterpolator::lazySliceConstZ() – so no query builds a full 2D slice, and none touches any shared mutable state: all are safe to call concurrently from multiple threads. Derives from std::enable_shared_from_this so that lazySliceConstFeH() can keep this object alive for as long as a slice it returns is.

Public Types

using M3DPtr = std::unique_ptr<interp::Mesh3DInterpolator<static_cast<size_t>(FieldIdx::nTrackQty)>>

Public Functions

Tracks3D(const std::string &trackName, double fehMin, double fehMax, double vvcrit = defaultVVcrit, double afe = defaultAFe, const std::string &registryName = defaultRegistry)

Construct a Tracks3D object from tracks on disk.

Parameters:
  • trackName – Name of track set

  • fehMin – Minimum [Fe/H] value

  • fehMax – Maximum [Fe/H] value

  • vvcrit – Rotation rate v/vcrit

  • afe – Value of [alpha/Fe]

  • registryName – Name of the track registry file

Throws:

std::runtime_error – if fehMin or fehMax lies outside the [Fe/H] range actually available for this track set at the requested vvcrit/afe, or if no tracks match trackName/ vvcrit/afe at all

inline Tracks3D()

Construct an empty, invalid Tracks3D object.

virtual ~Tracks3D() = default
Tracks3D(const Tracks3D&) = delete
Tracks3D(Tracks3D&&) = default
auto operator=(const Tracks3D&) -> Tracks3D& = delete
auto operator=(Tracks3D&&) -> Tracks3D& = default
inline auto mMin() const

Return the minimum mass in the tracks.

Returns:

Minimum mass in the tracks

inline auto mMax() const

Return the maximum mass in the tracks.

Returns:

Maximum mass in the tracks

inline auto logTMin() const

Return the minimum log of time in the tracks.

Returns:

Minimum log10(time) in the tracks

inline auto logTMax() const

Return the maximum log of time in the tracks.

Returns:

Maximum log10(time) in the tracks

inline auto feH() const -> const std::vector<double>&

Return the [Fe/H] values spanned by this set of tracks.

Returns:

A const reference to the [Fe/H] values spanned by this set of tracks

inline auto fehMin() const

Return the minimum [Fe/H] this object was constructed to cover.

This is the originally-requested bound, not derived from feH() (which can be wider, since the constructor pads the loaded grid with neighboring points beyond [fehMin, fehMax] to support interpolation – see the constructor’s own comment) or from any [Fe/H] distribution a caller may be using this object alongside, which can be narrower than this if it has since been amended. Callers that need to validate a new distribution against what this object can actually interpolate over should check against this and fehMax(), not against their own distribution’s current bounds.

Returns:

The fehMin value passed to the constructor

inline auto fehMax() const

Return the maximum [Fe/H] this object was constructed to cover.

See fehMin()’s own comment.

Returns:

The fehMax value passed to the constructor

inline auto aFe() const

Return the [alpha/Fe] value of this set of tracks.

Returns:

[alpha/Fe] value of this set of tracks, or quiet_NaN if not available

inline auto vVcrit() const

Return the v/vcrit value of this set of tracks.

Returns:

v/vcrit value of this set of tracks, or quiet_NaN if not available

inline auto starLifetime(const double m, const double feh) const

Return the lifetime of a star of specified mass and [Fe/H].

Parameters:
  • m – Mass of the star whose lifetime should be returned

  • feh – [Fe/H] value of the tracks to use

Returns:

The lifetime of a star of mass m at the given [Fe/H], in yr – see Tracks2D::starLifetime()’s own comment for why this un-logs the mesh’s own x-axis maximum rather than returning it directly

inline auto liveMassRange(const double t, const double feh) const

Return the range of stellar masses that are alive at a given time and [Fe/H].

Parameters:
  • t – Time at which to evaluate

  • feh – [Fe/H] value of the tracks to use

Returns:

The range of stellar masses alive at the given time and [Fe/H]

inline auto massAndDerivFromLifetime(const double logT, const double feh) const

Return the mass(es) and dm/d(logT) of the star(s) whose lifetime is a given value, at a given [Fe/H].

Mirrors liveMassRange()’s own identical pattern: slices interp_ (lazily) to feh, then delegates to that slice’s own yEdgeSlope(logT, false) – see Tracks2D:: massAndDerivFromLifetime()’s own comment for what it returns.

Parameters:
  • logT – log10(lifetime / yr)

  • feh – [Fe/H] value of the tracks to use

Returns:

See Tracks2D::massAndDerivFromLifetime()’s own comment

inline auto isAlive(const double m, const double logT, const double feh) const -> bool

Check whether a star of a given mass is alive at a given time and [Fe/H].

Parameters:
  • m – Mass of the star

  • logT – log10(time / yr) at which to evaluate

  • feh – [Fe/H] value of the tracks to use

Returns:

True if a star of mass m is alive at logT and feh, false otherwise

inline auto getTrack(const double m, const double feh) const

Return the track for a star of a given mass and [Fe/H].

Every point evaluation of the result has its surface mass fractions passed through renormalizeSurfaceAbundances() (see Interpolator1D::setPostProcess()).

Parameters:
  • m – Mass of the star whose track should be computed

  • feh – [Fe/H] value of the tracks to use

Returns:

An unique_ptr to an Interpolator1D describing the track for a given mass

inline auto getIsochrone(const double logT, const double feh) const

Return the isochrone at a given log time and [Fe/H].

Note that this method returns a vector of Interpolator1D objects rather than a single one because for non-monotonic tracks there may be multiple disjoint segments to the isochrone.

Every point evaluation of the result has its surface mass fractions passed through renormalizeSurfaceAbundances() (see Interpolator1D::setPostProcess()).

Parameters:
  • logT – The log10(time) of the isochrone

  • feh – [Fe/H] value of the tracks to use

Returns:

A vector of unique_ptr to Interpolator1D’s describing the isochrone

inline auto getStar(const double m, const double logT, const double feh, const bool linear = false) const

Return the properties of a star of a given mass, age, and [Fe/H].

No safety checking is performed: it is an error to call this with an (m, logT) pair that does not correspond to a live star at that time and [Fe/H]. If it is uncertain whether the star is alive, check first by calling liveMassRange().

The result’s surface mass fractions are passed through renormalizeSurfaceAbundances().

Parameters:
  • m – Mass of the star

  • logT – log10(time / yr) at which to evaluate

  • feh – [Fe/H] value of the tracks to use

  • linear – If true, force linear interpolation instead of the default interpolation type

Returns:

An array of the nTrackQty properties of the star

inline auto sliceConstFeH(const double feh) const -> Tracks2D

Construct a Tracks2D object for a slice at fixed [Fe/H].

Builds a new, independent Mesh2DInterpolator (via Mesh3DInterpolator::sliceConstZCopy) and uses it to construct a Tracks2D object that owns all of its own memory, and so remains valid even after this Tracks3D object is destroyed. Queries on it are as fast as possible, but building it costs O(Nmass * Ntime) time and memory, with a large constant (hundreds of MB for the largest track sets) – see lazySliceConstFeH() for a much cheaper alternative.

Parameters:

feh – [Fe/H] value at which to slice

Returns:

A Tracks2D object representing the (mass, time) slice at the given [Fe/H]

inline auto lazySliceConstFeH(const double feh) const -> Tracks2D

Construct a lazily-evaluated Tracks2D object for a slice at fixed [Fe/H].

Represents the same slice as sliceConstFeH()

, but via Mesh3DInterpolator::lazySliceConstZ(): it costs only O(Nmass) time and memory to construct, rather than O(Nmass *

Ntime) with a large constant, at the price of some extra work per query, and query results agree with

sliceConstFeH()’s to within floating-point rounding. It refers to this Tracks3D object’s own data, so if this object is owned by a std::shared_ptr (as SimControls::tracks() is), the returned Tracks2D holds a reference to it, keeping it alive for as long as the Tracks2D exists; otherwise, the caller must ensure this object outlives the returned one.

Parameters:

feh – [Fe/H] value at which to slice

Returns:

A Tracks2D object representing the (mass, time) slice at the given [Fe/H], evaluated lazily