Jpp  17.1.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_t::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 ()
 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 116 of file JAcoustics/JModel.hh.

Constructor & Destructor Documentation

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

Default constructor.

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

123  :
124  tx (0.0),
125  ty (0.0),
126  tx2(0.0),
127  ty2(0.0),
128  vs (0.0)
129  {}
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 141 of file JAcoustics/JModel.hh.

Member Function Documentation

static size_t JACOUSTICS::JMODEL::JString::getN ( )
inlinestatic

Get number of fit parameters.

Returns
number of parameters

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

160  {
161  switch (JMODEL::getOption()) {
162 
163  case fit_emitters_only_t:
164  return 0;
165 
167  return 2;
168 
170  return 4;
171 
173  return 5;
174 
175  default:
176  THROW(JValueOutOfRange, "Invalid option " << JMODEL::getOption());
177  }
178  }
fit times of emission of emitters and tilt angles of strings with second order correction and stretch...
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
fit times of emission of emitters and tilt angles of strings
fit times of emission of emitters and tilt angles of strings with second order correction ...
JOption_t getOption()
Get fit option.
fit only times of emission of emitters
JString& JACOUSTICS::JMODEL::JString::negate ( )
inline

Negate string.

Returns
this string

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

187  {
188  tx = -tx;
189  ty = -ty;
190  tx2 = -tx2;
191  ty2 = -ty2;
192  vs = -vs;
193 
194  return *this;
195  }
JString& JACOUSTICS::JMODEL::JString::add ( const JString string)
inline

Add string.

Parameters
stringstring
Returns
this string

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

205  {
206  tx += string.tx;
207  ty += string.ty;
208  tx2 += string.tx2;
209  ty2 += string.ty2;
210  vs += string.vs;
211 
212  return *this;
213  }
JString& JACOUSTICS::JMODEL::JString::sub ( const JString string)
inline

Subtract string.

Parameters
stringstring
Returns
this string

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

223  {
224  tx -= string.tx;
225  ty -= string.ty;
226  tx2 -= string.tx2;
227  ty2 -= string.ty2;
228  vs -= string.vs;
229 
230  return *this;
231  }
JString& JACOUSTICS::JMODEL::JString::mul ( const double  factor)
inline

Scale string.

Parameters
factormultiplication factor
Returns
this string

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

241  {
242  tx *= factor;
243  ty *= factor;
244  tx2 *= factor;
245  ty2 *= factor;
246  vs *= factor;
247 
248  return *this;
249  }
JString& JACOUSTICS::JMODEL::JString::div ( const double  factor)
inline

Scale string.

Parameters
factordivision factor
Returns
this string

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

259  {
260  tx /= factor;
261  ty /= factor;
262  tx2 /= factor;
263  ty2 /= factor;
264  vs /= factor;
265 
266  return *this;
267  }
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 277 of file JAcoustics/JModel.hh.

279  {
280  return (fabs(tx - string.tx) <= precision &&
281  fabs(ty - string.ty) <= precision &&
282  fabs(tx2 - string.tx2) <= precision &&
283  fabs(ty2 - string.ty2) <= precision &&
284  fabs(vs - string.vs) <= precision);
285  }
double JACOUSTICS::JMODEL::JString::getLengthSquared ( ) const
inline

Get length squared.

Returns
square of length

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

294  {
295  return tx*tx + ty*ty;
296  }
double JACOUSTICS::JMODEL::JString::getLength ( ) const
inline

Get length.

Returns
length

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

305  {
306  return sqrt(getLengthSquared());
307  }
double getLengthSquared() const
Get length squared.
double JACOUSTICS::JMODEL::JString::getAngle ( ) const
inline

Get angle.

Returns
angle [rad]

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

316  {
317  return atan2(ty, tx);
318  }
double JACOUSTICS::JMODEL::JString::getDot ( const JString string) const
inline

Get dot product.

Parameters
stringstring
Returns
dot product

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

328  {
329  return (tx * string.tx +
330  ty * string.ty +
331  tx2 * string.tx2 +
332  ty2 * string.ty2 +
333  vs * string.vs);
334  }
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 357 of file JMath.hh.

358  {
359  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
360  }
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18

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 344 of file JAcoustics/JModel.hh.

345  {
346  return in >> string.tx >> string.ty >> string.tx2 >> string.ty2 >> string.vs;
347  }
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:46
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 357 of file JAcoustics/JModel.hh.

358  {
359  using namespace std;
360  using namespace JPP;
361 
362  return out << FIXED(10,7) << string.tx << ' '
363  << FIXED(10,7) << string.ty << ' '
364  << SCIENTIFIC(12,3) << string.tx2 << ' '
365  << SCIENTIFIC(12,3) << string.ty2 << ' '
366  << FIXED(8,5) << string.vs;
367  }
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:484

Member Data Documentation

double JACOUSTICS::JMODEL::JString::tx

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

double JACOUSTICS::JMODEL::JString::ty

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

double JACOUSTICS::JMODEL::JString::tx2

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

double JACOUSTICS::JMODEL::JString::ty2

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

double JACOUSTICS::JMODEL::JString::vs

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


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