Commit ec1d00df authored by Joachim Pouderoux's avatar Joachim Pouderoux Committed by Cory Quammen

Fix code formating & style to VTK coding-style rules.

Change-Id: Id5b760ed9b3842284daf45ea1551f2759301efb3
parent f4ec97b3
......@@ -41,7 +41,8 @@ vtkXMLPDataWriter::vtkXMLPDataWriter()
// Setup a callback for the internal writer to report progress.
this->ProgressObserver = vtkCallbackCommand::New();
this->ProgressObserver->SetCallback(&vtkXMLPDataWriter::ProgressCallbackFunction);
this->ProgressObserver->SetCallback(
&vtkXMLPDataWriter::ProgressCallbackFunction);
this->ProgressObserver->SetClientData(this);
this->Controller = 0;
......@@ -62,7 +63,7 @@ vtkXMLPDataWriter::~vtkXMLPDataWriter()
//----------------------------------------------------------------------------
void vtkXMLPDataWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
this->Superclass::PrintSelf(os, indent);
os << indent << "NumberOfPieces: " << this->NumberOfPieces << "\n";
os << indent << "StartPiece: " << this->StartPiece << "\n";
os << indent << "EndPiece: " << this->EndPiece << "\n";
......@@ -75,7 +76,7 @@ void vtkXMLPDataWriter::SetWriteSummaryFile(int flag)
{
vtkDebugMacro(<< this->GetClassName() << " ("
<< this << "): setting WriteSummaryFile to " << flag);
if(this->WriteSummaryFile != flag)
if (this->WriteSummaryFile != flag)
{
this->WriteSummaryFile = flag;
this->Modified();
......@@ -97,7 +98,7 @@ int vtkXMLPDataWriter::WriteInternal()
// Decide whether to write the summary file.
int writeSummary = 0;
if(this->WriteSummaryFile)
if (this->WriteSummaryFile)
{
if (!this->Controller || this->Controller->GetLocalProcessId() == 0)
{
......@@ -106,14 +107,13 @@ int vtkXMLPDataWriter::WriteInternal()
}
// Write the summary file if requested.
if(result && writeSummary)
if (result && writeSummary)
{
if(!this->Superclass::WriteInternal())
if (!this->Superclass::WriteInternal())
{
int i;
vtkErrorMacro("Ran out of disk space; deleting file(s) already written");
for (i = this->StartPiece; i < this->EndPiece; i++)
for (int i = this->StartPiece; i < this->EndPiece; i++)
{
char* fileName = this->CreatePieceFileName(i, this->PathName);
this->DeleteAFile(fileName);
......@@ -163,8 +163,7 @@ int vtkXMLPDataWriter::WriteData()
}
// Write the elements referencing each piece and its file.
int i;
for(i=0;i < this->NumberOfPieces; ++i)
for (int i = 0; i < this->NumberOfPieces; ++i)
{
os << nextIndent << "<Piece";
this->WritePPieceAttributes(i);
......@@ -178,12 +177,7 @@ int vtkXMLPDataWriter::WriteData()
os << indent << "</" << this->GetDataSetName() << ">\n";
this->EndFile();
if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
{
return 0;
}
return 1;
return (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError) ? 0 : 1;
}
//----------------------------------------------------------------------------
......@@ -220,17 +214,30 @@ void vtkXMLPDataWriter::SplitFileName()
#if defined(_WIN32)
// Convert to UNIX-style slashes.
for(s=begin;s != end;++s) { if(*s == '\\') { *s = '/'; } }
for (s = begin; s != end; ++s)
{
if (*s == '\\')
{
*s = '/';
}
}
#endif
// Extract the path name up to the last '/'.
if(this->PathName) { delete [] this->PathName; this->PathName = 0; }
char* rbegin = end-1;
char* rend = begin-1;
for(s=rbegin;s != rend;--s) { if(*s == '/') { break; } }
if(s >= begin)
delete [] this->PathName;
this->PathName = 0;
char* rbegin = end - 1;
char* rend = begin - 1;
for (s = rbegin; s != rend; --s)
{
if(*s == '/')
{
break;
}
}
if (s >= begin)
{
length = (s-begin)+1;
length = (s-begin) + 1;
this->PathName = new char[length+1];
strncpy(this->PathName, this->FileName, length);
this->PathName[length] = '\0';
......@@ -239,20 +246,27 @@ void vtkXMLPDataWriter::SplitFileName()
// "begin" now points at the beginning of the file name.
// Look for the first "." to pull off the longest extension.
delete [] this->FileNameExtension; this->FileNameExtension = 0;
for(s=begin; s != end; ++s) { if(*s == '.') { break; } }
if(s < end)
delete [] this->FileNameExtension;
this->FileNameExtension = 0;
for (s = begin; s != end; ++s)
{
if (*s == '.')
{
break;
}
}
if (s < end)
{
length = end-s;
this->FileNameExtension = new char[length+1];
length = end - s;
this->FileNameExtension = new char[length + 1];
strncpy(this->FileNameExtension, s, length);
this->FileNameExtension[length] = '\0';
end = s;
}
// "end" now points to end of the file name.
if(this->FileNameBase) { delete [] this->FileNameBase; }
length = end-begin;
delete [] this->FileNameBase;
length = end - begin;
this->FileNameBase = new char[length+1];
strncpy(this->FileNameBase, begin, length);
this->FileNameBase[length] = '\0';
......@@ -264,17 +278,20 @@ void vtkXMLPDataWriter::SplitFileName()
//----------------------------------------------------------------------------
char* vtkXMLPDataWriter::CreatePieceFileName(int index, const char* path)
{
vtksys_ios::ostringstream fn_with_warning_C4701;
if(path) { fn_with_warning_C4701 << path; }
fn_with_warning_C4701 << this->FileNameBase << "_" << index;
if(this->PieceFileNameExtension)
{ fn_with_warning_C4701 << this->PieceFileNameExtension; }
//if(this->FileNameExtension)
//{ fn_with_warning_C4701 << this->FileNameExtension; }
size_t len = fn_with_warning_C4701.str().length();
vtksys_ios::ostringstream s;
if (path)
{
s << path;
}
s << this->FileNameBase << "_" << index;
if (this->PieceFileNameExtension)
{
s << this->PieceFileNameExtension;
}
size_t len = s.str().length();
char *buffer = new char[len + 1];
strncpy(buffer, fn_with_warning_C4701.str().c_str(), len);
strncpy(buffer, s.str().c_str(), len);
buffer[len] = '\0';
return buffer;
......@@ -285,22 +302,21 @@ int vtkXMLPDataWriter::WritePieces()
{
// Split progress range by piece. Just assume all pieces are the
// same size.
float progressRange[2] = {0,0};
float progressRange[2] = { 0.f, 0.f };
this->GetProgressRange(progressRange);
// Write each piece from StartPiece to EndPiece.
int i;
for(i=this->StartPiece; i <= this->EndPiece; ++i)
for(int i = this->StartPiece; i <= this->EndPiece; ++i)
{
this->SetProgressRange(progressRange, i-this->StartPiece,
this->EndPiece-this->StartPiece+1);
if(!this->WritePiece(i))
this->EndPiece-this->StartPiece + 1);
if (!this->WritePiece(i))
{
// Writing a piece failed. Delete files for previous pieces and
// abort.
// Writing a piece failed.
// Delete files for previous pieces and abort.
vtkErrorMacro("Ran out of disk space; deleting file(s) already written");
for(int j=this->StartPiece; j < i; ++j)
for (int j = this->StartPiece; j < i; ++j)
{
char* fileName = this->CreatePieceFileName(j, this->PathName);
this->DeleteAFile(fileName);
......
......@@ -35,7 +35,7 @@ vtkXMLPImageDataWriter::~vtkXMLPImageDataWriter()
//----------------------------------------------------------------------------
void vtkXMLPImageDataWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
this->Superclass::PrintSelf(os, indent);
}
//----------------------------------------------------------------------------
......@@ -77,7 +77,7 @@ void vtkXMLPImageDataWriter::WritePrimaryElementAttributes(ostream &os, vtkInden
//----------------------------------------------------------------------------
vtkXMLStructuredDataWriter*
vtkXMLPImageDataWriter::CreateStructuredPieceWriter()
vtkXMLPImageDataWriter::CreateStructuredPieceWriter()
{
// Create the writer for the piece.
vtkXMLImageDataWriter* pWriter = vtkXMLImageDataWriter::New();
......
......@@ -34,7 +34,7 @@ vtkXMLPPolyDataWriter::~vtkXMLPPolyDataWriter()
//----------------------------------------------------------------------------
void vtkXMLPPolyDataWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
this->Superclass::PrintSelf(os, indent);
}
//----------------------------------------------------------------------------
......@@ -67,7 +67,7 @@ vtkXMLPPolyDataWriter::CreateUnstructuredPieceWriter()
//----------------------------------------------------------------------------
int vtkXMLPPolyDataWriter::FillInputPortInformation(
int vtkNotUsed(port), vtkInformation* info)
int, vtkInformation* info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");
return 1;
......
......@@ -35,10 +35,9 @@ vtkXMLPStructuredGridWriter::~vtkXMLPStructuredGridWriter()
//----------------------------------------------------------------------------
void vtkXMLPStructuredGridWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
this->Superclass::PrintSelf(os, indent);
}
//----------------------------------------------------------------------------
vtkStructuredGrid* vtkXMLPStructuredGridWriter::GetInput()
{
......@@ -59,7 +58,7 @@ const char* vtkXMLPStructuredGridWriter::GetDefaultFileExtension()
//----------------------------------------------------------------------------
vtkXMLStructuredDataWriter*
vtkXMLPStructuredGridWriter::CreateStructuredPieceWriter()
vtkXMLPStructuredGridWriter::CreateStructuredPieceWriter()
{
// Create the writer for the piece.
vtkXMLStructuredGridWriter* pWriter = vtkXMLStructuredGridWriter::New();
......@@ -79,8 +78,9 @@ void vtkXMLPStructuredGridWriter::WritePData(vtkIndent indent)
this->WritePPoints(input->GetPoints(), indent);
}
//----------------------------------------------------------------------------
int vtkXMLPStructuredGridWriter::FillInputPortInformation(
int vtkNotUsed(port), vtkInformation* info)
int, vtkInformation* info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkStructuredGrid");
return 1;
......
......@@ -35,7 +35,7 @@ vtkXMLPUnstructuredDataWriter::~vtkXMLPUnstructuredDataWriter()
//----------------------------------------------------------------------------
void vtkXMLPUnstructuredDataWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
this->Superclass::PrintSelf(os, indent);
}
//----------------------------------------------------------------------------
......@@ -50,7 +50,7 @@ int vtkXMLPUnstructuredDataWriter::ProcessRequest(
vtkInformationVector** inputVector,
vtkInformationVector* outputVector)
{
if(request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT()))
if (request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT()))
{
vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
inInfo->Set(
......
......@@ -34,7 +34,7 @@ vtkXMLPUnstructuredGridWriter::~vtkXMLPUnstructuredGridWriter()
//----------------------------------------------------------------------------
void vtkXMLPUnstructuredGridWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
this->Superclass::PrintSelf(os, indent);
}
//----------------------------------------------------------------------------
......@@ -57,7 +57,7 @@ const char* vtkXMLPUnstructuredGridWriter::GetDefaultFileExtension()
//----------------------------------------------------------------------------
vtkXMLUnstructuredDataWriter*
vtkXMLPUnstructuredGridWriter::CreateUnstructuredPieceWriter()
vtkXMLPUnstructuredGridWriter::CreateUnstructuredPieceWriter()
{
// Create the writer for the piece.
vtkXMLUnstructuredGridWriter* pWriter = vtkXMLUnstructuredGridWriter::New();
......@@ -67,7 +67,7 @@ vtkXMLPUnstructuredGridWriter::CreateUnstructuredPieceWriter()
//----------------------------------------------------------------------------
int vtkXMLPUnstructuredGridWriter::FillInputPortInformation(
int vtkNotUsed(port), vtkInformation* info)
int, vtkInformation* info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkUnstructuredGridBase");
return 1;
......
......@@ -235,7 +235,7 @@ void vtkXMLCompositeDataReader::ReadXMLData()
// specified as relative paths.
std::string filePath = this->FileName;
std::string::size_type pos = filePath.find_last_of("/\\");
if(pos != filePath.npos)
if (pos != filePath.npos)
{
filePath = filePath.substr(0, pos);
}
......@@ -317,17 +317,17 @@ vtkDataSet* vtkXMLCompositeDataReader::ReadDataset(vtkXMLDataElement* xmlElem,
const char* filePath)
{
// Construct the name of the internal file.
std::string fileName;
const char* file = xmlElem->GetAttribute("file");
if (!file)
{
return NULL;
return 0;
}
if(!(file[0] == '/' || file[1] == ':'))
std::string fileName;
if (!(file[0] == '/' || file[1] == ':'))
{
fileName = filePath;
if(fileName.length())
if (fileName.length())
{
fileName += "/";
}
......@@ -348,7 +348,7 @@ vtkDataSet* vtkXMLCompositeDataReader::ReadDataset(vtkXMLDataElement* xmlElem,
this->Internal->ReaderList;
!rname && readerEntry->extension; ++readerEntry)
{
if(ext == readerEntry->extension)
if (ext == readerEntry->extension)
{
rname = readerEntry->name;
}
......@@ -393,7 +393,7 @@ int vtkXMLCompositeDataReader::RequestInformation(
//----------------------------------------------------------------------------
const vtkXMLCompositeDataReaderEntry
vtkXMLCompositeDataReaderInternals::ReaderList[] =
vtkXMLCompositeDataReaderInternals::ReaderList[] =
{
{"vtp", "vtkXMLPolyDataReader"},
{"vtu", "vtkXMLUnstructuredGridReader"},
......
This diff is collapsed.
This diff is collapsed.
......@@ -111,7 +111,7 @@ int vtkXMLDataSetWriter::WriteInternal()
}
// Make sure we got a valid writer for the data set.
if(!writer)
if (!writer)
{
vtkErrorMacro("Cannot write dataset type: "
<< this->GetInput()->GetDataObjectType() << " which is a "
......@@ -158,7 +158,7 @@ void vtkXMLDataSetWriter::ProgressCallbackFunction(vtkObject* caller,
void* clientdata, void*)
{
vtkAlgorithm* w = vtkAlgorithm::SafeDownCast(caller);
if(w)
if (w)
{
reinterpret_cast<vtkXMLDataSetWriter*>(clientdata)->ProgressCallback(w);
}
......@@ -167,11 +167,11 @@ void vtkXMLDataSetWriter::ProgressCallbackFunction(vtkObject* caller,
//----------------------------------------------------------------------------
void vtkXMLDataSetWriter::ProgressCallback(vtkAlgorithm* w)
{
float width = this->ProgressRange[1]-this->ProgressRange[0];
float width = this->ProgressRange[1] - this->ProgressRange[0];
float internalProgress = w->GetProgress();
float progress = this->ProgressRange[0] + internalProgress*width;
this->UpdateProgressDiscrete(progress);
if(this->AbortExecute)
if (this->AbortExecute)
{
w->SetAbortExecute(1);
}
......
......@@ -48,13 +48,13 @@ void vtkXMLFileReadTester::PrintSelf(ostream& os, vtkIndent indent)
//----------------------------------------------------------------------------
int vtkXMLFileReadTester::TestReadFile()
{
if(!this->FileName)
if (!this->FileName)
{
return 0;
}
ifstream inFile(this->FileName);
if(!inFile)
if (!inFile)
{
return 0;
}
......@@ -64,27 +64,22 @@ int vtkXMLFileReadTester::TestReadFile()
this->Parse();
if(this->Done)
{
return 1;
}
return 0;
return this->Done ? 1 : 0;
}
//----------------------------------------------------------------------------
void vtkXMLFileReadTester::StartElement(const char* name, const char** atts)
{
this->Done = 1;
if(strcmp(name, "VTKFile") == 0)
if (strcmp(name, "VTKFile") == 0)
{
unsigned int i;
for(i=0; atts[i] && atts[i+1]; i+=2)
for(unsigned int i = 0; atts[i] && atts[i+1]; i += 2)
{
if(strcmp(atts[i], "type") == 0)
if (strcmp(atts[i], "type") == 0)
{
this->SetFileDataType(atts[i+1]);
}
else if(strcmp(atts[i], "version") == 0)
else if (strcmp(atts[i], "version") == 0)
{
this->SetFileVersion(atts[i+1]);
}
......@@ -95,5 +90,5 @@ void vtkXMLFileReadTester::StartElement(const char* name, const char** atts)
//----------------------------------------------------------------------------
int vtkXMLFileReadTester::ParsingComplete()
{
return (this->Done? 1:0);
return this->Done ? 1 : 0;
}
......@@ -57,7 +57,7 @@ vtkHyperOctree* vtkXMLHyperOctreeReader::GetOutput()
//----------------------------------------------------------------------------
vtkHyperOctree* vtkXMLHyperOctreeReader::GetOutput(int idx)
{
return vtkHyperOctree::SafeDownCast( this->GetOutputDataObject(idx) );
return vtkHyperOctree::SafeDownCast(this->GetOutputDataObject(idx));
}
//----------------------------------------------------------------------------
......@@ -137,45 +137,44 @@ void vtkXMLHyperOctreeReader::ReadXMLData()
vtkXMLDataElement *ePrimary =
this->XMLParser->GetRootElement()->GetNestedElement(0);
int Dimension;
double Size[3];
double Origin[3];
int dimension;
double size[3];
double origin[3];
if (!ePrimary->GetScalarAttribute("Dimension", Dimension))
if (!ePrimary->GetScalarAttribute("Dimension", dimension))
{
Dimension = 3;
dimension = 3;
}
if(ePrimary->GetVectorAttribute("Size", 3, Size) != 3)
if (ePrimary->GetVectorAttribute("Size", 3, size) != 3)
{
Size[0] = 1;
Size[1] = 1;
Size[2] = 1;
size[0] = 1;
size[1] = 1;
size[2] = 1;
}
if(ePrimary->GetVectorAttribute("Origin", 3, Origin) != 3)
if (ePrimary->GetVectorAttribute("Origin", 3, origin) != 3)
{
Origin[0] = 0;
Origin[1] = 0;
Origin[2] = 0;
origin[0] = 0;
origin[1] = 0;
origin[2] = 0;
}
vtkHyperOctree *output = vtkHyperOctree::SafeDownCast(
this->GetCurrentOutput());
output->SetDimension(Dimension);
output->SetSize(Size);
output->SetOrigin(Origin);
output->SetDimension(dimension);
output->SetSize(size);
output->SetOrigin(origin);
// Find the topology element, which defines the structure of the HyperOctree
// Rebuild the HyperOctree from that.
// This needs to happen before ReadPieceData so that numPoints and numCells
// will be defined.
int numNested = ePrimary->GetNumberOfNestedElements();
int i;
for(i=0; i < numNested; ++i)
for (int i = 0; i < numNested; ++i)
{
vtkXMLDataElement* eNested = ePrimary->GetNestedElement(i);
if(strcmp(eNested->GetName(), "Topology") == 0)
if (strcmp(eNested->GetName(), "Topology") == 0)
{
this->ReadTopology(eNested);
break;
......@@ -191,15 +190,10 @@ void vtkXMLHyperOctreeReader::ReadXMLData()
void vtkXMLHyperOctreeReader::ReadTopology(vtkXMLDataElement *elem)
{
float progressRange[2] = {0,0};
float progressRange[2] = { 0.f, 0.f };
this->GetProgressRange(progressRange);
//Part spent reading and reconstructing assumed to be roughly equal.
float fractions[3] =
{
0,
0.5,
1
};
float fractions[3] = { 0.f, 0.5f, 1.f };
this->SetProgressRange(progressRange, 0, fractions);
//Find the topology array and read it into a vtkIntArray
......@@ -240,8 +234,7 @@ void vtkXMLHyperOctreeReader::ReadTopology(vtkXMLDataElement *elem)
return;
}
vtkIntArray *ta = NULL;
ta = vtkIntArray::SafeDownCast(tda);
vtkIntArray *ta = vtkIntArray::SafeDownCast(tda);
if (!ta)
{
tda->Delete();
......@@ -252,7 +245,7 @@ void vtkXMLHyperOctreeReader::ReadTopology(vtkXMLDataElement *elem)
//Restore the topology from the vtkIntArray. Do it recursively, cell by cell.
vtkHyperOctreeCursor *cursor=vtkHyperOctree::SafeDownCast(
this->GetCurrentOutput())->NewCellCursor();
this->GetCurrentOutput())->NewCellCursor();
cursor->ToRoot();
//Where in the array we need to read from next.
this->ArrayIndex = 0;
......@@ -270,9 +263,7 @@ void vtkXMLHyperOctreeReader::ReadTopology(vtkXMLDataElement *elem)
//----------------------------------------------------------------------------
int vtkXMLHyperOctreeReader::BuildNextCell(
vtkIntArray *ta,
vtkHyperOctreeCursor *cursor,
int nchildren)
vtkIntArray *ta, vtkHyperOctreeCursor *cursor, int nchildren)
{
int nodeType = ta->GetValue(this->ArrayIndex);
......@@ -295,8 +286,8 @@ int vtkXMLHyperOctreeReader::BuildNextCell(
//subdivide
vtkHyperOctree::SafeDownCast(this->GetCurrentOutput())->SubdivideLeaf(cursor);
//then keep going down
int i=0;
while(i<nchildren)
int i = 0;
while (i < nchildren)
{
cursor->ToChild(i);
......@@ -313,4 +304,3 @@ int vtkXMLHyperOctreeReader::BuildNextCell(
}
return 1;
}
......@@ -42,7 +42,7 @@ vtkXMLHyperOctreeWriter::vtkXMLHyperOctreeWriter()
this->TopologyOM = new OffsetsManagerGroup;
this->PointDataOM = new OffsetsManagerGroup;
this->CellDataOM = new OffsetsManagerGroup;
this->TopologyOM->Allocate(1,1);
this->TopologyOM->Allocate(1, 1);
}
//----------------------------------------------------------------------------
......@@ -60,7 +60,7 @@ vtkXMLHyperOctreeWriter::~vtkXMLHyperOctreeWriter()
//----------------------------------------------------------------------------
void vtkXMLHyperOctreeWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
this->Superclass::PrintSelf(os, indent);
}
//----------------------------------------------------------------------------
......@@ -83,7 +83,7 @@ const char* vtkXMLHyperOctreeWriter::GetDataSetName()
//----------------------------------------------------------------------------
int vtkXMLHyperOctreeWriter::FillInputPortInformation(
int , vtkInformation* info)
int, vtkInformation* info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkHyperOctree");
return 1;
......@@ -125,17 +125,10 @@ int vtkXMLHyperOctreeWriter::WriteData()
if (this->GetDataMode() == vtkXMLWriter::Appended)
{
float progressRange[2] = {0,0};
float progressRange[2] = { 0.f, 0.f };
this->GetProgressRange(progressRange);
//Part spent serializing and writing assumed to be roughly equal.
float fractions[5] =
{
0,
0.25,
0.5,
0.75,
1
};
float fractions[5] = { 0.f, 0.25f, 0.5f, 0.75f, 1.f };
this->SetProgressRange(progressRange, 0, fractions);
this->StartAppendedData();
......@@ -185,12 +178,7 @@ int vtkXMLHyperOctreeWriter::StartPrimElement(vtkIndent indent)
{
ostream& os = *(this->Stream);
if(!this->WritePrimaryElement(os, indent))
{
return 0;
}
return 1;
return (!this->WritePrimaryElement(os, indent)) ? 0 : 1;
}
//----------------------------------------------------------------------------
......@@ -206,7 +194,6 @@ void vtkXMLHyperOctreeWriter::WritePrimaryElementAttributes(ostream &os, vtkInde
//----------------------------------------------------------------------------
int vtkXMLHyperOctreeWriter::WriteTopology(vtkIndent indent)
{
if (this->TopologyArray)
{
this->TopologyArray->Delete();
......@@ -220,15 +207,10 @@ int vtkXMLHyperOctreeWriter::WriteTopology(vtkIndent indent)
//record structure into an array
float progressRange[2] = {0,0};
float progressRange[2] = { 0.f, 0.f };
this->GetProgressRange(progressRange);
//Part spent serializing and writing assumed to be roughly equal.
float fractions[3] =
{
0,
0.5,
1
};
float fractions[3] = { 0.f, 0.5f, 1.f };
this->SetProgressRange(progressRange, 0, fractions);
this->SerializeTopology(cursor, cursor->GetNumberOfChildren());
......@@ -248,14 +230,14 @@ int vtkXMLHyperOctreeWriter::WriteTopology(vtkIndent indent)
if (this->GetDataMode() == vtkXMLWriter::Appended)
{
this->WriteArrayAppended(this->TopologyArray,
indent.GetNextIndent(),
this->TopologyOM->GetElement(0),
"Topology", 1, 0);
indent.GetNextIndent(),
this->TopologyOM->GetElement(0),
"Topology", 1, 0);
}
else
{
this->WriteArrayInline(this->TopologyArray,
indent.GetNextIndent(), "Topology", 1);
indent.GetNextIndent(), "Topology", 1);
}
os << indent << "</" << "Topology" << ">\n";
......@@ -271,8 +253,8 @@ int vtkXMLHyperOctreeWriter::WriteTopology(vtkIndent indent)
}
//----------------------------------------------------------------------------
void vtkXMLHyperOctreeWriter::SerializeTopology(vtkHyperOctreeCursor *cursor,
int nchildren)
void vtkXMLHyperOctreeWriter::SerializeTopology(
vtkHyperOctreeCursor *cursor, int nchildren)
{
if (cursor->CurrentIsLeaf())
{
......@@ -293,8 +275,8 @@ void vtkXMLHyperOctreeWriter::SerializeTopology(vtkHyperOctreeCursor *cursor,
//some of which are internal nodes, so we must continue down
this->TopologyArray->InsertNextValue(0);