------------------------------------------------------------------------------
| 1607 | |
| 1608 | //------------------------------------------------------------------------------ |
| 1609 | void EnSightDataSet::ReadVariableNodes(EnSightFile& file, const std::string& arrayName, |
| 1610 | int numComponents, vtkPartitionedDataSetCollection* output, vtkDataArraySelection* selection, |
| 1611 | bool isComplex /*=false*/, bool isReal /*=true*/) |
| 1612 | { |
| 1613 | if (!file.SetTimeStepToRead(this->ActualTimeValue)) |
| 1614 | { |
| 1615 | vtkGenericWarningMacro("couldn't correctly set time step to read. Aborting"); |
| 1616 | return; |
| 1617 | } |
| 1618 | file.CheckForBeginTimeStepLine(); |
| 1619 | |
| 1620 | // skip description line |
| 1621 | file.SkipNLines(1); |
| 1622 | auto result = file.ReadNextLine(); |
| 1623 | while (result.first && result.second.find("part") != std::string::npos) |
| 1624 | { |
| 1625 | int partId = this->ReadPartId(file); |
| 1626 | partId--; |
| 1627 | |
| 1628 | // next line should be either coordinates or block |
| 1629 | // however it may or may not be there if there is an empty part. |
| 1630 | // we'll test for it and if it doesn't say coordinates or block, we'll assume |
| 1631 | // it's an empty part and move on |
| 1632 | result = file.ReadNextLine(); |
| 1633 | auto sectionHeader = result.second; |
| 1634 | if (sectionHeader.find("coordinates") == std::string::npos && |
| 1635 | sectionHeader.find("block") == std::string::npos) |
| 1636 | { |
| 1637 | continue; |
| 1638 | } |
| 1639 | |
| 1640 | auto it = this->PartInfoMap.find(partId); |
| 1641 | if (it == this->PartInfoMap.end()) |
| 1642 | { |
| 1643 | vtkGenericWarningMacro("Part Id " << partId << " could not be found in PartInfoMap"); |
| 1644 | return; |
| 1645 | } |
| 1646 | auto& partInfo = it->second; |
| 1647 | bool readPart = false; |
| 1648 | if (selection->ArrayIsEnabled(partInfo.Name.c_str())) |
| 1649 | { |
| 1650 | readPart = true; |
| 1651 | } |
| 1652 | |
| 1653 | if (readPart) |
| 1654 | { |
| 1655 | vtkPartitionedDataSet* pds = output->GetPartitionedDataSet(partInfo.PDCIndex); |
| 1656 | vtkDataSet* ds = pds->GetPartition(0); |
| 1657 | auto numPts = ds->GetNumberOfPoints(); |
| 1658 | if (numPts > 0) |
| 1659 | { |
| 1660 | // Because the old reader puts the real and imaginary components into a single array |
| 1661 | // with 2 components in the case of scalars, we will copy that functionality here, so |
| 1662 | // users of the old reader can expect to have the same variable names with this reader. |
| 1663 | // When numComponents > 1, the real and imaginary components are always put into their |
| 1664 | // own vtkDataArray. |
| 1665 | if (isComplex && numComponents == 1) |
| 1666 | { |
no test coverage detected