PeTar
N-body code for collisional gravitational systems
ChangeOver Class Reference

Changeover function class. More...

#include <changeover.hpp>

Public Member Functions

 ChangeOver ()
 

scaling for changeover factor (for next step)

More...
 
bool checkParams ()
 check whether parameters values are correct More...
 
template<class Tpars >
 ChangeOver (const Tpars &_par)
 constructor based on inherited class More...
 
void setR (const Float &_m_fac, const Float &_r_in, const Float &_r_out)
 set r_in and r_out for changeover function More...
 
void setR (const Float &_r_in, const Float &_r_out)
 set r_in and r_out for changeover function More...
 
void updateWithRScale ()
 update radius based on r_scale_next, reset r_scale_next to 1 More...
 
const Float & getRin () const
 get r_in More...
 
const Float & getRout () const
 get r_out More...
 
void print (std::ostream &_fout) const
 
void printColumn (std::ostream &_fout, const int _width=20)
 print data of class members using column style More...
 
void writeBinary (FILE *_fp) const
 write class data to file with binary format More...
 
void readBinary (FILE *_fin)
 read class data to file with binary format More...
 
void writeAscii (FILE *_fp) const
 write class data to file with binary format More...
 
void readAscii (FILE *_fin)
 read class data to file with binary format More...
 
template<class Tpars >
void dataCopy (const Tpars &_par)
 copy data from inherited class object More...
 
Float calcPotW (const Float &_dr) const
 changeover function for potential More...
 
Float calcAcc0W (const Float &_dr) const
 changeover function for force More...
 
Float calcAcc1W (const Float &_dr, const Float &_drdot) const
 changeover function for force derivative More...
 

Static Public Member Functions

static void printColumnTitle (std::ostream &_fout, const int _width=20)
 print titles of class members using column style More...
 
static int printTitleWithMeaning (std::ostream &_fout, const int _counter=0, const int _offset=0)
 print column title with meaning (each line for one column) More...
 
static Float calcPotWTwo (const ChangeOver &_ch1, const ChangeOver &_ch2, const Float &_dr)
 calculate changeover function Pot by selecting maximum rout More...
 
static Float calcAcc0WTwo (const ChangeOver &_ch1, const ChangeOver &_ch2, const Float &_dr)
 calculate changeover function Acc0 by selecting maximum rout More...
 
static Float calcAcc1WTwo (const ChangeOver &_ch1, const ChangeOver &_ch2, const Float &_dr, const Float &_drdot)
 calculate changeover function Acc1 by selecting maximum rout More...
 

Public Attributes

Float r_scale_next
 

(1 + coff_)/r_out = 2/(r_out+r_in)

More...
 

Detailed Description

Changeover function class.

Constructor & Destructor Documentation

◆ ChangeOver() [1/2]

ChangeOver::ChangeOver ( )
inline

scaling for changeover factor (for next step)

◆ ChangeOver() [2/2]

template<class Tpars >
ChangeOver::ChangeOver ( const Tpars &  _par)
inline

constructor based on inherited class

Here is the call graph for this function:

Member Function Documentation

◆ calcAcc0W()

Float ChangeOver::calcAcc0W ( const Float &  _dr) const
inline

changeover function for force

Parameters
[in]_drparticle separation
\( x = \frac{dr - r_{in}{r_{out} - r_{in}} \)
\( R_a = \frac{r_{in}}{r_{out} - r_{in}} \)
\( W_0(x) = (x-1)^4 (1 + 4 x + 10 x^2 + 20 x^3 + \frac{35 x^4}{2 R_a + 1} \)
Returns
\( W_0(x) \)
Here is the caller graph for this function:

◆ calcAcc0WTwo()

static Float ChangeOver::calcAcc0WTwo ( const ChangeOver _ch1,
const ChangeOver _ch2,
const Float &  _dr 
)
inlinestatic

calculate changeover function Acc0 by selecting maximum rout

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcAcc1W()

Float ChangeOver::calcAcc1W ( const Float &  _dr,
const Float &  _drdot 
) const
inline

changeover function for force derivative

Parameters
[in]_drparticle separation
[in]_drdottime derivation of _dr \( R_a = \frac{r_{in}}{r_{out} - r_{in}} \)
\( x = \frac{dr - r_{in}{r_{out} - r_{in}} \)
\( \frac{dx}{dt} = \frac{1}{r_{out} - r_{in}} \frac{dr}{dt} \)
\( W_1(x) = \frac{280 x^3 (R_a + x)(x-1)^3}{2 R_a + 1} \)
Returns
\( W_1(x) dx/dt \)
Here is the caller graph for this function:

◆ calcAcc1WTwo()

static Float ChangeOver::calcAcc1WTwo ( const ChangeOver _ch1,
const ChangeOver _ch2,
const Float &  _dr,
const Float &  _drdot 
)
inlinestatic

calculate changeover function Acc1 by selecting maximum rout

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcPotW()

Float ChangeOver::calcPotW ( const Float &  _dr) const
inline

changeover function for potential

Parameters
[in]_drparticle separation \( x = \frac{dr - r_{in}{r_{out} - r_{in}} \)
\( R_a = \frac{r_{in}}{r_{out} - r_{in}} \)
\( W_pot(x) = \frac{x^5}{2 R_a + 1} (5 x^3 - 20 x^2 + 28 x - 14) \)
Returns
\( W_pot(x) \)
Here is the caller graph for this function:

◆ calcPotWTwo()

static Float ChangeOver::calcPotWTwo ( const ChangeOver _ch1,
const ChangeOver _ch2,
const Float &  _dr 
)
inlinestatic

calculate changeover function Pot by selecting maximum rout

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkParams()

bool ChangeOver::checkParams ( )
inline

check whether parameters values are correct

Returns
true: all correct

◆ dataCopy()

template<class Tpars >
void ChangeOver::dataCopy ( const Tpars &  _par)
inline

copy data from inherited class object

Parameters
[in]_parobject that contain data (should be inherited class)
Here is the caller graph for this function:

◆ getRin()

const Float& ChangeOver::getRin ( ) const
inline

get r_in

Returns
r_in
Here is the caller graph for this function:

◆ getRout()

const Float& ChangeOver::getRout ( ) const
inline

get r_out

Returns
r_out
Here is the caller graph for this function:

◆ print()

void ChangeOver::print ( std::ostream &  _fout) const
inline
Here is the caller graph for this function:

◆ printColumn()

void ChangeOver::printColumn ( std::ostream &  _fout,
const int  _width = 20 
)
inline

print data of class members using column style

print data of class members in one line for column style. Notice no newline is printed at the end

Parameters
[out]_foutstd::ostream output object
[in]_widthprint width (defaulted 20)
Here is the caller graph for this function:

◆ printColumnTitle()

static void ChangeOver::printColumnTitle ( std::ostream &  _fout,
const int  _width = 20 
)
inlinestatic

print titles of class members using column style

print titles of class members in one line for column style

Parameters
[out]_foutstd::ostream output object
[in]_widthprint width (defaulted 20)
Here is the caller graph for this function:

◆ printTitleWithMeaning()

static int ChangeOver::printTitleWithMeaning ( std::ostream &  _fout,
const int  _counter = 0,
const int  _offset = 0 
)
inlinestatic

print column title with meaning (each line for one column)

Parameters
[out]_foutstd::ostream output object
[in]_counteroffset of the number counter for each line to indicate the column index (defaulted 0)
[in]_offsetthe printing whitespace offset for each line (defaulted 0)
Returns
: the total counter of columns
Here is the caller graph for this function:

◆ readAscii()

void ChangeOver::readAscii ( FILE *  _fin)
inline

read class data to file with binary format

Parameters
[in]_fpFILE type file for reading
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readBinary()

void ChangeOver::readBinary ( FILE *  _fin)
inline

read class data to file with binary format

Parameters
[in]_fpFILE type file for reading
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setR() [1/2]

void ChangeOver::setR ( const Float &  _m_fac,
const Float &  _r_in,
const Float &  _r_out 
)
inline

set r_in and r_out for changeover function

Parameters
[in]_m_facmass factor
[in]_r_inchangeover function inner boundary
[in]_r_outchangeover function outer boundary
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setR() [2/2]

void ChangeOver::setR ( const Float &  _r_in,
const Float &  _r_out 
)
inline

set r_in and r_out for changeover function

Parameters
[in]_m_facmass factor
[in]_r_inchangeover function inner boundary
[in]_r_outchangeover function outer boundary

◆ updateWithRScale()

void ChangeOver::updateWithRScale ( )
inline

update radius based on r_scale_next, reset r_scale_next to 1

Here is the call graph for this function:

◆ writeAscii()

void ChangeOver::writeAscii ( FILE *  _fp) const
inline

write class data to file with binary format

Parameters
[in]_fpFILE type file for output
Here is the caller graph for this function:

◆ writeBinary()

void ChangeOver::writeBinary ( FILE *  _fp) const
inline

write class data to file with binary format

Parameters
[in]_fpFILE type file for output
Here is the caller graph for this function:

Member Data Documentation

◆ r_scale_next

Float ChangeOver::r_scale_next

(1 + coff_)/r_out = 2/(r_out+r_in)


The documentation for this class was generated from the following file: