1 #ifndef __JACOUSTICS__JMODEL__
2 #define __JACOUSTICS__JMODEL__
27 namespace JACOUSTICS {}
28 namespace JPP {
using namespace JACOUSTICS; }
30 namespace JACOUSTICS {
117 public JMath <JString>,
143 const double tx2 = 0.0,
144 const double ty2 = 0.0,
145 const double vs = 0.0) :
278 const double precision = std::numeric_limits<double>::min())
const
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);
317 return atan2(
ty,
tx);
329 return (
tx *
string.
tx +
346 return in >>
string.tx >>
string.ty >>
string.tx2 >>
string.ty2 >>
string.vs;
362 return out <<
FIXED(10,7) <<
string.tx <<
' '
363 <<
FIXED(10,7) <<
string.ty <<
' '
366 <<
FIXED(8,5) <<
string.vs;
382 public JMath <JEmitter>,
491 const double precision = std::numeric_limits<double>::min())
const
493 return (fabs(t1 - emitter.
t1) <= precision);
509 return out <<
FIXED(20,6) << emitter.
t1;
525 public JMath <JModel>,
566 for (
T hit = __begin; hit != __end; ++hit) {
568 if (!this->
string.has(hit->getString())) {
569 this->
string[hit->getString()] =
JString();
572 if (!this->emitter.has(hit->getEKey())) {
573 this->emitter[hit->getEKey()] =
JEmitter();
695 const double precision = std::numeric_limits<double>::min())
const
697 return (
equals(this->
string, model.
string, precision) &&
715 out <<
"string: " << setw(4) << i->first <<
' ' << i->second << endl;
719 out <<
"emitter: " << setw(3) << i->first <<
' ' << i->second << endl;
733 return emitter.getN() +
string.getN();
779 if (i < emitter.getN()) {
return getParameter(emitter, i); }
799 if (i < emitter.getN()) {
return getParameter(emitter, i); }
906 return ((
double*) &(__p__->*p) - (
double*) __p__);
917 template<
class JKey_t,
class JValue_t,
class JEvaluator_t>
923 const JValue_t& value = buffer.data()[pos].second;
925 return ((
const double*) &value)[offset];
936 template<
class JKey_t,
class JValue_t,
class JEvaluator_t>
942 JValue_t& value = buffer.data()[pos].second;
944 return ((
double*) &value)[offset];
fit times of emission of emitters and tilt angles of strings with second order correction and stretch...
size_t getN() const
Get number of fit parameters.
JModel & negate()
Negate model.
void setOption(const int)
Set fit option.
int getParameter(const std::string &text)
Get parameter number from text string.
JString & mul(const double factor)
Scale string.
JEmitter & sub(const JEmitter &emitter)
Subtract emitter.
Auxiliary base class for aritmetic operations of derived class types.
void clear()
Clear parameters.
double getAngle() const
Get angle.
Auxiliary class to hide access function to fit option.
JModel & mul(const double factor)
Scale model.
JEmitter(const double t1)
Constructor.
bool equals(const JEmitter &emitter, const double precision=std::numeric_limits< double >::min()) const
Check equality.
General purpose class for hash map of unique elements.
bool equals(const JModel &model, const double precision=std::numeric_limits< double >::min()) const
Check equality.
JModel(T __begin, T __end)
Constructor.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
JEmitter & mul(const double factor)
Scale emitter.
JEmitter & div(const double factor)
Scale emitter.
static const JZero zero
Function object to assign zero value.
JMODEL::JEmitter JEmitter
friend std::istream & operator>>(std::istream &in, JString &string)
Read string parameters from input stream.
Auxiliary data structure for floating point format specification.
friend std::ostream & operator<<(std::ostream &out, const JString &string)
Write string parameters to output stream.
Definition of zero value for any class.
static JOption_t & get_option()
Get reference to fit option.
JHashMapHelper operator[](int id)
Get helper corresponding to emitter identifier (i.e. first part of JEKey).
double operator[](const size_t index) const
Read access to fit parameter value by index.
fit times of emission of emitters and tilt angles of strings
Auxiliary class for multiple associative map operators.
static size_t getIndex(double T::*p)
Get index of fit parameter in given data structure.
friend std::ostream & operator<<(std::ostream &out, const JEmitter &emitter)
Write emitter parameters to output stream.
static size_t getN()
Get number of fit parameters.
friend std::ostream & operator<<(std::ostream &out, const JModel &model)
Write model parameters to output stream.
Model for fit to acoustics data.
size_t parameter_type
Type definition of fit parameter.
bool equals(const JString &string, const double precision=std::numeric_limits< double >::min()) const
Check equality.
static double & getParameter(JHashMap< JKey_t, JValue_t, JEvaluator_t > &buffer, const size_t index)
Get read/write access to fit parameter value at given index in buffer.
JString & sub(const JString &string)
Subtract string.
Auxiliary class to assign zero value.
static double getParameter(const JHashMap< JKey_t, JValue_t, JEvaluator_t > &buffer, const size_t index)
Get read access to fit parameter value at given index in buffer.
JEmitter & add(const JEmitter &emitter)
Add emitter.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
JString & add(const JString &string)
Add string.
Template definition of auxiliary base class for comparison of data structures.
JString & negate()
Negate string.
static size_t getN()
Get number of fit parameters.
JHashMap< JEKey, JEmitter > & map
double getLengthSquared() const
Get length squared.
size_t getIndex(const JEKey &id, double JEmitter::*p) const
Get index of fit parameter for given emitter.
int getIndex()
Get index for user I/O manipulation.
JEmitter()
Default constructor.
fit times of emission of emitters and tilt angles of strings with second order correction ...
size_t getIndex(int id, double JString::*p) const
Get index of fit parameter for given string.
JModel & sub(const JModel &model)
Subtract model.
JOption_t getOption()
Get fit option.
JACOUSTICS::JModel::string_type string
JString & div(const double factor)
Scale string.
double & operator[](const size_t index)
Read/write access to fit parameter value by index.
JACOUSTICS::JModel::emitter_type emitter
JModel & div(const double factor)
Scale model.
Map emitter key to model parameters of emitter.
size_t getN() const
Get number of fit parameters.
JModel()
Default constructor.
JString(const double tx, const double ty, const double tx2=0.0, const double ty2=0.0, const double vs=0.0)
Constructor.
JModel & add(const JModel &model)
Add model.
size_t getN() const
Get number of fit parameters.
Base class for data structures with artithmetic capabilities.
Exception for accessing a value in a collection that is outside of its range.
Exception for accessing an index in a collection that is outside of its range.
fit only times of emission of emitters
JEmitter & negate()
Negate emitter.
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
Auxiliary data structure for floating point format specification.
void reset()
Reset parameters.
JString()
Default constructor.
double getDot(const JString &string) const
Get dot product.
JEmitter & operator[](const int counter)
Get value corresponding to event counter (i.e. second part of JEKey).
double getLength() const
Get length.
JHashMapHelper(JHashMap< JEKey, JEmitter > &map, int id)
Constructor.
Map string identifier to model parameters of string.
JModel & operator=(const JMATH::JZero &zero)
Reset parameters.