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

Method writeHeader

src/ResultWriter/ReceiverWriter.cpp:118–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118void ReceiverWriter::writeHeader(unsigned pointId, const Eigen::Vector3d& point) {
119 auto name = fileName(pointId);
120
121 std::vector<std::string> names(seissol::model::MaterialT::Quantities.begin(),
122 seissol::model::MaterialT::Quantities.end());
123 for (const auto& derived : derivedQuantities) {
124 auto derivedNames = derived->quantities();
125 names.insert(names.end(), derivedNames.begin(), derivedNames.end());
126 }
127
128 /// \todo Find a nicer solution that is not so hard-coded.
129 struct stat fileStat;
130 // Write header if file does not exist
131 if (stat(name.c_str(), &fileStat) != 0) {
132 std::ofstream file;
133 file.open(name);
134 file << "TITLE = \"Temporal Signal for receiver number " << std::setfill('0') << std::setw(5)
135 << (pointId + 1) << "\"" << std::endl;
136 file << "VARIABLES = \"Time\"";
137#ifdef MULTIPLE_SIMULATIONS
138 for (unsigned sim = init::QAtPoint::Start[0]; sim < init::QAtPoint::Stop[0]; ++sim) {
139 for (const auto& name : names) {
140 file << ",\"" << name << sim << "\"";
141 }
142 }
143#else
144 for (auto const& name : names) {
145 file << ",\"" << name << "\"";
146 }
147#endif
148 file << std::endl;
149 for (int d = 0; d < 3; ++d) {
150 file << "# x" << (d + 1) << " " << std::scientific << std::setprecision(12) << point[d]
151 << std::endl;
152 }
153 file.close();
154 }
155}
156
157void ReceiverWriter::syncPoint(double /*currentTime*/) {
158 if (m_receiverClusters.empty()) {

Callers

nothing calls this directly

Calls 7

quantitiesMethod · 0.80
c_strMethod · 0.80
statClass · 0.70
beginMethod · 0.45
endMethod · 0.45
openMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected