Skip to content

Commit

Permalink
Clean up Command Line Interface to have minimal changes in other files.
Browse files Browse the repository at this point in the history
  • Loading branch information
nealkruis committed Sep 20, 2014
1 parent 53e0a03 commit 4f41f3d
Show file tree
Hide file tree
Showing 23 changed files with 203 additions and 505 deletions.
419 changes: 141 additions & 278 deletions src/EnergyPlus/CommandLineInterface.cc

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/EnergyPlus/CommandLineInterface.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ namespace CommandLineInterface {
extern std::string outputMtrFile;
extern std::string outputRddFile;
extern std::string outputShdFile;
extern std::string outputCsvFile;
extern std::string outputHtmFile;
extern std::string outputTabFile;
extern std::string outputTxtFile;
extern std::string outputXmlFile;
extern std::string inputFileName;
extern std::string inputEnergyFile;
extern std::string inputWeatherFile;

// Process command line arguments
int
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/DataSystemVariables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ namespace DataSystemVariables {
std::string::size_type pos;

if ( firstTime ) {
EchoInputFile = FindUnitNumber( CommandLineInterface::outputAuditFile );
EchoInputFile = FindUnitNumber( outputAuditFile );
get_environment_variable( cInputPath1, envinputpath1 );
if ( envinputpath1 != blank ) {
pos = index( envinputpath1, pathChar, true ); // look backwards for pathChar
Expand Down
39 changes: 7 additions & 32 deletions src/EnergyPlus/InputProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
#include <DisplayRoutines.hh>
#include <SortAndStringUtilities.hh>

//Standard C++ library
#include <string>

namespace EnergyPlus {

namespace InputProcessor {
Expand Down Expand Up @@ -65,8 +62,7 @@ namespace InputProcessor {
using DataSystemVariables::SortedIDD;
using DataSystemVariables::iASCII_CR;
using DataSystemVariables::iUnicode_end;



// Use statements for access to subroutines in other modules

// Data
Expand All @@ -92,8 +88,6 @@ namespace InputProcessor {
Real64 const DefAutoCalculateValue( AutoCalculate );
static gio::Fmt const fmtLD( "*" );
static gio::Fmt const fmtA( "(A)" );
std::string inputFileName;
std::string inputEnergyFile;

// DERIVED TYPE DEFINITIONS

Expand Down Expand Up @@ -172,25 +166,6 @@ namespace InputProcessor {
FArray1D< LineDefinition > IDFRecords; // All the objects read from the IDF
FArray1D< SecretObjects > RepObjects; // Secret Objects that could replace old ones

std::string assign(std::string& _FileName){
DisplayString("====================================================================== \n");
DisplayString("== Module 'Input Processor'::Name of the input file = " + _FileName + "\n");
return _FileName;
}

std::string assignEFile(std::string& _EFileName){
DisplayString("== Module 'Input Processor'::Name of the energy file = " + _EFileName + "\n");
DisplayString("====================================================================== \n\n");
return _EFileName;
}

std::string assignAuditFile(std::string& _AuditFileName){
DisplayString("== Module 'Input Processor'::Name of the output (audit) file = " +_AuditFileName+ "\n");
DisplayString("====================================================================== \n\n");
return _AuditFileName;
}


// MODULE SUBROUTINES:
//*************************************************************************

Expand Down Expand Up @@ -252,14 +227,14 @@ namespace InputProcessor {
int endcol;
int write_stat;
int read_stat;

InitSecretObjects();

EchoInputFile = GetNewUnitNumber();
{ IOFlags flags; flags.ACTION( "write" ); gio::open( EchoInputFile, CommandLineInterface::outputAuditFile, flags ); write_stat = flags.ios(); }
{ IOFlags flags; flags.ACTION( "write" ); gio::open( EchoInputFile, outputAuditFile, flags ); write_stat = flags.ios(); }
if ( write_stat != 0 ) {
DisplayString( "Could not open (write) "+ CommandLineInterface::outputAuditFile + " ." );
ShowFatalError( "ProcessInput: Could not open file " + CommandLineInterface::outputAuditFile + " for output (write)." );
DisplayString( "Could not open (write) "+ outputAuditFile + " ." );
ShowFatalError( "ProcessInput: Could not open file " + outputAuditFile + " for output (write)." );
}

{ IOFlags flags; gio::inquire( "eplusout.iperr", flags ); FileExists = flags.exists(); }
Expand All @@ -275,7 +250,7 @@ namespace InputProcessor {
{ IOFlags flags; flags.ACTION( "write" ); gio::open( CacheIPErrorFile, "eplusout.iperr", flags ); write_stat = flags.ios(); }
if ( write_stat != 0 ) {
DisplayString( "Could not open (write) eplusout.iperr." );
ShowFatalError( "ProcessInput: Could not open file " + CommandLineInterface::outputAuditFile + " for output (write)." );
ShowFatalError( "ProcessInput: Could not open file " + outputAuditFile + " for output (write)." );
}

// FullName from StringGlobals is used to build file name with Path
Expand Down Expand Up @@ -652,7 +627,7 @@ namespace InputProcessor {
ErrorsFound = true;
}
} else {
ShowSevereError( "IP: Blank Sections not allowed. Review " + CommandLineInterface::outputAuditFile + " file.", EchoInputFile );
ShowSevereError( "IP: Blank Sections not allowed. Review " + outputAuditFile + " file.", EchoInputFile );
errFlag = true;
ErrorsFound = true;
}
Expand Down
13 changes: 4 additions & 9 deletions src/EnergyPlus/InputProcessor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ namespace InputProcessor {
extern std::string CurrentFieldName; // Current Field Name (IDD)
extern FArray1D_string ObsoleteObjectsRepNames; // Array of Replacement names for Obsolete objects
extern std::string ReplacementName;
extern std::string inputFileName;
extern std::string inputEnergyFile;


//Logical Variables for Module
extern bool OverallErrorFlag; // If errors found during parse of IDF, will fatal at end
extern bool EchoInputLine; // Usually True, if the IDD is backspaced, then is set to false, then back to true
Expand Down Expand Up @@ -409,12 +407,9 @@ namespace InputProcessor {
extern LineDefinition LineItem; // Description of current record
extern FArray1D< LineDefinition > IDFRecords; // All the objects read from the IDF
extern FArray1D< SecretObjects > RepObjects; // Secret Objects that could replace old ones

// Functions
std::string assign(std::string& _FileName);
std::string assignEFile(std::string& _EFileName);
std::string assignAuditFile(std::string& _AuditFileName);


void
ProcessInput();

Expand Down Expand Up @@ -872,7 +867,7 @@ namespace InputProcessor {

// NOTICE

// Copyright 1996-2014 The Board of Trustees of the University of Illinois
// Copyright © 1996-2014 The Board of Trustees of the University of Illinois
// and The Regents of the University of California through Ernest Orlando Lawrence
// Berkeley National Laboratory. All rights reserved.

Expand Down
23 changes: 2 additions & 21 deletions src/EnergyPlus/OutputProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <DataPrecisionGlobals.hh>
#include <DataStringGlobals.hh>
#include <DataSystemVariables.hh>
#include <DisplayRoutines.hh>
#include <General.hh>
#include <InputProcessor.hh>
#include <OutputProcessor.hh>
Expand Down Expand Up @@ -243,25 +242,7 @@ namespace OutputProcessor {
// UpdateDataandReport
// UpdateMeterReporting

// Function

std::string assignMtdFile(std::string& _MtdFileName){
DisplayString("== Module 'Output Processor'::Name of the output (mtd) file = " +_MtdFileName+ "\n");
DisplayString("====================================================================== \n\n");
return _MtdFileName;
}

std::string assignMddFile(std::string& _MddFileName){
DisplayString("== Module 'Output Processor'::Name of the output (mdd) file = " +_MddFileName+ "\n");
DisplayString("====================================================================== \n\n");
return _MddFileName;
}

std::string assignRddFile(std::string& _RddFileName){
DisplayString("== Module 'Output Processor'::Name of the output (rdd) file = " +_RddFileName+ "\n");
DisplayString("====================================================================== \n\n");
return _RddFileName;
}
// Functions

void
InitializeOutput()
Expand Down Expand Up @@ -8500,7 +8481,7 @@ AddToOutputVariableList(
}

// NOTICE
// Copyright � 1996-2014 The Board of Trustees of the University of Illinois
// Copyright � 1996-2014 The Board of Trustees of the University of Illinois
// and The Regents of the University of California through Ernest Orlando Lawrence
// Berkeley National Laboratory. All rights reserved.
// Portions of the EnergyPlus software package have been developed and copyrighted
Expand Down
4 changes: 0 additions & 4 deletions src/EnergyPlus/OutputProcessor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ namespace OutputProcessor {

extern int MaxNumSubcategories;

std::string assignMtdFile(std::string& _MtdFileName);
std::string assignMddFile(std::string& _MddFileName);
std::string assignRddFile(std::string& _RddFileName);

// All routines should be listed here whether private or not
//PUBLIC ReallocateTVar
//PUBLIC SetReportNow
Expand Down
37 changes: 3 additions & 34 deletions src/EnergyPlus/OutputReportTabular.cc
Original file line number Diff line number Diff line change
Expand Up @@ -408,36 +408,6 @@ namespace OutputReportTabular {
static gio::Fmt const fmtA( "(A)" );

// Functions
std::string outputFile;
std::string assignOFile(std::string& _OFileName){
DisplayString("== Module 'Output report tabular'::Name of the output file = "+_OFileName+ "\n");
DisplayString("====================================================================== \n\n");
return _OFileName;
}

std::string assignHtmFile(std::string& _HtmFileName){
DisplayString("== Module 'Output Report Tabular'::Name of the output (htm) file = " +_HtmFileName+ "\n");
DisplayString("====================================================================== \n\n");
return _HtmFileName;
}

std::string assignTabFile(std::string& _TabFileName){
DisplayString("== Module 'Output Report Tabular'::Name of the output (tab) file = " +_TabFileName+ "\n");
DisplayString("====================================================================== \n\n");
return _TabFileName;
}

std::string assignTxtFile(std::string& _TxtFileName){
DisplayString("== Module 'Output Report Tabular'::Name of the output (txt) file = " +_TxtFileName+ "\n");
DisplayString("====================================================================== \n\n");
return _TxtFileName;
}

std::string assignXmlFile(std::string& _XmlFileName){
DisplayString("== Module 'Output Report Tabular'::Name of the output (xml) file = " +_XmlFileName+ "\n");
DisplayString("====================================================================== \n\n");
return _XmlFileName;
}

void
UpdateTabularReports( int const IndexTypeKey ) // What kind of data to update (Zone, HVAC)
Expand Down Expand Up @@ -3141,9 +3111,9 @@ namespace OutputReportTabular {
curDel = del( iStyle );
if ( TableStyle( iStyle ) == tableStyleComma ) {
DisplayString( "Writing tabular output file results using comma format." );
{ IOFlags flags; flags.ACTION( "WRITE" ); gio::open( curFH, outputFile, flags ); write_stat = flags.ios(); }
{ IOFlags flags; flags.ACTION( "WRITE" ); gio::open( curFH, outputCsvFile, flags ); write_stat = flags.ios(); }
if ( write_stat != 0 ) {
ShowFatalError( "OpenOutputTabularFile: Could not open file (" + outputFile + ") for output (write)." );
ShowFatalError( "OpenOutputTabularFile: Could not open file (" + outputCsvFile + ") for output (write)." );
}
gio::write( curFH, fmtA ) << "Program Version:" + curDel + VerString;
gio::write( curFH, fmtLD ) << "Tabular Output Report in Format: " + curDel + "Comma";
Expand Down Expand Up @@ -4835,7 +4805,6 @@ namespace OutputReportTabular {
// report is added it can be added to the list here.

// Locals

int EchoInputFile; // found unit number for 'eplusout.audit'

FillWeatherPredefinedEntries();
Expand All @@ -4858,7 +4827,7 @@ namespace OutputReportTabular {
WriteTimeBinTables();
}
}
EchoInputFile = FindUnitNumber( CommandLineInterface::outputAuditFile );
EchoInputFile = FindUnitNumber( outputAuditFile );
gio::write( EchoInputFile, fmtLD ) << "MonthlyInputCount=" << MonthlyInputCount;
gio::write( EchoInputFile, fmtLD ) << "sizeMonthlyInput=" << sizeMonthlyInput;
gio::write( EchoInputFile, fmtLD ) << "MonthlyFieldSetInputCount=" << MonthlyFieldSetInputCount;
Expand Down
13 changes: 2 additions & 11 deletions src/EnergyPlus/OutputReportTabular.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ namespace EnergyPlus {

namespace OutputReportTabular {

extern std::string outputFile;
std::string assignOFile(std::string& _OFileName);
std::string assignHtmFile(std::string& _HtmFileName);
std::string assignTabFile(std::string& _TabFileName);
std::string assignTxtFile(std::string& _TxtFileName);
std::string assignXmlFile(std::string& _XmlFileName);

// Using/Aliasing

// Data
Expand Down Expand Up @@ -297,7 +290,6 @@ namespace OutputReportTabular {
extern std::string activeReportName;
extern std::string activeForName;
extern std::string prevReportName;


// SUBROUTINE SPECIFICATIONS FOR MODULE PrimaryPlantLoops
//PRIVATE DateToStr
Expand Down Expand Up @@ -732,7 +724,7 @@ namespace OutputReportTabular {
extern FArray1D< UnitConvType > UnitConv;

// Functions

void
UpdateTabularReports( int const IndexTypeKey ); // What kind of data to update (Zone, HVAC)

Expand All @@ -744,7 +736,6 @@ namespace OutputReportTabular {
//======================================================================================================================
//======================================================================================================================


void
GetInputTabularMonthly();

Expand Down Expand Up @@ -1072,7 +1063,7 @@ namespace OutputReportTabular {

// NOTICE

// Copyright � 1996-2014 The Board of Trustees of the University of Illinois
// Copyright � 1996-2014 The Board of Trustees of the University of Illinois
// and The Regents of the University of
// Berkeley National Laboratory. All rights reserved.

Expand Down
7 changes: 0 additions & 7 deletions src/EnergyPlus/OutputReports.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <DataGlobals.hh>
#include <DataHeatBalance.hh>
#include <DataPrecisionGlobals.hh>
#include <DisplayRoutines.hh>
#include <DataStringGlobals.hh>
#include <DataSurfaceColors.hh>
#include <DataSurfaces.hh>
Expand All @@ -30,12 +29,6 @@ namespace EnergyPlus {
using namespace CommandLineInterface;
static gio::Fmt const fmtLD( "*" );

std::string assignDxfFile(std::string& _DxfFileName){
DisplayString("== Module 'Output Reports'::Name of the output (dxf) file = " + _DxfFileName + "\n");
DisplayString("====================================================================== \n\n");
return _DxfFileName;
}

void
ReportSurfaces()
{
Expand Down
2 changes: 0 additions & 2 deletions src/EnergyPlus/OutputReports.hh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

namespace EnergyPlus {

std::string assignDxfFile(std::string& _DxfFileName);

void
ReportSurfaces();

Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/Psychrometrics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ namespace Psychrometrics {
Real64 AverageIterations;
std::string istring;

EchoInputFile = FindUnitNumber( CommandLineInterface::outputAuditFile );
EchoInputFile = FindUnitNumber( outputAuditFile );
if ( EchoInputFile == 0 ) return;
if ( any_gt( NumTimesCalled, 0 ) ) {
gio::write( EchoInputFile, fmtA ) << "RoutineName,#times Called,Avg Iterations";
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/ScheduleManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ namespace ScheduleManager {
Schedule( 0 ).ScheduleTypePtr = 0;
Schedule( 0 ).WeekSchedulePointer = 0;

UnitNumber = FindUnitNumber( CommandLineInterface::outputAuditFile );
UnitNumber = FindUnitNumber( outputAuditFile );
gio::write( UnitNumber, fmtLD ) << " Processing Schedule Input -- Start";

//!! Get Schedule Types
Expand Down
Loading

6 comments on commit 4f41f3d

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1277852-CommandLineInterface (nealkruis) - i386-Windows-7-VisualStudio-12: OK (903 of 906 tests passed)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1277852-CommandLineInterface (nealkruis) - Win64-Windows-7-VisualStudio-12: OK (903 of 906 tests passed)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1277852-CommandLineInterface (nealkruis) - x86_64-MacOS-10.9-clang: Tests Failed

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1277852-CommandLineInterface (nealkruis) - x86_64-Linux-Ubuntu-14.04-gcc-4.8: Build Failed

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1277852-CommandLineInterface (nealkruis) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: OK (0 of 0 tests passed)

Build Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1277852-CommandLineInterface (nealkruis) - x86_64-MacOS-10.9-clang-Debug: Tests Failed

Build Badge Test Badge

Please sign in to comment.