当前位置: 首页>>代码示例>>C++>>正文


C++ openstudio::toPath方法代码示例

本文整理汇总了C++中openstudio::toPath方法的典型用法代码示例。如果您正苦于以下问题:C++ openstudio::toPath方法的具体用法?C++ openstudio::toPath怎么用?C++ openstudio::toPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openstudio的用法示例。


在下文中一共展示了openstudio::toPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: resourcesPath

TEST(Table, Serialization)
{
  // construct table
  openstudio::path p = resourcesPath()/toPath("utilities/Table/EUI.csv");
  Table table = Table::load(p);
  table.setTitle("EUIs");
  table.setCaption("EUIs of several buildings");
  table.setNHead(2);
  table.setNLeft(2);
  p = resourcesPath()/toPath("utilities/Table/EUI.ost");

  // serialize
  openstudio::Time start = openstudio::Time::currentTime();
  table.save(p);
  openstudio::Time totalTime = openstudio::Time::currentTime() - start;
  LOG_FREE(Info, "openstudio.Table", "Time to serialize a small table = " << totalTime);

  // [email protected] Uncommenting this line results in a compiler error that I haven't been
  // able to debug.
  // OptionalTable ot;

  // deserialize
  start = openstudio::Time::currentTime();
  Table loaded = Table::load(p);
  totalTime = openstudio::Time::currentTime() - start;
  LOG_FREE(Info, "openstudio.Table", "Time to deserialize a small table = " << totalTime);
  ASSERT_EQ(static_cast<unsigned>(10),loaded.nRows());
  ASSERT_EQ(static_cast<unsigned>(6),loaded.nCols());
  std::stringstream ss;
  ss << std::fixed << std::setprecision(0) << table[2][2];
  EXPECT_EQ("120",ss.str()); ss.str("");
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:32,代码来源:Table_GTest.cpp

示例2: resourcesPath

TEST_F(CoreFixture, Path_CompletePathToFile)
{
  path p = resourcesPath()/toPath("energyplus/5ZoneAirCooled/eplusout");
  path result = completePathToFile(p,path(),"sql");
  logBeforeAndAfterPathInformation("completePathToFile with ext=\"sql\"",p,result);
  path tmp = p.replace_extension(toPath("sql").string());
  EXPECT_TRUE(result == tmp);

  p = toPath("energyplus/5ZoneAirCooled/eplusout");
  path base = resourcesPath();
  result = completePathToFile(p,base,"sql");
  logBeforeAndAfterPathInformation("completePathToFile with base=resourcesPath() and ext=\"sql\"",p,result);
  EXPECT_TRUE(result == tmp);

  p = resourcesPath()/toPath("energyplus/5ZoneAirCooled.idf");
  result = completePathToFile(p,path(),"sql",true);
  logBeforeAndAfterPathInformation("completePathToFile with ext=\"sql\"",p,result);
  EXPECT_TRUE(result.empty());

  p = resourcesPath()/toPath("energyplus/5ZoneAirCooled");
  result = completePathToFile(p);
  logBeforeAndAfterPathInformation("completePathToFile",p,result);
  EXPECT_TRUE(result.empty());
  
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:25,代码来源:Path_GTest.cpp

示例3: watcher

TEST_F(CoreFixture, PathWatcher_Dir)
{
  Application::instance().application();

  openstudio::path path = toPath("./");
  ASSERT_TRUE(boost::filesystem::exists(path));

  openstudio::path filePath = toPath("./PathWatcher_Dir");
  if (boost::filesystem::exists(filePath)){
    boost::filesystem::remove(filePath);
  }
  ASSERT_FALSE(boost::filesystem::exists(filePath));

  TestPathWatcher watcher(path);
  EXPECT_FALSE(watcher.changed);

  EXPECT_EQ(path.string(), watcher.path().string());

  // catches the file addition
  TestFileWriter w1(filePath, "test 1"); w1.start(); 
  while (!w1.isFinished()){  
    // do not call process events
    QThread::yieldCurrentThread();
  }
  EXPECT_TRUE(boost::filesystem::exists(filePath));

  // calls processEvents
  System::msleep(10);

  EXPECT_TRUE(watcher.changed);
  watcher.changed = false;
  EXPECT_FALSE(watcher.changed);

  // does not catch changes to the file
  TestFileWriter w2(filePath, "test 2"); w2.start(); 
  while (!w2.isFinished()){  
    // do not call process events
    QThread::yieldCurrentThread();
  }
  EXPECT_TRUE(boost::filesystem::exists(filePath));

  // calls processEvents
  System::msleep(10);

  EXPECT_FALSE(watcher.changed);
  
  // catches file removal
  TestFileRemover r1(filePath); r1.start();
  while (!r1.isFinished()){  
    // do not call process events
    QThread::yieldCurrentThread();
  }
  EXPECT_FALSE(boost::filesystem::exists(filePath));

  // calls processEvents
  System::msleep(10);

  EXPECT_TRUE(watcher.changed);
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:59,代码来源:PathWatcher_GTest.cpp

示例4: resourcesPath

TEST(EEFG, DummyTest)
{
  openstudio::path iddPath = resourcesPath()/toPath("eefg/dummy.idd");

  openstudio::path idfPath = resourcesPath()/toPath("eefg/dummy.idf");
  openstudio::path outPath = resourcesPath()/toPath("eefg/eefg.idf");
  eefgValidateIdf(toString(iddPath).c_str(), toString(idfPath).c_str(), toString(outPath).c_str());
}
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:8,代码来源:Eefg_GTest.cpp

示例5: toPath

TEST_F(CoreFixture, Path_RelativePathToFile) 
{
  path relPath = toPath("energyplus/5ZoneAirCooled/eplusout.sql");
  path fullPath = resourcesPath() / relPath;
  EXPECT_EQ(toString(relPath),toString(relativePath(fullPath,resourcesPath())));

  EXPECT_EQ("eplusout.sql",toString(relativePath(relPath,toPath("energyplus/5ZoneAirCooled/"))));
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:8,代码来源:Path_GTest.cpp

示例6: SetUpTestCase

void SqlFileFixture::SetUpTestCase()
{
  logFile = FileLogSink(toPath("./SqlFileFixture.log"));
  logFile->setLogLevel(Debug);

  openstudio::path path;
  path = resourcesPath()/toPath("energyplus/5ZoneAirCooled/eplusout.sql");
  sqlFile = openstudio::SqlFile(path);
  ASSERT_TRUE(sqlFile.connectionOpen());
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:10,代码来源:SqlFileFixture.cpp

示例7: SetUpTestCase

void ProjectFixture::SetUpTestCase() {
  // set up logging
  logFile = FileLogSink(toPath("./ProjectFixture.log"));
  logFile->setLogLevel(Info);
  openstudio::Logger::instance().standardOutLogger().disable();

  // set up data folder
  if (!boost::filesystem::exists(toPath("ProjectFixtureData"))) {
    boost::filesystem::create_directory(toPath("ProjectFixtureData"));
  }

}
开发者ID:pepsi7959,项目名称:OpenStudio,代码行数:12,代码来源:ProjectFixture.cpp

示例8: fileReference

TEST(FileReference,Constructor) {
  FileReference fileReference(resourcesPath() / toPath("energyplus/5ZoneAirCooled/dummyname.osm"));
  EXPECT_TRUE(fileReference.fileType() == FileReferenceType::OSM);

  fileReference = FileReference(resourcesPath() / toPath("energyplus/5ZoneAirCooled/eplusout.sql"));
  EXPECT_TRUE(fileReference.fileType() == FileReferenceType::SQL);

  fileReference = FileReference(resourcesPath() / toPath("energyplus/5ZoneAirCooled/in.epw"));
  EXPECT_TRUE(fileReference.fileType() == FileReferenceType::EPW);

  fileReference = FileReference(resourcesPath() / toPath("energyplus/5ZoneAirCooled/in.idf"));
  EXPECT_TRUE(fileReference.fileType() == FileReferenceType::IDF);
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:13,代码来源:FileReference_GTest.cpp

示例9: FileLogSink

void EnergyPlusFixture::SetUpTestCase() {
  // set up logging
  logFile = FileLogSink(toPath("./EnergyPlusFixture.log"));
  logFile->setLogLevel(Debug);
  openstudio::Logger::instance().standardOutLogger().disable();

  // initialize component paths
  openstudio::path basePath = resourcesPath()/openstudio::toPath("energyplus/Components/");
  // idfComponents consists of .first = path to directory, .second = component type
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_roof_1"),"roof"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_roof_2"),"roof"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_roof_3"),"roof"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_roof_4"),"roof"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_roof_5"),"roof"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_designday_1"),"designday"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_designday_2"),"designday"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_designday_3"),"designday"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_designday_4"),"designday"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_designday_5"),"designday"));

  // delete translated components
  BOOST_FOREACH(const ComponentDirectoryAndType& idfComponent,idfComponents) {
    // delete any *.osc and oscomponent.xml files in the directory
    for (openstudio::directory_iterator it(idfComponent.first), itEnd; it != itEnd; ++it) {
      if (boost::filesystem::is_regular_file(it->status())) {
        std::string ext = openstudio::toString(boost::filesystem::extension(*it));
        if (ext == ".osc") { boost::filesystem::remove(it->path()); }
        if ((ext == ".xml") && (openstudio::toString(it->filename()) == "oscomponent")) { 
          boost::filesystem::remove(it->path()); 
        }
      }
    } // for iterator over directory
  } // foreach component

}
开发者ID:CraigCasey,项目名称:OpenStudio,代码行数:35,代码来源:EnergyPlusFixture.cpp

