Jpp  18.4.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
JACOUSTICS::JMODEL::JString Struct Reference

String parameters. More...

#include <JModel.hh>

Inheritance diagram for JACOUSTICS::JMODEL::JString:
JMATH::JMath< JFirst_t, JSecond_t > JLANG::JEquals< JFirst_t, JSecond_t > JACOUSTICS::JKatoomba< JType >::H_t

Public Member Functions

 JString ()
 Default constructor. More...
 
 JString (const double tx, const double ty, const double tx2=0.0, const double ty2=0.0, const double vs=0.0)
 Constructor. More...
 
JStringnegate ()
 Negate string. More...
 
JStringadd (const JString &string)
 Add string. More...
 
JStringsub (const JString &string)
 Subtract string. More...
 
JStringmul (const double factor)
 Scale string. More...
 
JStringdiv (const double factor)
 Scale string. More...
 
bool equals (const JString &string, const double precision=std::numeric_limits< double >::min()) const
 Check equality. More...
 
double getLengthSquared () const
 Get length squared. More...
 
double getLength () const
 Get length. More...
 
double getAngle () const
 Get angle. More...
 
double getDot (const JString &string) const
 Get dot product. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 

Static Public Member Functions

static size_t getN (const JMODEL::JOption_t option)
 Get number of fit parameters. More...
 

Public Attributes

double tx
 
double ty
 
double tx2
 
double ty2
 
double vs
 

Friends

std::istream & operator>> (std::istream &in, JString &string)
 Read string parameters from input stream. More...
 
std::ostream & operator<< (std::ostream &out, const JString &string)
 Write string parameters to output stream. More...
 

Detailed Description

String parameters.

Definition at line 58 of file JAcoustics/JModel.hh.

Constructor & Destructor Documentation

JACOUSTICS::JMODEL::JString::JString ( )
inline

Default constructor.

Definition at line 65 of file JAcoustics/JModel.hh.

JACOUSTICS::JMODEL::JString::JString ( const double  tx,
const double  ty,
const double  tx2 = 0.0,
const double  ty2 = 0.0,
const double  vs = 0.0 
)
inline

Constructor.

Parameters
txslope dx/dz
tyslope dy/dz
tx22nd order correction of slope dx/dz
ty22nd order correction of slope dy/dz
vsstretching factor

Definition at line 83 of file JAcoustics/JModel.hh.

Member Function Documentation

static size_t JACOUSTICS::JMODEL::JString::getN ( const JMODEL::JOption_t  option)
inlinestatic

Get number of fit parameters.

Parameters
optionoption
Returns
number of parameters

Definition at line 102 of file JAcoustics/JModel.hh.

103  {
104  switch (option) {
105 
106  case FIT_UNDEFINED_t:
107  case FIT_EMITTERS_ONLY_t:
108  return 0;
109 
111  return 2;
112 
114  return 4;
115 
117  return 5;
118 
119  default:
120  THROW(JValueOutOfRange, "Invalid option " << option);
121  }
122  }
fit times of emission of emitters and tilt angles of strings with second order correction ...
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
fit times of emission of emitters and tilt angles of strings
fit only times of emission of emitters
fit times of emission of emitters and tilt angles of strings with second order correction and stretch...
JString& JACOUSTICS::JMODEL::JString::negate ( )
inline

Negate string.

Returns
this string

Definition at line 130 of file JAcoustics/JModel.hh.

131  {
132  tx = -tx;
133  ty = -ty;
134  tx2 = -tx2;
135  ty2 = -ty2;
136  vs = -vs;
137 
138  return *this;
139  }
JString& JACOUSTICS::JMODEL::JString::add ( const JString string)
inline

Add string.

Parameters
stringstring
Returns
this string

Definition at line 148 of file JAcoustics/JModel.hh.

149  {
150  tx += string.tx;
151  ty += string.ty;
152  tx2 += string.tx2;
153  ty2 += string.ty2;
154  vs += string.vs;
155 
156  return *this;
157  }
JString& JACOUSTICS::JMODEL::JString::sub ( const JString string)
inline

Subtract string.

Parameters
stringstring
Returns
this string

Definition at line 166 of file JAcoustics/JModel.hh.

