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

Function writeSlip

preprocessing/science/rconv/src/XMFWriter.cpp:45–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43
44
45void writeSlip(std::vector<SRFPointSource> const& sources, std::ofstream& xdmfFile)
46{
47 xdmfFile << " <Attribute Name=\"Slip path length (m)\" Center=\"Node\">" << std::endl
48 << " <DataItem Dimensions=\"" << sources.size() << "\" DataType=\"Float\" Precision=\"8\" Format=\"XML\">" << std::endl;
49 for (std::vector<SRFPointSource>::const_iterator source = sources.begin(); source != sources.end(); ++source) {
50 std::size_t maxSteps = std::max(std::max(source->slipRate[0].size(), source->slipRate[1].size()), source->slipRate[2].size());
51 double slip = 0.0;
52 double lastAbsSlipRate = 0.0;
53 // Slip path integration with trapezoidal rule
54 for (std::size_t step = 0; step < maxSteps; ++step) {
55 double sr[3];
56 for (int d = 0; d < 3; ++d) {
57 sr[d] = (step < source->slipRate[d].size()) ? source->slipRate[d][step] : 0.0;
58 }
59 double absSlipRate = sqrt(sr[0]*sr[0] + sr[1]*sr[1] + sr[2]*sr[2]);
60 slip += source->dt * (absSlipRate + lastAbsSlipRate) / 2.0;
61 lastAbsSlipRate = absSlipRate;
62 }
63 // Convert to meter and write
64 xdmfFile << slip / 100.0 << std::endl;
65 }
66 xdmfFile << " </DataItem>" << std::endl
67 << " </Attribute>" << std::endl;
68}
69
70void writeXMF(char const* filename, std::vector<SRFPointSource> const& sources, Map const& map)
71{

Callers 1

writeXMFFunction · 0.85

Calls 3

sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected