Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
DoubleAc.h File Reference
#include <cmath>
#include <climits>
#include <cfloat>
#include "wcpplib/util/FunNameStack.h"
#include "wcpplib/stream/prstream.h"
#include "wcpplib/math/minmax.h"

Go to the source code of this file.

Classes

class  DoubleAc
 

Macros

#define DEF_DBL_PREC   1.0e-15
 
#define DEF_FLT_PREC   1.0e-7
 
#define Iprintda(file, name)
 
#define Iprintdan(file, name)
 

Functions

DoubleAc operator- (const DoubleAc &f)
 
void change_sign (DoubleAc &f)
 
DoubleAc operator+ (const DoubleAc &f1, const DoubleAc &f2)
 
DoubleAc operator+ (const DoubleAc &f1, double f2)
 
DoubleAc operator+ (double f1, const DoubleAc &f2)
 
DoubleAc operator+ (const DoubleAc &f1, float f2)
 
DoubleAc operator+ (float f1, const DoubleAc &f2)
 
DoubleAc operator+ (const DoubleAc &f1, long f2)
 
DoubleAc operator+ (long f1, const DoubleAc &f2)
 
DoubleAc operator+ (const DoubleAc &f1, int f2)
 
DoubleAc operator+ (int f1, const DoubleAc &f2)
 
DoubleAc operator- (const DoubleAc &f1, const DoubleAc &f2)
 
DoubleAc operator- (const DoubleAc &f1, double f2)
 
DoubleAc operator- (double f1, const DoubleAc &f2)
 
DoubleAc operator- (const DoubleAc &f1, float f2)
 
DoubleAc operator- (float f1, const DoubleAc &f2)
 
DoubleAc operator- (const DoubleAc &f1, long f2)
 
DoubleAc operator- (long f1, const DoubleAc &f2)
 
DoubleAc operator- (const DoubleAc &f1, int f2)
 
DoubleAc operator- (int f1, const DoubleAc &f2)
 
DoubleAc operator* (const DoubleAc &f1, const DoubleAc &f2)
 
DoubleAc operator* (const DoubleAc &f1, double f2)
 
DoubleAc operator* (double f1, const DoubleAc &f2)
 
DoubleAc operator* (const DoubleAc &f1, float f2)
 
DoubleAc operator* (float f1, const DoubleAc &f2)
 
DoubleAc operator* (const DoubleAc &f1, long f2)
 
DoubleAc operator* (long f1, const DoubleAc &f2)
 
DoubleAc operator* (const DoubleAc &f1, int f2)
 
DoubleAc operator* (int f1, const DoubleAc &f2)
 
DoubleAc operator/ (const DoubleAc &f1, const DoubleAc &f2)
 
DoubleAc operator/ (const DoubleAc &f1, double f2)
 
DoubleAc operator/ (double f1, const DoubleAc &f2)
 
DoubleAc operator/ (const DoubleAc &f1, float f2)
 
DoubleAc operator/ (float f1, const DoubleAc &f2)
 
DoubleAc operator/ (const DoubleAc &f1, long f2)
 
DoubleAc operator/ (long f1, const DoubleAc &f2)
 
DoubleAc operator/ (const DoubleAc &f1, int f2)
 
DoubleAc operator/ (int f1, const DoubleAc &f2)
 
DoubleAc fabs (const DoubleAc &f)
 
DoubleAc find_min (const DoubleAc &a, const DoubleAc &b)
 
DoubleAc find_min (const DoubleAc &a, double b)
 
DoubleAc find_min (double a, const DoubleAc &b)
 
DoubleAc find_min (const DoubleAc &a, float b)
 
DoubleAc find_min (float a, const DoubleAc &b)
 
DoubleAc find_min (const DoubleAc &a, long b)
 
DoubleAc find_min (long a, const DoubleAc &b)
 
DoubleAc find_min (const DoubleAc &a, int b)
 
DoubleAc find_min (int a, const DoubleAc &b)
 
DoubleAc find_max (const DoubleAc &a, const DoubleAc &b)
 
DoubleAc find_max (const DoubleAc &a, double b)
 
DoubleAc find_max (double a, const DoubleAc &b)
 
DoubleAc find_max (const DoubleAc &a, float b)
 
DoubleAc find_max (float a, const DoubleAc &b)
 
DoubleAc find_max (const DoubleAc &a, long b)
 
DoubleAc find_max (long a, const DoubleAc &b)
 
DoubleAc find_max (const DoubleAc &a, int b)
 
DoubleAc find_max (int a, const DoubleAc &b)
 
DoubleAc sqrt (const DoubleAc &f)
 
DoubleAc square (const DoubleAc &f)
 
DoubleAc pow (const DoubleAc &f, double p)
 
DoubleAc exp (const DoubleAc &f)
 
DoubleAc sin (const DoubleAc &f)
 
DoubleAc cos (const DoubleAc &f)
 
DoubleAc asin (const DoubleAc &f)
 
DoubleAc acos (const DoubleAc &f)
 
std::ostream & operator<< (std::ostream &file, const DoubleAc &f)
 

Variables

const double one_plus_def_dbl_prec = double(1.0) + DEF_DBL_PREC
 
const double one_minus_def_dbl_prec = double(1.0) - DEF_DBL_PREC
 
const double one_plus_def_flt_prec = double(1.0) + DEF_FLT_PREC
 
const double one_minus_def_flt_prec = double(1.0) - DEF_FLT_PREC
 

Macro Definition Documentation

◆ DEF_DBL_PREC

#define DEF_DBL_PREC   1.0e-15

Definition at line 36 of file DoubleAc.h.

◆ DEF_FLT_PREC

#define DEF_FLT_PREC   1.0e-7

Definition at line 40 of file DoubleAc.h.

◆ Iprintda

