Fix issues.......

This commit is contained in:
Dave Pugmire 2023-03-15 12:45:45 -04:00
parent 6db8c316ad
commit 97b460110f
2 changed files with 20 additions and 18 deletions

@ -38,7 +38,7 @@ vtkm::cont::PartitionedDataSet VTKVisItFileReader::ReadPartitionedDataSet()
//Get the base dir name //Get the base dir name
auto pos = this->FileName.rfind("/"); auto pos = this->FileName.rfind("/");
if (pos != std::string::npos) if (pos != std::string::npos)
baseDirPath = baseDirPath.substr(0, pos); baseDirPath = this->FileName.substr(0, pos);
//Open up the file of filenames. //Open up the file of filenames.
std::ifstream stream(this->FileName); std::ifstream stream(this->FileName);
@ -58,12 +58,12 @@ vtkm::cont::PartitionedDataSet VTKVisItFileReader::ReadPartitionedDataSet()
//!NBLOCKS is already set!! //!NBLOCKS is already set!!
if (numBlocks > 0) if (numBlocks > 0)
throw vtkm::io::ErrorIO("Invalid file: " + this->FileName + throw vtkm::io::ErrorIO("Invalid file: " + this->FileName +
". Number of blocks already specified"); ". `!NBLOCKS` specified more than once.");
numBlocks = std::atoi(line.substr(8, line.size()).c_str()); numBlocks = std::atoi(line.substr(8, line.size()).c_str());
if (numBlocks <= 0) if (numBlocks <= 0)
throw vtkm::io::ErrorIO("Invalid file: " + this->FileName + throw vtkm::io::ErrorIO("Invalid file: " + this->FileName +
". Number of blocks must be > 0"); ". Number of blocks (!NBLOCKS) must be > 0.");
} }
else if (numBlocks > 0) else if (numBlocks > 0)
{ {
@ -82,7 +82,8 @@ vtkm::cont::PartitionedDataSet VTKVisItFileReader::ReadPartitionedDataSet()
} }
else else
{ {
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Skipping line: " << line); VTKM_LOG_S(vtkm::cont::LogLevel::Info,
"Skipping line that occurs before `!NBLOCKS`: " << line);
continue; continue;
} }
} }
@ -98,7 +99,7 @@ vtkm::cont::PartitionedDataSet VTKVisItFileReader::ReadPartitionedDataSet()
vtkm::cont::PartitionedDataSet pds; vtkm::cont::PartitionedDataSet pds;
//Read all the files. //Read all the files.
for (const auto fn : fileNames) for (auto&& fn : fileNames)
{ {
vtkm::io::VTKDataSetReader reader(fn); vtkm::io::VTKDataSetReader reader(fn);
pds.AppendPartition(reader.ReadDataSet()); pds.AppendPartition(reader.ReadDataSet());

@ -21,19 +21,20 @@ namespace vtkm
namespace io namespace io
{ {
// /// Reader for ".visit" files, a simple file format for partioned data sets.
// Reader for ".visit" files, a simple file format for partioned data sets. /// The file format consists of the keyword "!NBLOCKS <N>", where N is the number of
// The file format consists of the keyword "!NBLOCKS <N>", where N is the number of /// partitions, followed by a list of the N files. For example:
// partitions, followed by a list of the N files. For example: ///
// /// ```
/* /// # This is a comment
!NBLOCKS 2 /// !NBLOCKS 2
file1.vtk /// file1.vtk
file2.vtk /// file2.vtk
*/ /// ```
// ///
// Note: .visit files support time varying partitione data, but it is not supported /// Note: .visit files support time varying partitioned data, but it is not supported
// in this reader. /// in this reader.
///
class VTKM_IO_EXPORT VTKVisItFileReader class VTKM_IO_EXPORT VTKVisItFileReader
{ {