MCPcopy Create free account
hub / github.com/SeisSol/SeisSol / read

Method read

src/SourceTerm/FSRMReader.cpp:73–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71} // namespace
72
73void seissol::sourceterm::FSRMSource::read(const std::string& filename) {
74 logInfo() << "Reading FSRM point sources from file " << filename;
75
76 std::ifstream filestream(filename);
77
78 if (!filestream.good()) {
79 throw std::runtime_error("FSRM point source file not found.");
80 }
81
82 std::string lineval;
83
84 // comment
85 std::getline(filestream, lineval);
86 filestream >> this->momentTensor[0][0];
87 filestream >> this->momentTensor[0][1];
88 filestream >> this->momentTensor[0][2];
89 filestream >> this->momentTensor[1][0];
90 filestream >> this->momentTensor[1][1];
91 filestream >> this->momentTensor[1][2];
92 filestream >> this->momentTensor[2][0];
93 filestream >> this->momentTensor[2][1];
94 filestream >> this->momentTensor[2][2];
95 std::getline(filestream, lineval); // end of line
96
97 // comment
98 std::getline(filestream, lineval);
99 readArrayOrZero<3>(filestream, lineval, "velocity", this->solidVelocityComponent);
100 readArrayOrZero<1>(filestream, lineval, "pressure", &this->pressureComponent);
101 readArrayOrZero<3>(filestream, lineval, "fluid", this->fluidVelocityComponent);
102 // (we've last read a header/comment line at this point here)
103
104 // read faults
105 filestream >> this->numberOfSources;
106 this->centers.resize(this->numberOfSources);
107 this->strikes.resize(this->numberOfSources);
108 this->dips.resize(this->numberOfSources);
109 this->rakes.resize(this->numberOfSources);
110 this->onsets.resize(this->numberOfSources);
111 this->areas.resize(this->numberOfSources);
112
113 this->timeHistories.resize(this->numberOfSources);
114
115 std::getline(filestream, lineval); // end of line
116
117 // (read the comment before the actual data starts)
118 std::getline(filestream, lineval);
119
120 for (size_t i = 0; i < this->numberOfSources; ++i) {
121 filestream >> this->centers[i](0);
122 filestream >> this->centers[i](1);
123 filestream >> this->centers[i](2);
124 filestream >> this->strikes[i];
125 filestream >> this->dips[i];
126 filestream >> this->rakes[i];
127 filestream >> this->areas[i];
128 filestream >> this->onsets[i];
129 }
130

Callers 1

loadSourcesFromFSRMFunction · 0.45

Calls 1

resizeMethod · 0.80

Tested by

no test coverage detected