示例10: resourcesPath

TEST(Checksum, Paths)
{
  // read a file, contents are "Hi there"
  path p = resourcesPath() / toPath("utilities/Checksum/Checksum.txt");
  EXPECT_EQ("1AD514BA", checksum(p));

  // read a file, contents are "Hi there\r\nGoodbye" on Windows and "Hi there\nGoodbye" otherwise
  p = resourcesPath() / toPath("utilities/Checksum/Checksum2.txt");
  EXPECT_EQ("17B88D3A", checksum(p));

  // checksum of a directory is "00000000"
  p = resourcesPath() / toPath("utilities/Checksum/");
  EXPECT_EQ("00000000", checksum(p));

  // if can't find file return "00000000"
  p = resourcesPath() / toPath("utilities/Checksum/NotAFile.txt");
  EXPECT_EQ("00000000", checksum(p));
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:18,代码来源:Checksum_GTest.cpp

示例11: SetUpTestCase

void SqlFileLargeFixture::SetUpTestCase()
{
  openstudio::Logger::instance().disableStandardOut();
  openstudio::Logger::instance().logLevel(Debug);
  logFile = openstudio::Logger::instance().addLogFile(openstudio::toPath("./SqlFileLargeFixture.log"));

  openstudio::path path;
  path = resourcesPath()/toPath("utilities/eplusout.sql");
  sqlFile = openstudio::SqlFile(path);
  ASSERT_TRUE(sqlFile.connectionOpen());
}
开发者ID:airguider,项目名称:OpenStudio,代码行数:11,代码来源:SqlFileLargeFixture.cpp

示例12: toPath

openstudio::project::ProjectDatabase ProjectFixture::getDatabase(
    const std::string& projectDatabaseName,
    bool getCleanDatabase)
{
  openstudio::path projectDir = toPath("ProjectFixtureData") / toPath(projectDatabaseName);
  if (getCleanDatabase) {
    boost::filesystem::remove_all(projectDir);
  }
  if (!boost::filesystem::exists(projectDir)) {
    boost::filesystem::create_directory(projectDir);
    databaseDirs.push_back(projectDir);
  }

  openstudio::path runPath = projectDir / toPath("run.db");
  openstudio::path projectPath = projectDir / toPath("project.osp");

  openstudio::runmanager::RunManager runManager(runPath, true, false, false);
  openstudio::project::ProjectDatabase database(projectPath, runManager, getCleanDatabase);

  return database;
}
开发者ID:pepsi7959,项目名称:OpenStudio,代码行数:21,代码来源:ProjectFixture.cpp

示例13: Time

TEST(AnnotatedTimeline, StockPrices)
{
  // make two time series with random data
  unsigned N = 1000;
  TimeSeries t1(Date::currentDate(), Time(0,1), cumsum(randVector(-1,1.1,N), 100), "pesos");
  TimeSeries t2(Date::currentDate(), Time(0,1), cumsum(randVector(-1,1.1,N)), "dollars");

  AnnotatedTimeline::Ptr timeline = AnnotatedTimeline::create();
  timeline->addTimeSeries("Mexican Stocks", t1);
  timeline->addTimeSeries("US Stocks", t2);
  timeline->save(toPath("./StockPrices.htm"));
}
开发者ID:airguider,项目名称:OpenStudio,代码行数:12,代码来源:AnnotatedTimeline_GTest.cpp

示例14: SetUpTestCase

void DocumentFixture::SetUpTestCase() {
  // set up logging
  logFile = FileLogSink(toPath("./DocumentFixture.log"));
  logFile->setLogLevel(Info);

  // set up doc
  doc.setTitle("Excerpt from 2009 Grocery TSD");
  doc.addAuthor("Matthew Leach");
  doc.addAuthor("Elaine Hale");
  doc.addAuthor("Adam Hirsch");
  doc.addAuthor("Paul Torcellini");
  doc.setTopHeadingLevel(1u);
  Section section = doc.appendSection("Building Economic Parameters");
  Text txt;
  std::stringstream ss;
  ss << "Our statement of work mandates that the design recommendations be analyzed for cost "
     << "effectiveness based on a five-year analysis period, which is assumed acceptable to a "
     << "majority of developers and owners. The other basic economic parameters required for the "
     << "5-TLCC calculation were taken from RSMeans and the Office of Management and Budget "
     << "(OMB) (CITATIONS).";
  txt.append(ss.str()); ss.str("");
  ss << "This analysis uses the real discount rate, which accounts for the projected rate of "
     << "general inflation found in the Report of the President's Economic Advisors, Analytical "
     << "Perpectives, and is equal to 2.3% for a five-year analysis period (CITATION). By using "
     << "this rate, we do not have to explicitly account for energy and product inflation rates.";
  txt.append(ss.str()); ss.str("");
  ss << "Regional capital cost modifiers are used to convert national averages to regional "
     << "values. These are available from the RSMeans data sets and are applied before any of the "
     << "additional fees listed in TABLE REF, three of which are also provided by RSMeans "
     << "(CITATION).";
  txt.append(ss.str()); ss.str("");
  Table tbl;
  tbl.setTitle("Economic Parameter Values");
  std::vector<std::string> row;
  row.push_back("Economic Parameter");
  row.push_back("Value");
  row.push_back("Data Source");
  tbl.appendRow(row);
  tbl.setNHead(1);
  row[0] = "Analysis Period";            row[1] = "5 Years"; row[2] = "DOE";        tbl.appendRow(row);
  row[0] = "Discount Rate";              row[1] = "2.3%";    row[2] = "OMB";        tbl.appendRow(row);
  row[0] = "O&M Cost Inflation";         row[1] = "0%";      row[2] = "OMB";        tbl.appendRow(row);
  row[0] = "Gas Cost Inflation";         row[1] = "0%";      row[2] = "OMB";        tbl.appendRow(row);
  row[0] = "Electricity Cost Inflation"; row[1] = "0%";      row[2] = "OMB";        tbl.appendRow(row);
  row[0] = "Bond Fee";                   row[1] = "10%";     row[2] = "RSMeans";    tbl.appendRow(row);
  row[0] = "Contractor Fee";             row[1] = "10%";     row[2] = "RSMeans";    tbl.appendRow(row);
  row[0] = "Contingency Fee";            row[1] = "12%";     row[2] = "RSMeans";    tbl.appendRow(row);
  row[0] = "Commissioning Fee";          row[1] = "0.5%";    row[2] = "Assumption"; tbl.appendRow(row);
  section.append(txt);
  section.append(tbl);
}
开发者ID:airguider,项目名称:OpenStudio,代码行数:51,代码来源:DocumentFixture.cpp

示例15: SetUpTestCase

// initialize static members
void UnitsFixture::SetUpTestCase() 
{
  logFile = FileLogSink(toPath("./UnitsFixture.log"));
  logFile->setLogLevel(Debug);
  Logger::instance().standardOutLogger().disable();
  
  tol = 1.0E-8;

  openstudio::DoubleVector vals = openstudio::toStandardVector(openstudio::randVector(0.0,1000.0,8760u));
  openstudio::Unit u = openstudio::createSIPower();
  for (double val : vals) {
    testQuantityVector.push_back(openstudio::Quantity(val,u));
  }
  testOSQuantityVector = openstudio::OSQuantityVector(u,vals);
}
开发者ID:pepsi7959,项目名称:OpenStudio,代码行数:16,代码来源:UnitsFixture.cpp


注:本文中的openstudio::toPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。