本文整理汇总了C++中Tools类的典型用法代码示例。如果您正苦于以下问题:C++ Tools类的具体用法?C++ Tools怎么用?C++ Tools使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tools类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: plotEwithFilter
//----------------------------------------//
// Vector potential plots
//----------------------------------------//
void plotEwithFilter(vector<TString> fnames,
vector<TString> lnames,
vector<float> scales)
{
// Hist attributes
TString xtitle = "frequency [Hz]";
TString ytitle = "|E(t)| [V/m]";
float xmin = -999;
float xmax = -999;
TString savename = "EwithFilter";
// Filter frequency
float fmin = 200e6;
float fmax = 400e6;
// Get Tool for FT
Tools* fttool = new Tools();
// Load the histograms that are of interest
vector<TH1F*> hists;
for(unsigned int i=0; i<fnames.size(); ++i){
TFile* file = new TFile(fnames.at(i));
TH1F* E_td = SummaryMag->getE(0);
TH1F* E_fd = fttool->getFTFD(E_td);
hists.push_back( fttool->getFTTD(E_td, E_fd, fmin, fmax) );
hists.back()->SetDirectory(0);
setHistAtt(hists.back(), xtitle, ytitle, m_colors[i], m_markers[i]);
hists.back()->Scale(scales.at(i));
file->Close();
}// end loading of histograms
plot(hists, lnames, savename, xmin, xmax, false);
}
示例2: AddTool
static int AddTool(lua_State *L) {
Tool* tool = (Tool*) lua_touserdata(L, -1);
Tools* t = App::getTools();
t->AddTool(tool);
lua_pop(L, 1);
return 0;
}
示例3: Tools
vector<lObjType> * Domain::getConstant(){
Tools tools = Tools();
vector<lObjType> * ret = new vector<lObjType>();
vector<Type*>* types_obj,temp2;
bool marq;
lObjType temp;
for (vector<Constant *>::iterator it_const=m_constants->begin(); it_const != m_constants->end() ; ++it_const){//each constant
types_obj= (*it_const)->getTypes();
if ( ret->size() != 0){
marq=true;
for(vector<lObjType>::iterator it_ret = ret->begin() ; it_ret != ret->end() ; ++it_ret){
temp2 =(*it_ret).getType();
if (tools.compareVectorType(&temp2,types_obj)){
(*it_ret).addObject( new Object( (*it_const)->getName(),*(*it_const)->getTypes() ));
marq=false;
}
}
if(marq) {
temp = lObjType(*(types_obj));
temp.addObject(new Object((*it_const)->getName(),*((*it_const)->getTypes())));
ret->push_back(temp);
}
} else {
temp = lObjType(*(types_obj));
temp.addObject(new Object((*it_const)->getName(),*((*it_const)->getTypes())));
ret->push_back(temp);
}
}
return ret;
}
示例4: toString
Job JobFactory::createEnergyPlusJob(
ToolInfo t_energyPlusTool,
const openstudio::path &t_idd,
const openstudio::path &t_idf,
const openstudio::path &t_epw,
const openstudio::path &t_outdir,
const boost::optional<openstudio::UUID> &t_uuid)
{
JobParams params;
params.append("outdir", toString(t_outdir));
Tools tools;
t_energyPlusTool.name = "energyplus";
tools.append(t_energyPlusTool);
Files files;
FileInfo idf(t_idf, "idf");
if (!t_idd.empty())
{
idf.addRequiredFile(t_idd,toPath("Energy+.idd"));
}
idf.addRequiredFile(t_epw, toPath("in.epw"));
files.append(idf);
return createEnergyPlusJob(tools, params, files, std::vector<openstudio::URLSearchPath>(), t_uuid);
}
示例5: main
int main(int argc, const char * argv[]) {
std::string path = "/Users/JamesGuo/git_master/Algorithms/kargerMinCut.txt";
std::vector<std::vector<int>> graph;
int row, column;
size_t minimum = 19900;
Tools tool;
graph = tool.readTxt(path);
for (size_t i = 0; i < 80000; i++) {
srand((unsigned int)time(NULL));
uGraph undirectedGraph(graph, 200);
while (undirectedGraph.nbVertices > 2) {
row = rand() % undirectedGraph.adjacencyList.size();
column = rand() % undirectedGraph.adjacencyList[row].size();
if (column == 0) {
column = 1;
}
undirectedGraph.Contraction(row, column);
//std::cout << undirectedGraph.nbVertices << std::endl;
}
if (minimum > undirectedGraph.minCut()) {
minimum = undirectedGraph.minCut();
}
//std::cout << i << std::endl;
}
std::cout << minimum << std::endl;
return 0;
}
示例6: TEST_F
TEST_F(RunManagerTestFixture, Workflow_ToWorkItems)
{
ToolInfo ti("tool", openstudio::toPath("somepath"));
Tools tis;
tis.append(ti);
JobParam param("param1");
JobParams params;
params.append(param);
FileInfo fi(openstudio::toPath("somefile.txt"), "txt");
Files fis;
fis.append(fi);
Workflow wf("null->energyplus");
wf.add(params);
wf.add(tis);
wf.add(fis);
std::vector<WorkItem> wis = wf.toWorkItems();
ASSERT_EQ(2u, wis.size());
EXPECT_EQ(JobType(JobType::Null), wis[0].type);
EXPECT_EQ(JobType(JobType::EnergyPlus), wis[1].type);
EXPECT_EQ(params, wis[0].params);
EXPECT_EQ(fis, wis[0].files);
EXPECT_EQ(tis, wis[0].tools);
EXPECT_TRUE(wis[1].params.params().empty());
EXPECT_TRUE(wis[1].files.files().empty());
EXPECT_TRUE(wis[1].tools.tools().empty());
}
示例7: AddToolFromJson
static int AddToolFromJson(lua_State *L) {
const char* json_path = lua_tostring(L,-1);
Tools* t = App::getTools();
t->AddToolFromJson(json_path);
lua_pop(L,1);
return 0;
}
示例8: UnActiveTool
static int UnActiveTool(lua_State *L) {
const char* name = lua_tostring(L,-1);
Tools* t = App::getTools();
t->UnActive(name);
lua_pop(L,1);
return 0;
}
示例9: plotFTE
//----------------------------------------//
// Vector potential plots
//----------------------------------------//
void plotFTE(vector<TString> fnames,
vector<TString> lnames,
vector<float> scales)
{
// Hist attributes
TString xtitle = "frequency [Hz]";
TString ytitle = "Arbitrary Units";
float xmin = 1e8;
float xmax = 3e9;
TString savename = "FTE";
// Get Tool for FT
Tools* fttool = new Tools();
// Load the histograms that are of interest
vector<TH1F*> hists;
for(unsigned int i=0; i<fnames.size(); ++i){
TFile* file = new TFile(fnames.at(i));
TH1F* E_td = SummaryZ->getE(0);
TH1F* E_fd = fttool->getFTFD(E_td);
hists.push_back( E_fd );
hists.back()->SetDirectory(0);
setHistAtt(hists.back(), xtitle, ytitle, m_colors[i], m_markers[i]);
hists.back()->Scale(scales.at(i));
hists.back()->SetLineWidth(2);
file->Close();
}// end loading of histograms
plot(hists, lnames, savename, xmin, xmax, true, true);
}
示例10: TEST_F
TEST_F(RunManagerTestFixture, ConfigOptionsTest)
{
using namespace openstudio;
using namespace openstudio::runmanager;
ConfigOptions co;
co.reset();
ToolVersion e1(5,4,2);
ToolVersion e2(3,2,1);
ToolVersion e3(3,1,2);
ToolVersion e4(2,7);
ToolVersion e5(2,7,1);
ToolVersion e6(2);
ToolVersion e7(8,4,2,"TAG");
ToolLocationInfo p1 = ToolLocationInfo(ToolType("EnergyPlus"), toPath("e1"));
ToolLocationInfo p2 = ToolLocationInfo(ToolType("EnergyPlus"), toPath("e2"));
ToolLocationInfo p3 = ToolLocationInfo(ToolType("EnergyPlus"), toPath("e3"));
ToolLocationInfo p4 = ToolLocationInfo(ToolType("EnergyPlus"), toPath("e4"));
ToolLocationInfo p5 = ToolLocationInfo(ToolType("EnergyPlus"), toPath("e5"));
ToolLocationInfo p6 = ToolLocationInfo(ToolType("EnergyPlus"), toPath("e6"));
ToolLocationInfo p7 = ToolLocationInfo(ToolType("EnergyPlus"), toPath("e7"));
co.setToolLocation(e6, p6);
co.setToolLocation(e5, p5);
co.setToolLocation(e3, p3);
co.setToolLocation(e1, p1);
co.setToolLocation(e4, p4);
co.setToolLocation(e2, p2);
co.setToolLocation(e7, p7);
// getEnergyPlus returns the most completely specified version of E+ that matches the passed
// in requirements
EXPECT_EQ(static_cast<size_t>(7), co.getToolLocations().size());
Tools tools = co.getTools();
EXPECT_EQ(tools.getTool("energyplus").version, e7);
EXPECT_EQ(tools.getTool("energyplus", e3).version, e3);
EXPECT_EQ(tools.getTool("energyplus", ToolVersion(3)).version, e2);
EXPECT_EQ(tools.getTool("energyplus", ToolVersion(3, 2)).version, e2);
EXPECT_EQ(tools.getTool("energyplus", ToolVersion(3, 1)).version, e3);
EXPECT_EQ(tools.getTool("energyplus", ToolVersion(2)).version, e5);
EXPECT_EQ(tools.getTool("energyplus", ToolVersion(8)).version, e7);
EXPECT_EQ(tools.getTool("energyplus", ToolVersion(8,4)).version, e7);
EXPECT_EQ(tools.getTool("energyplus", ToolVersion(8,4,2)).version, e7);
EXPECT_EQ(tools.getTool("energyplus", ToolVersion(8,4,2, "TAG")).version, e7);
EXPECT_EQ(tools.getTool("energyplus", ToolVersion(boost::none,boost::none,boost::none,boost::optional<std::string>("TAG"))).version, e7);
co.reset();
EXPECT_EQ(co.getToolLocations().size(), static_cast<size_t>(0));
}
示例11: new
Tools* Tools::create(WJLayerJson *layer, Snowman *snowman)
{
Tools* deco = new (std::nothrow) Tools();
if (deco && deco->init(layer, snowman))
{
deco->autorelease();
return deco;
}
CC_SAFE_DELETE(deco);
return NULL;
}
示例12: AddToolFromLua
static int AddToolFromLua(lua_State *L) {
const char* name = lua_tostring(L,-4);
const char* click = lua_tostring(L,-3);
const char* release = lua_tostring(L,-2);
const char* move = lua_tostring(L,-1);
LuaTool* tool = new LuaTool(name);
tool->set_mouse_click_lua_funcname(click);
tool->set_mouse_release_lua_funcname(release);
tool->set_mouse_move_lua_funcname(move);
lua_pop(L, 4);
Tools* t = App::getTools();
t->AddTool(tool);
return 0;
}
示例13: TEST_F
TEST_F(RunManagerTestFixture, JSON_workItem)
{
Tools tools;
tools.tools().push_back(ToolInfo("tool", ToolVersion(1,5,6, "TAG"),
openstudio::toPath("path1"),
boost::regex(".*")
));
Files files;
files.files().push_back(FileInfo("filename",
openstudio::DateTime::now(),
"key",
openstudio::toPath("fullpath"),
true));
files.files()[0].addRequiredFile(QUrl("url"), openstudio::toPath("target"));
JobParams params;
params.append("key", "value");
WorkItem wi(JobType::EnergyPlus,
tools,
params,
files,
"keyname");
std::string json = wi.toJSON();
EXPECT_FALSE(json.empty());
openstudio::runmanager::WorkItem wi2 = WorkItem::fromJSON(json);
EXPECT_EQ(wi2.type, JobType::EnergyPlus);
EXPECT_EQ(wi2.tools, tools);
EXPECT_EQ(wi2.params, params);
EXPECT_EQ(wi2.files, files);
EXPECT_EQ(wi2.jobkeyname, "keyname");
std::string json2 = wi2.toJSON();
EXPECT_EQ(json, json2);
}
示例14: project_verify
void project_verify(Project& project, Tools& tools)
{
#if 0
for(Project::iterator i = project.begin(); i != project.end(); ++i)
{
Build& build = (*i).second;
for(Build::iterator j = build.begin(); j != build.end(); ++j)
{
Tools::iterator k = tools.find((*j).first);
if(k == g_build_tools.end())
{
build_error_undefined_tool((*i).first.c_str(), (*j).first.c_str());
}
}
}
#endif
}
示例15: Tools
void GameAttributes::writeAttributes(std::ofstream *out)
{
Tools t = Tools();
*out << "INNINGS=" << innings << std::endl;
*out << "EXTRAS=" << t.boolToString(extras) << std::endl;
*out << "BUNTING=" << t.boolToString(bunt) << std::endl;
*out << "HBP=" << t.boolToString(hbp) << std::endl;
*out << "STEALING=" << t.boolToString(stealing) << std::endl;
*out << "BALKS=" << t.boolToString(balks) << std::endl;
*out << "BALLS=" << startingBalls << std::endl;
*out << "STRIKES=" << startingStrikes << std::endl;
*out << "PLAYERS=" << players << std::endl;
*out << "SUBS=" << subs << std::endl;
}