#define Iprintda (   file,
  name 
)
Value:
file << indn << #name << "=" << noindent; \
name.print(file, 3); \
file << yesindent;
indentation indn
Definition: prstream.cpp:13
std::ostream & yesindent(std::ostream &f)
Definition: prstream.cpp:19
std::ostream & noindent(std::ostream &f)
Definition: prstream.cpp:15

Definition at line 702 of file DoubleAc.h.

◆ Iprintdan

#define Iprintdan (   file,
  name 
)
Value:
file << indn << #name << "=" << noindent; \
name.print(file, 3); \
file << yesindent << '\n';

Definition at line 707 of file DoubleAc.h.

Function Documentation

◆ acos()

DoubleAc acos ( const DoubleAc f)

Definition at line 488 of file DoubleAc.cpp.

488 {
489 if (fabs(f.get()) > 1) {
490 mcerr << "ERROR in inline DoubleAc acos(const DoubleAc& f):\n"
491 << "fabs(f.get()) > 1: f.get()=" << f.get() << '\n';
492 spexit(mcerr);
493 }
494 double d = std::acos(f.get());
495 double da;
496 if (f.left_limit() < -1.0)
497 da = std::acos(-1.0);
498 else
499 da = std::acos(f.left_limit());
500 double di;
501 if (f.right_limit() > 1.0)
502 di = std::acos(1.0);
503 else
504 di = std::acos(f.right_limit());
505 return DoubleAc(d, di, da);
506}
DoubleAc fabs(const DoubleAc &f)
Definition: DoubleAc.h:616
#define spexit(stream)
Definition: FunNameStack.h:536
double left_limit(void) const
Definition: DoubleAc.h:79
double right_limit(void) const
Definition: DoubleAc.h:83
double get(void) const
Definition: DoubleAc.h:76
#define mcerr
Definition: prstream.h:135

Referenced by Heed::spquadr::apos(), Garfield::Medium::ElectronAttachment(), Garfield::Medium::ElectronDiffusion(), Garfield::Medium::ElectronTownsend(), Garfield::Medium::ElectronVelocity(), Garfield::MediumMagboltz::GetElectronCollision(), Garfield::Medium::HoleAttachment(), Garfield::Medium::HoleDiffusion(), Garfield::Medium::HoleTownsend(), Garfield::Medium::HoleVelocity(), Garfield::Medium::IonDiffusion(), Garfield::Medium::IonDissociation(), Garfield::Medium::IonVelocity(), Heed::HeedDeltaElectron::physics_after_new_speed(), and Heed::theta_two_part().

◆ asin()

DoubleAc asin ( const DoubleAc f)

Definition at line 468 of file DoubleAc.cpp.

468 {
469 if (fabs(f.get()) > 1) {
470 mcerr << "ERROR in inline DoubleAc asin(const DoubleAc& f):\n"
471 << "fabs(f.get()) > 1: f.get()=" << f.get() << '\n';
472 spexit(mcerr);
473 }
474 double d = std::asin(f.get());
475 double di;
476 if (f.left_limit() < -1.0)
477 di = std::asin(-1.0);
478 else
479 di = std::asin(f.left_limit());
480 double da;
481 if (f.right_limit() > 1.0)
482 da = std::asin(1.0);
483 else
484 da = std::asin(f.right_limit());
485 return DoubleAc(d, di, da);
486}

Referenced by Garfield::Medium::ElectronAttachment(), Garfield::Medium::ElectronDiffusion(), Garfield::Medium::ElectronTownsend(), Garfield::Medium::ElectronVelocity(), Heed::ElElasticScat::fill_hist_low_scat(), Garfield::MediumMagboltz::GetElectronCollision(), Heed::HeedDeltaElectronCS::HeedDeltaElectronCS(), Garfield::Medium::HoleAttachment(), Garfield::Medium::HoleDiffusion(), Garfield::Medium::HoleTownsend(), Garfield::Medium::HoleVelocity(), Garfield::Medium::IonDiffusion(), Garfield::Medium::IonDissociation(), Garfield::Medium::IonVelocity(), and Heed::theta_two_part().

◆ change_sign()

void change_sign ( DoubleAc f)
inline

Definition at line 425 of file DoubleAc.h.

425 {
426 f.d = -f.d;
427 double temp = f.di;
428 f.di = -f.da;
429 f.da = -temp;
430}

◆ cos()

DoubleAc cos ( const DoubleAc f)

Definition at line 431 of file DoubleAc.cpp.

431 {
432 double d = std::cos(f.get());
433 double di = std::cos(f.left_limit());
434 double da = std::cos(f.right_limit());
435 long n = left_round(f.get() / M_PI - 1.0);
436 long ni = left_round(f.left_limit() / M_PI - 1.0);
437 long na = left_round(f.right_limit() / M_PI - 1.0);
438 int seven = even_num(n);
439 if (seven == 1) {
440 if (ni < n) {
441 di = -1.0;
442 da = find_max(di, da);
443 if (na > n) {
444 da = 1.0;
445 }
446 } else if (na > n) {
447 da = 1.0;
448 di = find_min(di, da);
449 }
450 } else {
451 double temp = di;
452 di = da;
453 da = temp;
454 if (ni < n) {
455 da = 1.0;
456 di = find_min(di, da);
457 if (na > n) {
458 di = -1.0;
459 }
460 } else if (na > n) {
461 di = -1.0;
462 da = find_max(di, da);
463 }
464 }
465 return DoubleAc(d, di, da);
466}
DoubleAc find_min(const DoubleAc &a, const DoubleAc &b)
Definition: DoubleAc.h:627
DoubleAc find_max(const DoubleAc &a, const DoubleAc &b)
Definition: DoubleAc.h:655
int even_num(long n)
Definition: minmax.h:105
long left_round(double f)
Definition: minmax.h:99

