| 18 | bool code_uses_equivalence_keys = false; |
| 19 | |
| 20 | filesystem::path CreateTempDir() |
| 21 | { |
| 22 | static int counter = 0; |
| 23 | int rank = 0; |
| 24 | #ifdef PARALLEL |
| 25 | if(MPI_Loaded()) |
| 26 | rank = ngcore::NgMPI_Comm(NG_MPI_COMM_WORLD).Rank(); |
| 27 | #endif // PARALLEL |
| 28 | filesystem::path dir; |
| 29 | #ifdef WIN32 |
| 30 | dir = filesystem::path(std::tmpnam(nullptr)).concat("_ngsolve_"+ToString(rank)+"_"+ToString(counter++)); |
| 31 | #else // WIN32 |
| 32 | string tmp_template = filesystem::temp_directory_path().append("ngsolve_tmp_"+ToString(rank)+"_"+ToString(counter++)+"_XXXXXX"); |
| 33 | if(mkdtemp(&tmp_template[0])==nullptr) |
| 34 | throw Exception("could not create temporary directory"); |
| 35 | dir = tmp_template; |
| 36 | #endif // WIN32 |
| 37 | filesystem::create_directories(dir); |
| 38 | return dir; |
| 39 | } |
| 40 | |
| 41 | atomic<unsigned> Code::id_counter{0}; |
| 42 |
no test coverage detected