本文整理汇总了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;
}
示例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;
}
示例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;
}