| 283 | |
| 284 | |
| 285 | int |
| 286 | GmshRecorder::write_mesh() |
| 287 | { |
| 288 | |
| 289 | if(!write_mesh_now) |
| 290 | { |
| 291 | return 0; |
| 292 | } |
| 293 | int rank = 0; |
| 294 | int nproc = 1; |
| 295 | #ifdef _PARALLEL_PROCESSING |
| 296 | rank = theMachineBroker->getPID(); |
| 297 | nproc = theMachineBroker->getNP(); |
| 298 | #endif |
| 299 | |
| 300 | DEBUGSTREAM << " Saving mesh for rank ---> " << rank << endln; |
| 301 | |
| 302 | if (theDomain == 0) { |
| 303 | opserr << "WARNING: setDomain has not been called -- GmshRecorder\n"; |
| 304 | return -1; |
| 305 | } |
| 306 | |
| 307 | // get time and part |
| 308 | std::stringstream ss; |
| 309 | ss.precision(precision); |
| 310 | ss << std::scientific; |
| 311 | ss << 0 << ' ' << timestep.back(); |
| 312 | std::string stime, spart; |
| 313 | ss >> spart >> stime; |
| 314 | |
| 315 | |
| 316 | // open file |
| 317 | theFile.close(); |
| 318 | std::stringstream ssmshname; |
| 319 | ssmshname << filename << ".mesh." << rank << ".msh"; |
| 320 | std::string mshname = ssmshname.str(); |
| 321 | |
| 322 | DEBUGSTREAM << "Opening " << mshname.c_str() << endln; |
| 323 | |
| 324 | |
| 325 | theFile.open(mshname.c_str(), std::ios::trunc | std::ios::out); |
| 326 | if (theFile.fail()) { |
| 327 | opserr << "WARNING: Failed to open file " << mshname.c_str() << "\n"; |
| 328 | return -1; |
| 329 | } |
| 330 | theFile.precision(precision); |
| 331 | theFile << std::scientific; |
| 332 | |
| 333 | write_header(); |
| 334 | |
| 335 | theFile << "$Nodes\n"; |
| 336 | |
| 337 | |
| 338 | theFile << theDomain->getNumNodes() << "\n"; |
| 339 | |
| 340 | // Write Node coordinates |
| 341 | NodeIter& theNodes = theDomain->getNodes(); |
| 342 | Node* theNode = 0; |
nothing calls this directly
no test coverage detected