Referenced by Heed::ElElasticScatDataStruct::CS(), Garfield::ViewMedium::EvaluateFunction(), Heed::ElElasticScat::fill_hist_low_scat(), Garfield::Medium::GetElectronCollision(), Garfield::MediumMagboltz::GetElectronCollision(), Garfield::MediumSilicon::GetElectronCollision(), Garfield::Medium::GetElectronMomentum(), Garfield::MediumSilicon::GetElectronMomentum(), Heed::HeedDeltaElectronCS::HeedDeltaElectronCS(), Garfield::ComponentFieldMap::MapCoordinates(), Garfield::TrackBichsel::NewTrack(), Garfield::TrackElectron::NewTrack(), Garfield::TrackHeed::NewTrack(), Garfield::TrackPAI::NewTrack(), Garfield::TrackSimple::NewTrack(), Heed::HeedDeltaElectron::physics_after_new_speed(), vec::random_conic_vec(), vec::random_round_vec(), rnorm_double(), rnorm_float(), Garfield::ViewField::Rotate(), Garfield::SolidBox::SolidBox(), Garfield::SolidTube::SolidTube(), Garfield::TrackHeed::TransportDeltaElectron(), Garfield::TrackHeed::TransportPhoton(), vec::turn_new(), and Garfield::ComponentFieldMap::UnmapFields().

◆ exp()

◆ fabs()

DoubleAc fabs ( const DoubleAc f)
inline

Definition at line 616 of file DoubleAc.h.

616 {
617 if (f.left_limit() >= 0)
618 return f;
619 else if (f.right_limit() > 0) {
620 return DoubleAc(fabs(f.get()), 0.0,
621 find_max(f.right_limit(), -f.left_limit()));
622 } else {
623 return DoubleAc(-f.get(), -f.right_limit(), -f.left_limit());
624 }
625}

Referenced by abstract_determinant(), acos(), Garfield::ComponentAnalyticField::AddStripOnPlaneX(), Garfield::ComponentAnalyticField::AddStripOnPlaneY(), asin(), Garfield::Numerics::Boxin3(), Garfield::Numerics::Cfact(), Heed::mparticle::check_consistency(), Heed::polygon::check_point_in(), Garfield::Numerics::Cinv(), Garfield::ComponentFieldMap::Coordinates13(), Garfield::ComponentFieldMap::Coordinates3(), Garfield::ComponentFieldMap::Coordinates5(), Heed::straight::cross(), Garfield::Numerics::Deqinv(), Garfield::Numerics::Dfact(), Heed::straight::distance(), Garfield::Numerics::Divdif(), Garfield::Medium::ElectronAttachment(), Garfield::Medium::ElectronDiffusion(), Garfield::Medium::ElectronTownsend(), Garfield::Medium::ElectronVelocity(), Garfield::ViewMedium::EvaluateFunction(), fabs(), Cubic::find_real_zero(), Cubic::find_zero(), Garfield::TrackHeed::GetCluster(), Garfield::TrackBichsel::GetClusterDensity(), Garfield::ComponentTcad2d::GetElement(), Garfield::ComponentTcad3d::GetElement(), Garfield::ComponentAnsys121::GetElementVolume(), Garfield::ComponentAnsys123::GetElementVolume(), Garfield::ComponentCST::GetElementVolume(), Garfield::ComponentElmer::GetElementVolume(), Garfield::MediumMagboltz::GetPhotonCollision(), Garfield::MediumMagboltz::GetPhotonCollisionRate(), Garfield::TrackBichsel::GetStoppingPower(), Heed::HeedPhoton::HeedPhoton(), Garfield::Medium::HoleAttachment(), Garfield::Medium::HoleDiffusion(), Garfield::Medium::HoleTownsend(), Garfield::Medium::HoleVelocity(), inverse_DynArr(), inverse_DynArr_prot(), Garfield::Medium::IonDiffusion(), Garfield::Medium::IonDissociation(), Garfield::Medium::IonVelocity(), Garfield::SolidBox::IsInside(), Garfield::SolidSphere::IsInside(), Garfield::SolidTube::IsInside(), Garfield::ComponentAnalyticField::IsWireCrossed(), Garfield::TrackHeed::NewTrack(), Parabol::Parabol(), Heed::HeedParticle::physics(), Heed::HeedParticle_BGM::physics(), Garfield::ViewGeometry::Plot(), Garfield::MediumMagboltz::RunMagboltz(), Garfield::Sensor::SetArea(), Garfield::TrackHeed::SetEnergyMesh(), Garfield::Medium::SetFieldGrid(), Garfield::GeometryRoot::SetMedium(), Garfield::TrackHeed::SetParticleUser(), Garfield::ComponentCST::SetRange(), Garfield::ComponentFieldMap::SetRange(), Garfield::ComponentAnsys121::SetRangeZ(), Garfield::ComponentCST::SetRangeZ(), Garfield::ComponentTcad2d::SetRangeZ(), Garfield::AvalancheMC::SetTimeWindow(), Garfield::AvalancheMicroscopic::SetTimeWindow(), Garfield::TrackHeed::TransportDeltaElectron(), Garfield::TrackHeed::TransportPhoton(), and Garfield::ComponentFieldMap::UpdatePeriodicityCommon().

◆ find_max() [1/9]

DoubleAc find_max ( const DoubleAc a,
const DoubleAc b 
)
inline

Definition at line 655 of file DoubleAc.h.

655 {
656 return (a.get() > b.get() ? a : b);
657}

Referenced by append(), cos(), fabs(), Heed::ExAtomPhotoAbsCS::get_integral_ACS(), DoubleAc::operator*=(), pow(), sin(), sqrt(), and square().

◆ find_max() [2/9]

DoubleAc find_max ( const DoubleAc a,
double  b 
)
inline

Definition at line 658 of file DoubleAc.h.

658 {
659 return (a.get() > b ? a : DoubleAc(b));
660}

◆ find_max() [3/9]

DoubleAc find_max ( const DoubleAc a,
float  b 
)
inline

Definition at line 664 of file DoubleAc.h.

664 {
665 return (a.get() > b ? a : DoubleAc(b));
666}

◆ find_max() [4/9]