167  {
168  tx -= string.tx;
169  ty -= string.ty;
170  tx2 -= string.tx2;
171  ty2 -= string.ty2;
172  vs -= string.vs;
173 
174  return *this;
175  }
JString& JACOUSTICS::JMODEL::JString::mul ( const double  factor)
inline

Scale string.

Parameters
factormultiplication factor
Returns
this string

Definition at line 184 of file JAcoustics/JModel.hh.

185  {
186  tx *= factor;
187  ty *= factor;
188  tx2 *= factor;
189  ty2 *= factor;
190  vs *= factor;
191 
192  return *this;
193  }
JString& JACOUSTICS::JMODEL::JString::div ( const double  factor)
inline

Scale string.

Parameters
factordivision factor
Returns
this string

Definition at line 202 of file JAcoustics/JModel.hh.

203  {
204  tx /= factor;
205  ty /= factor;
206  tx2 /= factor;
207  ty2 /= factor;
208  vs /= factor;
209 
210  return *this;
211  }
bool JACOUSTICS::JMODEL::JString::equals ( const JString string,
const double  precision = std::numeric_limits<double>::min() 
) const
inline

Check equality.

Parameters
stringstring
precisionprecision
Returns
true if strings are equal; else false

Definition at line 221 of file JAcoustics/JModel.hh.

223  {
224  return (fabs(tx - string.tx) <= precision &&
225  fabs(ty - string.ty) <= precision &&
226  fabs(tx2 - string.tx2) <= precision &&
227  fabs(ty2 - string.ty2) <= precision &&
228  fabs(vs - string.vs) <= precision);
229  }
double JACOUSTICS::JMODEL::JString::getLengthSquared ( ) const
inline

Get length squared.

Returns
square of length

Definition at line 237 of file JAcoustics/JModel.hh.

238  {
239  return tx*tx + ty*ty;
240  }
double JACOUSTICS::JMODEL::JString::getLength ( ) const
inline

Get length.

Returns
length

Definition at line 248 of file JAcoustics/JModel.hh.

249  {
250  return sqrt(getLengthSquared());
251  }
double getLengthSquared() const
Get length squared.
double JACOUSTICS::JMODEL::JString::getAngle ( ) const
inline

Get angle.

Returns
angle [rad]

Definition at line 259 of file JAcoustics/JModel.hh.

260  {
261  return atan2(ty, tx);
262  }
double JACOUSTICS::JMODEL::JString::getDot ( const JString string) const
inline

Get dot product.

Parameters
stringstring
Returns
dot product

Definition at line 271 of file JAcoustics/JModel.hh.

272  {
273  return (tx * string.tx +
274  ty * string.ty +
275  tx2 * string.tx2 +
276  ty2 * string.ty2 +
277  vs * string.vs);
278  }
template<class JFirst_t, class JSecond_t = JNullType>
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 354 of file JMath.hh.

355  {
356  return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357  }

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JString string 
)
friend

Read string parameters from input stream.

Parameters
ininput stream
stringstring
Returns
input stream

Definition at line 288 of file JAcoustics/JModel.hh.

289  {
290  return in >> string.tx >> string.ty >> string.tx2 >> string.ty2 >> string.vs;
291  }
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 JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
std::ostream& operator<< ( std::ostream &  out,
const JString string 
)
friend

Write string parameters to output stream.

Parameters
outoutput stream
stringstring
Returns
output stream

Definition at line 301 of file JAcoustics/JModel.hh.

302  {
303  using namespace std;
304  using namespace JPP;
305 
306  return out << FIXED(10,7) << string.tx << ' '
307  << FIXED(10,7) << string.ty << ' '
308  << SCIENTIFIC(12,3) << string.tx2 << ' '
309  << SCIENTIFIC(12,3) << string.ty2 << ' '
310  << FIXED(8,5) << string.vs;
311  }
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:486

Member Data Documentation

double JACOUSTICS::JMODEL::JString::tx

Definition at line 314 of file JAcoustics/JModel.hh.

double JACOUSTICS::JMODEL::JString::ty

Definition at line 315 of file JAcoustics/JModel.hh.

double JACOUSTICS::JMODEL::JString::tx2

Definition at line 316 of file JAcoustics/JModel.hh.

double JACOUSTICS::JMODEL::JString::ty2

Definition at line 317 of file JAcoustics/JModel.hh.

double JACOUSTICS::JMODEL::JString::vs

Definition at line 318 of file JAcoustics/JModel.hh.


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