void GrandmasterComponent::buttonClicked(Button* button)
{
	if (button == &initialPTPTimeButton)
	{
		int64 initialTime(initialPTPTimeEditor.getText().getLargeIntValue());
		int64 previousTime = tree[Identifiers::PTPInitialTime];

		initialTime = jlimit(int64(0), 0x7fffffffffffffffLL, initialTime);

		if (previousTime == initialTime)
		{
			tree.sendPropertyChangeMessage(Identifiers::PTPInitialTime);
		}
		else
		{
			tree.setProperty(Identifiers::PTPInitialTime, initialTime, nullptr);
		}

		initialPTPTimeEditor.setText(String(initialTime));
 
 		return;
	}

	if (button == &automaticPTPTimeToggle)
	{
		tree.setProperty(Identifiers::PTPAutomaticGMTime, button->getToggleState(), nullptr);
		return;
	}
}
void
InitPolicyInterpolation< mesh_Type >::
initSimulation ( bcContainerPtr_Type /*bchandler*/,
                 vectorPtr_Type solution )
{
    ASSERT ( problem()->hasExactSolution(), "Error: You cannot use the interpolation method if the problem has not an analytical solution." );

    Real currentTime = initialTime() - timestep() * bdf()->order();
    UInt pressureOffset = uFESpace()->fieldDim() * uFESpace()->dof().numTotalDof();

    vectorPtr_Type velocity;
    velocity.reset ( new vector_Type ( uFESpace()->map(), Unique ) );

    vectorPtr_Type pressure;
    pressure.reset ( new vector_Type ( pFESpace()->map(), Unique ) );

    *solution = 0.0;
    uFESpace()->interpolate ( problem()->uexact(), *velocity, currentTime );
    pFESpace()->interpolate ( problem()->pexact(), *pressure, currentTime );
    solution->add ( *velocity );
    solution->add ( *pressure, pressureOffset );
    bdf()->setInitialCondition ( *solution );

    currentTime += timestep();
    for ( ; currentTime <=  initialTime() + timestep() / 2.0; currentTime += timestep() )
    {
        *solution = 0.0;
        *velocity = 0.0;
        *pressure = 0.0;

        uFESpace()->interpolate ( problem()->uexact(), *velocity, currentTime );
        pFESpace()->interpolate ( problem()->pexact(), *pressure, currentTime );
        solution->add ( *velocity );
        solution->add ( *pressure, pressureOffset );

        // Updating bdf
        bdf()->shiftRight ( *solution );
    }
}
void DialogDay::task()
{
    DialogTask dialog;
    QTime initialTime(0, 0, 0);
    taskModel->setEditStrategy(QSqlTableModel::OnManualSubmit);
    taskModel->setTable("task");

    taskModel->setFilter("day='" + day.toString("yyyy-MM-dd") + "'");
    //taskModel.setEditStrategy(QSqlTableModel::OnFieldChange);
    taskModel->setHeaderData(0, Qt::Horizontal, QObject::tr("Project"));
     taskModel->setHeaderData(1, Qt::Horizontal, QObject::tr("ID"));
    taskModel->setHeaderData(2, Qt::Horizontal, QObject::tr("Date"));
    taskModel->setHeaderData(3, Qt::Horizontal, QObject::tr("Elapsed"));
    //taskModel->setHeaderData(3, Qt::Horizontal, QObject::tr("Attivita'"));
    taskModel->setHeaderData(4, Qt::Horizontal, QObject::tr("Task"));
    taskModel->setRelation(4, QSqlRelation("attivita", "id", "attivita"));

    taskModel->select();
    //QSqlRelationalTableModel todoModel;

    dialog.openTask("Task", "Elapsed", taskModel, day, "task", initialTime);
}
Example #4
0
//set up time
void NetCdfConfigureDialog::on_comboBoxDim3_currentIndexChanged(int id)
{
    if (_currentVar->num_dims() > 2)
    {
        if (id == -1) id = 0;
        double firstValue=0, lastValue=0;
        unsigned size = 0;
        getDimEdges(id,size,firstValue,lastValue);

        QTime firstTime(0,0,0), lastTime(0,0,0);
        int firstDaysToAdd = 0, lastDaysToAdd = 0;

        getDaysTime(firstValue,firstTime,firstDaysToAdd);
        getDaysTime(lastValue,lastTime,lastDaysToAdd);

        QDate initialDate(1960,1,1);
        QTime initialTime(0,0);

        QDateTime initialDateTime;
        initialDateTime.setDate(initialDate);
        initialDateTime.setTime(initialTime);

        QDateTime firstDateTime = initialDateTime.addDays(firstDaysToAdd);
        firstDateTime.setTime(firstTime);

        QDateTime lastDateTime = initialDateTime.addDays(lastDaysToAdd);
        lastDateTime.setTime(lastTime);

        dateTimeEditDim3->setDateTime(firstDateTime);
        dateTimeEditDim3->setMinimumDateTime(firstDateTime);
        dateTimeEditDim3->setMaximumDateTime(lastDateTime);

        _currentInitialDateTime = initialDateTime;
        lineEditName->setText(setName());
    }
}
Example #5
0
      /// Overload TabularSatStore::dump()
      /// Dump information about the object to an ostream.
      /// @param[in] os ostream to receive the output; defaults to std::cout
      /// @param[in] detail integer level of detail to provide; allowed values are
      ///    0: number of satellites, time step and time limits, flags,
      ///           gap and interval flags and values, and file information
      ///    1: number of data/sat
      ///    2: above plus all the data tables
      virtual void dump(std::ostream& os = std::cout, int detail = 0) const throw()
      {
         os << "Dump of RinexClockStore(" << detail << "):" << std::endl;
         if(detail >= 0) {
            const char *fmt="%4Y/%02m/%02d %2H:%02M:%02S";

            os << " Data stored for " << nsats()
               << " satellites\n";

            CommonTime initialTime(getInitialTime()), finalTime(getFinalTime());
            os << " Time span of data: ";
            if(initialTime == CommonTime::END_OF_TIME ||
               finalTime == CommonTime::BEGINNING_OF_TIME)
                  os << "(there are no time limits)" << std::endl;
            else
               os << initialTime.printf(fmt) << " TO "
                  << finalTime.printf(fmt) << std::endl;

            os << " This store contains:"
               << (haveClockBias ? "":" not") << " bias,"
               << (haveClockDrift ? "":" not") << " drift, and"
               << (haveClockAccel ? "":" not") << " acceleration data." << std::endl;
            os << " Checking for data gaps? " << (checkDataGap ? "yes":"no");
            if(checkDataGap) os << "; gap interval is "
               << std::fixed << std::setprecision(2) << gapInterval;
            os << std::endl;
            os << " Checking data interval? " << (checkInterval ? "yes":"no");
            if(checkInterval) os << "; max interval is "
               << std::fixed << std::setprecision(2) << maxInterval;
            os << std::endl;
            os << " Interpolation type is "
               << (interpType == 2 ? "Lagrange" : "Linear")
               << " using " << interpOrder << " consecutive data." << std::endl;
            os << " Rejecting bad clock data is turned "
               << (rejectBadClockFlag ? "ON":"OFF") << std::endl;

            // dump FileStore
            clkFiles.dump(os,detail);

            if(detail == 0) return;

            os << " List of satellites and number of records:\n";
            SatTable::const_iterator it;
            for(it=tables.begin(); it!=tables.end(); it++) {
               os << "  Sat " << it->first << " : "
                  << it->second.size() << " records.";

               if(detail == 1) { os << std::endl; continue; }

               os << "  Data:" << std::endl;
               DataTable::const_iterator jt;
               for(jt=it->second.begin(); jt!=it->second.end(); jt++) {
                  os << " " << jt->first.printf(fmt)
                     << " " << it->first
                     << std::scientific << std::setprecision(12)
                     << " " << std::setw(19) << jt->second.bias
                     << " " << std::setw(19) << jt->second.sig_bias;
                  if(haveClockDrift) os
                     << " " << std::setw(19) << jt->second.drift
                     << " " << std::setw(19) << jt->second.sig_drift;
                  if(haveClockAccel) os
                     << " " << std::setw(19) << jt->second.accel
                     << " " << std::setw(19) << jt->second.sig_accel;
                  os << std::endl;
               }
            }
         }
         os << "End dump of RinexClockStore." << std::endl;
      }