DoubleAc find_max ( const DoubleAc a,
int  b 
)
inline

Definition at line 676 of file DoubleAc.h.

676 {
677 return (a.get() > b ? a : DoubleAc(b));
678}

◆ find_max() [5/9]

DoubleAc find_max ( const DoubleAc a,
long  b 
)
inline

Definition at line 670 of file DoubleAc.h.

670 {
671 return (a.get() > b ? a : DoubleAc(b));
672}

◆ find_max() [6/9]

DoubleAc find_max ( double  a,
const DoubleAc b 
)
inline

Definition at line 661 of file DoubleAc.h.

661 {
662 return (a > b.get() ? DoubleAc(a) : b);
663}

◆ find_max() [7/9]

DoubleAc find_max ( float  a,
const DoubleAc b 
)
inline

Definition at line 667 of file DoubleAc.h.

667 {
668 return (a > b.get() ? DoubleAc(a) : b);
669}

◆ find_max() [8/9]

DoubleAc find_max ( int  a,
const DoubleAc b 
)
inline

Definition at line 679 of file DoubleAc.h.

679 {
680 return (a > b.get() ? DoubleAc(a) : b);
681}

◆ find_max() [9/9]

DoubleAc find_max ( long  a,
const DoubleAc b 
)
inline

Definition at line 673 of file DoubleAc.h.

673 {
674 return (a > b.get() ? DoubleAc(a) : b);
675}

◆ find_min() [1/9]

DoubleAc find_min ( const DoubleAc a,
const DoubleAc b 
)
inline

Definition at line 627 of file DoubleAc.h.

627 {
628 return (a.get() < b.get() ? a : b);
629}

Referenced by cos(), determinant_DynArr(), Heed::ExAtomPhotoAbsCS::get_integral_ACS(), DoubleAc::operator*=(), and sin().

◆ find_min() [2/9]

DoubleAc find_min ( const DoubleAc a,
double  b 
)
inline

Definition at line 630 of file DoubleAc.h.

630 {
631 return (a.get() < b ? a : DoubleAc(b));
632}

◆ find_min() [3/9]

DoubleAc find_min ( const DoubleAc a,
float  b 
)
inline

Definition at line 636 of file DoubleAc.h.

636 {
637 return (a.get() < b ? a : DoubleAc(b));
638}

◆ find_min() [4/9]

DoubleAc find_min ( const DoubleAc a,
int  b 
)
inline

Definition at line 648 of file DoubleAc.h.

648 {
649 return (a.get() < b ? a : DoubleAc(b));
650}

◆ find_min() [5/9]

DoubleAc find_min ( const DoubleAc a,
long  b 
)
inline

Definition at line 642 of file DoubleAc.h.

642 {
643 return (a.get() < b ? a : DoubleAc(b));
644}

◆ find_min() [6/9]

DoubleAc find_min ( double  a,
const DoubleAc b 
)
inline

Definition at line 633 of file DoubleAc.h.

633 {
634 return (a < b.get() ? DoubleAc(a) : b);
635}

◆ find_min() [7/9]

DoubleAc find_min ( float  a,
const DoubleAc b 
)
inline

Definition at line 639 of file DoubleAc.h.

639 {
640 return (a < b.get() ? DoubleAc(a) : b);
641}

◆ find_min() [8/9]

DoubleAc find_min ( int  a,
const DoubleAc b 
)
inline

Definition at line 651 of file DoubleAc.h.

651 {
652 return (a < b.get() ? DoubleAc(a) : b);
653}

◆ find_min() [9/9]

DoubleAc find_min ( long  a,
const DoubleAc b 
)
inline

Definition at line 645 of file DoubleAc.h.

645 {
646 return (a < b.get() ? DoubleAc(a) : b);
647}

◆ operator*() [1/9]

DoubleAc operator* ( const DoubleAc f1,
const DoubleAc f2 
)
inline

Definition at line 524 of file DoubleAc.h.

524 {
525 DoubleAc t = f1;
526 t *= f2;
527 return t;
528}

◆ operator*() [2/9]

DoubleAc operator* ( const DoubleAc f1,
double  f2 
)
inline

Definition at line 529 of file DoubleAc.h.

529 {
530 DoubleAc t = f1;
531 t *= f2;
532 return t;
533}

◆ operator*() [3/9]

DoubleAc operator* ( const DoubleAc f1,
float  f2 
)
inline

Definition at line 539 of file DoubleAc.h.

539 {
540 DoubleAc t = f1;
541 t *= f2;
542 return t;
543}

◆ operator*() [4/9]

DoubleAc operator* ( const DoubleAc f1,
int  f2 
)
inline

Definition at line 559 of file DoubleAc.h.

559 {
560 DoubleAc t = f1;
561 t *= f2;
562 return t;
563}

◆ operator*() [5/9]

DoubleAc operator* ( const DoubleAc f1,
long  f2 
)
inline

Definition at line 549 of file DoubleAc.h.

549 {
550 DoubleAc t = f1;
551 t *= f2;
552 return t;
553}

◆ operator*() [6/9]

DoubleAc operator* ( double  f1,
const DoubleAc f2 
)
inline

Definition at line 534 of file DoubleAc.h.

534 {
535 DoubleAc t = f2;
536 t *= f1;
537 return t;
538}

◆ operator*() [7/9]

DoubleAc operator* ( float  f1,
const DoubleAc f2 
)
inline

Definition at line 544 of file DoubleAc.h.

544 {
545 DoubleAc t = f2;
546 t *= f1;
547 return t;
548}

◆ operator*() [8/9]

DoubleAc operator* ( int  f1,
const DoubleAc f2 
)
inline

Definition at line 564 of file DoubleAc.h.

564 {
565 DoubleAc t = f2;
566 t *= f1;
567 return t;
568}

◆ operator*() [9/9]

DoubleAc operator* ( long  f1,
const DoubleAc f2 
)
inline

Definition at line 554 of file DoubleAc.h.

