2828#include < QDebug>
2929
3030SourceTheoryRvtMotion::SourceTheoryRvtMotion (QObject * parent)
31- : AbstractRvtMotion(parent)
31+ : AbstractRvtMotion(parent),
32+ _isCustomized(false ),
33+ _seismicMoment(0 ),
34+ _depth(0 ),
35+ _hypoDistance(0 ),
36+ _cornerFreq(0 ),
37+ _stressDrop(0 ),
38+ _geoAtten(0 ),
39+ _pathAttenCoeff(0 ),
40+ _pathAttenPower(0 ),
41+ _shearVelocity(0 ),
42+ _density(0 ),
43+ _siteAtten(0 )
3244{
3345 _freq = new Dimension (this );
3446 _freq->setMin (0.05 );
@@ -88,24 +100,24 @@ void SourceTheoryRvtMotion::setRegion(AbstractRvtMotion::Region region)
88100 _pathDuration->setRegion (_region);
89101
90102 switch (_region) {
91- case AbstractRvtMotion::WUS:
92- setStressDrop (100 );
93- setPathAttenCoeff (180 );
94- setPathAttenPower (0.45 );
95- setShearVelocity (3.5 );
96- setDensity (2.8 );
97- setSiteAtten (0.04 );
98- break ;
99- case AbstractRvtMotion::CEUS:
100- setStressDrop (150 );
101- setPathAttenCoeff (680 );
102- setPathAttenPower (0.36 );
103- setShearVelocity (3.6 );
104- setDensity (2.8 );
105- setSiteAtten (0.006 );
106- break ;
107- default :
108- break ;
103+ case AbstractRvtMotion::WUS:
104+ setStressDrop (100 );
105+ setPathAttenCoeff (180 );
106+ setPathAttenPower (0.45 );
107+ setShearVelocity (3.5 );
108+ setDensity (2.8 );
109+ setSiteAtten (0.04 );
110+ break ;
111+ case AbstractRvtMotion::CEUS:
112+ setStressDrop (150 );
113+ setPathAttenCoeff (680 );
114+ setPathAttenPower (0.36 );
115+ setShearVelocity (3.6 );
116+ setDensity (2.8 );
117+ setSiteAtten (0.006 );
118+ break ;
119+ default :
120+ break ;
109121 }
110122
111123 // Geometric attenuation may have changed
@@ -348,24 +360,24 @@ void SourceTheoryRvtMotion::calcGeoAtten()
348360 // Determine the geometric attenuation based on a piecewise linear
349361 // calculation
350362 switch (_region) {
351- case AbstractRvtMotion::WUS:
352- if (_hypoDistance < 40 .) {
353- _geoAtten = 1 . / _hypoDistance;
354- } else {
355- _geoAtten = 1 ./40 . * sqrt (40 ./_hypoDistance);
356- }
357- break ;
358- case AbstractRvtMotion::CEUS:
359- if (_hypoDistance < 70 .) {
360- _geoAtten = 1 . / _hypoDistance;
361- } else if (_hypoDistance < 130 .) {
362- _geoAtten = 1 . / 70 .;
363- } else {
364- _geoAtten = 1 ./70 . * sqrt (130 ./_hypoDistance);
365- }
366- break ;
367- default :
368- break ;
363+ case AbstractRvtMotion::WUS:
364+ if (_hypoDistance < 40 .) {
365+ _geoAtten = 1 . / _hypoDistance;
366+ } else {
367+ _geoAtten = 1 ./40 . * sqrt (40 ./_hypoDistance);
368+ }
369+ break ;
370+ case AbstractRvtMotion::CEUS:
371+ if (_hypoDistance < 70 .) {
372+ _geoAtten = 1 . / _hypoDistance;
373+ } else if (_hypoDistance < 130 .) {
374+ _geoAtten = 1 . / 70 .;
375+ } else {
376+ _geoAtten = 1 ./70 . * sqrt (130 ./_hypoDistance);
377+ }
378+ break ;
379+ default :
380+ break ;
369381 }
370382
371383 emit geoAttenChanged (_geoAtten);
@@ -390,7 +402,7 @@ void SourceTheoryRvtMotion::calculate()
390402 // Path component
391403 const double pathAtten = _pathAttenCoeff * pow (freqAt (i), _pathAttenPower);
392404 const double pathComp = _geoAtten *
393- exp ((-M_PI * freqAt (i) * _hypoDistance) / (pathAtten * _shearVelocity));
405+ exp ((-M_PI * freqAt (i) * _hypoDistance) / (pathAtten * _shearVelocity));
394406
395407 // Site component
396408 const double siteAmp = _crustalAmp->interpAmpAt (freqAt (i));
@@ -482,7 +494,7 @@ QDataStream & operator>> (QDataStream & in, SourceTheoryRvtMotion* strm)
482494 double depth;
483495
484496 in >> depth
485- >> strm->_freq ;
497+ >> strm->_freq ;
486498
487499 strm->setDepth (depth);
488500
@@ -497,15 +509,15 @@ QDataStream & operator>> (QDataStream & in, SourceTheoryRvtMotion* strm)
497509 double siteAtten;
498510
499511 in >> stressDrop
500- >> geoAtten
501- >> pathDurCoeff
502- >> pathAttenCoeff
503- >> pathAttenPower
504- >> shearVelocity
505- >> density
506- >> siteAtten
507- >> strm->_crustalAmp
508- >> strm->_pathDuration ;
512+ >> geoAtten
513+ >> pathDurCoeff
514+ >> pathAttenCoeff
515+ >> pathAttenPower
516+ >> shearVelocity
517+ >> density
518+ >> siteAtten
519+ >> strm->_crustalAmp
520+ >> strm->_pathDuration ;
509521
510522 // FIXME: Move to one function
511523 // Use set methods to calculate dependent parameters
0 commit comments