コード例 #1
0
void patchExpressionFunctionObject::writeTheData(const word &pName,PatchValueExpressionDriver &driver)
{
    Field<T> result(driver.getResult<T>());

    AccumulationCalculation<T> calculator(
        result,
        driver.result().isPoint(),
        driver
    );

    Field<T> results(accumulations_.size());

    forAll(accumulations_,i) {
        const NumericAccumulationNamedEnum::accuSpecification accu=
            accumulations_[i];
        T val=calculator(accu);

        results[i]=val;
        if(verbose()) {
            Info << " " << accu
                << "=" << val;
        }
    }

    if (Pstream::master()) {
        writeTime(pName,time().value());
        writeData(pName,results);
        endData(pName);
    }
}
コード例 #2
0
//---------------------------------------------------------------------------------------------------
// MAIN.
//---------------------------------------------------------------------------------------------------
int main(void)
{
	
	//---------------------------------------------------------------------------------------------------
	// SETTING INPUT/OUTPUT CHARACTERISTICS FOR THE PINS.
	//---------------------------------------------------------------------------------------------------
	myPortDDR |=  (1 << p_clear);	// clear is an output.
	myPortDDR |=  (1 << p_1);		// 1	 is an output.
	myPortDDR |=  (1 << p_3);		// 3	 is an output.
	myPortDDR |=  (1 << p_8);		// 8	 is an output.
	myPortDDR &= ~(1 << p_sig_in);	// the input audio signal is and INPUT (obviously  :P).
	
	//---------------------------------------------------------------------------------------------------
	// MAIN CODE LOOP.
	//---------------------------------------------------------------------------------------------------
    int testDelay = 250;
	while(1)
    {
        calculator(p_clear);
		_delay_ms(testDelay);
		calculator(p_1);
		_delay_ms(testDelay);
		calculator(p_3);
		_delay_ms(testDelay);
		calculator(p_8);
		_delay_ms(testDelay);
    }
}
コード例 #3
0
ファイル: 4_10.c プロジェクト: wxiaodong0829/aka_edu_learned
int main()
{
	int ret;
	int a, b;
	char c;
	scanf("%c\n%d %d", &c, &a, &b);
	switch (c) {
		case '+':
			ret = calculator(a, b, add);
			break;
		case '-':
			ret = calculator(a, b, sub);
			break;
		case '*':
			ret = calculator(a, b, mul);
			break;
		case '/':
			ret = calculator(a, b, dev);
			break;
			
	}
	if (ret == -1)
		return 0;
	printf("%d\n", ret);
	return 0;
}
コード例 #4
0
void MainWindow::spi_recvOver120003(Msg* pMsg)
{
	qDebug()<<"0x50:"<<QDateTime::currentDateTime().toString("hh:mm:ss");	
        customPlot->legend->setVisible(true);
	calculator();
	modeCombo->setEnabled(true);
}
コード例 #5
0
ファイル: calculator.c プロジェクト: dvhuynh/pic32-examples
int main (void)
{
    char c;

    for (;;)
    {
        c = getch ();

        if (strchr ("zq.", c) != NULL)
            break;

        switch (c)
        {
        case '+'  : c = add         ; break;
        case '-'  : c = substract   ; break;
        case '*'  : c = multiply    ; break;
        case '/'  : c = divide      ; break;
        case '('  : c = parentheses ; break;
        case ')'  : c = parentheses ; break;
        default   : c = c - '0'     ; break;
        }

        printf ("%s", calculator (c));
    }

    return 0;
}
コード例 #6
0
ファイル: project.c プロジェクト: IronFactory/Project1
int main(void) {
	int menuChoice;
	int subMenu;

	printf("\tMenu\n");
	printf("1. Calculator\n");
	printf("2. Scheduler\n");
	printf("3. End\n");

	scanf("%d", &menuChoice);
	switch(menuChoice) {
		case 1:
			// 계산기
			calculator();
			break;

		case 2:
			while (1) {
				// 스케쥴러
				subMenu = schedulerMenu();
				switch(subMenu) {
					case 1:
						insertSchedule(mScheduleCount);
						break;
				}
			}
			break;

		case 3:
			// 종료
			printf("종료됩니다.\n");
			break;
	}
	return 0;
}
コード例 #7
0
    // see also TestPapillaryFibreCalculatorLong() for bigger test of the main method on a cylinder.
    void TestGetFibreOrientationsOnSimpleCube(void) throw(Exception)
    {
        TrianglesMeshReader<3,3> mesh_reader("mesh/test/data/simple_cube");
        TetrahedralMesh<3,3> mesh;
        mesh.ConstructFromMeshReader(mesh_reader);

        PapillaryFibreCalculator calculator(mesh);
        std::vector<c_vector<double,3> > fibre_orientations = calculator.CalculateFibreOrientations();

        // Not very well defined for a cube (since it's so well structured that there are zero
        // eigenvectors in the smoothed tensors) but necessary to test coverage.
        // Nightly test TestPapillaryFibreCalculatorLong.hpp is a better one if you want to understand it!

        ///\todo There may still be a sign issue between flapack and MKL
        ///\todo THIS TEST IS KNOWN TO STALL IN LAPACK (dgeev_)
        //       ON THIS CONFIGURATION :
        //  * 32-bit virtual machine on Ubuntu 8.04 LTS
        //  * build=GccOpt
        //  * PETSc: petsc-2.3.2-p10 with f2cblaslapack
        TS_ASSERT_DELTA(fabs(fibre_orientations[0](0)), 0.7056, 1e-4);
        TS_ASSERT_DELTA(fabs(fibre_orientations[0](1)), 0.0641, 1e-4);
        TS_ASSERT_DELTA(fabs(fibre_orientations[0](2)), 0.7056, 1e-4);

        TS_ASSERT_DELTA(fabs(fibre_orientations[4](0)), 0.0455, 1e-4);
        TS_ASSERT_DELTA(fabs(fibre_orientations[4](1)), 0.5005, 1e-4);
        TS_ASSERT_DELTA(fabs(fibre_orientations[4](2)),  0.8645, 1e-4);

        TS_ASSERT_DELTA(fabs(fibre_orientations[5](0)), 0.6704, 1e-4);
        TS_ASSERT_DELTA(fabs(fibre_orientations[5](1)), 0.3176, 1e-4);
        TS_ASSERT_DELTA(fabs(fibre_orientations[5](2)), 0.6704, 1e-4);
    }
コード例 #8
0
    void TestAllCases()
    {
        TrianglesMeshReader<2,2> mesh_reader("mesh/test/data/square_2_elements");
        MutableMesh<2,2> mesh;
        mesh.ConstructFromMeshReader(mesh_reader);

        TS_ASSERT_DELTA(mesh.GetAngleBetweenNodes(2,0), -0.75*M_PI, 1e-12);
        TS_ASSERT_DELTA(mesh.GetAngleBetweenNodes(2,1), -0.5*M_PI, 1e-12);

        CellsGenerator<FixedG1GenerationalCellCycleModel, 2> cells_generator;
        std::vector<CellPtr> cells;
        cells_generator.GenerateBasic(cells, mesh.GetNumNodes());

        MeshBasedCellPopulation<2> cell_population(mesh, cells);

        MAKE_PTR(GeneralisedLinearSpringForce<2>, p_force);
        std::vector<boost::shared_ptr<AbstractTwoBodyInteractionForce<2> > > force_collection;
        force_collection.push_back(p_force);

        DiscreteSystemForceCalculator calculator(cell_population, force_collection);

        double epsilon = 0.5*M_PI;
        calculator.SetEpsilon(epsilon);

        TS_ASSERT_THROWS_NOTHING(calculator.GetSamplingAngles(2));
    }
コード例 #9
0
void addSiteDialog::doSubnetUpdate()
{
    IpCalculator calculator(ui->lineEdit_2->text()+'/'+ui->lineEdit_3->text());

    ui->label_15->setText(calculator.getBroadcast());
    broadcastIp=calculator.getBroadcast();

    ui->label_16->setText(calculator.getHostsPerNetwork());
    ui->label_17->setText(calculator.getMaxHost());
    ui->label_14->setText(calculator.getMinHost());
    ui->label_13->setText(calculator.getSubnetMask());

    ui->label_12->setText(calculator.getNetwork());
    networkIp=calculator.getNetwork();

    /*QString networkClass = calculator.getNetworkClass();

    if (networkClass == IpCalculator::classUndefined) {
        ui->labelInformation->setText(QString("Undefined Class"));
    } else {
        QString classInformation = QString("Class %1 Network")
            .arg(calculator.getNetworkClass());
        ui->labelInformation->setText(classInformation);
    }*/
}
コード例 #10
0
//=========================================================================================
ProjectivePoint::ProjectivePoint( BindType bindType ) : GAVisToolGeometry( bindType )
{
	VectorMath::Zero( center );
	weight = 1.0;

	CalcLib::Calculator calculator( "geoalg" );

	char decompositionCode[ 512 ];
	sprintf_s( decompositionCode, sizeof( decompositionCode ),
		"do("
		"w = pt . e0,"
		"pt = pt / w,"
		"x = scalar_part( pt, e1 ),"
		"y = scalar_part( pt, e2 ),"
		"z = scalar_part( pt, e3 ),"
		")"
	);
	decompositionEvaluator = calculator.CompileEvaluator( decompositionCode );
	wxASSERT( decompositionEvaluator != 0 );

	char compositionCode[ 512 ];
	sprintf_s( compositionCode, sizeof( compositionCode ),
		"do("
		"c = x*e1 + y*e2 + z*e3,"
		"pt = w*(c + e0),"
		")"
	);
	compositionEvaluator = calculator.CompileEvaluator( compositionCode );
	wxASSERT( compositionEvaluator != 0 );
}
コード例 #11
0
int main(int argc, const char* argv[]){
	char chk;
	printf("\t<<<<<<<<<< Welcome to Postfix to Result Program >>>>>>>>>>\n");
	do{
		printf("\n\tPostfix\t: ");
		input();
		printf("\t----------------------------------------------------------");
		printf("\n\tResult\t: ");
		output();
		printf("\n\t----------------------------------------------------------\n\n");
		printf("\tPlease input value each variable\n");
		calculator();
		printf("\n\tTotal: %.2f", total);
		printf("\n\t----------------------------------------------------------");
		destroy();
		printf("\n\n");
		do{
			printf("\tDo you want to change Postfix to Result (y/n)? : ");
			fflush(stdin);
			scanf("%c", &chk);
		}while(!(tolower(chk) == 'y' || tolower(chk) == 'n'));
		
	}while(tolower(chk) != 'n');
	
	printf("\n\n\t<<<<<<<<<<<<<<<<<<<<<<<< Good Bye >>>>>>>>>>>>>>>>>>>>>>>>\n\n");
	
	getch();
	return 0;
}
コード例 #12
0
QString addressRangeValidAvailable(QString networkIp,QString broadcastIp, QString vpnAddressRange, unsigned int vpnId)
{
    unsigned int rangeStart=qstringAddressToUint(networkIp);
    unsigned int rangeEnd=qstringAddressToUint(broadcastIp);

    //bool valid=false;
    bool available=true;


    IpCalculator calculator(vpnAddressRange);

    unsigned int bufferRangeStart=qstringAddressToUint(calculator.getNetwork());
    unsigned int bufferRangeEnd=qstringAddressToUint(calculator.getBroadcast());

    if ((rangeStart>=bufferRangeStart)&&(rangeEnd<=bufferRangeEnd)){}
    else{return "Range outside current VPN";}


    QSqlQuery getSitesinVpn;
    getSitesinVpn.exec(QString("select siteAddressRange,siteName from sites where vpnId=%1").arg(vpnId));

    QString siteAddress;
    QString interferingSites="";
    while(getSitesinVpn.next())
    {
        siteAddress=getSitesinVpn.value(0).toString();

        IpCalculator calculator(siteAddress);

        bufferRangeStart=qstringAddressToUint(calculator.getNetwork());
        bufferRangeEnd=qstringAddressToUint(calculator.getBroadcast());

        if ((rangeStart<=bufferRangeEnd)&&(rangeEnd>=bufferRangeStart))
            {
                available=false;
                interferingSites=interferingSites+" "+getSitesinVpn.value(1).toString();
            }


    }

    if(!available){return("Range already used in sites:"+interferingSites+".");}

    return("ok");

}
コード例 #13
0
ファイル: vv.cpp プロジェクト: TiesB/RM2
void MainWindow::on_but_res_clicked()
{
    if (!is_a||!is_b) {
        ui->op_show->setText("=");
        ui->output->display(temp);
    }
    if (is_a&&is_b&&is_op) {
        calculator();
    }
}
コード例 #14
0
static void measureTextRenderer(RenderSVGInlineText* text, MeasureTextData* data, bool processRenderer)
{
    ASSERT(text);

    SVGTextLayoutAttributes* attributes = text->layoutAttributes();
    Vector<SVGTextMetrics>* textMetricsValues = &attributes->textMetricsValues();
    if (processRenderer) {
        if (data->allCharactersMap)
            attributes->clear();
        else
            textMetricsValues->clear();
    }

    SVGTextMetricsCalculator calculator(text);
    bool preserveWhiteSpace = text->style()->whiteSpace() == PRE;
    unsigned surrogatePairCharacters = 0;
    unsigned skippedCharacters = 0;
    unsigned textPosition = 0;
    unsigned textLength = calculator.textLength();

    SVGTextMetrics currentMetrics;
    for (; textPosition < textLength; textPosition += currentMetrics.length()) {
        currentMetrics = calculator.computeMetricsForCharacter(textPosition);
        if (!currentMetrics.length())
            break;

        bool characterIsWhiteSpace = calculator.characterIsWhiteSpace(textPosition);
        if (characterIsWhiteSpace && !preserveWhiteSpace && data->lastCharacterWasWhiteSpace) {
            if (processRenderer)
                textMetricsValues->append(SVGTextMetrics(SVGTextMetrics::SkippedSpaceMetrics));
            if (data->allCharactersMap)
                skippedCharacters += currentMetrics.length();
            continue;
        }

        if (processRenderer) {
            if (data->allCharactersMap) {
                const SVGCharacterDataMap::const_iterator it = data->allCharactersMap->find(data->valueListPosition + textPosition - skippedCharacters - surrogatePairCharacters + 1);
                if (it != data->allCharactersMap->end())
                    attributes->characterDataMap().set(textPosition + 1, it->value);
            }
            textMetricsValues->append(currentMetrics);
        }

        if (data->allCharactersMap && calculator.characterStartsSurrogatePair(textPosition))
            surrogatePairCharacters++;

        data->lastCharacterWasWhiteSpace = characterIsWhiteSpace;
    }

    if (!data->allCharactersMap)
        return;

    data->valueListPosition += textPosition - skippedCharacters;
}
コード例 #15
0
ファイル: DS2.cpp プロジェクト: iamlkj/linguistic-tree
void search()
{
	
	char tmp[610];

	int p=ncount+1; 
	while(fgets(tmp,610,input))
	{
		latree[p].clean (); 
		int c=0;
		while(tmp[c])c++;
		if(!isen(tmp[c-1])) tmp[c-1]=0;
		c=0; 
		double ansmax=0.00000;
		latree[p].l=tmp[1]-48;                      //LEVEL<10
		latree[p].makeakey(tmp+4);
		//	printf("%d\n",latree[21].v); 
		while(latree[c].howlong)
		{
			//printf("   [%d %d]\n",c,latree[c].l);
			if(latree[c].l<=latree[p].l)
			{
			
				if(calculator(c,p)>=ansmax&&calculator(c,p)!=0)
				{

					ansmax= calculator(c,p); 
					anssheet(calculator(c,p),c);
				}	
			}
			c++; 
		}
		output(tmp);
		anssheet(); 
		for(int a=0;a<610;a++)
		{
			tmp[a]=0; 
		} 
	} 
	
} 
コード例 #16
0
int main(int argc, char* argv[])
{
	Options options(argc, argv);

	if (options.parse())
	{
		Calculator calculator(options.width(), options.height(), options.probability(), options.type(), options.gravity());
		std::cout << (options.is_simulation() ? calculator.simulate() : calculator.calculate(options.steps())) << std::endl;
	}

	return 0;
}
コード例 #17
0
    forAll(fractionBiggerThan,i) {
        scalar value=fractionBiggerThan[i];
        NumericAccumulationNamedEnum::accuSpecification bigger(
            NumericAccumulationNamedEnum::numBigger,
            value
        );
        NumericAccumulationNamedEnum::accuSpecification wbigger(
            NumericAccumulationNamedEnum::numWeightedBigger,
            value
        );
        OStringStream annotation;
        annotation << "x > " << value << " | weighted";

        writeData(
            Info,calculator(bigger),
            annotation.str(),NumericAccumulationNamedEnum::toString(bigger));
        Info << " | ";
        writeData(
            Info,calculator(wbigger),
            "",NumericAccumulationNamedEnum::toString(wbigger),true);
    }
コード例 #18
0
ファイル: DS2.cpp プロジェクト: iamlkj/linguistic-tree
int findmymom(int now)
{
	int tmp=0;
	double max=0;
	for(int i=0;i<now;i++)
	{
		if(max<calculator(now,i))
		{

		   
		      
			max=calculator(now,i);
		//	printf("%f",max) ;
			tmp=i; 
		}
		
		
		//printf(" %d %d",i,now) ; 
		//system("pause") ; 
	}
	return tmp; 
}
コード例 #19
0
ファイル: myintl.cpp プロジェクト: bingmann/cryptote
MyPluralFormsCalculator* MyPluralFormsCalculator::make(const char* s)
{
    MyPluralFormsCalculatorPtr calculator(new MyPluralFormsCalculator);
    if (s != NULL)
    {
        MyPluralFormsScanner scanner(s);
        MyPluralFormsParser p(scanner);
        if (!p.parse(*calculator))
        {
            return NULL;
        }
    }
    return calculator.release();
}
コード例 #20
0
ファイル: float.c プロジェクト: VincentBao/Cloud-Computing
/*********************************
/function name: signal_handler()
/function: execute the calculation every seconds
*********************************/
void signal_handler()
{
	clock_t start, finish;

	start = clock();

	do{
		calculator();
		finish = clock();
	}while(((finish - start) / CLOCKS_PER_SEC) <= 1);
	printf("%d seconds ", ++count);
	printf("%ld instructions\n", amount);

}
コード例 #21
0
ファイル: calculator.c プロジェクト: ytaoWang/test
int main(int argc, char* argv[])
{
	int sum = 0;

	if(argc != 2) {
		fprintf(stderr,"usage:%s expression.\n",argv[0]);
		return -1;
	}

    //printf("next operator:%c\n",__next_op_parenthesis("(((123+123)*3))-3",NULL));
	calculator(argv[1],&sum);
	printf("expression:%s,value:%d\n",argv[1],sum);

	return 0;
}
コード例 #22
0
void interfaceViewer::on_pushButton_6_clicked()             ///addDetail button
{
    IpCalculator calculator(interfaceAddressRange);

    addDetail.setRangeStart(calculator.getMinHost());
    addDetail.setRangeEnd(calculator.getMaxHost());

    addDetail.setInterfaceId(interfaceId);
    addDetail.setInterfaceName(interfaceName);

    addDetail.setVpnId(vpnId);
    addDetail.setVpnName(vpnName);

    addDetail.show();
}
コード例 #23
0
                                                        ///gets the settings, interfaceId etc...
