当前位置: 首页>>代码示例>>C++>>正文


C++ Array1D::fill方法代码示例

本文整理汇总了C++中Array1D::fill方法的典型用法代码示例。如果您正苦于以下问题:C++ Array1D::fill方法的具体用法?C++ Array1D::fill怎么用?C++ Array1D::fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Array1D的用法示例。


在下文中一共展示了Array1D::fill方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: printSimulationResultsForTed_pedigreeDepth_badMR

/*!
 * Print simulation results to standard output when MR constraints are not satisfied.
 * These results fixed to very high pedigree depths / non-satisfied constraints
 */
void printSimulationResultsForTed_pedigreeDepth_badMR(PedigreeDepthStorage *pdStorage, ProgramOptionParser *opt) {

	// print pedigree depth (i.e., value that Ted's optimizer is minimizing)
	printf("999\n");

	// print whether cell production constraints (cpc) met
	printf("0\n");

	// print whether fecundity constraints (fc) met
	printf("0\n");

	// print whether all constraints met
	printf("0\n");

	// print pedigree depth of individual simulations runs
	Array1D<float> temp;
	Array1D<float>::array_index numRuns = pdStorage->pd_AllCellsEnterMeioticRegion->size();
	temp.resize(numRuns);
	temp.fill(999);
	temp.display();

	// print whether cell production constraint is met for individual simulation runs
	Array2D<float>::array_index dimx_cellProduction,dimy_cellProduction;
	pdStorage->simulatedCellProductionSchedule->getDimensions(dimx_cellProduction,dimy_cellProduction);
	for (int x=0;x<dimx_cellProduction;x++) {
		printf("0");
		if (x!=dimx_cellProduction-1) {
			printf(",");
		}
	}
	printf("\n");

	// print whether fecundity constraint is met for individual simulation runs
	Array2D<float>::array_index dimx_simulatedFecundity, dimy_simulatedFecundity;
	pdStorage->simulatedFecunditySchedule->getDimensions(dimx_simulatedFecundity,dimy_simulatedFecundity);
	for (Array2D<float>::array_index x=0;x<dimx_simulatedFecundity;x++) {
		printf("%d",false);
		if (x!=dimx_simulatedFecundity-1) {
			printf(",");
		}
	}
	printf("\n");

	// print cell production time constraints for individual runs
	for (int i=0;i<dimy_cellProduction;i++) {
		printf("%f",(*pdStorage->cellProductionConstraints)(0,i));
		if (i!=dimy_cellProduction-1) {
			printf(",");
		}
	}
	printf("\n");

	// print cell production times for individual runs
	for (int i=0;i<dimy_cellProduction;i++) {
		for (int j=0;j<dimx_cellProduction;j++) {
			printf("999");
			if (j!=dimx_cellProduction-1) {
				printf(",");
			}
		}
		printf("\n");
	}

	// print fecundity constraints for individual runs
	int sumConstraint=0;
	for (int i=0;i<dimy_simulatedFecundity;i++) {
		int constraint;
		if (i==0) {
			constraint = opt->numSperm;
		} else {
			constraint = boost::math::iround((*pdStorage->fecundityConstraints)(i));
		}
		sumConstraint+=constraint;
		printf("%d",sumConstraint);
		if (i!=dimy_simulatedFecundity-1) {
			printf(",");
		}
	}
	printf("\n");

	// print fecundity for individual runs
	Array1D<float> sumGamete;
	sumGamete.resize(dimx_cellProduction);
	for (int i=0;i<dimy_simulatedFecundity;i++) {
		for (int j=0;j<dimx_cellProduction;j++) {
			sumGamete(j)+=(*pdStorage->simulatedFecunditySchedule)(j,i);
			printf("%d",boost::math::iround(sumGamete(j)));
			if (j!=dimx_cellProduction-1) {
				printf(",");
			}
		}
		printf("\n");
	}
}
开发者ID:mc-simworm,项目名称:simworm,代码行数:98,代码来源:util_germline.cpp


注:本文中的Array1D::fill方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。