void URITestObject::test<16>() { // Test the default escaping // yes -- this mangles the url. This is expected behavior std::string simple("http://GIS.com"); ensure_equals( "simple http", LLURI::escape(simple), "http%3A%2F%2FGIS.com"); ensure_equals( "needs escape", LLURI::escape("http://get.GIS.com/windows viewer"), "http%3A%2F%2Fget.GIS.com%2Fwindows%20viewer"); }
//--------------------------------------------------------------------------- int main(int argc, char *argv[]) { argList args = setRootCase( argc, argv ); TimeHolder runTime=createTime( Time::controlDictName, args ); fvMeshHolder mesh = createMesh( runTime ); volScalarFieldHolder p; volVectorFieldHolder U; surfaceScalarFieldHolder phi; singlePhaseTransportModelHolder laminarTransport; incompressible::RASModelHolder turbulence; label pRefCell = 0; scalar pRefValue = 0.0; createFields( runTime, mesh, p, U, phi, laminarTransport, turbulence, pRefCell, pRefValue ); scalar cumulativeContErr = initContinuityErrs(); simpleControlHolder simple(mesh); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (simple->loop()) { Info<< "Time = " << runTime->timeName() << nl << endl; p->storePrevIter(); // --- Pressure-velocity SIMPLE corrector { fvVectorMatrixHolder UEqn = fun_UEqn( U, phi, turbulence, p ); fun_pEqn( mesh, runTime, simple, U, phi, turbulence, p, UEqn, pRefCell, pRefValue, cumulativeContErr ); } turbulence->correct(); runTime->write(); Info<< "ExecutionTime = " << runTime->elapsedCpuTime() << " s" << " ClockTime = " << runTime->elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; }
void arraysInBlocks() { typedef int INTS[4]; void (^simple)(int [_Nonnull 2]) = ^(int x[_Nonnull 2]) {}; simple(0); // expected-warning {{null passed to a callee that requires a non-null argument}} void (^nested)(void *_Nullable x[_Nonnull 2]) = ^(void *_Nullable x[_Nonnull 2]) {}; nested(0); // expected-warning {{null passed to a callee that requires a non-null argument}} void (^nestedBad)(int x[2][_Nonnull 2]) = // expected-error {{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int [2]'}} ^(int x[2][_Nonnull 2]) {}; // expected-error {{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int [2]'}} void (^withTypedef)(INTS _Nonnull) = ^(INTS _Nonnull x) {}; withTypedef(0); // expected-warning {{null passed to a callee that requires a non-null argument}} void (^withTypedefBad)(INTS _Nonnull [2]) = // expected-error {{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'INTS' (aka 'int [4]')}} ^(INTS _Nonnull x[2]) {}; // expected-error {{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'INTS' (aka 'int [4]')}} }
test<REACTOR_IMPLEMENTATION>::test (void) { if (test_simple_event_handler) simple (new REACTOR_IMPLEMENTATION); if (test_reference_counted_event_handler_1) reference_count_1 (new REACTOR_IMPLEMENTATION); if (test_reference_counted_event_handler_2) reference_count_2 (new REACTOR_IMPLEMENTATION); if (test_closed_in_upcall_event_handler) closed_in_upcall (new REACTOR_IMPLEMENTATION); }
// FIXME : add this as a member of SkPath void Simplify(const SkPath& path, SkPath* result) { #if DEBUG_SORT || DEBUG_SWAP_TOP gDebugSortCount = gDebugSortCountDefault; #endif // returns 1 for evenodd, -1 for winding, regardless of inverse-ness result->reset(); result->setFillType(SkPath::kEvenOdd_FillType); SkPathWriter simple(*result); // turn path into list of segments SkTArray<SkOpContour> contours; SkOpEdgeBuilder builder(path, contours); builder.finish(); SkTDArray<SkOpContour*> contourList; MakeContourList(contours, contourList, false, false); SkOpContour** currentPtr = contourList.begin(); if (!currentPtr) { return; } SkOpContour** listEnd = contourList.end(); // find all intersections between segments do { SkOpContour** nextPtr = currentPtr; SkOpContour* current = *currentPtr++; if (current->containsCubics()) { AddSelfIntersectTs(current); } SkOpContour* next; do { next = *nextPtr++; } while (AddIntersectTs(current, next) && nextPtr != listEnd); } while (currentPtr != listEnd); // eat through coincident edges CoincidenceCheck(&contourList, 0); FixOtherTIndex(&contourList); SortSegments(&contourList); #if DEBUG_ACTIVE_SPANS DebugShowActiveSpans(contourList); #endif // construct closed contours if (builder.xorMask() == kWinding_PathOpsMask ? bridgeWinding(contourList, &simple) : !bridgeXor(contourList, &simple)) { // if some edges could not be resolved, assemble remaining fragments SkPath temp; temp.setFillType(SkPath::kEvenOdd_FillType); SkPathWriter assembled(temp); Assemble(simple, &assembled); *result = *assembled.nativePath(); } }
int main(int argc, char *argv[]) { # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" # include "createFields.H" simpleControl simple(mesh); Dt = nut/Sct; Dt.write();//must write the Dturbulent field if changed by ScNo.H // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nCalculating passive scalar transport for a turbulent flow\n" << endl; while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; tmp<fvScalarMatrix> CEqn ( fvm::div(phi, C) + fvm::SuSp(-fvc::div(phi), C)//added for boundedness from post (http://www.cfd-online.com/Forums/openfoam/64602-origin-fvm-sp-fvc-div-phi_-epsilon_-kepsilon-eqn.html) - fvm::laplacian(D, C) - fvm::laplacian(Dt, C) ); CEqn().relax(); solve(CEqn()); runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; }
int main(int argc, char **argv){ /* hard code platform and device number */ int plat = 0; int dev = 0; occa::device device; device.setup("OpenCL", plat, dev); // build jacobi kernel from source file const char *functionName = ""; // build Jacobi kernel occa::kernel simple = device.buildKernelFromSource("simple.occa", "simple"); // size of array int N = 256; // set thread array for Jacobi iteration int T = 32; int dims = 1; occa::dim inner(T); occa::dim outer((N+T-1)/T); simple.setWorkingDims(dims, inner, outer); size_t sz = N*sizeof(float); // allocate array on HOST float *h_x = (float*) malloc(sz); for(int n=0;n<N;++n) h_x[n] = 123; // allocate array on DEVICE (copy from HOST) occa::memory c_x = device.malloc(sz, h_x); // queue kernel simple(N, c_x); // copy result to HOST c_x.copyTo(h_x); /* print out results */ for(int n=0;n<N;++n) printf("h_x[%d] = %g\n", n, h_x[n]); exit(0); }
void main() { struct tree *root=NULL,*temp,*dltree; int i,j,k,ch,n; int gd=0,gm; clrscr(); printf("\n1 insert"); printf("\n2 disp"); printf("\n3 delete"); while(1) { printf("\n enter choice:"); scanf("%d",&ch); switch(ch) { case 1: printf("\nEnter the data:"); scanf("%d",&n); if(root==NULL) { root=malloc(size); root->data=n; root->left=root->right=NULL; } else insert(root,n); break; case 2: initgraph(&gd,&gm,"e:\\tc\\bgi"); display(root,1,640,15,1); getch(); closegraph(); break; case 3: delet(root); if(dlt->left==NULL&&dlt->right==NULL) simple(root,dlt); if(dltree->left!=NULL&&dltree->right!=NULL) // complex(&dltree); // else // inter(&dltree); break; case 4: break; case 0: exit(0); } } }
int main () { srand (time (NULL)); simple (); test_matrix_multipliers (); time_full (); mult_test (); //13 big_test (40); return 0; }
//parses a stage, returning a command struct //modifies global variable t CMD *stage() { CMD *tmp; CMD *cmd = 0; if (!t) return 0; tmp = mallocCMD(); while (t && (ISREDOUT(t->type) || ISREDIN(t->type))) tmp = redirect(tmp); if (!tmp) return 0; else if (!t) { DIE("Parse: null command\n"); return 0; } else if (t->type == PAR_LEFT) { cmd = mallocCMD(); cmd->type = SUBCMD; t = t->next; cmd->left = command(); if (!cmd->left) { DIE("Parse: null command\n"); freeCMD(cmd); return 0; } else if (!t || t->type != PAR_RIGHT) { DIE("Parse: unbalanced parens\n"); freeCMD(cmd); return 0; } else { t = t->next; while(t && cmd && (ISREDOUT(t->type) || ISREDIN(t->type))) cmd = redirect(cmd); } } else cmd = simple(); cmd = merge(cmd, tmp); freeCMD(tmp); return cmd; }
int main(void) { struct stack *stack; stack = newStack(); if (stack == NULL) exit(EXIT_FAILURE); simple(stack); multiple(stack); freeStack(stack); exit(EXIT_SUCCESS); }
void RxCompile::element() { if (match('^')) emit(&startOfLine); else if (match('$')) emit(&endOfLine); else if (match("\\A")) emit(&startOfString); else if (match("\\Z")) emit(&endOfString); else if (match("\\<")) emit(&startOfWord); else if (match("\\>")) emit(&endOfWord); else if (match("(?i)")) ignoringCase = true; else if (match("(?-i)")) ignoringCase = false; else if (match("(?q)")) quoted(); else if (match("(?-q)")) ; else { int start = pat.size(); simple(); int len = pat.size() - start; if (match("??")) insert(start, new Branch(len + 1, 1)); else if (match('?')) insert(start, new Branch(1, len + 1)); else if (match("+?")) emit(new Branch(1, -len)); else if (match('+')) emit(new Branch(-len, 1)); else if (match("*?")) { emit(new Branch(1, -len)); insert(start, new Branch(len + 2, 1)); } else if (match('*')) { emit(new Branch(-len, 1)); insert(start, new Branch(1, len + 2)); } } }
int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "createFields.H" simpleControl simple(mesh); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nCalculating scalar transport\n" << endl; # include "readTimeControls.H" # include "CourantNo.H" # include "setDeltaT.H" while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { solve ( fvm::ddt(C) + fvm::div(phi, C) + turbulence->divDFlux(C) ); } turbulence->correct(); runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; }
int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "createFields.H" #include "initContinuityErrs.H" simpleControl simple(mesh); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; p.storePrevIter(); rho.storePrevIter(); if (!simple.transonic()) { rho.storePrevIter(); } // Velocity-pressure-enthalpy SIMPLEC corrector { #include "UEqn.H" #include "pEqn.H" #include "hEqn.H" } turbulence->correct(); runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; }
int compar_carac(char **tabeulo) { if (size_of_tabeulo(tabeulo) != 3) return (0); if (my_strncmp(tabeulo[1], ">>", 2) == 0) { if (redir_double_droite(tabeulo) == 0) return (1); } else if (my_strncmp(tabeulo[1], "<<", 2) == 0) { if (redir_double_gauche(tabeulo) == 0) return (1); } else if (simple(tabeulo) == 0) return (1); return (0); }
int main(void) { puts("simple barectf example!"); const size_t buf_sz = 8192; uint8_t* buf = malloc(buf_sz); if (!buf) { return 1; } simple(buf, buf_sz); write_packet("ctf/stream_0", buf, buf_sz); free(buf); return 0; }
static const char * password_check(const char *old, const char *newval, const struct passwd *pwdp) { const char *msg; char *newmono, *wrapped; int lenwrap; if (strcmp(newval, old) == 0) return "no change"; if (simple(newval)) return "too simple"; msg = NULL; newmono = str_lower(bb_xstrdup(newval)); lenwrap = strlen(old); wrapped = (char *) xmalloc(lenwrap * 2 + 1); str_lower(strcpy(wrapped, old)); if (palindrome(newmono)) msg = "a palindrome"; else if (strcmp(wrapped, newmono) == 0) msg = "case changes only"; else if (similiar(wrapped, newmono)) msg = "too similiar"; else if ( strstr(newval, pwdp->pw_name) ) msg = "username in password"; else { safe_strncpy(wrapped + lenwrap, wrapped, lenwrap + 1); if (strstr(wrapped, newmono)) msg = "rotated"; } memset(newmono, 0, strlen(newmono)); memset(wrapped, 0, lenwrap * 2); free(newmono); free(wrapped); return msg; }
int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "createFields.H" #include "initContinuityErrs.H" MRFZones mrfZones(mesh); mrfZones.correctBoundaryVelocity(U); simpleControl simple(mesh); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; p.storePrevIter(); // --- Pressure-velocity SIMPLE corrector { #include "UEqn.H" #include "pEqn.H" } turbulence->correct(); runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; }
void testSimple() { // Randomize test length uint testSize = 5 + (cOSRand::rand() % 16384); cSetArray simple(testSize); // Check all elements are cleared uint i; for (i = 0; i < testSize; ++i) { TESTS_ASSERT(!simple.isSet(i)); } // Start puting random values for (i = 0; i < 10; ++i) { uint location = cOSRand::rand() % testSize; simple.set(location); for (uint j = 0; j < testSize; ++j) { if (j == location) { TESTS_ASSERT(simple.isSet(j)); } else { TESTS_ASSERT(!simple.isSet(j)); } } simple.clear(location); } // Test out of scope exception TESTS_EXCEPTION(simple.isSet(testSize)); TESTS_EXCEPTION(simple.isSet(testSize + 5)); TESTS_EXCEPTION(simple.isSet(testSize + 90)); TESTS_EXCEPTION(simple.clear(testSize)); TESTS_EXCEPTION(simple.clear(testSize + 5)); TESTS_EXCEPTION(simple.clear(testSize + 90)); TESTS_EXCEPTION(simple.set(testSize)); TESTS_EXCEPTION(simple.set(testSize + 5)); TESTS_EXCEPTION(simple.set(testSize + 90)); }
void modules_transform::create_modules(const std::unordered_map<std::string, std::list<std::string>>& internal_modules, meta_model::model& m) { helpers::name_factory f; for (const auto& pair : internal_modules) { const auto& ipp(pair.second); const auto n(f.build_module_name(m.name(), ipp)); const auto i(m.structural_elements().modules().find(n.qualified().dot())); if (i == m.structural_elements().modules().end()) { auto mod(boost::make_shared<meta_model::structural::module>()); mod->name(n); mod->origin_type(m.origin_type()); mod->configuration( boost::make_shared<variability::meta_model::configuration>()); mod->configuration()->name().simple(n.simple()); mod->configuration()->name().qualified(n.qualified().dot()); m.structural_elements().modules().insert(std::make_pair(n.qualified().dot(), mod)); } } }
int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "createFields.H" #include "createFvOptions.H" #include "initContinuityErrs.H" simpleControl simple(mesh); interpolationCellPoint<vector> UInterp(U); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; // --- Pressure-velocity SIMPLE corrector { #include "UEqn.H" #include "UInterp.H" #include "pEqn.H" } turbulence->correct(); runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; }
int main() { int t,i; long long pr; long long max; scanf("%d",&t); while(t--) { pr=0; double rate; int time; int op; int mode; int serv; long long a=0; scanf("%lld",&pr); scanf("%d",&time); scanf("%d",&op); max=0; for(i=0;i<op;i++) { scanf("%d %lf %d",&mode,&rate,&serv); if(mode==0) {a=simple(rate,serv,time,pr); if(a>max) max=a; } else { a=compound(rate,serv,time,pr); if(a>max) max=a; } } printf("%lld\n",max); } return 0; }
void testmain(void) { print("macros"); special(); include(); predefined(); simple(); loop(); undef(); cond_incl(); const_expr(); defined(); ifdef(); funclike(); empty(); noarg(); line(); null(); counter(); gnuext(); }
//Function handles stage command; if is a simple call that, otherwise fork and //call command function in child process //Parameters are the command and the bkgd value //returns the status from the command called int stageA(CMD* c, bool bkgd) { if(c->type == SIMPLE) { return simple(c, bkgd); } else { pid_t pid, wpid; int status; pid = fork(); if (pid == 0) { int saved_stdout = NULL; int saved_stdin = NULL; int dupsval = dups(c, &saved_stdout, &saved_stdin); if(dupsval != -1) exit(EXIT_FAILURE); //call command function and exit commandA(c->left, bkgd); resetDups(c, &saved_stdout, &saved_stdin); exit(EXIT_FAILURE); } else if (pid < 0) { // Error forking perror("lsh"); } else if(!bkgd){ // Parent process do { //pointer to wait wpid = waitpid(pid, &status, WUNTRACED); } while (!WIFEXITED(status) && !WIFSIGNALED(status)); return status; }else { return 0; } } return 1; }
int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "createFields.H" simpleControl simple(mesh); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nCalculating temperature distribution\n" << endl; while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { solve ( fvm::ddt(T) - fvm::laplacian(DT, T) ); } #include "write.H" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; }
int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "createFields.H" #include "createFvOptions.H" simpleControl simple(mesh); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nCalculating scalar transport\n" << endl; #include "CourantNo.H" while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; // solve // ( // fvm::ddt(T) // + fvc::div(phi, T) // ); T -= runTime.deltaT()*(fvc::div(phi,T) - fvc::laplacian(DT,T)); #include "write.H" runTime.write(); } Info<< "End\n" << endl; return 0; }
int main(int c, char *v[], char *e[]) { int rflag = ttyflg; int rsflag = 1; /* local restricted flag */ unsigned char *flagc = flagadr; struct namnod *n; mypid = getpid(); mypgid = getpgid(mypid); mysid = getsid(mypid); /* * Do locale processing only if /usr is mounted. */ localedir_exists = (access(localedir, F_OK) == 0); /* * initialize storage allocation */ if (stakbot == 0) { addblok((unsigned)0); } /* * If the first character of the last path element of v[0] is "-" * (ex. -sh, or /bin/-sh), this is a login shell */ if (*simple(v[0]) == '-') { signal(SIGXCPU, SIG_DFL); signal(SIGXFSZ, SIG_DFL); /* * As the previous comment states, this is a login shell. * Therefore, we set the login_shell flag to explicitly * indicate this condition. */ login_shell = TRUE; } stdsigs(); /* * set names from userenv */ setup_env(); /* * LC_MESSAGES is set here so that early error messages will * come out in the right style. * Note that LC_CTYPE is done later on and is *not* * taken from the previous environ */ /* * Do locale processing only if /usr is mounted. */ if (localedir_exists) (void) setlocale(LC_ALL, ""); #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ #define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */ #endif (void) textdomain(TEXT_DOMAIN); /* * 'rsflag' is zero if SHELL variable is * set in environment and * the simple file part of the value. * is rsh */ if (n = findnam("SHELL")) { if (eq("rsh", simple(n->namval))) rsflag = 0; } /* * a shell is also restricted if the simple name of argv(0) is * rsh or -rsh in its simple name */ #ifndef RES if (c > 0 && (eq("rsh", simple(*v)) || eq("-rsh", simple(*v)))) rflag = 0; #endif if (eq("jsh", simple(*v)) || eq("-jsh", simple(*v))) flags |= monitorflg; hcreate(); set_dotpath(); /* * look for options * dolc is $# */ dolc = options(c, v); if (dolc < 2) { flags |= stdflg; { while (*flagc) flagc++; *flagc++ = STDFLG; *flagc = 0; } } if ((flags & stdflg) == 0) dolc--; if ((flags & privflg) == 0) { uid_t euid; gid_t egid; uid_t ruid; gid_t rgid; /* * Determine all of the user's id #'s for this process and * then decide if this shell is being entered as a result * of a fork/exec. * If the effective uid/gid do NOT match and the euid/egid * is < 100 and the egid is NOT 1, reset the uid and gid to * the user originally calling this process. */ euid = geteuid(); ruid = getuid(); egid = getegid(); rgid = getgid(); if ((euid != ruid) && (euid < 100)) setuid(ruid); /* reset the uid to the orig user */ if ((egid != rgid) && ((egid < 100) && (egid != 1))) setgid(rgid); /* reset the gid to the orig user */ } dolv = (unsigned char **)v + c - dolc; dolc--; /* * return here for shell file execution * but not for parenthesis subshells */ if (setjmp(subshell)) { freejobs(); flags |= subsh; } /* * number of positional parameters */ replace(&cmdadr, dolv[0]); /* cmdadr is $0 */ /* * set pidname '$$' */ assnum(&pidadr, (long)mypid); /* * set up temp file names */ settmp(); /* * default internal field separators * Do not allow importing of IFS from parent shell. * setup_env() may have set anything from parent shell to IFS. * Always set the default ifs to IFS. */ assign(&ifsnod, (unsigned char *)sptbnl); dfault(&mchknod, MAILCHECK); mailchk = stoi(mchknod.namval); /* initialize OPTIND for getopt */ n = lookup("OPTIND"); assign(n, (unsigned char *)"1"); /* * make sure that option parsing starts * at first character */ _sp = 1; if ((beenhere++) == FALSE) /* ? profile */ { if ((login_shell == TRUE) && (flags & privflg) == 0) { /* system profile */ #ifndef RES if ((input = pathopen(nullstr, sysprofile)) >= 0) exfile(rflag); /* file exists */ #endif /* user profile */ if ((input = pathopen(homenod.namval, profile)) >= 0) { exfile(rflag); flags &= ~ttyflg; } } if (rsflag == 0 || rflag == 0) { if ((flags & rshflg) == 0) { while (*flagc) flagc++; *flagc++ = 'r'; *flagc = '\0'; } flags |= rshflg; } /* * open input file if specified */ if (comdiv) { estabf(comdiv); input = -1; } else { if (flags & stdflg) { input = 0; } else { /* * If the command file specified by 'cmdadr' * doesn't exist, chkopen() will fail calling * exitsh(). If this is a login shell and * the $HOME/.profile file does not exist, the * above statement "flags &= ~ttyflg" does not * get executed and this makes exitsh() call * longjmp() instead of exiting. longjmp() will * return to the location specified by the last * active jmpbuffer, which is the one set up in * the function exfile() called after the system * profile file is executed (see lines above). * This would cause an infinite loop, because * chkopen() will continue to fail and exitsh() * to call longjmp(). To make exitsh() exit instead * of calling longjmp(), we then set the flag forcexit * at this stage. */ flags |= forcexit; input = chkopen(cmdadr, 0); flags &= ~forcexit; } #ifdef ACCT if (input != 0) preacct(cmdadr); #endif comdiv--; } } #ifdef pdp11 else *execargs = (char *)dolv; /* for `ps' cmd */ #endif exfile(0); done(0); }
int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createDynamicFvMesh.H" #include "readDicts.H" #include "createFields.H" // Get patch ID for moving boundaries ("walls") //const label patchMotion = mesh.boundaryMesh().findPatchID("walls"); // Get patch ID for scaling flow rate const label patchScaling = mesh.boundaryMesh().findPatchID("outlet"); //meshRelax mesh_rlx(mesh, args); //Info << "Setup mesh relaxation object. meshRelax version is " // << mesh_rlx.get_version() << endl; fieldOperations fieldOp(args, patchScaling); Info << "Setup field operation object" << endl; Info<<"Patch \""<<mesh.boundaryMesh().names()[patchScaling] <<"\" is used for scaling U"<<nl; // * * * * * MAIN LOOP * * * * * * * * * * * * * * * * * * * * * // runTime.functionObjects().execute(); // Execute cntlDict functions bool runTimeIs0 = (runTime.value()==0) ? true : false; while (runTime.run()) { if( !runTimeIs0 ) // No mesh update at t=0 { runTime++; Info << "Begin cycle: Time = " << runTime.timeName() << " dt = " << runTime.deltaTValue() << nl << endl; // ********************************************************* // * Mesh motion & relaxation // ********************************************************* // calculate mesh motion //vectorField pointDisplacement = // l_T * fieldOp.getWallPointMotion(mesh, C, patchMotion); //mesh_rlx.meshUpdate(pointDisplacement, runTime); mesh.update(); //runTime.write(); Info << "Mesh update: ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s"<< nl<< endl; } /*############################################### * Steady-state flow solver *###############################################*/ steadyStateControl simple(mesh); while ( simple.loop() ) { if(inertia) { #include "UEqn.H" // Navier Stokes #include "pEqn.H" } else { #include "UEqnStokes.H" // Stokes #include "pEqn.H" } if(limitFlux) { scalar Q = fieldOp.getScalingFlowRate(phi); scalar compareTo = (constFlux) ? SMALL : limitValue; scalar scaleFactor = ( Q > compareTo ) ? limitValue / Q : 1.0; p == scaleFactor * p; U == scaleFactor * U; } } Info << "Final flow rate: " << fieldOp.getScalingFlowRate(phi)<<nl<<nl; Info << "Flow solver: " << "ExecutionTime = " << runTime.elapsedCpuTime() << " s " << "ClockTime = "<< runTime.elapsedClockTime() << " s" << nl << nl << endl; /*########################################## * Steady-state convection-diffusion solver *##########################################*/ Info << "Steady-state concentration solver"<< endl; int iter = 0; while ( true ) { iter++; double residual = solve ( fvm::div(phi, C) - fvm::laplacian(D, C) ).initialResidual(); if( residual < convCrit ) { Info << "Convection-diffusion: " << "ExecutionTime = " << runTime.elapsedCpuTime() << " s " << "ClockTime = " << runTime.elapsedClockTime() << " s" <<nl << "Converged in " << iter << " steps. Residual="<< residual << nl << endl; if(iter >= maxIter) { Info << nl << "dissolFoam Runtime WARNING:" << "Convection-diffusion solver did not converge." << nl << "Maximum number of iterations" << " iter: "<< iter << endl; } break; } else{ Info << " Step " << iter << " residual: "<< residual << " > " << convCrit << endl; } } // ********************************************************* // * Write Output data // ********************************************************* if(gradCWrite) gradC == -fvc::snGrad(C)*mesh.magSf(); Info << "Write fields: Time = " << runTime.timeName() << nl <<endl; (runTimeIs0) ? runTime.writeNow() : runTime.write(); runTimeIs0 = false; } Info << "End" << endl; return 0; }
int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "readMassFlowProperties.H" #include "readGravitationalAcceleration.H" #if OPENFOAM_VERSION < 40 simpleControl simple(mesh); #else #include "createControl.H" #endif #include "createFields.H" #include "createFvOptions.H" #include "initContinuityErrs.H" #if OPENFOAM_VERSION >= 40 turbulence->validate(); #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; #if OPENFOAM_VERSION >= 60 while (simple.loop(runTime)) #else while (simple.loop()) #endif { Info<< "Time = " << runTime.timeName() << nl << endl; // Pressure-velocity SIMPLE corrector { #include "UEqn.H" #if OPENFOAM_VERSION >= 40 if (simple.consistent()) { #include "pcEqn.H" } else #endif { #include "pEqn.H" } #include "ZEqn.H" #include "HEqn.H" } turbulence->correct(); runTime.write(); #include "writeMassFlow.H" #include "outputVariables.H" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; }
{ if (!pCamera || !pCamera->Connected) return 0; return m_exposureDuration; } void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { Close(false); } void MyFrame::OnInstructions(wxCommandEvent& WXUNUSED(event)) { wxMessageBox(wxString::Format(_("Welcome to PHD2 (Push Here Dummy, Gen2) Guiding\n\n \ Operation is quite simple (hence the 'PHD')\n\n \ 1) Press the 'Camera' button, select your camera and mount, click on 'Connect All'\n \ 2) Pick an exposure duration from the drop-down list\n \ 3) Hit the 'Loop' button, adjust your focus if necessary\n \ 4) Click on a star away from the edge or use Alt-S to auto-select a star\n \ 5) Press the PHD (archery target) icon\n\n \ PHD2 will then calibrate itself and begin guiding. That's it!\n\n \ To stop guiding, simply press the 'Loop' or 'Stop' buttons. If you need to \n \ tweak any options, click on the 'Brain' button to bring up the 'Advanced' \n \ panel. Use the 'View' menu to watch your guiding performance. If you have\n \ problems, read the help files! ")),_("Instructions")); } void MyFrame::OnHelp(wxCommandEvent& WXUNUSED(event)) {