int main(int argc , char** argv){ x = atoi(argv[1]); y = atoi(argv[2]); dx = WIDTH / (x - 1); dy = HEIGHT / (y - 1); int countNodes = x * y , currentProc; voltage = new double*[countNodes + 1]; for(int i = 0 ; i < countNodes + 1 ; i++) voltage[i] = new double[1]; plate = createPlate(x , y , voltage); argThread* args = new argThread(); struct timeval begin; struct timeval end; struct timezone zone; gettimeofday(&begin, &zone); MPI_Init (&argc, &argv); MPI_Comm_size (MPI_COMM_WORLD, &countThreads); MPI_Comm_rank (MPI_COMM_WORLD, ¤tProc); MPI_Barrier(MPI_COMM_WORLD); int** intervals = createBlockOrder(&plate -> getOrder()[1] , y , x , countThreads); if(countThreads > 1){ Plate* plates; if(currentProc == 0) plates = new Plate(&plate -> getNodes()[intervals[0][0]] , intervals[1][1] - intervals[0][0]); else if(currentProc == countThreads - 1) plates = new Plate(&plate -> getNodes()[intervals[2 * currentProc - 1][0]] , intervals[2 * currentProc][1] - intervals[2 * currentProc - 1][0]); else plates = new Plate(&plate -> getNodes()[intervals[2 * currentProc - 1][0]] , intervals[2 * currentProc + 1][1] - intervals[2 * currentProc - 1][0]); args -> init(currentProc , plates , intervals[2 * currentProc][1] - intervals[2 * currentProc][0]); } else args -> init(0 , plate , intervals[0][1] - intervals[0][0]); MPI_Barrier(MPI_COMM_WORLD); action((void*)(args)); gettimeofday(&end, &zone); fprintf(stderr , "Time executing :: %lu on number of process %d\n" , end.tv_sec * 1000000 + end.tv_usec - begin.tv_usec - begin.tv_sec * 1000000 , countThreads); createScript(x , y , MaxToGnuPlot); MPI_Finalize(); delete args; delete plate; delete voltage; delete test; return 0; }
virtual Component createComponent(uint32_t type, const Entity& entity) { if (type == SCRIPT_HASH) { return createScript(entity); } return Component::INVALID; }
// Add a script to a list of DomScripts unless empty void QSimpleResource::addScript(const QString &script, ScriptSource source, DomScripts &domScripts) { if (DomScript *domScript = createScript(script, source)) { domScripts += domScript; } }
int main(){ cout<<"Allocating memory"<<endl; state** s = setUpStates(); vector<transition*> t; testSet ts, *prioSet=0, *extendSet=0, *multiextendSet=0; if(!clearWD()){ cerr<<"Error preping up WD\n"; return 1; } setUpTransitions(&t,s); printHeader("Traffic Lights FSM",OUT); printFml(s,&t,OUT); wrapUp(OUT); parseSpecs(s,&t,"specs",&ts); vector<transitionPair*> *tp=getTPairs(s,&t); cout<<"Test cases parsed.\nSelect operation to perform:\n"; cout<<"\t1 - Generate diagrams for the original test set\n"; cout<<"\t2 - Generate diagrams for the minimized test set using Priority Cull\n"; cout<<"\t3 - Generate diagrams for the minimized test set using Subgraph Cull\n"; cout<<"\t4 - Generate diagrams for the minimized test set using Multi-Stage Subgraph Cull\n"; cout<<"\t9 - Perform Stress Test\n"; cout<<"\t0 - Exit application\n"; cout<<"---------------------------------------------\n"; int option=0; cin>>option; float tpc=0; bool *selectedTestCases=0; int MAX_TESTS=0; switch(option){ case 1: ts.printTestSet(s,&t); cout<<"Test set size: "<<ts.getSize()<<endl; tpc=ts.computeTPairCoverage(tp); cout<<"Transition-Pair Coverage: "<<tpc*100<<"%"<<endl; selectedTestCases=ts.getSelectedCases(ts.getSize()); createScript(selectedTestCases, ts.getSize(), string(SCRIPT)); cout<<"---------------------------------------------\nJob Done.\n"; break; case 2: prioSet=ts.priorityCull(tp); prioSet->printTestSet(s,&t); cout<<"Original Test set size: "<<ts.getSize()<<endl; cout<<"Final Test set size: "<<prioSet->getSize()<<endl; tpc=prioSet->computeTPairCoverage(tp); cout<<"Transition-Pair Coverage: "<<tpc*100<<"%"<<endl; selectedTestCases=prioSet->getSelectedCases(ts.getSize()); createScript(selectedTestCases, ts.getSize(), string(SCRIPT)); cout<<"---------------------------------------------\nJob Done.\n"; break; case 3: extendSet=ts.subgraphCull(tp,s); extendSet->printTestSet(s,&t); cout<<"Original Test set size: "<<ts.getSize()<<endl; cout<<"Final Test set size: "<<extendSet->getSize()<<endl; tpc=extendSet->computeTPairCoverage(tp); cout<<"Transition-Pair Coverage: "<<tpc*100<<"%"<<endl; selectedTestCases=extendSet->getSelectedCases(ts.getSize()); createScript(selectedTestCases, ts.getSize(), string(SCRIPT)); cout<<"---------------------------------------------\nJob Done.\n"; break; case 4: multiextendSet=ts.multiStageSubgraphCull(tp,s); multiextendSet->printTestSet(s,&t); cout<<"Original Test set size: "<<ts.getSize()<<endl; cout<<"Final Test set size: "<<multiextendSet->getSize()<<endl; tpc=multiextendSet->computeTPairCoverage(tp); cout<<"Transition-Pair Coverage: "<<tpc*100<<"%"<<endl; selectedTestCases=multiextendSet->getSelectedCases(ts.getSize()); createScript(selectedTestCases, ts.getSize(), string(SCRIPT)); cout<<"---------------------------------------------\nJob Done.\n"; break; case 9: cout<<"Enter number of test cases: "; cin>>MAX_TESTS; stressTest(MAX_TESTS,10,tp,s); break; default: break; } cout<<"Freeing memory.."<<endl; tp->clear(); if(prioSet) delete prioSet; if(extendSet) delete extendSet; if(selectedTestCases) delete [] selectedTestCases; dropStates(s); cout<<"Exiting application.\n"; system("pause"); return 0; }