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

Method savePart0

SRC/recorder/PVDRecorder.cpp:375–836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373}
374
375int
376PVDRecorder::savePart0(int nodendf)
377{
378 if (theDomain == 0) {
379 opserr<<"WARNING: setDomain has not been called -- PVDRecorder\n";
380 return -1;
381 }
382
383 // get time and part
384 std::stringstream ss;
385 ss.precision(precision);
386 ss << std::scientific;
387 ss << 0 << ' ' << timestep.back();
388 std::string stime, spart;
389 ss >> spart >> stime;
390
391 // open file
392 theFile.close();
393 std::string vtuname = pathname+basename+"/"+basename+"_T"+stime+"_P"+spart+".vtu";
394 theFile.open(vtuname.c_str(), std::ios::trunc|std::ios::out);
395 if(theFile.fail()) {
396 opserr<<"WARNING: Failed to open file "<<vtuname.c_str()<<"\n";
397 return -1;
398 }
399 theFile.precision(precision);
400 theFile << std::scientific;
401
402 // header
403 theFile<<"<?xml version="<<quota<<"1.0"<<quota<<"?>\n";
404 theFile<<"<VTKFile type="<<quota<<"UnstructuredGrid"<<quota;
405 theFile<<" version="<<quota<<"1.0"<<quota;
406 theFile<<" byte_order="<<quota<<"LittleEndian"<<quota;
407 theFile<<" compressor="<<quota<<"vtkZLibDataCompressor"<<quota;
408 theFile<<">\n";
409 this->incrLevel();
410 this->indent();
411 theFile<<"<UnstructuredGrid>\n";
412
413 // get pressure nodes
414 ID ptags(0,theDomain->getNumPCs());
415 Pressure_ConstraintIter& thePCs = theDomain->getPCs();
416 Pressure_Constraint* thePC = 0;
417 while ((thePC = thePCs()) != 0) {
418 Node* pnode = thePC->getPressureNode();
419 if (pnode != 0) {
420 ptags.insert(pnode->getTag());
421 }
422 }
423
424 // get all nodes except pressure nodes
425 std::vector<Node*> nodes;
426 NodeIter& theNodes = theDomain->getNodes();
427 Node* theNode = 0;
428 while ((theNode = theNodes()) != 0) {
429 int nd = theNode->getTag();
430 if (ptags.getLocationOrdered(nd) < 0) {
431 nodes.push_back(theNode);
432 }

Callers 1

vtuMethod · 0.95

Calls 15

incrLevelMethod · 0.95
indentMethod · 0.95
decrLevelMethod · 0.95
getNodesMethod · 0.80
push_backMethod · 0.80
getCrdsMethod · 0.80
precisionMethod · 0.45
closeMethod · 0.45
openMethod · 0.45
getNumPCsMethod · 0.45
getPressureNodeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected