| 805 | |
| 806 | |
| 807 | int |
| 808 | GmshRecorder::write_element_graph() |
| 809 | { |
| 810 | static bool do_only_once = true; |
| 811 | |
| 812 | int rank = 0; |
| 813 | int nproc = 1; |
| 814 | |
| 815 | #ifdef _PARALLEL_PROCESSING |
| 816 | rank = theMachineBroker->getPID(); |
| 817 | nproc = theMachineBroker->getNP(); |
| 818 | |
| 819 | // if (rank > 0) |
| 820 | // { |
| 821 | // return 0; // Only do this on proc0 |
| 822 | // } |
| 823 | |
| 824 | // DEBUGSTREAM << "Saving mesh for rank ---> " << rank << endln; |
| 825 | |
| 826 | if (theDomain == 0) { |
| 827 | opserr << "WARNING: setDomain has not been called -- GmshRecorder\n"; |
| 828 | return -1; |
| 829 | } |
| 830 | |
| 831 | if(do_only_once) |
| 832 | { |
| 833 | // get time and part |
| 834 | std::stringstream ss; |
| 835 | ss.precision(precision); |
| 836 | ss << std::scientific; |
| 837 | ss << 0 << ' ' << timestep.back(); |
| 838 | std::string stime, spart; |
| 839 | ss >> spart >> stime; |
| 840 | |
| 841 | |
| 842 | // open file |
| 843 | theFile.close(); |
| 844 | std::stringstream ssmshname; |
| 845 | ssmshname << filename << ".graphnodes." << rank << ".msh"; |
| 846 | std::string mshname = ssmshname.str(); |
| 847 | |
| 848 | // DEBUGSTREAM << "Opening " << mshname.c_str() << endln; |
| 849 | |
| 850 | |
| 851 | theFile.open(mshname.c_str(), std::ios::trunc | std::ios::out); |
| 852 | if (theFile.fail()) { |
| 853 | opserr << "WARNING: Failed to open file " << mshname.c_str() << "\n"; |
| 854 | return -1; |
| 855 | } |
| 856 | theFile.precision(precision); |
| 857 | theFile << std::scientific; |
| 858 | |
| 859 | write_header(); |
| 860 | |
| 861 | |
| 862 | Graph& theGraph = theDomain->getElementGraph(); |
| 863 | int numvertex = theGraph.getNumVertex(); |
| 864 | int numedge = theGraph.getNumEdge(); |
nothing calls this directly
no test coverage detected