File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -417,6 +417,8 @@ namespace minsky
417417 void VariableValue::exportAsCSV (const string& filename, const string& comment, bool tabular) const
418418 {
419419 ofstream of (filename);
420+ if (!of)
421+ throw runtime_error (" Unable to open " +filename+" for writing." );
420422 if (!comment.empty ())
421423 of<<R"( """)" <<comment<<R"( """)" <<endl;
422424
@@ -433,14 +435,14 @@ namespace minsky
433435 os<<json (static_cast <const NamedDimension&>(i));
434436 }
435437 of<<quoted (" RavelHypercube=[" +os.str ()+" ]" )<<endl;
436- if (tabular)
438+ if (tabular && rank ()> 0 )
437439 of<<" HorizontalDimension=" <<quoted (xv[longestDim].name )<<endl;
438440
439441 for (size_t i=0 ; i<xv.size (); ++i)
440442 if (!tabular || i!=longestDim)
441443 of<<CSVQuote (xv[i].name ,' ,' )<<" ," ;
442444
443- if (tabular)
445+ if (tabular && rank ()> 0 )
444446 for (size_t k=0 ; k<dims[longestDim]; ++k)
445447 {
446448 if (k>0 ) of<<" ," ;
@@ -452,7 +454,7 @@ namespace minsky
452454
453455 auto idxv=index ();
454456
455- if (tabular)
457+ if (tabular && rank ()> 0 )
456458 {
457459 size_t stride=1 ;
458460 for (size_t i=0 ; i<longestDim; ++i)
You can’t perform that action at this time.
0 commit comments