| 649 | |
| 650 | |
| 651 | int |
| 652 | GmshRecorder::write_element_data() |
| 653 | { |
| 654 | |
| 655 | int rank = 0; |
| 656 | int nproc = 1; |
| 657 | |
| 658 | #ifdef _PARALLEL_PROCESSING |
| 659 | rank =theMachineBroker->getPID(); |
| 660 | nproc =theMachineBroker->getNP(); |
| 661 | #endif |
| 662 | |
| 663 | DEBUGSTREAM << "GmshRecorder -- Saving mesh for rank ---> " << rank << endln; |
| 664 | |
| 665 | if (theDomain == 0) { |
| 666 | opserr << "GmshRecorder::write_data() - WARNING: setDomain has not been called -- GmshRecorder\n"; |
| 667 | return -1; |
| 668 | } |
| 669 | |
| 670 | // get time and part |
| 671 | std::stringstream ss; |
| 672 | ss.precision(precision); |
| 673 | ss << std::scientific; |
| 674 | ss << 0 << ' ' << timestep.back(); |
| 675 | std::string stime, spart; |
| 676 | ss >> spart >> stime; |
| 677 | |
| 678 | |
| 679 | // open file |
| 680 | std::stringstream ssmshname; |
| 681 | ssmshname << filename << ".eledata." << rank << ".msh"; |
| 682 | std::string mshname = ssmshname.str(); |
| 683 | |
| 684 | |
| 685 | DEBUGSTREAM << "mshname = " << mshname.c_str() << endln; |
| 686 | |
| 687 | if(!theFile.is_open()) |
| 688 | { |
| 689 | if(write_binary_mode) |
| 690 | { |
| 691 | theFile.open(mshname.c_str(), std::ios::trunc | std::ios::out | std::ios::binary); |
| 692 | } |
| 693 | else |
| 694 | { |
| 695 | theFile.open(mshname.c_str(), std::ios::trunc | std::ios::out | std::ios::binary); |
| 696 | } |
| 697 | |
| 698 | |
| 699 | if (theFile.fail()) { |
| 700 | opserr << "WARNING: Failed to open file " << mshname.c_str() << "\n"; |
| 701 | return -1; |
| 702 | } |
| 703 | theFile.precision(precision); |
| 704 | theFile << std::scientific; |
| 705 | |
| 706 | write_header(); |
| 707 | } |
| 708 |
nothing calls this directly
no test coverage detected