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

Function writeXMF

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

Source from the content-addressed store, hash-verified

68}
69
70void writeXMF(char const* filename, std::vector<SRFPointSource> const& sources, Map const& map)
71{
72 std::ofstream xdmfFile;
73 xdmfFile.open(filename);
74
75 xdmfFile << "<?xml version=\"1.0\" ?>" << std::endl
76 << "<!DOCTYPE Xdmf SYSTEM \"Xdmf.dtd\" []>" << std::endl
77 << "<Xdmf>" << std::endl
78 << " <Domain>" << std::endl
79 << " <Topology Type=\"Polyvertex\" NumberOfElements=\"" << sources.size() << "\"/>" << std::endl
80 << " <Geometry Type=\"XYZ\">" << std::endl
81 << " <DataItem Dimensions=\"" << sources.size() << " 3\" NumberType=\"Float\" Precision=\"8\" Format=\"XML\">" << std::endl;
82
83 for (std::vector<SRFPointSource>::const_iterator source = sources.begin(); source != sources.end(); ++source) {
84 double x, y, z;
85#ifdef noproj
86 x = source->longitude;
87 y = source->latitude;
88 z = source->depth;
89#else
90 map.map(source->longitude, source->latitude, source->depth, &x, &y, &z);
91#endif
92 xdmfFile << x << " " << y << " " << z << std::endl;
93 }
94
95 xdmfFile << " </DataItem>" << std::endl
96 << " </Geometry>" << std::endl
97 << " <Grid Name=\"Fault\" GridType=\"Uniform\">" << std::endl
98 << " <Topology Reference=\"/Xdmf/Domain/Topology[1]\"/>" << std::endl
99 << " <Geometry Reference=\"/Xdmf/Domain/Geometry[1]\"/>" << std::endl;
100
101 writeSlip(sources, xdmfFile);
102
103 xdmfFile << " </Grid>" << std::endl
104 << " </Domain>" << std::endl
105 << "</Xdmf>" << std::endl;
106
107 xdmfFile.close();
108}

Callers 1

mainFunction · 0.85

Calls 7

writeSlipFunction · 0.85
mapMethod · 0.80
openMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected