PeTar
N-body code for collisional gravitational systems
Particle Struct Reference

A sample particle class. More...

Public Member Functions

void writeBinary (FILE *_fout) 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 (std::ostream &_fout) const
 write class data to file with ASCII format More...
 
void readAscii (std::istream &_fin)
 read class data to file with ASCII format More...
 
void printColumn (std::ostream &_fout, const int _width=20)
 print data of class members using column style More...
 
void readAscii (FILE *fp)
 
void printColumn (std::ostream &_fout, const int _width=20) const
 print data of class members using column style 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 void printColumnTitle (std::ostream &_fout, const int _width=20)
 print titles of class members using column style More...
 

Public Attributes

long long int id
 
Float mass
 
PS::F64vec3 pos
 
PS::F64vec3 vel
 
double mass
 
double pos [3]
 
double vel [3]
 
double acc [3]
 
double pot
 

Detailed Description

A sample particle class.

A particle class should contain public members: Float mass, Float pos[3], Float vel[3],

Member Function Documentation

◆ printColumn() [1/2]

void Particle::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)

◆ printColumn() [2/2]

void Particle::printColumn ( std::ostream &  _fout,
const int  _width = 20 
) const
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)

◆ printColumnTitle() [1/2]

static void Particle::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)

◆ printColumnTitle() [2/2]

static void Particle::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)

◆ readAscii() [1/2]

void Particle::readAscii ( FILE *  fp)
inline

◆ readAscii() [2/2]

void Particle::readAscii ( std::istream &  _fin)
inline

read class data to file with ASCII format

Parameters
[in]_finstd::istream file for input

◆ readBinary()

void Particle::readBinary ( FILE *  _fin)
inline

read class data to file with binary format

Parameters
[in]_fpFILE type file for reading

◆ writeAscii()

void Particle::writeAscii ( std::ostream &  _fout) const
inline

write class data to file with ASCII format

Parameters
[in]_foutstd:osteram file for output

◆ writeBinary()

void Particle::writeBinary ( FILE *  _fout) const
inline

write class data to file with binary format

Parameters
[in]_fpFILE type file for output

Member Data Documentation

◆ acc

double Particle::acc[3]

◆ id

long long int Particle::id

◆ mass [1/2]

double Particle::mass

◆ mass [2/2]

Float Particle::mass

◆ pos [1/2]

double Particle::pos[3]

◆ pos [2/2]

PS::F64vec3 Particle::pos

◆ pot

double Particle::pot

◆ vel [1/2]

double Particle::vel[3]

◆ vel [2/2]

PS::F64vec3 Particle::vel

The documentation for this struct was generated from the following files: