add lab3
This commit is contained in:
40
lab3/print_grid2D.cpp
Normal file
40
lab3/print_grid2D.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
// Read and print a file with format GRID2D_POINTS3D.
|
||||
// Mainly for testing.
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "grid2DPoints3D.h"
|
||||
#include "grid2DIO.h"
|
||||
|
||||
|
||||
// ********************* Functions ************************************
|
||||
|
||||
void UsageMsg(const std::string& command_name) {
|
||||
std::cerr << "Usage: " << command_name << " {filename}\n";
|
||||
}
|
||||
|
||||
|
||||
// ********************* Main *****************************************
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
||||
if (argc == 1) {
|
||||
UsageMsg(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GRID2D_POINTS3D grid2D;
|
||||
|
||||
try {
|
||||
OpenReadGrid2DPoints3D(argv[1], grid2D);
|
||||
}
|
||||
catch (const std::exception&) {
|
||||
std::cerr << "Exiting...\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
grid2D.FormattedPrint();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user