554 {
555 DoubleAc t = f2;
556 t *= f1;
557 return t;
558}

◆ operator+() [1/9]

DoubleAc operator+ ( const DoubleAc f1,
const DoubleAc f2 
)
inline

Definition at line 432 of file DoubleAc.h.

432 {
433 DoubleAc t = f1;
434 t += f2;
435 return t;
436}

◆ operator+() [2/9]

DoubleAc operator+ ( const DoubleAc f1,
double  f2 
)
inline

Definition at line 437 of file DoubleAc.h.

437 {
438 DoubleAc t = f1;
439 t += f2;
440 return t;
441}

◆ operator+() [3/9]

DoubleAc operator+ ( const DoubleAc f1,
float  f2 
)
inline

Definition at line 447 of file DoubleAc.h.

447 {
448 DoubleAc t = f1;
449 t += f2;
450 return t;
451}

◆ operator+() [4/9]

DoubleAc operator+ ( const DoubleAc f1,
int  f2 
)
inline

Definition at line 467 of file DoubleAc.h.

467 {
468 DoubleAc t = f1;
469 t += f2;
470 return t;
471}

◆ operator+() [5/9]

DoubleAc operator+ ( const DoubleAc f1,
long  f2 
)
inline

Definition at line 457 of file DoubleAc.h.

457 {
458 DoubleAc t = f1;
459 t += f2;
460 return t;
461}

◆ operator+() [6/9]

DoubleAc operator+ ( double  f1,
const DoubleAc f2 
)
inline

Definition at line 442 of file DoubleAc.h.

442 {
443 DoubleAc t = f2;
444 t += f1;
445 return t;
446}

◆ operator+() [7/9]

DoubleAc operator+ ( float  f1,
const DoubleAc f2 
)
inline

Definition at line 452 of file DoubleAc.h.

452 {
453 DoubleAc t = f2;
454 t += f1;
455 return t;
456}

◆ operator+() [8/9]

DoubleAc operator+ ( int  f1,
const DoubleAc f2 
)
inline

Definition at line 472 of file DoubleAc.h.

472 {
473 DoubleAc t = f2;
474 t += f1;
475 return t;
476}

◆ operator+() [9/9]

DoubleAc operator+ ( long  f1,
const DoubleAc f2 
)
inline

Definition at line 462 of file DoubleAc.h.

462 {
463 DoubleAc t = f2;
464 t += f1;
465 return t;
466}

◆ operator-() [1/10]

DoubleAc operator- ( const DoubleAc f)
inline

Definition at line 420 of file DoubleAc.h.

420 {
421 DoubleAc t(-f.get(), -f.get_right_limit(), -f.get_left_limit());
422 return t;
423}
double get_right_limit(void) const
Definition: DoubleAc.h:82
double get_left_limit(void) const
Definition: DoubleAc.h:78

◆ operator-() [2/10]

DoubleAc operator- ( const DoubleAc f1,
const DoubleAc f2 
)
inline

Definition at line 478 of file DoubleAc.h.

478 {
479 DoubleAc t = f1;
480 t -= f2;
481 return t;
482}

◆ operator-() [3/10]

DoubleAc operator- ( const DoubleAc f1,
double  f2 
)
inline

Definition at line 483 of file DoubleAc.h.

483 {
484 DoubleAc t = f1;
485 t -= f2;
486 return t;
487}

◆ operator-() [4/10]

DoubleAc operator- ( const DoubleAc f1,
float  f2 
)
inline

Definition at line 493 of file DoubleAc.h.

493 {
494 DoubleAc t = f1;
495 t -= f2;
496 return t;
497}

◆ operator-() [5/10]

DoubleAc operator- ( const DoubleAc f1,
int  f2 
)
inline

Definition at line 513 of file DoubleAc.h.

513 {
514 DoubleAc t = f1;
515 t -= f2;
516 return t;
517}

◆ operator-() [6/10]

DoubleAc operator- ( const DoubleAc f1,
long  f2 
)
inline

Definition at line 503 of file DoubleAc.h.

503 {
504 DoubleAc t = f1;
505 t -= f2;
506 return t;
507}

◆ operator-() [7/10]

DoubleAc operator- ( double  f1,
const DoubleAc f2 
)
inline

Definition at line 488 of file DoubleAc.h.

488 {
489 DoubleAc t = -f2;
490 t += f1;
491 return t;
492}

◆ operator-() [8/10]

DoubleAc operator- ( float  f1,
const DoubleAc f2 
)
inline

Definition at line 498 of file DoubleAc.h.

498 {
499 DoubleAc t = -f2;
500 t += f1;
501 return t;
502}

◆ operator-() [9/10]

DoubleAc operator- ( int  f1,
const DoubleAc f2 
)
inline

Definition at line 518 of file DoubleAc.h.

518 {
519 DoubleAc t = -f2;
520 t += f1;
521 return t;
522}

◆ operator-() [10/10]

DoubleAc operator- ( long  f1,
const DoubleAc f2 
)
inline

Definition at line 508 of file DoubleAc.h.

508 {
509 DoubleAc t = -f2;
510 t += f1;
511 return t;
512}

◆ operator/() [1/9]

DoubleAc operator/ ( const DoubleAc f1,
const DoubleAc f2 
)
inline

Definition at line 570 of file DoubleAc.h.

570 {
571 DoubleAc t = f1;
572 t /= f2;
573 return t;
574}

◆ operator/() [2/9]

DoubleAc operator/ ( const DoubleAc f1,
double  f2 
)
inline

Definition at line 575 of file DoubleAc.h.

575 {
576 DoubleAc t = f1;
577 t /= f2;
578 return t;
579}

◆ operator/() [3/9]

DoubleAc operator/ ( const DoubleAc f1,
float  f2 
)
inline

Definition at line 585 of file DoubleAc.h.

585 {
586 DoubleAc t = f1;
587 t /= f2;
588 return t;
589}

◆ operator/() [4/9]

DoubleAc operator/ ( const DoubleAc f1,
int  f2 
)
inline

Definition at line 605 of file DoubleAc.h.

605 {
606 DoubleAc t = f1;
607 t /= f2;
608 return t;
609}

◆ operator/() [5/9]

DoubleAc operator/ ( const DoubleAc f1,
long  f2 
)
inline

Definition at line 595 of file DoubleAc.h.

595 {
596 DoubleAc t = f1;
597 t /= f2;
598 return t;
599}

◆ operator/() [6/9]

DoubleAc operator/ ( double  f1,
const DoubleAc f2 
)
inline

Definition at line 580 of file DoubleAc.h.

580 {
581 DoubleAc t = f1;
582 t /= f2;
583 return t;
584}

◆ operator/() [7/9]

DoubleAc operator/ ( float  f1,
const DoubleAc f2 
)
inline

Definition at line 590 of file DoubleAc.h.

590 {
591 DoubleAc t = f1;
592 t /= f2;
593 return t;
594}

◆ operator/() [8/9]

DoubleAc operator/ ( int  f1,
const DoubleAc f2 
)
inline

Definition at line 610 of file DoubleAc.h.

610 {
611 DoubleAc t = f1;
612 t /= f2;
613 return t;
614}

◆ operator/() [9/9]

DoubleAc operator/ ( long  f1,
const DoubleAc f2 
)
inline

Definition at line 600 of file DoubleAc.h.

600 {
601 DoubleAc t = f1;
602 t /= f2;
603 return t;
604}

◆ operator<<()

std::ostream & operator<< ( std::ostream &  file,
const DoubleAc f 
)

Definition at line 544 of file DoubleAc.cpp.

544 {
545 f.print(file, 1);
546 return file;
547}
void print(std::ostream &file, int l=1) const
Definition: DoubleAc.cpp:508

◆ pow()

DoubleAc pow ( const DoubleAc f,
double  p 
)

Definition at line 336 of file DoubleAc.cpp.

336 {
337 if (p == 1) return f;
338 if (p == 0) return DoubleAc(1.0);
339 if (p > 0) {
340 double d = std::pow(f.get(), p);
341 double di = std::pow(f.left_limit(), p);
342 double da = std::pow(f.right_limit(), p);
343 if (f.left_limit() >= 0.0) {
344 return DoubleAc(d, di, da);
345 } else if (f.right_limit() >= 0.0) {
346 if (di < 0.0)
347 return DoubleAc(d, di, da);
348 else // the power is even
349 return DoubleAc(d, 0.0, find_max(di, da));
350 } else {
351 if (di < 0.0)
352 return DoubleAc(d, di, da);
353 else // the power is even
354 return DoubleAc(d, da, di);
355 }
356 } else {
357 double d = std::pow(f.get(), -p);
358 double di = std::pow(f.left_limit(), -p);
359 double da = std::pow(f.right_limit(), -p);
360 if (f.left_limit() >= 0.0) {
361 return 1.0 / DoubleAc(d, di, da);
362 } else if (f.right_limit() >= 0.0) {
363 if (di < 0.0)
364 return 1.0 / DoubleAc(d, di, da);
365 else // the power is even
366 return 1.0 / DoubleAc(d, 0.0, find_max(di, da));
367 } else {
368 if (di < 0.0)
369 return 1.0 / DoubleAc(d, di, da);
370 else // the power is even
371 return 1.0 / DoubleAc(d, da, di);
372 }
373 }
374}

Referenced by Garfield::Numerics::BesselI0S(), Garfield::Numerics::BesselI1S(), Garfield::Numerics::BesselK0L(), Garfield::Numerics::BesselK0S(), Garfield::Numerics::BesselK1L(), Garfield::Numerics::BesselK1S(), Heed::Bethe_Bloch_energy_loss(), Heed::Bethe_Bloch_energy_loss_gamma_1(), Heed::Bethe_Bloch_restricted_energy_loss_gamma_1(), Garfield::ComponentFieldMap::Coordinates4(), Heed::ElElasticScatDataStruct::CS(), Heed::e_cont_enloss(), Garfield::Medium::ElectronAttachment(), Garfield::Medium::ElectronDiffusion(), Garfield::Medium::ElectronTownsend(), Garfield::Medium::ElectronVelocity(), Garfield::MediumCdTe::ElectronVelocity(), Garfield::MediumGaAs::ElectronVelocity(), Garfield::MediumSilicon::ElectronVelocity(), Heed::ElElasticScat::ElElasticScat(), Heed::EnergyMesh::EnergyMesh(), Heed::EnTransfCS::EnTransfCS(), Heed::ExAtomPhotoAbsCS::ExAtomPhotoAbsCS(), Heed::ElElasticScat::fill_hist(), Heed::ElElasticScat::fill_hist_low_scat(), Cubic::find_zero(), Heed::HydrogenPhotoAbsCS::get_CS(), Heed::SimpleTablePhotoAbsCS::get_CS(), Heed::PhenoPhotoAbsCS::get_CS(), Heed::ElElasticScat::get_CS(), Heed::ElElasticScat::get_CS_Rutherford(), Heed::PairProd::get_eloss(), Heed::HydrogenPhotoAbsCS::get_integral_CS(), Heed::SimpleTablePhotoAbsCS::get_integral_CS(), Heed::PhenoPhotoAbsCS::get_integral_CS(), Garfield::ComponentAnsys121::GetAspectRatio(), Garfield::ComponentAnsys123::GetAspectRatio(), Garfield::ComponentElmer::GetAspectRatio(), Garfield::TrackElectron::GetCluster(), Garfield::MediumSilicon::GetConductionBandDensityOfStates(), Garfield::MediumMagboltz::GetElectronCollision(), Garfield::ComponentTcad2d::GetElement(), Garfield::ComponentTcad3d::GetElement(), Garfield::TrackElectron::GetStoppingPower(), Heed::HeedDeltaElectronCS::HeedDeltaElectronCS(), Garfield::Medium::HoleAttachment(), Garfield::Medium::HoleDiffusion(), Garfield::Medium::HoleTownsend(), Garfield::Medium::HoleVelocity(), Garfield::MediumCdTe::HoleVelocity(), Garfield::MediumGaAs::HoleVelocity(), Garfield::MediumSilicon::HoleVelocity(), Garfield::Medium::IonDiffusion(), Garfield::Medium::IonDissociation(), Garfield::Medium::IonVelocity(), Garfield::ComponentAnalyticField::IsInTrapRadius(), Garfield::ComponentAnalyticField::IsWireCrossed(), Heed::make_log_mesh(), Heed::make_log_mesh_ec(), Heed::mparticle::new_speed(), Heed::PhenoPhotoAbsCS::PhenoPhotoAbsCS(), Heed::HeedPhoton::physics_after_new_speed(), Garfield::ViewField::PlotProfile(), Heed::HeedMatterDef::print(), Garfield::RndmPolya(), Garfield::Medium::SetFieldGrid(), Heed::SimpleTablePhotoAbsCS::SimpleTablePhotoAbsCS(), Heed::straight::straight(), t_integ_power_2point(), t_value_power_2point(), and t_value_power_extended_2point().

◆ sin()

DoubleAc sin ( const DoubleAc f)

Definition at line 383 of file DoubleAc.cpp.

383 {
384 //mcout<<"DoubleAc sin is starting, f="; f.print(mcout, 3);
385 double d = std::sin(f.get());
386 double di = std::sin(f.left_limit());
387 double da = std::sin(f.right_limit());
388 //Iprintn(mcout, d);
389 //Iprintn(mcout, di);
390 //Iprintn(mcout, da);
391 long n = left_round(f.get() / M_PI + 0.5);
392 long ni = left_round(f.left_limit() / M_PI + 0.5);
393 long na = left_round(f.right_limit() / M_PI + 0.5);
394 //Iprintn(mcout, n);
395 //Iprintn(mcout, ni);
396 //Iprintn(mcout, na);
397 int seven = even_num(n);
398 //Iprintn(mcout, seven);
399 if (seven == 1) {
400 if (ni < n) {
401 di = -1.0;
402 da = find_max(di, da);
403 if (na > n) {
404 da = 1.0;
405 }
406 } else if (na > n) {
407 da = 1.0;
408 di = find_min(di, da);
409 }
410 } else {
411 double temp = di;
412 di = da;
413 da = temp;
414 if (ni < n) {
415 da = 1.0;
416 di = find_min(di, da);
417 if (na > n) {
418 di = -1.0;
419 }
420 } else if (na > n) {
421 di = -1.0;
422 da = find_max(di, da);
423 }
424 }
425 //Iprintn(mcout, d);
426 //Iprintn(mcout, di);
427 //Iprintn(mcout, da);
428 return DoubleAc(d, di, da);
429}

Referenced by Garfield::ViewMedium::EvaluateFunction(), Heed::ElElasticScat::fill_hist(), Heed::ElElasticScat::fill_hist_low_scat(), Heed::ElElasticScat::get_CS_Rutherford(), Garfield::Medium::GetElectronCollision(), Garfield::MediumMagboltz::GetElectronCollision(), Garfield::MediumSilicon::GetElectronCollision(), Garfield::Medium::GetElectronMomentum(), Garfield::MediumSilicon::GetElectronMomentum(), Heed::HeedDeltaElectronCS::HeedDeltaElectronCS(), Garfield::ComponentFieldMap::MapCoordinates(), Garfield::TrackBichsel::NewTrack(), Garfield::TrackElectron::NewTrack(), Garfield::TrackHeed::NewTrack(), Garfield::TrackPAI::NewTrack(), Garfield::TrackSimple::NewTrack(), Heed::HeedDeltaElectron::physics_after_new_speed(), vec::random_conic_vec(), vec::random_round_vec(), rnorm_double(), rnorm_float(), Garfield::ViewField::Rotate(), Garfield::SolidBox::SolidBox(), Garfield::SolidTube::SolidTube(), Heed::theta_two_part(), Garfield::TrackHeed::TransportDeltaElectron(), Garfield::TrackHeed::TransportPhoton(), vec::turn_new(), and Garfield::ComponentFieldMap::UnmapFields().

◆ sqrt()

DoubleAc sqrt ( const DoubleAc f)

Definition at line 313 of file DoubleAc.cpp.

313 {
314 if (f.get() < 0) {
315 mcerr << "error in DoubleAc sqrt(const DoubleAc& f): f.get() < 0, f.get()="
316 << f.get() << '\n';
317 spexit(mcerr);
318 }
319 return DoubleAc(std::sqrt(double(f.get())),
320 std::sqrt(double(find_max(f.get_left_limit(), 0.0))),
321 std::sqrt(double(f.get_right_limit())));
322}

Referenced by Garfield::Numerics::BesselK0L(), Garfield::Numerics::BesselK1L(), Garfield::ComponentFieldMap::Coordinates4(), Heed::cos_theta_two_part(), Heed::circumf::cross(), GarfieldPhysics::DoIt(), Heed::e_cont_enloss(), Garfield::Medium::ElectronAttachment(), Garfield::MediumCdTe::ElectronAttachment(), Garfield::MediumGaAs::ElectronAttachment(), Garfield::MediumSilicon::ElectronAttachment(), Garfield::Medium::ElectronDiffusion(), Garfield::Medium::ElectronTownsend(), Garfield::MediumSilicon::ElectronTownsend(), Garfield::Medium::ElectronVelocity(), Garfield::MediumCdTe::ElectronVelocity(), Garfield::MediumGaAs::ElectronVelocity(), Garfield::MediumSilicon::ElectronVelocity(), Heed::EnTransfCS::EnTransfCS(), Heed::EnTransfCS_BGM::EnTransfCS_BGM(), Garfield::ViewField::EvaluatePotential(), Garfield::ViewField::EvaluatePotentialProfile(), Garfield::ViewField::EvaluateWeightingField(), Heed::ElElasticScat::fill_hist_low_scat(), Parabol::find_zero(), Cubic::find_zero(), Garfield::DriftLineRKF::GetArrivalTimeSpread(), Garfield::ComponentAnsys121::GetAspectRatio(), Garfield::ComponentAnsys123::GetAspectRatio(), Garfield::ComponentElmer::GetAspectRatio(), Garfield::Track::GetBeta(), Garfield::Track::GetBetaGamma(), Garfield::SolidBox::GetBoundingBox(), Garfield::SolidTube::GetBoundingBox(), Garfield::TrackElectron::GetCluster(), Garfield::MediumSilicon::GetConductionBandDensityOfStates(), Garfield::Medium::GetElectronCollision(), Garfield::MediumMagboltz::GetElectronCollision(), Garfield::MediumSilicon::GetElectronCollision(), Garfield::MediumSilicon::GetElectronEnergy(), Garfield::Medium::GetElectronMomentum(), Garfield::MediumSilicon::GetElectronMomentum(), Garfield::ComponentTcad2d::GetElement(), Garfield::ComponentTcad3d::GetElement(), Garfield::DriftLineRKF::GetGain(), Garfield::Track::GetGamma(), Garfield::Track::GetMomentum(), Garfield::TrackElectron::GetStoppingPower(), Heed::HeedDeltaElectronCS::HeedDeltaElectronCS(), Garfield::Medium::HoleAttachment(), Garfield::MediumCdTe::HoleAttachment(), Garfield::MediumGaAs::HoleAttachment(), Garfield::MediumSilicon::HoleAttachment(), Garfield::Medium::HoleDiffusion(), Garfield::Medium::HoleTownsend(), Garfield::MediumSilicon::HoleTownsend(), Garfield::Medium::HoleVelocity(), Garfield::MediumCdTe::HoleVelocity(), Garfield::MediumGaAs::HoleVelocity(), Garfield::MediumSilicon::HoleVelocity(), Garfield::Medium::IonDiffusion(), Garfield::Medium::IonDissociation(), Garfield::Medium::IonVelocity(), Garfield::SolidSphere::IsInside(), Garfield::SolidTube::IsInside(), Garfield::ComponentAnalyticField::IsInTrapRadius(), Garfield::ComponentAnalyticField::IsWireCrossed(), Garfield::MediumGas::LoadGasFile(), Heed::lorbeta(), Heed::lorgamma_1(), Garfield::ComponentFieldMap::MapCoordinates(), Garfield::TrackBichsel::NewTrack(), Garfield::TrackElectron::NewTrack(), Garfield::TrackHeed::NewTrack(), Garfield::TrackPAI::NewTrack(), Garfield::TrackSimple::NewTrack(), norm_DynLinArr(), norm_DynLinArr_part(), Heed::PairProd::PairProd(), Heed::HeedParticle_BGM::physics(), Heed::HeedDeltaElectron::physics_after_new_speed(), Heed::HeedPhoton::physics_after_new_speed(), Garfield::ViewField::PlotProfile(), pois(), PointsRan::ran(), vec::random_sfer_vec(), Garfield::RndmGaussian(), Garfield::RndmPolya(), rnorm_double(), rnorm_float(), rnorm_improved(), Garfield::MediumMagboltz::RunMagboltz(), Garfield::MediumGas::ScaleDiffusion(), Garfield::Track::SetBeta(), Garfield::Track::SetBetaGamma(), Garfield::Track::SetMomentum(), Garfield::ViewFEMesh::SetPlane(), Garfield::ViewField::SetPlane(), Heed::SimpleTablePhotoAbsCS::SimpleTablePhotoAbsCS(), Garfield::SolidBox::SolidBox(), Garfield::SolidTube::SolidTube(), Heed::straight::straight(), Heed::theta_two_part(), Garfield::TrackHeed::TransportDeltaElectron(), Garfield::TrackHeed::TransportPhoton(), Garfield::ComponentFieldMap::UnmapFields(), and Garfield::MediumGas::WriteGasFile().

◆ square()

DoubleAc square ( const DoubleAc f)

Definition at line 324 of file DoubleAc.cpp.

324 {
325 if (f.left_limit() >= 0.0) {
326 return DoubleAc(f.get() * f.get(), f.left_limit() * f.left_limit(),
327 f.right_limit() * f.right_limit());
328 } else if (f.right_limit() >= 0.0) {
329 double t = find_max(-f.left_limit(), f.right_limit());
330 return DoubleAc(f.get() * f.get(), 0.0, t * t);
331 }
332 return DoubleAc(f.get() * f.get(), f.right_limit() * f.right_limit(),
333 f.left_limit() * f.left_limit());
334}

Referenced by norm_DynLinArr(), and normsq_DynLinArr().

Variable Documentation

◆ one_minus_def_dbl_prec

const double one_minus_def_dbl_prec = double(1.0) - DEF_DBL_PREC

Definition at line 38 of file DoubleAc.h.

◆ one_minus_def_flt_prec

const double one_minus_def_flt_prec = double(1.0) - DEF_FLT_PREC

Definition at line 42 of file DoubleAc.h.

Referenced by DoubleAc::DoubleAc(), and DoubleAc::operator=().

◆ one_plus_def_dbl_prec

const double one_plus_def_dbl_prec = double(1.0) + DEF_DBL_PREC

Definition at line 37 of file DoubleAc.h.

Referenced by DoubleAc::DoubleAc(), and DoubleAc::operator=().

◆ one_plus_def_flt_prec

const double one_plus_def_flt_prec = double(1.0) + DEF_FLT_PREC

Definition at line 41 of file DoubleAc.h.

Referenced by DoubleAc::DoubleAc(), and DoubleAc::operator=().