Jpp  15.0.1-rc.1-highqe
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
JMATH::JTrigonometric Class Reference

Trigonometric function object for sin and cos. More...

#include <JTrigonometric.hh>

Public Types

typedef double(* pF )(double)
 Type definition of pointer to trigonometric function. More...
 

Public Member Functions

 JTrigonometric (pF f1, const double factor=1.0)
 Constructor. More...
 
double getValue (const double x) const
 Function value. More...
 
double getDerivative (const double x) const
 Derivative value. More...
 
double getIntegral (const double x) const
 Integral value. More...
 
double operator() (const double x) const
 Function value. More...
 
JTrigonometric getDerivative () const
 Derivative function. More...
 
JTrigonometric getIntegral () const
 Integral function. More...
 

Protected Attributes

pF f1
 
double factor
 

Friends

std::istream & operator>> (std::istream &in, JTrigonometric &object)
 Read trigonometric from input. More...
 
std::ostream & operator<< (std::ostream &out, const JTrigonometric &object)
 Write trigonometric to output. More...
 

Detailed Description

Trigonometric function object for sin and cos.

Evaluation of function, derivative and integral values.

Definition at line 28 of file JTrigonometric.hh.

Member Typedef Documentation

typedef double(* JMATH::JTrigonometric::pF)(double)

Type definition of pointer to trigonometric function.

Definition at line 33 of file JTrigonometric.hh.

Constructor & Destructor Documentation

JMATH::JTrigonometric::JTrigonometric ( pF  f1,
const double  factor = 1.0 
)
inline

Constructor.

Parameters
f1pointer to function
factormultiplication factor

Definition at line 42 of file JTrigonometric.hh.

43  {
44  if (f1 != sin && f1 != cos) {
45  throw JException("Invalid trigonometric function.");
46  }
47 
48  this->f1 = f1;
49  this->factor = factor;
50  }

Member Function Documentation

double JMATH::JTrigonometric::getValue ( const double  x) const
inline

Function value.

Parameters
xabscissa value
Returns
function value

Definition at line 59 of file JTrigonometric.hh.

60  {
61  return factor * f1(x);
62  }
double JMATH::JTrigonometric::getDerivative ( const double  x) const
inline

Derivative value.

Parameters
xabscissa value
Returns
derivative value

Definition at line 71 of file JTrigonometric.hh.

72  {
73  return getDerivative().getValue(x);
74  }
double getValue(const double x) const
Function value.
JTrigonometric getDerivative() const
Derivative function.
double JMATH::JTrigonometric::getIntegral ( const double  x) const
inline

Integral value.

Parameters
xabscissa value
Returns
integral value

Definition at line 83 of file JTrigonometric.hh.

84  {
85  return getIntegral().getValue(x);
86  }
JTrigonometric getIntegral() const
Integral function.
double getValue(const double x) const
Function value.
double JMATH::JTrigonometric::operator() ( const double  x) const
inline

Function value.

Parameters
xabscissa value
Returns
function value

Definition at line 95 of file JTrigonometric.hh.

96  {
97  return getValue(x);
98  }
double getValue(const double x) const
Function value.
JTrigonometric JMATH::JTrigonometric::getDerivative ( ) const
inline

Derivative function.

Returns
derivative function

Definition at line 106 of file JTrigonometric.hh.

107  {
108  if (f1 == sin)
109  return JTrigonometric(cos, +factor);
110  else if (f1 == cos)
111  return JTrigonometric(sin, -factor);
112  else
113  throw JException("Invalid trigonometric function.");
114  }
JTrigonometric(pF f1, const double factor=1.0)
Constructor.
JTrigonometric JMATH::JTrigonometric::getIntegral ( ) const
inline

Integral function.

Returns
integral function

Definition at line 122 of file JTrigonometric.hh.

123  {
124  if (f1 == sin)
125  return JTrigonometric(cos, -factor);
126  else if (f1 == cos)
127  return JTrigonometric(sin, +factor);
128  else
129  throw JException("Invalid trigonometric function.");
130  }
JTrigonometric(pF f1, const double factor=1.0)
Constructor.

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JTrigonometric object 
)
friend

Read trigonometric from input.

Parameters
ininput stream
objecttrigonometric
Returns
input stream

Definition at line 140 of file JTrigonometric.hh.

141  {
142  std::string buffer;
143 
144  if (in >> object.factor >> buffer) {
145  if (buffer == "sin")
146  object.f1 = sin;
147  else if (buffer == "cos")
148  object.f1 = cos;
149  else
150  throw JException("Invalid trigonometric function.");
151  }
152 
153  return in;
154  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41
std::ostream& operator<< ( std::ostream &  out,
const JTrigonometric object 
)
friend

Write trigonometric to output.

Parameters
outoutput stream
objecttrigonometric
Returns
output stream

Definition at line 164 of file JTrigonometric.hh.

165  {
166  out << object.factor;
167 
168  if (object.f1 == sin)
169  out << ' ' << "sin";
170  else if (object.f1 == cos)
171  out << ' ' << "cos";
172  else
173  throw JException("Invalid trigonometric function.");
174 
175  return out;
176  }

Member Data Documentation

pF JMATH::JTrigonometric::f1
protected

Definition at line 179 of file JTrigonometric.hh.

double JMATH::JTrigonometric::factor
protected

Definition at line 180 of file JTrigonometric.hh.


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