本文整理汇总了C++中idataarray::Pointer::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetName方法的具体用法?C++ Pointer::GetName怎么用?C++ Pointer::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idataarray::Pointer
的用法示例。
在下文中一共展示了Pointer::GetName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addEnsembleData
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SurfaceMeshDataContainer::addEnsembleData(const std::string &name, IDataArray::Pointer data)
{
if (data->GetName().compare(name) != 0)
{
std::cout << "Adding Ensemble array with different array name than key name" << std::endl;
std::cout << "Key name: " << name << std::endl;
std::cout << "Array Name:" << data->GetName() << std::endl;
data->SetName(name);
}
m_EnsembleData[name] = data;
m_NumEnsembleTuples = data->GetNumberOfTuples();
}
示例2: addVertexData
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void VoxelDataContainer::addVertexData(const std::string &name, IDataArray::Pointer data)
{
if (data->GetName().compare(name) != 0)
{
std::cout << "Adding Vertex array with different array name than key name" << std::endl;
std::cout << "Key name: " << name << std::endl;
std::cout << "Array Name:" << data->GetName() << std::endl;
data->SetName(name);
}
m_VertexData[name] = data;
m_NumVertexTuples = data->GetNumberOfTuples();
}
示例3: dataCheckSurfaceMesh
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FindFaceAverage::dataCheckSurfaceMesh(bool preflight, size_t voxels, size_t fields, size_t ensembles)
{
setErrorCondition(0);
std::stringstream ss;
SurfaceMeshDataContainer* sm = getSurfaceMeshDataContainer();
if(NULL == sm)
{
addErrorMessage(getHumanLabel(), "SurfaceMeshDataContainer is missing", -383);
setErrorCondition(-383);
}
else
{
// We MUST have Triangles defined.
if(sm->getFaces().get() == NULL)
{
addErrorMessage(getHumanLabel(), "SurfaceMesh DataContainer missing Triangles", -385);
setErrorCondition(-385);
}
else
{
GET_PREREQ_DATA(sm, DREAM3D, FaceData, SurfaceMeshGrainFaceId, ss, -387, int32_t, Int32ArrayType, fields, 1)
if(1==m_AverageMethod)
{
GET_PREREQ_DATA(sm, DREAM3D, FaceData, SurfaceMeshTriangleAreas, ss, -387, double, DoubleArrayType, fields, 1)
}
if(m_SelectedFaceArrayName.empty() == true)
{
setErrorCondition(-11000);
addErrorMessage(getHumanLabel(), "An array from the Face Data Container must be selected.", getErrorCondition());
}
else if(preflight)
{
IDataArray::Pointer inputData = sm->getFaceData(m_SelectedFaceArrayName);
if (NULL == inputData.get())
{
ss.str("");
ss << "Selected array '" << m_SelectedFaceArrayName << "' does not exist in the Surface Mesh Data Container. Was it spelled correctly?";
setErrorCondition(-11001);
notifyErrorMessage(ss.str(), getErrorCondition());
return;
}
int numberOfComponents = inputData->GetNumberOfComponents();
std::string dType = inputData->getTypeAsString();
IDataArray::Pointer p = IDataArray::NullPointer();
if (dType.compare("int8_t") == 0)
{
p = Int8ArrayType::CreateArray(1, numberOfComponents, m_SelectedFaceArrayName);
}
else if (dType.compare("uint8_t") == 0)
{
p = UInt8ArrayType::CreateArray(1, numberOfComponents, m_SelectedFaceArrayName);
}
else if (dType.compare("int16_t") == 0)
{
p = Int16ArrayType::CreateArray(1, numberOfComponents, m_SelectedFaceArrayName);
}
else if (dType.compare("uint16_t") == 0)
{
p = UInt16ArrayType::CreateArray(1, numberOfComponents, m_SelectedFaceArrayName);
}
else if (dType.compare("int32_t") == 0)
{
p = Int32ArrayType::CreateArray(1, numberOfComponents, m_SelectedFaceArrayName);
}
else if (dType.compare("uint32_t") == 0)
{
p = UInt32ArrayType::CreateArray(1, numberOfComponents, m_SelectedFaceArrayName);
}
else if (dType.compare("int64_t") == 0)
{
p = Int64ArrayType::CreateArray(1, numberOfComponents, m_SelectedFaceArrayName);
}
else if (dType.compare("uint64_t") == 0)
{
p = UInt64ArrayType::CreateArray(1, numberOfComponents, m_SelectedFaceArrayName);
}
else if (dType.compare("float") == 0)
{
p = FloatArrayType::CreateArray(1, numberOfComponents, m_SelectedFaceArrayName);
}
else if (dType.compare("double") == 0)
{
p = DoubleArrayType::CreateArray(1, numberOfComponents, m_SelectedFaceArrayName);
}
else if (dType.compare("bool") == 0)
{
p = BoolArrayType::CreateArray(1, numberOfComponents, m_SelectedFaceArrayName);
}
sm->addFieldData(p->GetName(), p);
}
}
}
示例4: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ChangeResolution::execute()
{
int err = 0;
setErrorCondition(err);
DREAM3D_RANDOMNG_NEW()
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
setErrorCondition(0);
if (getErrorCondition() < 0)
{
return;
}
if(m->getXRes() == m_Resolution.x
&& m->getYRes() == m_Resolution.y
&& m->getZRes() == m_Resolution.z)
{
return;
}
size_t dims[3];
m->getDimensions(dims);
float sizex = (dims[0])*m->getXRes();
float sizey = (dims[1])*m->getYRes();
float sizez = (dims[2])*m->getZRes();
int m_XP = int(sizex / m_Resolution.x);
int m_YP = int(sizey / m_Resolution.y);
int m_ZP = int(sizez / m_Resolution.z);
int64_t totalPoints = m_XP*m_YP*m_ZP;
float x, y, z;
int col, row, plane;
int index;
int index_old;
std::vector<size_t> newindicies;
newindicies.resize(totalPoints);
for (int i = 0; i < m_ZP; i++)
{
std::stringstream ss;
ss << "Changing Resolution - " << ((float)i/m->getZPoints())*100 << " Percent Complete";
notifyStatusMessage(ss.str());
for (int j = 0; j < m_YP; j++)
{
for (int k = 0; k < m_XP; k++)
{
x = (k * m_Resolution.x);
y = (j * m_Resolution.y);
z = (i * m_Resolution.z);
col = int(x / m->getXRes());
row = int(y / m->getYRes());
plane = int(z / m->getZRes());
index_old = (plane * m->getXPoints() * m->getYPoints()) + (row * m->getXPoints()) + col;
index = (i * m_XP * m_YP) + (j * m_XP) + k;
newindicies[index] = index_old;
}
}
}
std::list<std::string> voxelArrayNames = m->getCellArrayNameList();
for (std::list<std::string>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
std::string name = *iter;
IDataArray::Pointer p = m->getCellData(*iter);
// Make a copy of the 'p' array that has the same name. When placed into
// the data container this will over write the current array with
// the same name. At least in theory
IDataArray::Pointer data = p->createNewArray(p->GetNumberOfTuples(), p->GetNumberOfComponents(), p->GetName());
data->Resize(totalPoints);
void* source = NULL;
void* destination = NULL;
size_t newIndicies_I = 0;
int nComp = data->GetNumberOfComponents();
for (size_t i = 0; i < static_cast<size_t>(totalPoints); i++)
{
newIndicies_I = newindicies[i];
source = p->GetVoidPointer((nComp * newIndicies_I));
destination = data->GetVoidPointer((data->GetNumberOfComponents() * i));
::memcpy(destination, source, p->GetTypeSize() * data->GetNumberOfComponents());
}
m->addCellData(*iter, data);
}
m->setResolution(m_Resolution.x, m_Resolution.y, m_Resolution.z);
m->setDimensions(m_XP, m_YP, m_ZP);
notifyStatusMessage("Complete");
}
示例5: dataCheck
//.........这里部分代码省略.........
addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition());
}
if (m_Dimensionality < 1)
{
ss.str("");
ss << "The dimensionality must be larger than Zero";
setErrorCondition(-389);
addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition());
}
if ( m_Dimensions.x == 0 || m_Dimensions.y == 0 || m_Dimensions.z == 0)
{
ss.str("");
ss << "One of the dimensions has a size less than or Equal to Zero (0). The minimum size must be greater than One (1).";
setErrorCondition(-390);
addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition());
}
if (true == preflight)
{
size_t allocatedBytes = 0;
IDataArray::Pointer p = IDataArray::NullPointer();
if (m_ScalarType == Detail::Int8)
{
p = Int8ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName);
allocatedBytes = sizeof(int8_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z;
}
else if (m_ScalarType == Detail::UInt8)
{
p = UInt8ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName);
allocatedBytes = sizeof(uint8_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z;
}
else if (m_ScalarType == Detail::Int16)
{
p = Int16ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName);
allocatedBytes = sizeof(int16_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z;
}
else if (m_ScalarType == Detail::UInt16)
{
p = UInt16ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName);
allocatedBytes = sizeof(uint16_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z;
}
else if (m_ScalarType == Detail::Int32)
{
p = Int32ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName);
allocatedBytes = sizeof(int32_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z;
}
else if (m_ScalarType == Detail::UInt32)
{
p = UInt32ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName);
allocatedBytes = sizeof(uint32_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z;
}
else if (m_ScalarType == Detail::Int64)
{
p = Int64ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName);
allocatedBytes = sizeof(int64_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z;
}
else if (m_ScalarType == Detail::UInt64)
{
p = UInt64ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName);
allocatedBytes = sizeof(uint64_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z;
}
else if (m_ScalarType == Detail::Float)
{
p = FloatArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName);
allocatedBytes = sizeof(float) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z;
}
else if (m_ScalarType == Detail::Double)
{
p = DoubleArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName);
allocatedBytes = sizeof(double) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z;
}
// Sanity Check Allocated Bytes versus size of file
uint64_t fileSize = MXAFileInfo::fileSize(m_InputFile);
int check = SanityCheckFileSizeVersusAllocatedSize(allocatedBytes, fileSize, m_SkipHeaderBytes);
if (check == -1)
{
ss.str("");
ss << "The file size is " << fileSize << " but the number of bytes needed to fill the array is " << allocatedBytes << ". This condition would cause an error reading the input file.";
ss << " Please adjust the input parameters to match the size of the file or select a different data file.";
setErrorCondition(RBR_FILE_TOO_SMALL);
addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition());
}
else if (check == 1)
{
ss.str("");
ss << "The file size is " << fileSize << " but the number of bytes needed to fill the array is " << allocatedBytes << " which is less than the size of the file.";
ss << " DREAM3D will read only the first part of the file into the array.";
addWarningMessage(getHumanLabel(), ss.str(), RBR_FILE_TOO_BIG);
}
m->addCellData(p->GetName(), p);
m->setDimensions(m_Dimensions.x, m_Dimensions.y, m_Dimensions.z);
m->setResolution(m_Resolution.x, m_Resolution.y, m_Resolution.z);
m->setOrigin(m_Origin.x, m_Origin.y, m_Origin.z);
}
}
示例6: writeXdmfAttributeDataHelper
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
std::string SurfaceMeshDataContainerWriter::writeXdmfAttributeDataHelper(int numComp, const std::string &attrType,
const std::string &groupName,
IDataArray::Pointer array,
const std::string ¢ering,
int precision, const std::string &xdmfTypeName)
{
std::stringstream out;
std::stringstream dimStr;
std::stringstream dimStr1;
std::stringstream dimStr1half;
std::stringstream dimStr2;
std::stringstream dimStr2half;
if((numComp%2) == 1)
{
out << " <Attribute Name=\"" << array->GetName() << "\" ";
out << "AttributeType=\"" << attrType << "\" ";
dimStr << array->GetNumberOfTuples() << " " << array->GetNumberOfComponents();
out << "Center=\"" << centering << "\">" << std::endl;
// Open the <DataItem> Tag
out << " <DataItem Format=\"HDF\" Dimensions=\"" << dimStr.str() << "\" ";
out << "NumberType=\"" << xdmfTypeName << "\" " << "Precision=\"" << precision << "\" >" << std::endl;
ssize_t nameSize = H5Fget_name(m_HdfFileId, NULL, 0) + 1;
std::vector<char> nameBuffer(nameSize, 0);
nameSize = H5Fget_name(m_HdfFileId, &(nameBuffer.front()), nameSize);
std::string hdfFileName(&(nameBuffer.front()), nameSize);
hdfFileName = MXAFileInfo::filename(hdfFileName);
out << " " << hdfFileName << ":/SurfaceMeshDataContainer/" << groupName << "/" << array->GetName() << std::endl;
out << " </DataItem>" << std::endl;
out << " </Attribute>" << std::endl << std::endl;
}
else
{
//First Slab
out << " <Attribute Name=\"" << array->GetName() << " (Field 0)\" ";
out << "AttributeType=\"" << attrType << "\" ";
dimStr1 << array->GetNumberOfTuples() << " " << array->GetNumberOfComponents();
dimStr1half << array->GetNumberOfTuples() << " " << (array->GetNumberOfComponents()/2);
out << "Center=\"" << centering << "\">" << std::endl;
// Open the <DataItem> Tag
out << " <DataItem ItemType=\"HyperSlab\" Dimensions=\"" << dimStr1half.str() << "\" ";
out << "Type=\"HyperSlab\" " << "Name=\"" << array->GetName() << " (Field 0)\" >" << std::endl;
out << " <DataItem Dimensions=\"3 2\" " << "Format=\"XML\" >" << std::endl;
out << " 0 0" << std::endl;
out << " 1 1" << std::endl;
out << " " << dimStr1half.str() << " </DataItem>" << std::endl;
out << std::endl;
out << " <DataItem Format=\"HDF\" Dimensions=\"" << dimStr1.str() << "\" " << "NumberType=\"" << xdmfTypeName << "\" " << "Precision=\"" << precision << "\" >" << std::endl;
ssize_t nameSize = H5Fget_name(m_HdfFileId, NULL, 0) + 1;
std::vector<char> nameBuffer(nameSize, 0);
nameSize = H5Fget_name(m_HdfFileId, &(nameBuffer.front()), nameSize);
std::string hdfFileName(&(nameBuffer.front()), nameSize);
hdfFileName = MXAFileInfo::filename(hdfFileName);
out << " " << hdfFileName << ":/SurfaceMeshDataContainer/" << groupName << "/" << array->GetName() << std::endl;
out << " </DataItem>" << std::endl;
out << " </DataItem>" << std::endl;
out << " </Attribute>" << std::endl << std::endl;
//Second Slab
out << " <Attribute Name=\"" << array->GetName() << " (Field 1)\" ";
out << "AttributeType=\"" << attrType << "\" ";
dimStr2 << array->GetNumberOfTuples() << " " << array->GetNumberOfComponents();
dimStr2half << array->GetNumberOfTuples() << " " << (array->GetNumberOfComponents()/2);
out << "Center=\"" << centering << "\">" << std::endl;
// Open the <DataItem> Tag
out << " <DataItem ItemType=\"HyperSlab\" Dimensions=\"" << dimStr2half.str() << "\" ";
out << "Type=\"HyperSlab\" " << "Name=\"" << array->GetName() << " (Field 1)\" >" << std::endl;
out << " <DataItem Dimensions=\"3 2\" " << "Format=\"XML\" >" << std::endl;
out << " 0 " << (array->GetNumberOfComponents()/2) << std::endl;
out << " 1 1" << std::endl;
out << " " << dimStr2half.str() << " </DataItem>" << std::endl;
out << std::endl;
out << " <DataItem Format=\"HDF\" Dimensions=\"" << dimStr2.str() << "\" " << "NumberType=\"" << xdmfTypeName << "\" " << "Precision=\"" << precision << "\" >" << std::endl;
ssize_t nameSize2 = H5Fget_name(m_HdfFileId, NULL, 0) + 1;
std::vector<char> nameBuffer2(nameSize2, 0);
nameSize2 = H5Fget_name(m_HdfFileId, &(nameBuffer2.front()), nameSize2);
std::string hdfFileName2(&(nameBuffer2.front()), nameSize2);
hdfFileName2 = MXAFileInfo::filename(hdfFileName2);
out << " " << hdfFileName2 << ":/SurfaceMeshDataContainer/" << groupName << "/" << array->GetName() << std::endl;
out << " </DataItem>" << std::endl;
out << " </DataItem>" << std::endl;
out << " </Attribute>" << std::endl << std::endl;
}
return out.str();
}
示例7: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ConvertData::dataCheck(bool preflight, size_t voxels, size_t fields, size_t ensembles)
{
setErrorCondition(0);
std::stringstream ss;
VoxelDataContainer* m = getVoxelDataContainer();
if(m_SelectedCellArrayName.empty() == true)
{
ss.str("");
ss << "The Input Voxel Cell Array Name is blank (empty) and a value must be filled in for the pipeline to complete.";
setErrorCondition(-397);
addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition());
}
if(m_OutputArrayName.empty() == true)
{
ss.str("");
ss << "The Output Array Name is blank (empty) and a value must be filled in for the pipeline to complete.";
setErrorCondition(-398);
addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition());
}
int numberOfComponents = 0;
IDataArray::Pointer iArray = m->getCellData(m_SelectedCellArrayName);
if (NULL != iArray)
{
numberOfComponents = iArray->GetNumberOfComponents();
}
if (true == preflight)
{
IDataArray::Pointer p = IDataArray::NullPointer();
if (m_ScalarType == Detail::Int8)
{
p = Int8ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName);
}
else if (m_ScalarType == Detail::UInt8)
{
p = UInt8ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName);
}
else if (m_ScalarType == Detail::Int16)
{
p = Int16ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName);
}
else if (m_ScalarType == Detail::UInt16)
{
p = UInt16ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName);
}
else if (m_ScalarType == Detail::Int32)
{
p = Int32ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName);
}
else if (m_ScalarType == Detail::UInt32)
{
p = UInt32ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName);
}
else if (m_ScalarType == Detail::Int64)
{
p = Int64ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName);
}
else if (m_ScalarType == Detail::UInt64)
{
p = UInt64ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName);
}
else if (m_ScalarType == Detail::Float)
{
p = FloatArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName);
}
else if (m_ScalarType == Detail::Double)
{
p = DoubleArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName);
}
m->addCellData(p->GetName(), p);
}
}