MINT2
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
MINT::Phase Class Reference

#include <Phase.h>

Public Member Functions

 Phase (const Phase &other)
 
 Phase (double ph_in=0)
 
 operator double () const
 
Phaseoperator *= (double rhs)
 
Phaseoperator/= (double rhs)
 
Phaseoperator+= (const Phase &rhs)
 
Phase operator+ (const Phase &rhs) const
 
const Phaseoperator+ () const
 
Phaseoperator-= (const Phase &rhs)
 
Phase operator- (const Phase &rhs) const
 
Phase operator- () const
 
double inDegrees () const
 
void testPhase (std::ostream &os=std::cout) const
 

Static Public Member Functions

static double rangeMax ()
 
static double rangeMin ()
 

Protected Member Functions

void toRange ()
 

Protected Attributes

double _ph
 

Static Protected Attributes

static const double _minPh = 0
 

Detailed Description

Definition at line 9 of file Phase.h.

Constructor & Destructor Documentation

◆ Phase() [1/2]

Phase::Phase ( const Phase other)

Definition at line 23 of file Phase.cpp.

24  : _ph(other._ph){
25  toRange();
26 }
double _ph
Definition: Phase.h:11
void toRange()
Definition: Phase.cpp:19

◆ Phase() [2/2]

Phase::Phase ( double  ph_in = 0)

Definition at line 27 of file Phase.cpp.

28  : _ph(ph_in){
29  toRange();
30 }
double _ph
Definition: Phase.h:11
void toRange()
Definition: Phase.cpp:19

Member Function Documentation

◆ inDegrees()

double Phase::inDegrees ( ) const

Definition at line 69 of file Phase.cpp.

69  {
70  return _ph * 180.0/pi;
71 }
static const double pi
double _ph
Definition: Phase.h:11

◆ operator *=()

Phase & Phase::operator *= ( double  rhs)

Definition at line 31 of file Phase.cpp.

31  {
32  _ph *= rhs;
33  toRange();
34  return *this;
35 }
double _ph
Definition: Phase.h:11
void toRange()
Definition: Phase.cpp:19

◆ operator double()

MINT::Phase::operator double ( ) const
inline

Definition at line 17 of file Phase.h.

17  {
18  return _ph;
19  }
double _ph
Definition: Phase.h:11

◆ operator+() [1/2]

Phase Phase::operator+ ( const Phase rhs) const

Definition at line 46 of file Phase.cpp.

46  {
47  Phase newPhase(*this);
48  newPhase += rhs;
49  return newPhase;
50 }

◆ operator+() [2/2]

const Phase & Phase::operator+ ( ) const

Definition at line 51 of file Phase.cpp.

51  {
52  return (*this);
53 }

◆ operator+=()

Phase & Phase::operator+= ( const Phase rhs)

Definition at line 41 of file Phase.cpp.

41  {
42  _ph += (double) rhs;
43  toRange();
44  return *this;
45 }
double _ph
Definition: Phase.h:11
void toRange()
Definition: Phase.cpp:19

◆ operator-() [1/2]

Phase Phase::operator- ( const Phase rhs) const

Definition at line 59 of file Phase.cpp.

59  {
60  Phase newPhase(*this);
61  newPhase -= rhs;
62  return newPhase;
63 }

◆ operator-() [2/2]

Phase Phase::operator- ( ) const

Definition at line 64 of file Phase.cpp.

64  {
65  Phase newPhase(*this);
66  newPhase *= -1.;
67  return newPhase;
68 }

◆ operator-=()

Phase & Phase::operator-= ( const Phase rhs)

Definition at line 54 of file Phase.cpp.

54  {
55  _ph -= (double) rhs;
56  _ph = fmod(_ph, twopi);
57  return *this;
58 }
double _ph
Definition: Phase.h:11
static const double twopi

◆ operator/=()

Phase & Phase::operator/= ( double  rhs)

Definition at line 36 of file Phase.cpp.

36  {
37  _ph /= rhs;
38  toRange();
39  return *this;
40 }
double _ph
Definition: Phase.h:11
void toRange()
Definition: Phase.cpp:19

◆ rangeMax()

double Phase::rangeMax ( )
static

Definition at line 13 of file Phase.cpp.

13  {
14  return _minPh + twopi;
15 }
static const double twopi
static const double _minPh
Definition: Phase.h:12

◆ rangeMin()

double Phase::rangeMin ( )
static

Definition at line 16 of file Phase.cpp.

16  {
17  return _minPh;
18 }
static const double _minPh
Definition: Phase.h:12

◆ testPhase()

void Phase::testPhase ( std::ostream &  os = std::cout) const

Definition at line 73 of file Phase.cpp.

73  {
74  os << " testing Phase object:" << endl;
75  Phase testPhase(9);
76  os << " testPhase(9) " << testPhase
77  << "( = " << testPhase.inDegrees() << " deg)"
78  << endl;
79  Phase otherPhase(6);
80  os << " otherPhase(3) " << otherPhase
81  << "( = " << otherPhase.inDegrees() << " deg)"
82  << endl;
83 
84  os << " sum of the two ="
85  << (otherPhase + testPhase).inDegrees()
86  << " deg \n difference: "
87  << (otherPhase - testPhase).inDegrees()
88  << " deg \n negative of testPhase "
89  << -testPhase
90  << " = " << (-testPhase).inDegrees()
91  << " deg" << endl;
92  return;
93 }
void testPhase(std::ostream &os=std::cout) const
Definition: Phase.cpp:73
double inDegrees() const
Definition: Phase.cpp:69

◆ toRange()

void Phase::toRange ( )
protected

Definition at line 19 of file Phase.cpp.

19  {
20  while (_ph > rangeMax()) _ph -= 2 * pi;
21  while (_ph < rangeMin()) _ph += 2 * pi;
22 }
static double rangeMax()
Definition: Phase.cpp:13
static const double pi
double _ph
Definition: Phase.h:11
static double rangeMin()
Definition: Phase.cpp:16

Member Data Documentation

◆ _minPh

const double Phase::_minPh = 0
staticprotected

Definition at line 12 of file Phase.h.

◆ _ph

double MINT::Phase::_ph
protected

Definition at line 11 of file Phase.h.


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