Line data Source code
1 : #ifndef HazardCurve_H 2 : #define HazardCurve_H 3 : 4 : // MOOSE includes 5 : #include "GeneralUserObject.h" 6 : #include "DelimitedFileReader.h" 7 : 8 : // MASTODON includes 9 : #include "GroundMotionReader.h" 10 : 11 : 12 : 13 : /** 14 : * Reads hazard curve data and create scaled ground motions. 15 : */ 16 : class HazardCurve : public GeneralUserObject 17 : { 18 : public: 19 : static InputParameters validParams(); 20 : HazardCurve(const InputParameters & parameters); 21 : virtual void execute() override; 22 0 : virtual void initialize() override {} 23 0 : virtual void finalize() override {} 24 : 25 : /** 26 : * Return ground motion for a given hazard bin, index, and component. 27 : * @param bin The hazard curve bin index. 28 : * @param index The ground motion index. 29 : * @param comp The ground motion component. 30 : */ 31 : const std::vector<Real> & getData(const std::size_t & bin, 32 : const std::size_t & index, 33 : const GroundMotionReader::Component & comp) const; 34 : 35 : /** 36 : * Return the sampled hazard curve. 37 : */ 38 : const std::vector<std::pair<Real, Real>> & getSamples() const; 39 : 40 : /** 41 : * Return the number of curves. 42 : */ 43 : unsigned int count() const; 44 : 45 : /** 46 : * Return the number of curves within the provided bin. 47 : */ 48 : std::size_t count(const std::size_t & bin) const; 49 : 50 : /** 51 : * Return the number of bins. 52 : */ 53 : std::size_t bins() const; 54 : 55 : protected: 56 : /// Reader for the hazard data 57 : MooseUtils::DelimitedFileReader _hazard_reader; 58 : 59 : /// Reader for the ground motions (UserObject) 60 : const GroundMotionReader & _ground_motion_reader; 61 : 62 : /// Storage for the scaled ground motions 63 : std::vector<GroundMotionReader::Data> _ground_motion_data; 64 : 65 : /// Hazard sample data 66 : std::vector<std::pair<Real, Real>> _hazard_sample; 67 : 68 : /// Reference Acceleration 69 : std::vector<Real> _reference; 70 : 71 : /** 72 : * Method for checking initialization status. 73 : */ 74 : void check() const; 75 : 76 : public: 77 : /* The following methods are private static methods that implement the primary functions of this 78 : * object. They are static so that they may be unit tested. They are private because they are 79 : * not intended to be used outside of this class (excluding testing). 80 : */ 81 : static std::vector<GroundMotionReader::Data> execute( 82 : const std::string & name, 83 : const std::vector<Real> & reference, 84 : const MooseUtils::DelimitedFileReader & hazard_reader, 85 : const std::vector<std::unique_ptr<MooseUtils::DelimitedFileReader>> & ground_motion_readers, 86 : std::vector<std::pair<Real, Real>> & sample_data); 87 : }; 88 : 89 : #endif