Skip to content

Commit 80e2313

Browse files
committed
Fix mesh check with missing second file
1 parent b178800 commit 80e2313

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

vtkdiff.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ bool comparePoints(vtkPoints* const points_a, vtkPoints* const points_b,
419419
if (n_points_a != n_points_b)
420420
{
421421
std::cerr << "Number of points in the first mesh is " << n_points_a
422-
<< " and differst from the number of point in the second "
422+
<< " and differs from the number of points in the second "
423423
"mesh, which is "
424424
<< n_points_b << "\n";
425425
return false;
@@ -459,23 +459,38 @@ int main(int argc, char* argv[])
459459

460460
if (args.meshcheck)
461461
{
462+
if (args.vtk_input_b.empty())
463+
{
464+
std::cerr
465+
<< "Error: Second input file must be provided for mesh check."\
466+
<< "\n";
467+
return EXIT_FAILURE;
468+
}
469+
470+
if (!std::get<0>(meshes) || !std::get<1>(meshes))
471+
{
472+
std::cerr << "Error reading mesh file(s)." << std::endl;
473+
return EXIT_FAILURE;
474+
}
475+
462476
if (args.vtk_input_a == args.vtk_input_b)
463477
{
464478
std::cout << "Will not compare meshes from same input file.\n";
465479
return EXIT_SUCCESS;
466480
}
481+
467482
if (!comparePoints(std::get<0>(meshes)->GetPoints(),
468483
std::get<1>(meshes)->GetPoints(),
469484
args.abs_err_thr * args.abs_err_thr))
470485
{
471-
std::cerr << "Error in mesh points' comparison occured.\n";
486+
std::cerr << "Error in mesh points' comparison occurred.\n";
472487
return EXIT_FAILURE;
473488
}
474489

475490
if (!compareCellTopology(std::get<0>(meshes)->GetCells(),
476491
std::get<1>(meshes)->GetCells()))
477492
{
478-
std::cerr << "Error in cells' topology comparison occured.\n";
493+
std::cerr << "Error in cells' topology comparison occurred.\n";
479494
return EXIT_FAILURE;
480495
}
481496
return EXIT_SUCCESS;

0 commit comments

Comments
 (0)