void interfaceViewer::set(unsigned int inputInterfaceId, QString inputInterfaceName, QString inputInterfaceAddressRange)
{
    interfaceId=inputInterfaceId;
    interfaceName=inputInterfaceName;
    interfaceAddressRange=inputInterfaceAddressRange;
    ui->label_7->setText("Platform name "+interfaceName);
    ui->label_8->setText("Address range "+interfaceAddressRange);
    QString detailQry=QString("SELECT detailId,detailAddress,localPort,comment FROM details where interfaceId=%1").arg(interfaceId);
    detailsModel->setQuery(detailQry);
    IpCalculator calculator(interfaceAddressRange);
    ui->label_2->setText(calculator.getHostsPerNetwork());
    ui->label->setText(tr("%1").arg(countUsedDetails(interfaceId)));


}
コード例 #24
0
ファイル: rpn_automat.c プロジェクト: lorenzgerber/rpn_pda
int main(int argc, char **argv) {

    /*
     * Check number of command line arguments
     */
    if(argc <= 1){
        return wrongArgs();
    }

    /*
     * make copy of input string for rpn calculation
     */
    char *rpn_input = calloc(strlen(argv[1]),255);
    strcpy(rpn_input, argv[1]);


    /*
     * Creating and execute RPN Validator
     * Push Down Automaton
     */
    Pda *val_pda = pda_create();
    validator(val_pda);
    pda_execute(val_pda, argv[1], false);


    /*
     * creating and executing RPN Calculator
     * Push Down Automaton
     */
    if(val_pda->succeed) {
        Pda *calc_pda = pda_create();
        calculator(calc_pda);
        pda_execute(calc_pda, rpn_input, false);
        pda_free(calc_pda);
    }


    /*
     * Clean up
     */
    free(rpn_input);
    pda_free(val_pda);


    return 0;
}
コード例 #25
0
void ZLQtApplicationWindow::refresh() {
	if (((MyMenuBar*)myToolBar)->myIndex == -1) {
		((MyMenuBar*)myToolBar)->myIndex = 1;
		ZLApplicationWindow::refresh();
		((MyMenuBar*)myToolBar)->myIndex = -1;
	}

	MenuMaskCalculator calculator(*this);
	calculator.processMenu(application());
	if (calculator.shouldBeUpdated()) {
		myMenu->clear();
		MenuUpdater(*this).processMenu(application());
	} else {
		for (std::map<std::string,ZLQtMenuAction*>::iterator it = myMenuMap.begin(); it != myMenuMap.end(); ++it) {
			it->second->setEnabled(application().isActionEnabled(it->first));
		}
	}
}
コード例 #26
0
int main(int argc, const char * argv[])
{

    //struct linearEq formula_1 = {1, -2, 0};
    struct linearEq formula = {-3, 1 , 4};
    struct xyPoint results;
    int x = 1;
    
    results = calculator(formula, x);
    
    
    
    printf(" solution of Eq1 %f * x + %f * y = %f is ( %f , %f) when x = %f \n",formula.A, formula.B, formula.C, results.x, results.y, results.x);
    
    // insert code here...
    printf("Hello, World!\n");
    return 0;
}
コード例 #27
0
    void TestCalculateWriteResultsToFile()
    {
        std::string output_directory = "TestDiscreteSystemForceCalculator";

        // Set up a cell population

        HoneycombMeshGenerator mesh_generator(7, 5, 0, 2.0);
        MutableMesh<2,2>* p_mesh = mesh_generator.GetMesh();

        CellsGenerator<FixedG1GenerationalCellCycleModel, 2> cells_generator;
        std::vector<CellPtr> cells;
        cells_generator.GenerateBasic(cells, p_mesh->GetNumNodes());

        MeshBasedCellPopulation<2> cell_population(*p_mesh, cells);

        // Create the force law and pass in to a std::list
        MAKE_PTR(GeneralisedLinearSpringForce<2>, p_force);
        std::vector<boost::shared_ptr<AbstractTwoBodyInteractionForce<2> > > force_collection;
        force_collection.push_back(p_force);

        // Create a force calculator
        DiscreteSystemForceCalculator calculator(cell_population, force_collection);

        // Test WriteResultsToFile
        calculator.WriteResultsToFile(output_directory);

        // Compare output with saved files of what they should look like
        OutputFileHandler handler(output_directory, false);
        std::string results_file = handler.GetOutputDirectoryFullPath() + "results_from_time_0/results.vizstress";

        NumericFileComparison node_velocities(results_file, "cell_based/test/data/TestDiscreteSystemForceCalculator/results.vizstress");
        TS_ASSERT(node_velocities.CompareFiles(1e-4));

        // Run a simulation to generate some results.viz<other things> files
        // so the visualizer can display the results.vizstress file.
        // (These lines are not actually necessary for generating results.vizstress)
        OffLatticeSimulation<2> simulator(cell_population);

        simulator.AddForce(p_force);

        simulator.SetEndTime(0.05);
        simulator.SetOutputDirectory(output_directory+"_rerun");
        simulator.Solve();
    }
コード例 #28
0
//=========================================================================================
ConformalQuarticGeometry::ConformalQuarticGeometry( BindType bindType ) : SurfaceGeometry( bindType, &conformalQuartic )
{
	CalcLib::Calculator calculator( "geoalg" );

	char decompositionCode[ 2*1024 ];
	strcpy_s( decompositionCode, sizeof( decompositionCode ),
		"do("

		"c0 = scalar_part( quartic, no^nob ),"
		"c1 = scalar_part( quartic, no^e1b ),"
		"c2 = scalar_part( quartic, no^e2b ),"
		"c3 = scalar_part( quartic, no^e3b ),"
		"c4 = scalar_part( quartic, no^nib ),"

		"c5 = scalar_part( quartic, e1^nob ),"
		"c6 = scalar_part( quartic, e1^e1b ),"
		"c7 = scalar_part( quartic, e1^e2b ),"
		"c8 = scalar_part( quartic, e1^e3b ),"
		"c9 = scalar_part( quartic, e1^nib ),"
		
		"c10 = scalar_part( quartic, e2^nob ),"
		"c11 = scalar_part( quartic, e2^e1b ),"
		"c12 = scalar_part( quartic, e2^e2b ),"
		"c13 = scalar_part( quartic, e2^e3b ),"
		"c14 = scalar_part( quartic, e2^nib ),"
		
		"c15 = scalar_part( quartic, e3^nob ),"
		"c16 = scalar_part( quartic, e3^e1b ),"
		"c17 = scalar_part( quartic, e3^e2b ),"
		"c18 = scalar_part( quartic, e3^e3b ),"
		"c19 = scalar_part( quartic, e3^nib ),"
		
		"c20 = scalar_part( quartic, ni^nob ),"
		"c21 = scalar_part( quartic, ni^e1b ),"
		"c22 = scalar_part( quartic, ni^e2b ),"
		"c23 = scalar_part( quartic, ni^e3b ),"
		"c24 = scalar_part( quartic, ni^nib ),"

		")"
	);
	decompositionEvaluator = calculator.CompileEvaluator( decompositionCode );
	wxASSERT( decompositionEvaluator != 0 );
}
コード例 #29
0
ファイル: a.c プロジェクト: Rishabh04-02/DS-lab
int main()
{
 int i;
 printf("Insert a postfix notation :: ");
 gets(post);
 for(i=0;i<strlen(post);i++)
 {
  if(post[i]>='0' && post[i]<='9')
  {
   pushstack(i);
  }
  if(post[i]=='+' || post[i]=='-' || post[i]=='*' || 
  post[i]=='/' || post[i]=='^')
  {
   calculator(post[i]);
  }
 }
 printf("\n\nResult :: %d",stack[top]);
}
コード例 #30
0
    void TestGetSingleRadiusVector(void) throw(Exception)
    {
        TrianglesMeshReader<3,3> mesh_reader("mesh/test/data/simple_cube");
        TetrahedralMesh<3,3> mesh;
        mesh.ConstructFromMeshReader(mesh_reader);

        TS_ASSERT_EQUALS(mesh.GetNumElements(),12u);

        PapillaryFibreCalculator calculator(mesh);

        // Call GetRadiusVectors on an element
        unsigned element_index = 0;
        c_vector<double, 3> radius_vector = calculator.GetRadiusVectorForOneElement(element_index);

        // Check they are right
        TS_ASSERT_DELTA(radius_vector[0], -0.275, 1e-9);
        TS_ASSERT_DELTA(radius_vector[1], -0.025, 1e-9);
        TS_ASSERT_DELTA(radius_vector[2], -0.275, 1e-9);
    }