159 {
160 constexpr MInt rootId = 0;
164 file.defineArray(PIO_FLOAT, "coordinates", 2, &dimSizesCoordinates[0]);
166
169 file.writeArray(
m_coords,
"coordinates");
170 if(isRoot) {
172 m_mpiComm, AT_,
"MPI_IN_PLACE",
"m_prms");
173
174 std::ofstream outfile;
176 if constexpr(nDim == 2) {
177 outfile << "# obs:1 x:2 y:3 theta:4 p_rms:5" << std::endl;
180 const MFloat theta = atan2(obsCoord[1], obsCoord[0]);
181 outfile << obs <<
" " << obsCoord[0] <<
" " << obsCoord[1] <<
" " << theta <<
" " <<
m_prms[obs] << std::endl;
182 }
183 } else if constexpr(nDim == 3) {
184 outfile << "# obs:1 x:2 y:3 z:4 theta:5 alpha:6 p_rms:7" << std::endl;
188 const MFloat theta = atan2(obsCoord[2], obsCoord[0]);
189 const MFloat alpha = asin(obsCoord[1] /
dist);
190 outfile << obs << " " << obsCoord[0] << " " << obsCoord[1] << " " << obsCoord[2] << " " << theta << " " << alpha
191 <<
" " <<
m_prms[obs] << std::endl;
192 }
193 }
194 outfile.close();
196 } else {
198 m_mpiComm, AT_,
"MPI_IN_PLACE",
"m_prms");
199 file.setOffset(0, 0);
200 }
201 file.writeArray(
m_prms.data(),
"rms_pressure");
202}
MString m_fileNameIoParallel
int MPI_Reduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Reduce
PARALLELIO_DEFAULT_BACKEND ParallelIo
MFloat dist(const Point< DIM > &p, const Point< DIM > &q)