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

Function readMeshPUML

src/Initializer/InitProcedure/InitMesh.cpp:74–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void readMeshPUML(const seissol::initializer::parameters::SeisSolParameters& seissolParams,
75 seissol::SeisSol& seissolInstance) {
76#if defined(USE_HDF) && defined(USE_MPI)
77 const int rank = seissol::MPI::mpi.rank();
78 double nodeWeight = 1.0;
79
80 if (utils::Env::get<bool>("SEISSOL_MINISEISSOL", true)) {
81 if (seissol::MPI::mpi.size() > 1) {
82 logInfo(rank) << "Running mini SeisSol to determine node weights.";
83 auto elapsedTime = seissol::miniSeisSol(
84 seissolInstance.getMemoryManager(), seissolParams.model.plasticity, seissolInstance);
85 nodeWeight = 1.0 / elapsedTime;
86
87 const auto summary = seissol::statistics::parallelSummary(nodeWeight);
88 logInfo(rank) << "Node weights: mean =" << summary.mean << " std =" << summary.std
89 << " min =" << summary.min << " median =" << summary.median
90 << " max =" << summary.max;
91
92 writer::MiniSeisSolWriter writer(seissolParams.output.prefix.c_str());
93 writer.write(elapsedTime, nodeWeight);
94 } else {
95 logInfo(rank) << "Skipping mini SeisSol (SeisSol is used with a single rank only).";
96 }
97 } else {
98 logInfo(rank) << "Skipping mini SeisSol (disabled).";
99 }
100
101 logInfo(rank) << "Reading PUML mesh";
102
103 auto boundaryFormat = seissolParams.mesh.pumlBoundaryFormat;
104
105 if (boundaryFormat == seissol::initializer::parameters::BoundaryFormat::Auto) {
106 logInfo(rank) << "Inferring boundary format.";
107 MPI_Info info = MPI_INFO_NULL;
108 const hid_t plistId = _eh(H5Pcreate(H5P_FILE_ACCESS));
109 _eh(H5Pset_fapl_mpio(plistId, seissol::MPI::mpi.comm(), info));
110 const hid_t dataFile =
111 _eh(H5Fopen(seissolParams.mesh.meshFileName.c_str(), H5F_ACC_RDONLY, plistId));
112 const hid_t existenceTest = _eh(H5Aexists(dataFile, "boundary-format"));
113 if (existenceTest > 0) {
114 logInfo(rank) << "Boundary format given in PUML file.";
115 hid_t boundaryAttribute = _eh(H5Aopen(dataFile, "boundary-format", H5P_DEFAULT));
116
117 hid_t boundaryAttributeType = _eh(H5Aget_type(boundaryAttribute));
118
119 auto format = [&]() {
120 if (_eh(H5Tis_variable_str(boundaryAttributeType))) {
121 char* formatRaw = nullptr;
122 _eh(H5Aread(boundaryAttribute, boundaryAttributeType, &formatRaw));
123 auto format = std::string(formatRaw);
124 _eh(H5free_memory(formatRaw));
125 return format;
126 } else {
127 auto length = H5Tget_size(boundaryAttributeType);
128 std::vector<char> data(length);
129 _eh(H5Aread(boundaryAttribute, boundaryAttributeType, data.data()));
130 std::size_t actualLength = length;
131 for (std::size_t i = 0; i < length; ++i) {

Callers 1

initMeshMethod · 0.85

Calls 15

_ehFunction · 0.85
rankMethod · 0.80
c_strMethod · 0.80
commMethod · 0.80
getRateMethod · 0.80
getLtsWeightsTypeMethod · 0.80
pauseMethod · 0.80
printTimeMethod · 0.80
sizeMethod · 0.45
writeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected