| 373 | } |
| 374 | |
| 375 | int |
| 376 | PVDRecorder::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 | } |
no test coverage detected