TreeNode* Convert(TreeNode* pRootOfTree) { g(pRootOfTree); return head; }
int foomain(int argc, char **argv) { I e(4); I g(5); int i; int &j = i; #pragma omp parallel sections lastprivate // expected-error {{expected '(' after 'lastprivate'}} { foo(); } #pragma omp parallel sections lastprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} { foo(); } #pragma omp parallel sections lastprivate() // expected-error {{expected expression}} { foo(); } #pragma omp parallel sections lastprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} { foo(); } #pragma omp parallel sections lastprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} { foo(); } #pragma omp parallel sections lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} { foo(); } #pragma omp parallel sections lastprivate(argc) { foo(); } #pragma omp parallel sections lastprivate(S1) // expected-error {{'S1' does not refer to a value}} { foo(); } #pragma omp parallel sections lastprivate(a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}} { foo(); } #pragma omp parallel sections lastprivate(argv[1]) // expected-error {{expected variable name}} { foo(); } #pragma omp parallel sections lastprivate(e, g) // expected-error 2 {{calling a private constructor of class 'S4'}} { foo(); } #pragma omp parallel sections lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}} { foo(); } #pragma omp parallel sections linear(i) // expected-error {{unexpected OpenMP clause 'linear' in directive '#pragma omp parallel sections'}} { foo(); } #pragma omp parallel { int v = 0; int i; #pragma omp parallel sections lastprivate(i) { foo(); } v += i; } #pragma omp parallel shared(i) #pragma omp parallel private(i) #pragma omp parallel sections lastprivate(j) { foo(); } #pragma omp parallel sections lastprivate(i) { foo(); } return 0; }
int main(int argc, char **argv) { const int d = 5; const int da[5] = { 0 }; S4 e(4); S5 g(5); int i; int &j = i; int *k = &j; S6<int> m; int x; int y; int to, tofrom, always; const int (&l)[5] = da; #pragma omp target data map // expected-error {{expected '(' after 'map'}} expected-error {{expected at least one 'map' or 'use_device_ptr' clause for '#pragma omp target data'}} #pragma omp target data map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} #pragma omp target data map() // expected-error {{expected expression}} #pragma omp target data map(alloc) // expected-error {{use of undeclared identifier 'alloc'}} #pragma omp target data map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}} #pragma omp target data map(to:) // expected-error {{expected expression}} #pragma omp target data map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} #pragma omp target data map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} #pragma omp target map(x) foo(); #pragma omp target map(to: x) foo(); #pragma omp target map(to: to) foo(); #pragma omp target map(to) foo(); #pragma omp target map(to, x) foo(); #pragma omp target data map(to x) // expected-error {{expected ',' or ')' in 'map' clause}} #pragma omp target data map(tofrom: argc > 0 ? argv[1] : argv[2]) // expected-error {{xpected expression containing only member accesses and/or array sections based on named variables}} #pragma omp target data map(argc) #pragma omp target data map(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}} #pragma omp target data map(argv[1]) #pragma omp target data map(ba) // expected-error 2 {{type 'S2' is not mappable to target}} #pragma omp target data map(ca) #pragma omp target data map(da) #pragma omp target data map(S2::S2s) #pragma omp target data map(S2::S2sc) #pragma omp target data map(e, g) #pragma omp target data map(h) // expected-error {{threadprivate variables are not allowed in 'map' clause}} #pragma omp target data map(k), map(k) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}} #pragma omp target map(k), map(k[:5]) // expected-error {{pointer cannot be mapped along with a section derived from itself}} expected-note {{used here}} foo(); #pragma omp target data map(da) #pragma omp target map(da[:4]) foo(); #pragma omp target data map(k, j, l) // expected-note {{used here}} #pragma omp target data map(k[:4]) // expected-error {{pointer cannot be mapped along with a section derived from itself}} #pragma omp target data map(j) #pragma omp target map(l) map(l[:5]) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}} foo(); #pragma omp target data map(k[:4], j, l[:5]) // expected-note {{used here}} #pragma omp target data map(k) // expected-error {{pointer cannot be mapped along with a section derived from itself}} #pragma omp target data map(j) #pragma omp target map(l) foo(); #pragma omp target data map(always, tofrom: x) #pragma omp target data map(always: x) // expected-error {{missing map type}} #pragma omp target data map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always'}} expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} #pragma omp target data map(always, tofrom: always, tofrom, x) #pragma omp target map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}} foo(); #pragma omp target private(j) map(j) // expected-error {{private variable cannot be in a map clause in '#pragma omp target' directive}} expected-note {{defined as private}} {} #pragma omp target firstprivate(j) map(j) // expected-error {{firstprivate variable cannot be in a map clause in '#pragma omp target' directive}} expected-note {{defined as firstprivate}} {} #pragma omp target map(m) // expected-error {{type 'S6<int>' is not mappable to target}} {} return tmain<int, 3>(argc)+tmain<from, 4>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<int, 4>' requested here}} }
void f(int *f) { if(f == (void *)0) // CHECK: !/warn/ g(); }
void server_base::handle_message(send_function send_fn, boost::function<void(client_info&)> close_fn, boost::function<socket_info&(void)> socket_info_fn, int session_id, const variant& msg) { const std::string& type = msg["type"].as_string(); if(session_id == -1) { if(type == "create_game") { game_info_ptr g(create_game(msg)); if(!g) { send_fn(json::parse("{ \"type\": \"create_game_failed\" }")); return; } send_fn(json::parse(formatter() << "{ \"type\": \"game_created\", \"game_id\": " << g->game_state->game_id() << " }")); status_change(); return; } else if(type == "get_status") { const int last_status = msg["last_seen"].as_int(); if(last_status == status_id_) { status_fns_.push_back(send_fn); } else { send_fn(create_lobby_msg()); } return; } else if(type == "get_server_info") { send_fn(get_server_info()); return; } else { std::map<variant,variant> m; m[variant("type")] = variant("unknown_message"); m[variant("msg_type")] = variant(type); send_fn(variant(&m)); return; } } if(type == "observe_game") { fprintf(stderr, "ZZZ: RECEIVE observe_game\n"); const int id = msg["game_id"].as_int(-1); const std::string user = msg["user"].as_string(); game_info_ptr g; foreach(const game_info_ptr& gm, games_) { if(id == -1 || gm->game_state->game_id() == id) { g = gm; break; } } if(!g) { fprintf(stderr, "ZZZ: SEND unknown_game\n"); send_fn(json::parse("{ \"type\": \"unknown_game\" }")); return; } if(clients_.count(session_id)) { fprintf(stderr, "ZZZ: SEND reuse_ssoin_id\n"); send_fn(json::parse("{ \"type\": \"reuse_session_id\" }")); return; } client_info& cli_info = clients_[session_id]; cli_info.user = user; cli_info.game = g; cli_info.nplayer = -1; cli_info.last_contact = nheartbeat_; cli_info.session_id = session_id; g->clients.push_back(session_id); send_fn(json::parse(formatter() << "{ \"type\": \"observing_game\" }")); fprintf(stderr, "ZZZ: RESPONDED TO observe_game\n"); return; }
Fl_Color Fl_Color_Chooser::value() const { Fl_Color ret = fl_rgb(uchar(255*r()+.5f), uchar(255*g()+.5f), uchar(255*b()+.5f)); return (ret ? ret : (Fl_Color)FL_BLACK); }
int main () { g (0x1234567887654321ll); return 0; }
//================================================================================================ void multithreadLBFGS::calculateDataTermOneRegion(const mylib::Region* regionP,const mylib::Array* imTarget,const mylib::Array** imTargetDer,const mylib::uint16* imSourcePtr,const double* x,const float *scale,double deltaHdataTerm,double &fAux,double* gAux) { #ifndef INTERP_TRILINEAR #define INTERP_TRILINEAR //decides the kind of interpolation we want #endif //calculate data term (value and gradient) by exploring every voxel in the supervoxel /* * TODO: calculate derivatives at any point using bicubic interpolation (it requires a lot of memory.Approx. x8 imageSize) * If anytime you decide to implement it look at paper * [1] F. Lekien and J. Marsden, ÒTricubic interpolation in three dimensions,Ó International Journal for Numerical Methods in Engineering, vol. 63, no. 3, pp. 455-471, May 2005. * There is code at http://ece5470project.jasondsouza.org/programs that has been saved at ./interpolation */ mylib::Size_Type k; mylib::Indx_Type p; double auxI,der,f; int ndims=imTarget->ndims; mylib::Coordinate *c=mylib::Make_Array(mylib::PLAIN_KIND,mylib::DIMN_TYPE,1,&ndims); memset(gAux,0,sizeof(double)*(ndims)); fAux=0.0; #ifdef INTERP_TRILINEAR double* df=new double[ndims]; double* xx=new double[ndims]; #endif #if defined(INTERP_NEAREST_NEIGH) //nearest neighbor displacement (can be precomputed since it will be the same for each voxel in the same region) uvw= mylib::Indx_Type(x(numPpos+1))+imTarget->dims[0]*(mylib::Indx_Type(x(numPpos+2))+imTarget->dims[1]*mylib::Indx_Type(x(numPpos+3))); for (k = 0; k < regionP->rastlen; k+=2) for (p = regionP->raster[k]; p <= regionP->raster[k+1]; p++)//perform computation on voxel p { //nearest neighbor interpolation pTarget=max(mylib::Indx_Type(0),p+uvw); pTarget=min(pTarget,imTarget->size-1); auxI=(double)((imTargetPtr[pTarget]))-(double)((imSourcePtr[p])); HuberCostAndDer(auxI,deltaHdataTerm,fAux,gAux); f+=fAux; g(numPpos+1)+=gAux*imTarget_dxPtr[pTarget];//nearest neighbor interpolation of derivative g(numPpos+2)+=gAux*imTarget_dyPtr[pTarget];//nearest neighbor interpolation of derivative g(numPpos+3)+=gAux*imTarget_dzPtr[pTarget];//nearest neighbor interpolation of derivative //-----------------------------------debug------------------------------------------------------------ /* //cout<<pTarget<<" "<<p<<" "<<auxI<<" "<<fAux<<" "<<" "<<gAux<<" "<<imTarget_dxPtr[pTarget]<<" "<<imTarget_dyPtr[pTarget]<<" "<<imTarget_dzPtr[pTarget]<<";"<<endl; mylib::Coordinate *tt=mylib::Idx2CoordA(imTarget,pTarget); cout<<pTarget<<" "<<p<<" "<<auxI<<" "<<fAux<<" "<<" "<<gAux<<" "<<imTarget_dxPtr[pTarget]<<" "<<imTarget_dyPtr[pTarget]<<" "<<imTarget_dzPtr[pTarget]<<" "; cout<<((mylib::Dimn_Type*)(tt->data))[0]+1<<" "<<((mylib::Dimn_Type*)(tt->data))[1]+1<<" "<<((mylib::Dimn_Type*)(tt->data))[2]+1<<";"<<endl;//matlab indexes */ //------------------------------------------------------ } #elif defined(INTERP_TRILINEAR) for (k = 0; k < regionP->rastlen; k+=2) { p = regionP->raster[k]; mylib::Coordinate* coord=coord4idx(imTarget->ndims,imTarget->dims, p, "Hola"); mylib::Dimn_Type* coordPtr=((mylib::Dimn_Type*)(coord->data)); int dimIdx=0; for (; p <= regionP->raster[k+1]; p++)//perform computation on voxel p { for(int aa=0;aa<ndims;aa++) xx[aa]=coordPtr[aa]+x[aa]; int err=trilinearInterpolation(xx,scale,imTarget,imTargetDer,auxI,df,c);//cubic interpolation if(err>0) exit(err); if(auxI<-1e31) continue;//flow out of bounds auxI-=(double)((imSourcePtr[p])); HuberCostAndDer(auxI,deltaHdataTerm,f,der); fAux+=f; for(int aa=0;aa<ndims;aa++) gAux[aa]+=der*df[aa]; //increase coordinate counter dimIdx=0; while(dimIdx<ndims) { coordPtr[dimIdx]++; if(coordPtr[dimIdx]<imTarget->dims[dimIdx]) break; else coordPtr[dimIdx]=0; dimIdx++; } //-----------------------------------debug------------------------------------------------------------ /* //cout<<pTarget<<" "<<p<<" "<<auxI<<" "<<fAux<<" "<<" "<<gAux<<" "<<imTarget_dxPtr[pTarget]<<" "<<imTarget_dyPtr[pTarget]<<" "<<imTarget_dzPtr[pTarget]<<";"<<endl; mylib::Coordinate *tt=mylib::Idx2CoordA(imTarget,pTarget); cout<<pTarget<<" "<<p<<" "<<auxI<<" "<<fAux<<" "<<" "<<gAux<<" "<<df[0]<<" "<<df[1]<<" "<<df[2]<<" "; cout<<((mylib::Dimn_Type*)(tt->data))[0]+1<<" "<<((mylib::Dimn_Type*)(tt->data))[1]+1<<" "<<((mylib::Dimn_Type*)(tt->data))[2]+1<<";"<<endl;//matlab indexes */ //------------------------------------------------------ } mylib::Free_Array(coord); } delete[] xx; delete[] df; #endif mylib::Free_Array(c); }
int main(int argc, char **argv) { const int d = 5; const int da[5] = { 0 }; S4 e(4); S5 g(5); int i; int &j = i; #pragma omp target #pragma omp teams distribute parallel for shared // expected-error {{expected '(' after 'shared'}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared () // expected-error {{expected expression}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared (argc) for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared (S1) // expected-error {{'S1' does not refer to a value}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared (a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared (argv[1]) // expected-error {{expected variable name}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared(ba) for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared(ca) for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared(da) for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared(e, g) for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be shared}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for private(i), shared(i) // expected-error {{private variable cannot be shared}} expected-note {{defined as private}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for firstprivate(i), shared(i) // expected-error {{firstprivate variable cannot be shared}} expected-note {{defined as firstprivate}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for private(i) for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared(i) for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for shared(j) for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for firstprivate(i) for (int j=0; j<100; j++) foo(); return 0; }
double addmul_sse() { long long ii; double res; double mul=1.00001; Vec2d a(0.1, 0.2); Vec2d b(0.3, 0.4); Vec2d c(0.5, 0.6); Vec2d d(0.7, 0.8); Vec2d e(2.1, 2.2); Vec2d f(2.3, 2.4); Vec2d g(2.5, 2.6); Vec2d h(2.7, 2.8); Vec2d i(3.1, 3.2); Vec2d j(3.3, 3.4); Vec2d k(3.5, 3.6); Vec2d l(3.7, 3.8); Vec2d m(4.1, 4.2); Vec2d n(4.3, 4.4); Vec2d o(4.5, 4.6); Vec2d p(4.7, 4.8); for(ii=0; ii< max1*max2 ; ii++) { a=a*b; b=b+c; c=c*d; d=d+e; e=e*f; f=f+g; g=g*h; h=h+i; i=i*j; j=j+k; k=k*l; l=l+m; m=m*n; n=n+o; o=o*p; p=p+a; } res= a[0]+a[1]+ b[0]+b[1]+ c[0]+c[1]+ d[0]+d[1]+ e[0]+e[1]+ f[0]+f[1]+ g[0]+g[1]+ h[0]+h[1]+ i[0]+i[1]+ j[0]+j[1]+ k[0]+k[1]+ l[0]+l[1]+ m[0]+m[1]+ n[0]+n[1]+ o[0]+o[1]+ p[0]+p[1] ; return res; }
double addmul_avx() { long long ii; double res; double mul=1.00001; Vec4d a(0.1, 0.2, 0.3, 0.4); Vec4d b(0.5, 0.6, 0.7, 0.8); Vec4d c(0.9, 1.0, 1.1, 1.2); Vec4d d(1.3, 1.4, 1.5, 1.6); Vec4d e(2.1, 2.2, 2.3, 2.4); Vec4d f(2.5, 2.6, 2.7, 2.8); Vec4d g(2.9, 3.0, 3.1, 3.2); Vec4d h(3.3, 3.4, 3.5, 3.6); Vec4d i(4.1, 4.2, 4.3, 4.4); Vec4d j(4.5, 4.6, 4.7, 4.8); Vec4d k(4.9, 5.0, 5.1, 5.2); Vec4d l(5.3, 5.4, 5.5, 5.6); Vec4d m(6.1, 6.2, 6.3, 6.4); Vec4d n(6.5, 6.6, 6.7, 6.8); Vec4d o(6.9, 7.0, 7.1, 7.2); Vec4d p(7.3, 7.4, 7.5, 7.6); for(ii=0; ii< max1*max2 ; ii++) { a=a*c; b=b+d; c=c*e; d=d+f; e=e*g; f=f+h; g=g*i; h=h+j; i=i*k; j=j+l; k=k*m; l=l+n; m=m*o; n=n+p; o=o*a; p=p+b; } res= a[0]+a[1]+a[2]+a[3] + b[0]+b[1]+b[2]+b[3] + c[0]+c[1]+c[2]+c[3] + d[0]+d[1]+d[2]+d[3] + e[0]+e[1]+e[2]+e[3] + f[0]+f[1]+f[2]+f[3] + g[0]+g[1]+g[2]+g[3] + h[0]+h[1]+h[2]+h[3] + i[0]+i[1]+i[2]+i[3] + j[0]+j[1]+j[2]+j[3] + k[0]+k[1]+k[2]+k[3] + l[0]+l[1]+l[2]+l[3] + m[0]+m[1]+m[2]+m[3] + n[0]+n[1]+n[2]+n[3] + o[0]+o[1]+o[2]+o[3] + p[0]+p[1]+p[2]+p[3] ; return res; }
//�ݹ���ֱ�߷ָ�Բ int g(int k){ if(k==1)return 2; return g(k-1)+k; }
void f() { const Enum v2 = v; Enum e = false ? g() : v; Enum e2 = false ? v2 : v; Enum e3 = false ? g2() : v; }
// This is not really called. Its only purpose is to // instantiate the constructor of the grammar. void instantiate_statement() { typedef std::string::const_iterator iterator_type; std::vector<int> code; statement<iterator_type> g(code); }
// WIN32: define void @"\01?g@@YAXUX@@@Z"(<{ %struct.X, [3 x i8] }>* inalloca) {{.*}} { // WIN32: call x86_thiscallcc void @"\01??1X@@QAE@XZ"(%struct.X* {{.*}}) // WIN32: } void f() { g(X()); }
NM_Status LineSearchNM :: solve(FloatArray *r, FloatArray *dr, FloatArray *F, FloatArray *R, FloatArray *R0, IntArray &eqnmask, double lambda, double &etaValue, LS_status &status, TimeStep *tNow) { int ico, ii, ils, neq = r->giveSize(); double s0, si; FloatArray g(neq), rb(neq); // Compute inner product at start and stop if positive g = * R; g.times(lambda); if ( R0 ) { g.add(*R0); } g.subtract(*F); for ( ii = 1; ii <= eqnmask.giveSize(); ii++ ) { g.at( eqnmask.at(ii) ) = 0.0; } s0 = ( -1.0 ) * g.dotProduct(* dr); if ( s0 >= 0.0 ) { //printf ("\nLineSearchNM::solve starting inner product uphill, val=%e",s0); OOFEM_LOG_DEBUG("LS: product uphill, eta=%e\n", 1.0); r->add(*dr); tNow->incrementStateCounter(); // update solution state counter engngModel->updateComponent(tNow, InternalRhs, domain); etaValue = 1.0; status = ls_ok; return NM_Success; } // keep original total displacement r rb = * r; eta.resize(this->max_iter + 1); prod.resize(this->max_iter + 1); // prepare starting product ratios and step lengths prod.at(1) = 1.0; eta.at(1) = 0.0; eta.at(2) = 1.0; // following counter shows how many times the max or min step length has been reached ico = 0; // begin line search loop for ( ils = 2; ils <= this->max_iter; ils++ ) { // update displacements for ( ii = 1; ii <= neq; ii++ ) { r->at(ii) = rb.at(ii) + this->eta.at(ils) * dr->at(ii); } tNow->incrementStateCounter(); // update solution state counter // update internal forces according to new state engngModel->updateComponent(tNow, InternalRhs, domain); // compute out-of balance forces g in new state g = * R; g.times(lambda); if ( R0 ) { g.add(*R0); } g.subtract(*F); for ( ii = 1; ii <= eqnmask.giveSize(); ii++ ) { g.at( eqnmask.at(ii) ) = 0.0; } // compute current inner-product ratio si = ( -1.0 ) * g.dotProduct(*dr) / s0; prod.at(ils) = si; // check if line-search tolerance is satisfied if ( fabs(si) < ls_tolerance ) { dr->times( this->eta.at(ils) ); //printf ("\nLineSearchNM::solve tolerance satisfied for eta=%e, ils=%d", eta.at(ils),ils); OOFEM_LOG_DEBUG( "LS: ils=%d, eta=%e\n", ils, eta.at(ils) ); etaValue = eta.at(ils); status = ls_ok; return NM_Success; } // call line-search routine to get new estimate of eta.at(ils) this->search(ils, prod, eta, this->amplifFactor, this->maxEta, this->minEta, ico); if ( ico == 2 ) { break; // exit the loop } } // end line search loop // exceeded no of ls iterations of ls failed //if (ico == 2) printf("\nLineSearchNM::solve max or min step length has been reached two times"); //else printf("\nLineSearchNM::solve reached max number of ls searches"); OOFEM_LOG_DEBUG( "LS: ils=%d, ico=%d, eta=%e\n", ils, ico, eta.at(ils) ); /* update F before */ for ( ii = 1; ii <= neq; ii++ ) { r->at(ii) = rb.at(ii) + dr->at(ii); } tNow->incrementStateCounter(); // update solution state counter engngModel->updateComponent(tNow, InternalRhs, domain); etaValue = 1.0; status = ls_failed; return NM_NoSuccess; }
void f() { A a; h(g(a)); }
int main() { g(); f(0); return 0; }
void f() noexcept { A var; g(); }
foobar() { g(); }
int f(int a, char b) { return a + 5 * g(b); }
void server_base::handle_message(send_function send_fn, boost::function<void(client_info&)> close_fn, boost::function<socket_info&(void)> socket_info_fn, int session_id, const variant& msg) { const std::string& type = msg["type"].as_string(); if(session_id == -1) { if(type == "create_game") { game_info_ptr g(new game_info(msg)); if(!g->game_state) { std::cerr << "COULD NOT CREATE GAME TYPE: " << msg["game_type"].as_string() << "\n"; send_fn(json::parse("{ \"type\": \"create_game_failed\" }")); return; } std::vector<variant> users = msg["users"].as_list(); for(int i = 0; i != users.size(); ++i) { const std::string user = users[i]["user"].as_string(); const int session_id = users[i]["session_id"].as_int(); if(clients_.count(session_id) && session_id != -1) { std::cerr << "ERROR: REUSED SESSION ID WHEN CREATING GAME: " << session_id << "\n"; send_fn(json::parse("{ \"type\": \"create_game_failed\" }")); return; } client_info& cli_info = clients_[session_id]; cli_info.user = user; cli_info.game = g; cli_info.nplayer = i; cli_info.last_contact = nheartbeat_; cli_info.session_id = session_id; if(users[i]["bot"].as_bool(false) == false) { g->game_state->add_player(user); } else { g->game_state->add_ai_player(user, users[i]); } g->clients.push_back(session_id); } const game_context context(g->game_state.get()); g->game_state->setup_game(); games_.push_back(g); send_fn(json::parse(formatter() << "{ \"type\": \"game_created\", \"game_id\": " << g->game_state->game_id() << " }")); status_change(); return; } else if(type == "observe_game") { const int id = msg["game_id"].as_int(); const std::string user = msg["user"].as_string(); const int session_id = msg["session_id"].as_int(); game_info_ptr g; foreach(const game_info_ptr& gm, games_) { if(gm->game_state->game_id() == id) { g = gm; break; } } if(!g) { send_fn(json::parse("{ \"type\": \"unknown_game\" }")); return; } if(clients_.count(session_id)) { send_fn(json::parse("{ \"type\": \"reuse_session_id\" }")); return; } client_info& cli_info = clients_[session_id]; cli_info.user = user; cli_info.game = g; cli_info.nplayer = -1; cli_info.last_contact = nheartbeat_; cli_info.session_id = session_id; g->clients.push_back(session_id); send_fn(json::parse(formatter() << "{ \"type\": \"observing_game\" }")); return; } else if(type == "get_status") { const int last_status = msg["last_seen"].as_int(); if(last_status == status_id_) { status_fns_.push_back(send_fn); } else { send_fn(create_lobby_msg()); } return; } else if(type == "get_server_info") { send_fn(get_server_info()); return; } else { send_fn(json::parse("{ \"type\": \"unknown_message\" }")); return; } }
void Uklad(QVector<double>** M,double (*f)(double x,double y, double z,double a,double b,double K,int wersja),double (*g)(double x,double y, double z,double c,double d,double K,int wersja),double w1, double w2, double h, double pocz, double koniec,int wersja,double a,double b,double c,double d,double K) { QVector<double> k,q; int i=1,j=0; double warunek=pocz; bool pomoc=false; M[0]=new QVector<double>; M[1]=new QVector<double>; M[2]=new QVector<double>; k.push_back(h*f(w1,w2,0,a,b,K,wersja)); q.push_back(h*g(w1,w2,0,c,d,K,wersja)); k.push_back(h*f(w1+0.5*h,w2+0.5*k[0],0.5*q[0],a,b,K,wersja)); q.push_back(h*g(w1+0.5*h,w2+0.5*k[0],0.5*q[0],c,d,K,wersja)); k.push_back(h*f(w1+0.5*h,w2+0.5*k[1],0.5*q[1],a,b,K,wersja)); q.push_back(h*g(w1+0.5*h,w2+0.5*k[1],0.5*q[1],c,d,K,wersja)); k.push_back(h*f(w1+h,w2+k[2],q[2],a,b,K,wersja)); q.push_back(h*g(w1+h,w2+k[2],q[2],c,d,K,wersja)); (**M).push_back(w1); (*M[1]).push_back(w2); (*M[2]).push_back(warunek); while(warunek<koniec) { if((*M[0])[i-1]<=0.0) (**M).push_back(0.0); else (**M).push_back((**M)[i-1]+(1.0/6.0)*(k[0]+2*k[1]+2*k[2]+k[3])); if((*M[1])[i-1]<=0.0) { pomoc=true; (*M[1]).push_back(0.0); } else (*M[1]).push_back((*M[1])[i-1]+(1.0/6.0)*(q[0]+2*q[1]+2*q[2]+q[3])); k.clear(); q.clear(); k.push_back(h*f(M[0][0][i],M[1][0][i],0,a,b,K,wersja)); q.push_back(h*g(M[0][0][i],M[1][0][i],0,c,d,K,wersja)); k.push_back(h*f(M[0][0][i]+0.5*h,M[1][0][i]+0.5*k[0],0.5*q[0],a,b,K,wersja)); q.push_back(h*g(M[0][0][i]+0.5*h,M[1][0][i]+0.5*k[0],0.5*q[0],c,d,K,wersja)); k.push_back(h*f(M[0][0][i]+0.5*h,M[1][0][i]+0.5*k[1],0.5*q[1],a,b,K,wersja)); q.push_back(h*g(M[0][0][i]+0.5*h,M[1][0][i]+0.5*k[1],0.5*q[1],c,d,K,wersja)); k.push_back(h*f(M[0][0][i]+h,M[1][0][i]+k[2],q[2],a,b,K,wersja)); q.push_back(h*g(M[0][0][i]+h,M[1][0][i]+k[2],q[2],c,d,K,wersja)); i++; if(pomoc==true) { j++; if(j==5) warunek=koniec; } warunek=warunek+h; (*M[2]).push_back(warunek); } }
int main(int argc, char* argv[]) { assert(argc>1 && argc < 8); int nx = argc>2 ? std::atoi(argv[2]) : 2; int ny = argc>3 ? std::atoi(argv[3]) : 2; int nz = argc>4 ? std::atoi(argv[4]) : 2; int n = argc>5 ? std::atoi(argv[5]) : 2; std::ifstream in(argv[1]); Nef_polyhedron Nin; in >> Nin; Nin.transform(Aff_transformation_3(CGAL::SCALING,100,1)); std::ostringstream out1; ggen g(out1, Nin); g.print(nx,ny,nz); std::istringstream in1(out1.str()); Nef_polyhedron N1; in1 >> N1; RT s = g.size_x(); N1.transform(Aff_transformation_3(CGAL::TRANSLATION,Vector_3(s,s,s,2))); CGAL_assertion(N1.is_valid()); std::ostringstream out2; if(argc>6) { tgen t2(out2,s,std::atoi(argv[6])); t2.create_tetrahedra(nx+1,ny+1,nz+1); } else { tgen t2(out2,s); t2.create_tetrahedra(nx+1,ny+1,nz+1); } std::istringstream in2(out2.str()); Nef_polyhedron N2; in2 >> N2; CGAL_assertion(N2.is_valid()); #if defined CGAL_NEF3_UNION N1=N1.join(N2); #elif defined CGAL_NEF3_INTERSECTION N1=N1.intersection(N2); #elif defined CGAL_NEF3_DIFFERENCE N1=N1.difference(N2); #else N1=N1.symmetric_difference(N2); #endif RT b=s*(nx+1); N1.transform(Aff_transformation_3(CGAL::TRANSLATION,Vector_3(-b,-b,-b,2))); CGAL::Timer pl; pl.start(); Point_source P(CGAL::to_double(b)/2); for(int i=0;i<n;++i) { N1.locate(*P++); } pl.stop(); std::cout << "Input_size: " << N1.number_of_vertices() << std::endl; std::cout << "Number_of_point_location_queries: " << n << std::endl; std::cout << "Total_runtime: " << pl.time() << std::endl; std::cout << "Runtime_per_query: " << pl.time()/n << std::endl; }
int main(int argc, char **argv) { const int d = 5; // expected-note {{constant variable is predetermined as shared}} const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}} S4 e(4); S5 g(5); S3 m; S6 n(2); int i; int &j = i; #pragma omp parallel sections lastprivate // expected-error {{expected '(' after 'lastprivate'}} { foo(); } #pragma omp parallel sections lastprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} { foo(); } #pragma omp parallel sections lastprivate() // expected-error {{expected expression}} { foo(); } #pragma omp parallel sections lastprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} { foo(); } #pragma omp parallel sections lastprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} { foo(); } #pragma omp parallel sections lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} { foo(); } #pragma omp parallel sections lastprivate(argc) { foo(); } #pragma omp parallel sections lastprivate(S1) // expected-error {{'S1' does not refer to a value}} { foo(); } #pragma omp parallel sections lastprivate(a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 3 {{shared variable cannot be lastprivate}} { foo(); } #pragma omp parallel sections lastprivate(argv[1]) // expected-error {{expected variable name}} { foo(); } #pragma omp parallel sections lastprivate(2 * 2) // expected-error {{expected variable name}} { foo(); } #pragma omp parallel sections lastprivate(ba) { foo(); } #pragma omp parallel sections lastprivate(ca) // expected-error {{shared variable cannot be lastprivate}} { foo(); } #pragma omp parallel sections lastprivate(da) // expected-error {{shared variable cannot be lastprivate}} { foo(); } int xa; #pragma omp parallel sections lastprivate(xa) // OK { foo(); } #pragma omp parallel sections lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}} { foo(); } #pragma omp parallel sections lastprivate(S2::S2sc) // expected-error {{shared variable cannot be lastprivate}} { foo(); } #pragma omp parallel sections safelen(5) // expected-error {{unexpected OpenMP clause 'safelen' in directive '#pragma omp parallel sections'}} { foo(); } #pragma omp parallel sections lastprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} { foo(); } #pragma omp parallel sections lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}} { foo(); } #pragma omp parallel sections lastprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be lastprivate}} { foo(); } #pragma omp parallel sections private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}} { foo(); } #pragma omp parallel sections lastprivate(i) { foo(); } #pragma omp parallel private(xa) #pragma omp parallel sections lastprivate(xa) { foo(); } #pragma omp parallel reduction(+ : xa) #pragma omp parallel sections lastprivate(xa) { foo(); } #pragma omp parallel sections lastprivate(j) { foo(); } #pragma omp parallel sections firstprivate(m) lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}} { foo(); } #pragma omp parallel sections lastprivate(n) firstprivate(n) // OK { foo(); } static int r; #pragma omp parallel sections lastprivate(r) // OK { foo(); } return foomain<S4, S5>(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<S4, S5>' requested here}} }
int main (int argc, char **argv) { // XInitThreads(); Graphics g(argc, argv); return 0; }
T tmain(T argc) { const T d = 5; const T da[5] = { 0 }; S4 e(4); S5 g(5); T i, t[20]; T &j = i; T *k = &j; T x; T y; T to, tofrom, always; const T (&l)[5] = da; #pragma omp target map // expected-error {{expected '(' after 'map'}} {} #pragma omp target map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} {} #pragma omp target map() // expected-error {{expected expression}} {} #pragma omp target map(alloc) // expected-error {{use of undeclared identifier 'alloc'}} {} #pragma omp target map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}} {} #pragma omp target map(to:) // expected-error {{expected expression}} {} #pragma omp target map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} {} #pragma omp target map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} {} #pragma omp target map(x) foo(); #pragma omp target map(tofrom: t[:I]) foo(); #pragma omp target map(T: a) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} expected-error {{incomplete type 'S1' where a complete type is required}} foo(); #pragma omp target map(T) // expected-error {{'T' does not refer to a value}} foo(); #pragma omp target map(I) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}} foo(); #pragma omp target map(S2::S2s) foo(); #pragma omp target map(S2::S2sc) foo(); #pragma omp target map(x) foo(); #pragma omp target map(to: x) foo(); #pragma omp target map(to: to) foo(); #pragma omp target map(to) foo(); #pragma omp target map(to, x) foo(); #pragma omp target data map(to x) // expected-error {{expected ',' or ')' in 'map' clause}} #pragma omp target data map(tofrom: argc > 0 ? x : y) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}} #pragma omp target data map(argc) #pragma omp target data map(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}} #pragma omp target data map(ba) // expected-error 2 {{type 'S2' is not mappable to target}} #pragma omp target data map(ca) #pragma omp target data map(da) #pragma omp target data map(S2::S2s) #pragma omp target data map(S2::S2sc) #pragma omp target data map(e, g) #pragma omp target data map(h) // expected-error {{threadprivate variables are not allowed in 'map' clause}} #pragma omp target data map(k) map(k) // expected-error 2 {{variable already marked as mapped in current construct}} expected-note 2 {{used here}} #pragma omp target map(k), map(k[:5]) // expected-error 2 {{pointer cannot be mapped along with a section derived from itself}} expected-note 2 {{used here}} foo(); #pragma omp target data map(da) #pragma omp target map(da[:4]) foo(); #pragma omp target data map(k, j, l) // expected-note 2 {{used here}} #pragma omp target data map(k[:4]) // expected-error 2 {{pointer cannot be mapped along with a section derived from itself}} #pragma omp target data map(j) #pragma omp target map(l) map(l[:5]) // expected-error 2 {{variable already marked as mapped in current construct}} expected-note 2 {{used here}} foo(); #pragma omp target data map(k[:4], j, l[:5]) // expected-note 2 {{used here}} #pragma omp target data map(k) // expected-error 2 {{pointer cannot be mapped along with a section derived from itself}} #pragma omp target data map(j) #pragma omp target map(l) foo(); #pragma omp target data map(always, tofrom: x) #pragma omp target data map(always: x) // expected-error {{missing map type}} #pragma omp target data map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always'}} expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} #pragma omp target data map(always, tofrom: always, tofrom, x) #pragma omp target map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}} foo(); return 0; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QStateMachine machine; MidiKontrol *midiKontrol = new MidiKontrol(); MidiKontrol *virtualMidi = new MidiKontrol(); QGroupBox *deviceInGroup = new QGroupBox(tr("Device In")); QLabel *deviceInLabel = new QLabel(tr("PadKontrol PORT A")); QComboBox *deviceInComboBox = new QComboBox; QMapIterator<int, QString> i(midiKontrol->getInputDevicesList()); while (i.hasNext()) { i.next(); deviceInComboBox->insertItem(i.key(),i.value()); //std::cout << i.key << i.value() << std::endl; } QGroupBox *deviceOutGroup = new QGroupBox(tr("Device Out")); QLabel *deviceOutLabel = new QLabel(tr("PadKontrol CTRL")); QComboBox *deviceOutComboBox = new QComboBox; //deviceOutComboBox->addItems(midiKontrol->getOutputDevicesList()); QMapIterator<int, QString> j(midiKontrol->getOutputDevicesList()); while (j.hasNext()) { j.next(); deviceOutComboBox->insertItem(j.key(),j.value()); //std::cout << j.key() << j.value() <<std::endl; } QGroupBox *midiInGroup = new QGroupBox(tr("Midi In")); QLabel *midiInLabel = new QLabel(tr("In from Virtual midi 2")); QComboBox *midiInComboBox = new QComboBox; QMapIterator<int, QString> k(virtualMidi->getInputDevicesList()); while (k.hasNext()) { k.next(); midiInComboBox->insertItem(k.key(),k.value()); } QGroupBox *midiOutGroup = new QGroupBox(tr("Midi Out")); QLabel *midiOutLabel = new QLabel(tr("Out to Virtual midi 1")); QComboBox *midiOutComboBox = new QComboBox; QMapIterator<int, QString> g(virtualMidi->getOutputDevicesList()); while (g.hasNext()) { g.next(); midiOutComboBox->insertItem(g.key(),g.value()); } QGridLayout *deviceOutLayout = new QGridLayout; deviceOutLayout->addWidget(deviceOutLabel, 0, 0); deviceOutLayout->addWidget(deviceOutComboBox, 0, 1); deviceOutGroup->setLayout(deviceOutLayout); QGridLayout *deviceInLayout = new QGridLayout; deviceInLayout->addWidget(deviceInLabel, 0, 0); deviceInLayout->addWidget(deviceInComboBox, 0, 1); deviceInGroup->setLayout(deviceInLayout); QGridLayout *midiOutLayout = new QGridLayout; midiOutLayout->addWidget(midiOutLabel, 0, 0); midiOutLayout->addWidget(midiOutComboBox, 0, 1); midiOutGroup->setLayout(midiOutLayout); QGridLayout *midiInLayout = new QGridLayout; midiInLayout->addWidget(midiInLabel, 0, 0); midiInLayout->addWidget(midiInComboBox, 0, 1); midiInGroup->setLayout(midiInLayout); QPushButton *nativeModeOnBtn = new QPushButton("Enter Native mode", this); QPushButton *nativeModeOffBtn = new QPushButton("Exit Native mode", this); QGridLayout *layout = new QGridLayout; layout->addWidget(deviceOutGroup, 0, 0); layout->addWidget(deviceInGroup, 0, 1); layout->addWidget(midiOutGroup, 1, 0); layout->addWidget(midiInGroup, 1, 1); layout->addWidget(nativeModeOnBtn,2,0); layout->addWidget(nativeModeOffBtn,2,1); centralWidget()->setLayout(layout); PadKontrol *padKontrol = new PadKontrol(); virtualMidiKontrol *vMidiKontrol = new virtualMidiKontrol(); connect(deviceInComboBox, SIGNAL(activated(int)), padKontrol, SLOT(connectPadIn(int))); connect(deviceOutComboBox, SIGNAL(activated(int)), padKontrol, SLOT(connectPadOut(int))); connect(midiInComboBox, SIGNAL(activated(int)), vMidiKontrol, SLOT(connectMidiIn(int))); connect(midiOutComboBox, SIGNAL(activated(int)), vMidiKontrol, SLOT(connectMidiOut(int))); connect(nativeModeOnBtn, SIGNAL(clicked()), padKontrol, SLOT(enterNativeMode())); connect(nativeModeOnBtn, SIGNAL(clicked()), vMidiKontrol, SLOT(enterNativeMode())); connect(nativeModeOffBtn, SIGNAL(clicked()), padKontrol, SLOT(exitNativeMode())); connect(nativeModeOffBtn, SIGNAL(clicked()), vMidiKontrol, SLOT(exitNativeMode())); setWindowTitle(tr("totalKontrol")); connect(padKontrol,SIGNAL(midiMessage(QString)),vMidiKontrol,SLOT(messageMapper(QString))); connect(vMidiKontrol,SIGNAL(midiMessage(QString)),padKontrol,SLOT(messageMapper(QString))); }
NOMIPS16 void f () { g (0x1233ffff, 0x12340001); }
void f2() { int *ip = nil; ip = nil; g(nil); }