Skip to content
Snippets Groups Projects
Commit a88ace33 authored by Oliver Sander's avatar Oliver Sander Committed by sander
Browse files

Allow to write one set of scalar cell data

[[Imported from SVN: r9930]]
parent 1f277c23
No related branches found
No related tags found
No related merge requests found
...@@ -59,6 +59,10 @@ namespace Dune { ...@@ -59,6 +59,10 @@ namespace Dune {
writer.addArray<float>("zCoord", 1); writer.addArray<float>("zCoord", 1);
writer.endPointData(); writer.endPointData();
writer.beginCellData();
writer.addArray<float>("mycelldata", 1);
writer.endCellData();
// dump point coordinates // dump point coordinates
writer.beginPoints(); writer.beginPoints();
writer.addArray<float>("Coordinates", 3); writer.addArray<float>("Coordinates", 3);
...@@ -112,7 +116,9 @@ namespace Dune { ...@@ -112,7 +116,9 @@ namespace Dune {
outFile << " </Cells>" << std::endl; outFile << " </Cells>" << std::endl;
// Point data //////////////////////////////////////////////////
// Point data
//////////////////////////////////////////////////
outFile << " <PointData Scalars=\"zCoord\" Vectors=\"director0\">" << std::endl; outFile << " <PointData Scalars=\"zCoord\" Vectors=\"director0\">" << std::endl;
// Z coordinate for better visualization of wrinkles // Z coordinate for better visualization of wrinkles
...@@ -132,7 +138,25 @@ namespace Dune { ...@@ -132,7 +138,25 @@ namespace Dune {
outFile << " </PointData>" << std::endl; outFile << " </PointData>" << std::endl;
// Write footer //////////////////////////////////////////////////
// Cell data
//////////////////////////////////////////////////
if (cellData_.size() > 0)
{
outFile << " <CellData>" << std::endl;
outFile << " <DataArray type=\"Float32\" Name=\"mycelldata\" NumberOfComponents=\"1\" format=\"ascii\">" << std::endl;
for (size_t i=0; i<cellData_.size(); i++)
outFile << " " << cellData_[i] << std::endl;
outFile << " </DataArray>" << std::endl;
outFile << " </CellData>" << std::endl;
}
//////////////////////////////////////////////////
// Write footer
//////////////////////////////////////////////////
outFile << " </Piece>" << std::endl; outFile << " </Piece>" << std::endl;
outFile << " </UnstructuredGrid>" << std::endl; outFile << " </UnstructuredGrid>" << std::endl;
outFile << "</VTKFile>" << std::endl; outFile << "</VTKFile>" << std::endl;
...@@ -270,6 +294,8 @@ namespace Dune { ...@@ -270,6 +294,8 @@ namespace Dune {
std::vector<double> zCoord_; std::vector<double> zCoord_;
std::vector<double> cellData_;
std::array<std::vector<Dune::FieldVector<double,3> >, 3 > directors_; std::array<std::vector<Dune::FieldVector<double,3> >, 3 > directors_;
private: private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment