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


C++ BlockPtr::shape方法代码示例

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


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

示例1: do_print_block

void SialPrinterForTests::do_print_block(const BlockId& id, Block::BlockPtr block, int line_number){
		int MAX_TO_PRINT = 1024;
		int size = block->size();
		int OUTPUT_ROW_SIZE = block->shape().segment_sizes_[0];
		double* data = block->get_data();
	        out_.precision(14);
		out_.setf(std::ios_base::fixed);
		out_ << line_number << ":  ";
		if (size == 1) {
		    out_ << "printing " << id.str(sip_tables_) << " = ";
		    out_ << *(data);
		} else {
		    out_ << "printing " << (size < MAX_TO_PRINT?size:MAX_TO_PRINT);
		    out_ << " of " <<size << " elements of block " <<  id.str(sip_tables_);//BlockId2String(id);
		    out_ << " in the order stored in memory ";
		    int i;
		    for (i = 0; i < size && i < MAX_TO_PRINT; ++i){
			if (i%OUTPUT_ROW_SIZE == 0) out_ << std::endl;
			out_ << *(data+i) << " ";
		    }
		    if (i == MAX_TO_PRINT){
			out_ << "....";
		    }
		}
		out_ << std::endl;
	}
开发者ID:UFParLab,项目名称:aces4,代码行数:26,代码来源:sial_printer.cpp

示例2: do_print_contiguous

void SialPrinterForTests::do_print_contiguous(int array_slot, Block::BlockPtr block, int line_number){
	int MAX_TO_PRINT = 1024;
	int size = block->size();
	int OUTPUT_ROW_SIZE = block->shape().segment_sizes_[0];
	double* data = block->get_data();
	out_ << line_number << ":  ";
	out_ << "printing " << (size < MAX_TO_PRINT?size:MAX_TO_PRINT);
	out_ << " of " <<size << " elements of contiguous array " <<  sip_tables_.array_name(array_slot);
	out_ << " in the order stored in memory ";
	int i;
    for (i = 0; i < size && i < MAX_TO_PRINT; ++i){
    	if (i%OUTPUT_ROW_SIZE == 0) out_ << std::endl;
    	out_.width(14);
    	out_ << *(data+i) << " ";
    }
    if (i == MAX_TO_PRINT){
    	out_ << "....";
    }
    out_ << std::endl;
}
开发者ID:UFParLab,项目名称:aces4,代码行数:20,代码来源:sial_printer.cpp

示例3: insert_contiguous_array

Block::BlockPtr ContiguousArrayManager::insert_contiguous_array(int array_id,
		Block::BlockPtr block_ptr) {
	sip::check(block_ptr != NULL && block_ptr->get_data() != NULL,
			"Trying to insert null block_ptr or null block into contiguous array manager\n");
	ContiguousArrayMap::iterator it = contiguous_array_map_.find(array_id);
	if (it != contiguous_array_map_.end()){
		delete it->second;
		it->second = NULL;
		contiguous_array_map_.erase(it);
	}
	contiguous_array_map_[array_id] = block_ptr;

	SIP_LOG(
			std::cout<<"Contiguous Block of array "<<sip_tables_.array_name(array_id)<<std::endl);
	sip::check(
			block_ptr->shape() == sip_tables_.contiguous_array_shape(array_id),
			std::string("array ") + sip_tables_.array_name(array_id)
					+ std::string(
							"shape inconsistent in Sial program and inserted array "));
	return block_ptr;
}
开发者ID:BB-Goldstein,项目名称:aces4,代码行数:21,代码来源:contiguous_array_manager.cpp


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