Commit d2cba4f2 authored by Caitlin Ross's avatar Caitlin Ross
Browse files

complex node vars done

parent 4132147d
......@@ -945,8 +945,8 @@ private:
void ReadNSidedSection(vtkUnstructuredGrid* output);
void ReadNFacedSection(vtkUnstructuredGrid* output);
void ReadVariableNodes(VariableOptions& opts, vtkPartitionedDataSetCollection* output,
vtkDataArraySelection* selection);
void ReadVariableNodes(const std::string& filename, const std::string& arrayName,
int numComponents, vtkPartitionedDataSetCollection* output, vtkDataArraySelection* selection);
void ProcessNodeIds(int numPts, vtkDataSet* output);
void ProcessElementIds(int numCells, vtkDataSet* output);
......@@ -1325,28 +1325,57 @@ bool EnSightFileStream::ReadVariables(
{
for (auto& var : this->Variables)
{
this->ReadVariableNodes(var, output, selection);
switch (var.Type)
{
case VariableType::ScalarPerNode:
case VariableType::VectorPerNode:
case VariableType::TensorSymmPerNode:
case VariableType::TensorAsymPerNode:
this->ReadVariableNodes(
this->GetFullPath(var.FileName), var.Name,
getNumComponents(var.Type), output, selection);
break;
case VariableType::ComplexScalarPerNode:
case VariableType::ComplexVectorPerNode:
this->ReadVariableNodes(
this->GetFullPath(var.FileName), var.Name + "-Real",
getNumComponents(var.Type), output, selection);
this->ReadVariableNodes(
this->GetFullPath(var.ImagFileName), var.Name + "-Imaginary",
getNumComponents(var.Type), output, selection);
break;
case VariableType::ScalarPerElement:
case VariableType::VectorPerElement:
case VariableType::TensorSymmPerElement:
case VariableType::TensorAsymPerElement:
case VariableType::ComplexScalarPerElement:
case VariableType::ComplexVectorPerElement:
vtkGenericWarningMacro("Variable type isn't implemented yet");
break;
default:
vtkGenericWarningMacro("Variable type is unknown");
}
}
return true;
}
//------------------------------------------------------------------------------
void EnSightFileStream::ReadVariableNodes(VariableOptions& opts,
vtkPartitionedDataSetCollection* output, vtkDataArraySelection* selection)
void EnSightFileStream::ReadVariableNodes(const std::string& filename, const std::string& arrayName,
int numComponents, vtkPartitionedDataSetCollection* output, vtkDataArraySelection* selection)
{
// TODO since we already know binary/ascii info from geometry file,
// could have a way to create a file where we specify that in the
// EnSightFile object when we create it
EnSightFile file;
file.FileName = this->GetFullPath(opts.FileName);
file.FileName = filename;
if (!file.OpenFile())
{
return;
}
int numComponents = getNumComponents(opts.Type);
// skip description line
file.SkipNLines(1);
......@@ -1379,7 +1408,7 @@ void EnSightFileStream::ReadVariableNodes(VariableOptions& opts,
vtkNew<vtkFloatArray> array;
array->SetNumberOfComponents(numComponents);
array->SetNumberOfTuples(numPts);
array->SetName(opts.Name.c_str());
array->SetName(arrayName.c_str());
if (numComponents == 1)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment