本文整理汇总了C++中VoxelDataContainer::getYPoints方法的典型用法代码示例。如果您正苦于以下问题:C++ VoxelDataContainer::getYPoints方法的具体用法?C++ VoxelDataContainer::getYPoints怎么用?C++ VoxelDataContainer::getYPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VoxelDataContainer
的用法示例。
在下文中一共展示了VoxelDataContainer::getYPoints方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ClearData::dataCheck(bool preflight, size_t voxels, size_t fields, size_t ensembles)
{
setErrorCondition(0);
std::stringstream ss;
VoxelDataContainer* m = getVoxelDataContainer();
if (getXMax() < getXMin())
{
ss.str("");
ss << "X Max (" << getXMax() << ") less than X Min (" << getXMin() << ")";
addErrorMessage(getHumanLabel(), ss.str(), -5555);
setErrorCondition(-5555);
}
if (getYMax() < getYMin())
{
ss.str("");
ss << "Y Max (" << getYMax() << ") less than Y Min (" << getYMin() << ")";
addErrorMessage(getHumanLabel(), ss.str(), -5555);
setErrorCondition(-5555);
}
if (getZMax() < getZMin())
{
ss.str("");
ss << "Z Max (" << getZMax() << ") less than Z Min (" << getZMin() << ")";
addErrorMessage(getHumanLabel(), ss.str(), -5555);
setErrorCondition(-5555);
}
if (getXMin() < 0)
{
ss.str("");
ss << "X Min (" << getXMin() << ") less than 0";
addErrorMessage(getHumanLabel(), ss.str(), -5555);
setErrorCondition(-5555);
}
if (getYMin() < 0)
{
ss.str("");
ss << "Y Min (" << getYMin() << ") less than 0";
addErrorMessage(getHumanLabel(), ss.str(), -5555);
setErrorCondition(-5555);
}
if (getZMin() < 0)
{
ss.str("");
ss <<"Z Min (" << getZMin() << ") less than 0";
addErrorMessage(getHumanLabel(), ss.str(), -5555);
setErrorCondition(-5555);
}
if (getXMax() > (static_cast<int64_t>(m->getXPoints())-1))
{
ss.str("");
ss << "The X Max you entered of " << getXMax() << " is greater than your Max X Point of " << static_cast<int64_t>(m->getXPoints())-1;
addErrorMessage(getHumanLabel(), ss.str(), -5555);
setErrorCondition(-5555);
}
if (getYMax() > (static_cast<int64_t>(m->getYPoints())-1))
{
ss.str("");
ss << "The Y Max you entered of " << getYMax() << " is greater than your Max Y Point of " << static_cast<int64_t>(m->getYPoints())-1;
addErrorMessage(getHumanLabel(), ss.str(), -5555);
setErrorCondition(-5556);
}
if (getZMax() > (static_cast<int64_t>(m->getZPoints())-1))
{
ss.str("");
ss << "The Z Max you entered of " << getZMax() << ") greater than your Max Z Point of " << static_cast<int64_t>(m->getZPoints())-1;
addErrorMessage(getHumanLabel(), ss.str(), -5555);
setErrorCondition(-5557);
}
}
示例2: 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");
}
示例3: writeCellData
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int VoxelDataContainerWriter::writeCellData(hid_t dcGid)
{
std::stringstream ss;
int err = 0;
VoxelDataContainer* m = getVoxelDataContainer();
int64_t volDims[3] =
{ m->getXPoints(), m->getYPoints(), m->getZPoints() };
float spacing[3] =
{ m->getXRes(), m->getYRes(), m->getZRes() };
float origin[3] =
{ 0.0f, 0.0f, 0.0f };
m->getOrigin(origin);
writeCellXdmfGridHeader(origin, spacing, volDims);
// Get the name of the .dream3d file that we are writing to:
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);
std::string xdmfGroupPath = std::string(":/") + VoxelDataContainer::ClassName() + std::string("/") + H5_CELL_DATA_GROUP_NAME;
// Write the Voxel Data
err = H5Utilities::createGroupsFromPath(H5_CELL_DATA_GROUP_NAME, dcGid);
if(err < 0)
{
ss.str("");
ss << "Error creating HDF Group " << H5_CELL_DATA_GROUP_NAME << std::endl;
setErrorCondition(-63);
notifyErrorMessage(ss.str(), err);
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
hid_t cellGroupId = H5Gopen(dcGid, H5_CELL_DATA_GROUP_NAME, H5P_DEFAULT);
if(err < 0)
{
ss.str("");
ss << "Error writing string attribute to HDF Group " << H5_CELL_DATA_GROUP_NAME << std::endl;
setErrorCondition(-64);
notifyErrorMessage(ss.str(), err);
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
NameListType names = m->getCellArrayNameList();
for (NameListType::iterator iter = names.begin(); iter != names.end(); ++iter)
{
ss.str("");
ss << "Writing Cell Data '" << *iter << "' to HDF5 File" << std::endl;
notifyStatusMessage(ss.str());
IDataArray::Pointer array = m->getCellData(*iter);
err = array->writeH5Data(cellGroupId);
if(err < 0)
{
ss.str("");
ss << "Error writing array '" << *iter << "' to the HDF5 File";
notifyErrorMessage(ss.str(), err);
setErrorCondition(err);
H5Gclose(cellGroupId); // Close the Cell Group
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
array->writeXdmfAttribute( *m_XdmfPtr, volDims, hdfFileName, xdmfGroupPath, " (Cell)");
}
H5Gclose(cellGroupId); // Close the Cell Group
writeXdmfGridFooter("Cell Data");
return err;
}
示例4: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void VoxelDataContainerWriter::execute()
{
int err = 0;
std::stringstream ss;
setErrorCondition(err);
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The Voxel DataContainer Object was NULL", -999);
return;
}
setErrorCondition(0);
dataCheck(false, 1, 1, 1);
hid_t dcGid = -1;
// Create the HDF5 Group for the Data Container
err = H5Utilities::createGroupsFromPath(DREAM3D::HDF5::VoxelDataContainerName.c_str(), m_HdfFileId);
if (err < 0)
{
ss.str("");
ss << "Error creating HDF Group " << DREAM3D::HDF5::VoxelDataContainerName << std::endl;
setErrorCondition(-60);
notifyErrorMessage( ss.str(), err);
return;
}
dcGid = H5Gopen(m_HdfFileId, DREAM3D::HDF5::VoxelDataContainerName.c_str(), H5P_DEFAULT );
if (dcGid < 0)
{
ss.str("");
ss << "Error opening Group " << DREAM3D::HDF5::VoxelDataContainerName << std::endl;
setErrorCondition(-61);
notifyErrorMessage( ss.str(), err);
return;
}
// This just writes the header information
int64_t volDims[3] =
{ m->getXPoints(), m->getYPoints(), m->getZPoints() };
float spacing[3] =
{ m->getXRes(), m->getYRes(), m->getZRes() };
float origin[3] =
{ 0.0f, 0.0f, 0.0f };
m->getOrigin(origin);
err = writeMetaInfo(DREAM3D::HDF5::VoxelDataContainerName, volDims, spacing, origin);
if (err < 0)
{
ss.str("");
ss << ":Error Writing header information to output file" << std::endl;
setErrorCondition(-62);
notifyErrorMessage( ss.str(), err);
H5Gclose(dcGid); // Close the Data Container Group
return;
}
err = writeVertexData(dcGid);
if (err < 0)
{
H5Gclose(dcGid); // Close the Data Container Group
return;
}
err = writeEdgeData(dcGid);
if (err < 0)
{
H5Gclose(dcGid); // Close the Data Container Group
return;
}
err = writeFaceData(dcGid);
if (err < 0)
{
H5Gclose(dcGid); // Close the Data Container Group
return;
}
err = writeCellData(dcGid);
if (err < 0)
{
H5Gclose(dcGid); // Close the Data Container Group
return;
}
err = writeFieldData(dcGid);
if (err < 0)
{
H5Gclose(dcGid); // Close the Data Container Group
return;
}
err = writeEnsembleData(dcGid);
if (err < 0)
{
H5Gclose(dcGid); // Close the Data Container Group
return;
//.........这里部分代码省略.........
示例5: if
//.........这里部分代码省略.........
else if(manufacturer.compare(Ebsd::Mic::Manufacturer) == 0)
{
ebsdReader = initHEDMEbsdVolumeReader();
}
else
{
setErrorCondition(-1);
std::string msg("Could not determine or match a supported manufacturer from the data file.");
msg = msg.append("Supported manufacturer codes are: ").append(Ebsd::Ctf::Manufacturer);
msg = msg.append(", ").append(Ebsd::Ang::Manufacturer).append(" and ").append(Ebsd::Mic::Manufacturer);
addErrorMessage(getHumanLabel(), msg, -1);
return;
}
// Sanity Check the Error Condition or the state of the EBSD Reader Object.
if(getErrorCondition() < 0 || NULL == ebsdReader.get())
{
return;
}
// Initialize all the arrays with some default values
int64_t totalPoints = m->getTotalPoints();
ss.str("");
ss << " - Initializing " << totalPoints << " voxels";
notifyStatusMessage(ss.str());
ss.str("");
ss << " - Reading Ebsd Data from file";
notifyStatusMessage(ss.str());
ebsdReader->setSliceStart(m_ZStartIndex);
ebsdReader->setSliceEnd(m_ZEndIndex);
ebsdReader->readAllArrays(false);
ebsdReader->setArraysToRead(m_SelectedVoxelCellArrays);
err = ebsdReader->loadData(m->getXPoints(), m->getYPoints(), m->getZPoints(), m_RefFrameZDir);
if(err < 0)
{
setErrorCondition(err);
PipelineMessage em (getHumanLabel(), "Error Loading Data from Ebsd Data file.", -1);
addErrorMessage(em);
return;
}
typedef DataArray<unsigned int> XTalStructArrayType;
GET_PREREQ_DATA(m, DREAM3D, EnsembleData, CrystalStructures, ss, -304, unsigned int, XTalStructArrayType, m->getNumEnsembleTuples(), 1)
GET_PREREQ_DATA(m, DREAM3D, EnsembleData, LatticeConstants, ss, -305, float, FloatArrayType, m->getNumEnsembleTuples(), 6)
// Copy the data from the pointers embedded in the reader object into our data container (Cell array).
if(manufacturer.compare(Ebsd::Ang::Manufacturer) == 0)
{
copyTSLArrays(ebsdReader.get());
}
else if(manufacturer.compare(Ebsd::Ctf::Manufacturer) == 0)
{
copyHKLArrays(ebsdReader.get());
}
else if(manufacturer.compare(Ebsd::Mic::Manufacturer) == 0)
{
copyHEDMArrays(ebsdReader.get());
}
else
{
std::string msg("Could not determine or match a supported manufacturer from the data file.");
msg = msg.append("Supported manufacturer codes are: ").append(Ebsd::Ctf::Manufacturer);
msg = msg.append(" and ").append(Ebsd::Ang::Manufacturer);
addErrorMessage(getHumanLabel(), msg, -10001);
示例6: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FindNeighbors::execute()
{
setErrorCondition(0);
std::stringstream ss;
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
int64_t totalPoints = m->getTotalPoints();
int totalFields = int(m->getNumFieldTuples());
dataCheck(false, totalPoints, totalFields, m->getNumEnsembleTuples());
if (getErrorCondition() < 0)
{
return;
}
size_t udims[3] = {0,0,0};
m->getDimensions(udims);
#if (CMP_SIZEOF_SIZE_T == 4)
typedef int32_t DimType;
#else
typedef int64_t DimType;
#endif
DimType dims[3] = {
static_cast<DimType>(udims[0]),
static_cast<DimType>(udims[1]),
static_cast<DimType>(udims[2]),
};
DimType neighpoints[6];
neighpoints[0] = -dims[0]*dims[1];
neighpoints[1] = -dims[0];
neighpoints[2] = -1;
neighpoints[3] = 1;
neighpoints[4] = dims[0];
neighpoints[5] = dims[0]*dims[1];
float column, row, plane;
int grain;
size_t nnum;
int onsurf = 0;
int good = 0;
int neighbor = 0;
//size_t xtalCount = m->getEnsembleData(DREAM3D::EnsembleData::CrystalStructures)->GetNumberOfTuples();
std::vector<std::vector<int> > neighborlist;
std::vector<std::vector<float> > neighborsurfacearealist;
int nListSize = 100;
neighborlist.resize(totalFields);
neighborsurfacearealist.resize(totalFields);
for (int i = 1; i < totalFields; i++)
{
std::stringstream ss;
ss << "Finding Neighbors - Initializing Neighbor Lists - " << (static_cast<float>(i)/totalFields)*100 << " Percent Complete";
// notifyStatusMessage(ss.str());
m_NumNeighbors[i] = 0;
neighborlist[i].resize(nListSize);
neighborsurfacearealist[i].resize(nListSize, -1.0);
m_SurfaceFields[i] = false;
}
totalPoints = m->getTotalPoints();
for (int64_t j = 0; j < totalPoints; j++)
{
std::stringstream ss;
ss << "Finding Neighbors - Determining Neighbor Lists - " << (static_cast<float>(j)/totalPoints)*100 << " Percent Complete";
// notifyStatusMessage(ss.str());
onsurf = 0;
grain = m_GrainIds[j];
if(grain > 0)
{
column = static_cast<float>( j % m->getXPoints() );
row = static_cast<float>( (j / m->getXPoints()) % m->getYPoints() );
plane = static_cast<float>( j / (m->getXPoints() * m->getYPoints()) );
if((column == 0 || column == (m->getXPoints() - 1) || row == 0 || row == (m->getYPoints() - 1) || plane == 0 || plane == (m->getZPoints() - 1)) && m->getZPoints() != 1)
{
m_SurfaceFields[grain] = true;
}
if((column == 0 || column == (m->getXPoints() - 1) || row == 0 || row == (m->getYPoints() - 1)) && m->getZPoints() == 1)
{
m_SurfaceFields[grain] = true;
}
for (int k = 0; k < 6; k++)
{
good = 1;
neighbor = static_cast<int>( j + neighpoints[k] );
if(k == 0 && plane == 0) good = 0;
if(k == 5 && plane == (m->getZPoints() - 1)) good = 0;
if(k == 1 && row == 0) good = 0;
//.........这里部分代码省略.........