Exemplo n.º 1
0
Foam::binaryNode<CompType, ThermoType>::binaryNode
(
    chemPointISAT<CompType, ThermoType>* elementLeft,
    chemPointISAT<CompType, ThermoType>* elementRight,
    binaryNode<CompType, ThermoType>* parent
)
:
    leafLeft_(elementLeft),
    leafRight_(elementRight),
    nodeLeft_(nullptr),
    nodeRight_(nullptr),
    parent_(parent),
    variableTimeStep_(elementLeft->variableTimeStep()),
    v_(elementLeft->completeSpaceSize(), 0)
{
    if (this->variableTimeStep_)
    {
        nAdditionalEqns_ = 3;
    }
    else
    {
        nAdditionalEqns_ = 2;
    }

    calcV(elementLeft, elementRight, v_);
    a_ = calcA(elementLeft, elementRight);
}
Exemplo n.º 2
0
bool MainWindow::checkPassedA(quint32 docu, quint32 exam){
    bool retVal=true;
    if(calcA(docu,exam)<50 || docu<30 || exam<30){
        retVal = false;
    }
    return retVal;
}
Exemplo n.º 3
0
size_t PlanOperation::determineDynamicCount(size_t maxTaskRunTime) {
  // this can never be satisfied. Default to NO parallelization.
  if (maxTaskRunTime == 0) {
    return 1;
  }

  auto totalTableSize = getTotalTableSize();

  // Table is empty or in case of RadixJoin at least one operand is empty.
  // Also if getTotalTableSize() uses default implementation.
  if (totalTableSize == 0) {
    return 1;
  }

  auto totalTblSizeIn100k = totalTableSize / 100000.0;

  // this is the b of the mts = a / instances + b  model
  auto minMts = calcMinMts(totalTblSizeIn100k);

  if (maxTaskRunTime < minMts) {
    LOG4CXX_ERROR(logger, planOperationName() << ": Could not honor MTS request. Too small.");
    return 1024;
  }

  auto a = calcA(totalTblSizeIn100k);
  size_t numTasks = std::max(1, static_cast<int>(round(a / (maxTaskRunTime - minMts))));

  LOG4CXX_DEBUG(logger, planOperationName() << ": tts(in 100k): " << totalTblSizeIn100k << ", numTasks: " << numTasks);

  return numTasks;
}
void AffineDeformationFast::doAffineDeformation()
{
	if(oldControlPoint.size()!=newControlPoint.size())
	{
		return;//控制点形变前后数目不等,不能形变
	}

	if(!isPreComputed)
	{
		calcA();
	}

	int i,j;
	Point tempPoint,qstar;
	double sumofwqx,sumofwqy;
	ansPoint=commonPoint;
	for(i=0;i<ansPoint.size();i++)
	{
		if((j=isControlPoint(commonPoint[i]))>=0)
		{
			ansPoint[i].xx=newControlPoint[j].xx;
			ansPoint[i].yy=newControlPoint[j].yy;
			continue;
		}

		sumofwqx=0.0;
		sumofwqy=0.0;
		for(j=0;j<oldControlPoint.size();j++)
		{
			sumofwqx+=w[i][j]*newControlPoint[j].xx;
			sumofwqy+=w[i][j]*newControlPoint[j].yy;
		}
		qstar.xx=sumofwqx/sumofw[i];
		qstar.yy=sumofwqy/sumofw[i];
		
		tempPoint.xx=0;
		tempPoint.yy=0;
		for(j=0;j<oldControlPoint.size();j++)
		{
			tempPoint.xx+=A[i][j]*(newControlPoint[j].xx-qstar.xx);
			tempPoint.yy+=A[i][j]*(newControlPoint[j].yy-qstar.yy);
		}
		ansPoint[i].xx=tempPoint.xx+qstar.xx;
		ansPoint[i].yy=tempPoint.yy+qstar.yy;
	}

	isComputed=true;
}
Exemplo n.º 5
0
Foam::binaryNode<CompType, ThermoType>::binaryNode
(
    chemPointISAT<CompType, ThermoType>* elementLeft,
    chemPointISAT<CompType, ThermoType>* elementRight,
    binaryNode<CompType, ThermoType>* parent
)
:
    leafLeft_(elementLeft),
    leafRight_(elementRight),
    nodeLeft_(NULL),
    nodeRight_(NULL),
    parent_(parent),
    v_(elementLeft->completeSpaceSize(),0.0)
{
    calcV(elementLeft, elementRight, v_);
    a_ = calcA(elementLeft, elementRight);
}
Exemplo n.º 6
0
size_t calcB() {
    return sizeof(int) + calcA();
}
Exemplo n.º 7
0
int main(void) {
    malloc(calcA());
    return 0;
}
Exemplo n.º 8
0
void MainWindow::writeResults(){
    // Part A
    quint32 docu = (quint32) ui->spinboxDocumentation->value();
    quint32 exam  = (quint32) ui->spinboxExamination->value();
    qint32 pointsA = calcA(docu,exam);
    QString gradeA = getGrade(pointsA);
    ui->labelPointsA->setText(QString::number(pointsA).rightJustified(3,' '));
    if(checkPassedA(docu,exam)){
        ui->labelGradeA->setStyleSheet("QLabel { color : green; }");
    }
    else{
        ui->labelGradeA->setStyleSheet("QLabel { color : red; }");
    }
    ui->labelGradeA->setText(getGrade(pointsA).rightJustified(12,' '));

    // Part B
    quint32 nr=0;
    quint32 points=0;
    quint32 ga1 = (quint32) ui->spinboxGa1->value();
    quint32 ga2  = (quint32) ui->spinboxGa2->value();
    quint32 wiso  = (quint32) ui->spinboxWiso->value();
//    quint32 ga1E = (quint32) ui->spinboxGa1E->value();
//    quint32 ga2E  = (quint32) ui->spinboxGa2E->value();
//    quint32 wisoE  = (quint32) ui->spinboxWisoE->value();

    if(checkMAllowed(ga1,ga2,wiso)){    // oral is possible
        if(round((round((ga1*2.0+100.0)/3.0)*2.0+ga2*2.0+wiso)/5.0)>=50 && ga1<50){ // oral in ga1
            ui->radioButton1->setEnabled(true);
            if(ui->radioButton1->isChecked()){ // oral in ga1
                ui->spinboxGa1E->setEnabled(true);
                ui->spinboxGa1E->show();
                nr=1;
                points=ui->spinboxGa1E->value();
            }
            else{
                ui->spinboxGa1E->setValue(0);
                ui->spinboxGa1E->setEnabled(false);
                ui->spinboxGa1E->hide();
            }
        }
        else{
            ui->radioButton1->setAutoExclusive(false);
            ui->radioButton2->setAutoExclusive(false);
            ui->radioButton3->setAutoExclusive(false);
            ui->radioButton1->setChecked(false);
            ui->radioButton1->setAutoExclusive(true);
            ui->radioButton2->setAutoExclusive(true);
            ui->radioButton3->setAutoExclusive(true);
           ui->radioButton1->setEnabled(false);
           ui->spinboxGa1E->setValue(0);
           ui->spinboxGa1E->hide();
        }
        if(round((round((ga2*2.0+100.0)/3.0)*2.0+ga1*2.0+wiso)/5.0)>=50 && ga2<50){ // oral in ga2
            ui->radioButton2->setEnabled(true);
            if(ui->radioButton2->isChecked()){ // oral in ga1
                 ui->spinboxGa2E->setEnabled(true);
                 ui->spinboxGa2E->show();
                 nr=2;
                 points=ui->spinboxGa2E->value();
             }
             else{
                 ui->spinboxGa2E->setValue(0);
                 ui->spinboxGa2E->setEnabled(false);
                 ui->spinboxGa2E->hide();
             }
        }
        else{
            ui->radioButton1->setAutoExclusive(false);
            ui->radioButton2->setAutoExclusive(false);
            ui->radioButton3->setAutoExclusive(false);
            ui->radioButton2->setChecked(false);
            ui->radioButton1->setAutoExclusive(true);
            ui->radioButton2->setAutoExclusive(true);
            ui->radioButton3->setAutoExclusive(true);
            ui->radioButton2->setEnabled(false);
            ui->spinboxGa2E->setValue(0);
            ui->spinboxGa2E->hide();
        }
        if(round((round((wiso*2.0+100.0)/3.0)+ga1*2.0+ga2*2.0)/5.0)>=50 && wiso<50){ // oral in wiso
            ui->radioButton3->setEnabled(true);
            if(ui->radioButton3->isChecked()){ // oral in ga1
                ui->spinboxWisoE->setEnabled(true);
                ui->spinboxWisoE->show();
                nr=3;
                points=ui->spinboxWisoE->value();
            }
            else{
                ui->spinboxWisoE->setValue(0);
                ui->spinboxWisoE->setEnabled(false);
                ui->spinboxWisoE->hide();
            }

        }
        else{
            ui->radioButton1->setAutoExclusive(false);
            ui->radioButton2->setAutoExclusive(false);
            ui->radioButton3->setAutoExclusive(false);
            ui->radioButton3->setChecked(false);
            ui->radioButton1->setAutoExclusive(true);
            ui->radioButton2->setAutoExclusive(true);
            ui->radioButton3->setAutoExclusive(true);
            ui->radioButton3->setChecked(false);
            ui->radioButton3->setEnabled(false);
            ui->spinboxWisoE->setValue(0);
            ui->spinboxWisoE->hide();
        }
    }
    else{   // oral not possible
        ui->radioButton1->setAutoExclusive(false);
        ui->radioButton2->setAutoExclusive(false);
        ui->radioButton3->setAutoExclusive(false);
        ui->radioButton1->setChecked(false);
        ui->radioButton1->setEnabled(false);
        ui->radioButton2->setChecked(false);
        ui->radioButton2->setEnabled(false);
        ui->radioButton3->setChecked(false);
        ui->radioButton3->setEnabled(false);
        ui->radioButton1->setAutoExclusive(true);
        ui->radioButton2->setAutoExclusive(true);
        ui->radioButton3->setAutoExclusive(true);
        ui->spinboxGa1E->setValue(0);
        ui->spinboxGa1E->hide();
        ui->spinboxGa2E->setValue(0);
        ui->spinboxGa2E->hide();
        ui->spinboxWisoE->setValue(0);
        ui->spinboxWisoE->hide();
    }
    if(checkPassedB(ga1,ga2,wiso,nr,points)){
        ui->labelGradeB->setStyleSheet("QLabel { color : green; }");
    }
    else{
        ui->labelGradeB->setStyleSheet("QLabel { color : red; }");
    }

    qint32 pointsB = calcB(ga1,ga2,wiso,nr,points);
    QString gradeB = getGrade(pointsB);
    ui->labelPointsB->setText(QString::number(pointsB).rightJustified(3,' '));

    ui->labelGradeB->setText(getGrade(pointsB).rightJustified(12,' '));


    // Results
    // Part A
    ui->labelResultA->setText(QString::number(pointsA).rightJustified(3,' '));
    if(checkPassedA(docu,exam)){
        ui->labelGradeResultA->setStyleSheet("QLabel { color : green; }");
    }
    else{
        ui->labelGradeResultA->setStyleSheet("QLabel { color : red; }");
    }
    ui->labelGradeResultA->setText(getGrade(pointsA).rightJustified(12,' '));

    // Part B
    ui->labelResultB->setText(QString::number(pointsB).rightJustified(3,' '));
    if(checkPassedB(ga1,ga2,wiso,nr,points)){
        ui->labelGradeResultB->setStyleSheet("QLabel { color : green; }");
    }
    else{
        ui->labelGradeResultB->setStyleSheet("QLabel { color : red; }");
    }
    ui->labelGradeResultB->setText(getGrade(pointsB).rightJustified(12,' '));

    // All
    quint32 pointsAll = calcAll(pointsA,pointsB);
    QString gradeAll = getGrade(pointsAll);
    ui->labelResultAll->setText(QString::number(pointsAll).rightJustified(3,' '));
    if(checkPassedB(ga1,ga2,wiso,nr,points) && checkPassedA(docu,exam)){
        ui->labelGradeResult->setStyleSheet("QLabel { color : green; }");
        hasPassed=true;
    }
    else{
        ui->labelGradeResult->setStyleSheet("QLabel { color : red; }");
        hasPassed=false;
    }
    ui->labelGradeResult->setText(getGrade(pointsAll).rightJustified(12,' '));

    fillPRFG();
    fillMEPR();
    ui->saveFile->setEnabled(true);
}
Exemplo n.º 9
0
int main(void) {
    malloc(calcA());
    malloc(valid());
    malloc(shouldA());
    return 0;
}