QList<qreal> toJSList(int64_t low, int64_t high)
{
    int64_t lowMillis;
    int64_t lowNanos;
    int64_t highMillis;
    int64_t highNanos;

    splitTime(low, &lowMillis, &lowNanos);
    splitTime(high, &highMillis, &highNanos);

    QList<qreal> jslist;
    jslist.append((qreal) lowMillis);
    jslist.append((qreal) highMillis);
    jslist.append((qreal) lowNanos);
    jslist.append((qreal) highNanos);

    return jslist;
}
//---------------------------------------------------------------------------
std::ostream& operator<<(std::ostream& out,const Timestamp& value)
   // Output
{
   if (value==Timestamp::null())
      out << "NULL";

   unsigned year,month,day;
   splitJulianDay(value.value/msPerDay,year,month,day);
   unsigned hour,minute,second,ms;
   splitTime(value.value%msPerDay,hour,minute,second,ms);

   char buffer[50];
   if (ms)
      snprintf(buffer,sizeof(buffer),"%04u-%02u-%02u %u:%02u:%02u.%03u",year,month,day,hour,minute,second,ms); else
      snprintf(buffer,sizeof(buffer),"%04u-%02u-%02u %u:%02u:%02u",year,month,day,hour,minute,second);
   return out << buffer;
}
Exemple #3
0
int main(int argc, char *argv[])
{

    #include "setRootCase.H"
    if (! Pstream::parRun()) MPI_Init(&argc,&argv);

    #include "createTime.H"
    #include "createMesh.H"
    #include "readEnvironmentalProperties.H"
    #include "createFields.H"
    scalar t0 = runTime.elapsedCpuTime();
    #include "createParticles.H"
    #include "initContinuityErrs.H"
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

    scalarList splitTime(5,0.0);

    Info<< "\nStarting time loop\n" << endl;
    #include "liftDragCoeffs.H"

    splitTime[1] += runTime.elapsedCpuTime() - t0;

    while (runTime.run())
    {
        t0 = runTime.elapsedCpuTime();

        runTime++;
        Info<< "Time = " << runTime.timeName() << nl << endl;

        // Correct the kinetic viscosity
        // not applicable in Newtonian flow
        continuousPhaseTransport.correct();

        #include "readPISO.H"
        #include "CourantNo.H"

        #include "alphaEqn.H"

        #include "UEqns.H"

        // --- PISO loop
        #include "pEqn.H"

        // update the turbulence viscosity
        continuousPhaseTurbulence->correct();

        #include "DDtU.H"

        splitTime[0] += runTime.elapsedCpuTime() - t0;
        t0 = runTime.elapsedCpuTime();

        // get drag from latest velocity fields and evolve particles.
        #include "moveParticles.H"

        splitTime[1] += runTime.elapsedCpuTime() - t0;
        t0 = runTime.elapsedCpuTime();

        #include "liftDragCoeffs.H"
        #include "write.H"

        splitTime[2] += runTime.elapsedCpuTime() - t0;
        t0 = runTime.elapsedCpuTime();

        #include "writeCPUTime.H"

        if (runTime.outputTime())
        {
            // TODO: for debugging
            volVectorField ggradp("gradp",fvc::grad(p));
            ggradp.write();
        }
    }

    Info<< "End\n" << endl;

    if (! Pstream::parRun())  MPI_Finalize();
    return(0);
}