Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
SpinOrbitLockInfo.h
Go to the documentation of this file.
1 
8 #ifndef __SPIN_ORBIT_LOCK_INFO
9 #define __SPIN_ORBIT_LOCK_INFO
10 
11 #include "../Core/SharedLibraryExportMacros.h"
12 #include <iostream>
13 
14 namespace Evolve {
15 
20  //frequencies, not only when the orbital and spin periods are the same. In
25  class LIB_LOCAL SpinOrbitLockInfo {
26  private:
28  int __orbital_freq_mult,
29 
32 
49 
50  public:
54  int orbital_freq_mult=0,
55 
57  int spin_freq_mult=0,
58 
61  short lock_direction=-1)
62  {set_lock(orbital_freq_mult, spin_freq_mult, lock_direction);}
63 
66  {set_lock(orig.orbital_frequency_multiplier(),
68  orig.lock_direction());}
69 
72  {set_lock(rhs.orbital_frequency_multiplier(),
74  rhs.lock_direction()); return *this;}
75 
77  void set_lock(
79  int orbital_freq_mult,
80 
82  int spin_freq_mult,
83 
86  short lock_direction=0);
87 
90  double spin(double orbital_frequency) const
91  {return (orbital_frequency*__orbital_freq_mult)/__spin_freq_mult;}
92 
94  bool operator()(
96  int orbital_freq_mult,
97 
99  int spin_freq_mult) const
100  {return (__lock_direction ? false :
101  term(orbital_freq_mult, spin_freq_mult));}
102 
105  bool term(
107  int orbital_freq_mult,
108 
110  int spin_freq_mult) const
111  {return (orbital_freq_mult * __spin_freq_mult
112  ==
113  spin_freq_mult * __orbital_freq_mult);}
114 
116  operator bool() const {return __lock_direction==0;}
117 
120  short lock_direction() const {return __lock_direction;}
121 
123  void lock_direction(short value) {__lock_direction=value;}
124 
126  int orbital_frequency_multiplier() const {return __orbital_freq_mult;}
127 
129  int spin_frequency_multiplier() const {return __spin_freq_mult;}
130 
133  bool operator==(const SpinOrbitLockInfo &rhs) const;
134  };//End SpinOrbitLockInfo class.
135 
137  LIB_LOCAL std::ostream &operator<<(std::ostream &os,
138  const SpinOrbitLockInfo &lock);
139 
140 } //End Evolve namespace.
141 
142 #endif
SpinOrbitLockInfo(const SpinOrbitLockInfo &orig)
Copy the original to this.
int __spin_freq_mult
The multiplier in front of the spin frequency in the lock.
SpinOrbitLockInfo(int orbital_freq_mult=0, int spin_freq_mult=0, short lock_direction=-1)
Define which tidal dissipation term is in a lock.
std::ostream & operator<<(std::ostream &os, const ZoneEvolutionQuantities &evol_var)
More civilized output for EvolVarType variables.
int orbital_frequency_multiplier() const
The multiplier in front of the orbital frequency in the lock.
short __lock_direction
Should a lock be assumed, and if so from which direction is it approached?
Orientations of zones of bodies in a binary system.
double spin(double orbital_frequency) const
Spin frequency at exactly the lock that corresponds to the given orbital frequency.
int spin_frequency_multiplier() const
The multiplier in front of the spin frequency in the lock.
bool operator()(int orbital_freq_mult, int spin_freq_mult) const
Is the given tidal dissipation term one of the locked terms?
bool term(int orbital_freq_mult, int spin_freq_mult) const
void lock_direction(short value)
Set the lock direction to the given value.
Defines a lock between the spin of a dissipating body and the orbit.
SpinOrbitLockInfo & operator=(const SpinOrbitLockInfo &rhs)
Make this the same lock as RHS.