MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / write_mesh

Method write_mesh

SRC/recorder/GmshRecorder.cpp:285–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283
284
285int
286GmshRecorder::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;

Callers

nothing calls this directly

Calls 14

getPIDMethod · 0.80
getNPMethod · 0.80
getNodesMethod · 0.80
getCrdsMethod · 0.80
precisionMethod · 0.45
closeMethod · 0.45
strMethod · 0.45
openMethod · 0.45
getNumNodesMethod · 0.45
getTagMethod · 0.45
SizeMethod · 0.45
getNumElementsMethod · 0.45

Tested by

no test coverage detected