int main(int, char *[])
{
constexpr unsigned int PointDimension = 3;
constexpr unsigned int MaxTopologicalDimension = 2;
using CoordinateType = double;
using InterpolationWeightType = double;
PixelType, PointDimension, MaxTopologicalDimension,
CoordinateType, InterpolationWeightType, CellDataType >;
using CellType = MeshType::CellType;
MeshType::Pointer mesh = MeshType::New();
constexpr unsigned int numberOfPoints = 10;
for(unsigned int id=0; id<numberOfPoints; id++)
{
point[0] = 1.565;
point[1] = 3.647;
point[2] = 4.129;
mesh->SetPoint( id, point );
}
CellType::CellAutoPointer line;
const unsigned int numberOfCells = numberOfPoints-1;
for(unsigned int cellId=0; cellId<numberOfCells; cellId++)
{
line.TakeOwnership( new LineType );
line->SetPointId( 0, cellId );
line->SetPointId( 1, cellId+1 );
mesh->SetCell( cellId, line );
}
std::cout << "Points = " << mesh->GetNumberOfPoints() << std::endl;
std::cout << "Cells = " << mesh->GetNumberOfCells() << std::endl;
for(unsigned int cellId=0; cellId<numberOfCells; cellId++)
{
CellDataType value;
mesh->SetCellData( cellId, value );
}
for(unsigned int cellId=0; cellId<numberOfCells; ++cellId)
{
CellDataType value;
mesh->GetCellData( cellId, &value );
std::cout << "Cell " << cellId << " = " << value << std::endl;
}
using CellDataIterator = MeshType::CellDataContainer::ConstIterator;
CellDataIterator cellDataIterator = mesh->GetCellData()->Begin();
CellDataIterator end = mesh->GetCellData()->End();
while( cellDataIterator != end )
{
CellDataType cellValue = cellDataIterator.Value();
std::cout << cellValue << std::endl;
++cellDataIterator;
}
return EXIT_SUCCESS;
}