本文整理汇总了C++中idataarray::Pointer::printTuple方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::printTuple方法的具体用法?C++ Pointer::printTuple怎么用?C++ Pointer::printTuple使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idataarray::Pointer
的用法示例。
在下文中一共展示了Pointer::printTuple方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FieldDataCSVWriter::execute()
{
int err = 0;
setErrorCondition(err);
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
// Make sure any directory path is also available as the user may have just typed
// in a path without actually creating the full path
std::string parentPath = MXAFileInfo::parentPath(m_FieldDataFile);
if(!MXADir::mkdir(parentPath, true))
{
std::stringstream ss;
ss << "Error creating parent path '" << parentPath << "'";
notifyErrorMessage(ss.str(), -1);
setErrorCondition(-1);
return;
}
std::string filename = getFieldDataFile();
std::ofstream outFile;
outFile.open(filename.c_str(), std::ios_base::binary);
char space = DREAM3D::GrainData::Delimiter;
// Write the total number of grains
outFile << m->getNumFieldTuples()-1 << std::endl;
// Get all the names of the arrays from the Data Container
std::list<std::string> headers = m->getFieldArrayNameList();
std::vector<IDataArray::Pointer> data;
//For checking if an array is a neighborlist
NeighborList<int>::Pointer neighborlistPtr = NeighborList<int>::New();
// Print the GrainIds Header before the rest of the headers
outFile << DREAM3D::GrainData::GrainID;
// Loop throught the list and print the rest of the headers, ignoring those we don't want
for(std::list<std::string>::iterator iter = headers.begin(); iter != headers.end(); ++iter)
{
// Only get the array if the name does NOT match those listed
IDataArray::Pointer p = m->getFieldData(*iter);
if(p->getNameOfClass().compare(neighborlistPtr->getNameOfClass()) != 0)
{
if (p->GetNumberOfComponents() == 1) {
outFile << space << (*iter);
}
else // There are more than a single component so we need to add multiple header values
{
for(int k = 0; k < p->GetNumberOfComponents(); ++k)
{
outFile << space << (*iter) << "_" << k;
}
}
// Get the IDataArray from the DataContainer
data.push_back(p);
}
}
outFile << std::endl;
// Get the number of tuples in the arrays
size_t numTuples = data[0]->GetNumberOfTuples();
std::stringstream ss;
float threshold = 0.0f;
// Skip the first grain
for(size_t i = 1; i < numTuples; ++i)
{
if (((float)i / numTuples) * 100.0f > threshold) {
ss.str("");
ss << "Writing Field Data - " << ((float)i / numTuples) * 100 << "% Complete";
notifyStatusMessage(ss.str());
threshold = threshold + 5.0f;
if (threshold < ((float)i / numTuples) * 100.0f) {
threshold = ((float)i / numTuples) * 100.0f;
}
}
// Print the grain id
outFile << i;
// Print a row of data
for( std::vector<IDataArray::Pointer>::iterator p = data.begin(); p != data.end(); ++p)
{
outFile << space;
(*p)->printTuple(outFile, i, space);
}
outFile << std::endl;
}
if(m_WriteNeighborListData == true)
{
//.........这里部分代码省略.........