MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / TryOutput

Method TryOutput

Src/Base/AMReX_Utility.cpp:596–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

594}
595
596bool amrex::StreamRetry::TryOutput()
597{
598 if(tries == 0) {
599 ++tries;
600 return true;
601 } else {
602 if(sros->fail()) {
603 ++nStreamErrors;
604 int myProc(ParallelDescriptor::MyProc());
605 if(tries <= maxTries) {
606 if (amrex::Verbose() > 1) {
607 amrex::AllPrint() << "PROC: " << myProc << " :: STREAMRETRY_" << suffix << " # "
608 << tries << " :: gbfe: "
609 << sros->good() << sros->bad() << sros->fail() << sros->eof()
610 << " :: sec = " << ParallelDescriptor::second()
611 << " :: os.tellp() = " << sros->tellp()
612 << " :: rewind spos = " << spos
613 << '\n';
614 }
615 sros->clear(); // clear the bad bits
616 if (amrex::Verbose() > 1) {
617 amrex::AllPrint() << "After os.clear() : gbfe: " << sros->good() << sros->bad()
618 << sros->fail() << sros->eof() << '\n';
619 }
620 sros->seekp(spos, std::ios::beg); // reset stream position
621 ++tries;
622 return true;
623 } else {
624 if (amrex::Verbose() > 1) {
625 amrex::AllPrint() << "PROC: " << myProc << " :: STREAMFAILED_" << suffix << " # "
626 << tries << " :: File may be corrupt. :: gbfe: "
627 << sros->good() << sros->bad() << sros->fail() << sros->eof()
628 << " :: sec = " << ParallelDescriptor::second()
629 << " :: os.tellp() = " << sros->tellp()
630 << " :: rewind spos = " << spos
631 << '\n';
632 }
633 sros->clear(); // clear the bad bits
634 if (amrex::Verbose() > 1) {
635 amrex::AllPrint() << "After os.clear() : gbfe: " << sros->good() << sros->bad()
636 << sros->fail() << sros->eof() << '\n';
637 }
638 return false;
639 }
640 } else {
641 return false;
642 }
643 }
644}
645
646
647bool amrex::StreamRetry::TryFileOutput()

Callers 5

write_headerMethod · 0.80
AMReX_FabConv.cppFile · 0.80

Calls 4

AllPrintClass · 0.85
secondFunction · 0.85
MyProcFunction · 0.70
clearMethod · 0.45

Tested by

no test coverage detected