# include # include # include # include using namespace std; # include "tetrahedron_grid.hpp" int main ( ); void tetrahedron_grid_test01 ( ); void timestamp ( ); //****************************************************************************80 int main ( ) //****************************************************************************80 // // Purpose: // // TETRAHEDRON_GRID_TEST() tests TETRAHEDRON_GRID(). // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 11 November 2011 // // Author: // // John Burkardt // { timestamp ( ); cout << "\n"; cout << "TETRAHEDRON_GRID_TEST:\n"; cout << " C++ version\n"; cout << " Test the TETRAHEDRON_GRID library.\n"; tetrahedron_grid_test01 ( ); // // Terminate. // cout << "\n"; cout << "TETRAHEDRON_GRID_TEST:\n"; cout << " Normal end of execution.\n"; cout << "\n"; timestamp ( ); return 0; } //****************************************************************************80 void tetrahedron_grid_test01 ( void ) //****************************************************************************80 // // Purpose: // // TETRAHEDRON_GRID_TEST01 tests TETRAHEDRON_GRID. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 11 November 2011 // // Author: // // John Burkardt // { string filename = "tetrahedron_grid_test01.xyz"; int n; int ng; double t[3*4] = { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 }; double *tg; cout << "\n"; cout << "TEST01:\n"; cout << " TETRAHEDRON_GRID can define a tetrahedral grid\n"; cout << " with N+1 points on a side, based on any tetrahedron.\n"; n = 10; cout << " N = " << n << "\n"; ng = tetrahedron_grid_count ( n ); r8mat_print ( 3, 4, t, " Tetrahedron vertices:" ); tg = tetrahedron_grid ( n, t, ng ); r83vec_print_part ( ng, tg, 20, " Part of the grid point array:" ); r8mat_write ( filename, 3, ng, tg ); cout << "\n"; cout << " Data written to the file \"" << filename << "\".\n"; delete [] tg; return; } //****************************************************************************80 void timestamp ( ) //****************************************************************************80 // // Purpose: // // TIMESTAMP prints the current YMDHMS date as a time stamp. // // Example: // // 31 May 2001 09:45:54 AM // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 08 July 2009 // // Author: // // John Burkardt // { # define TIME_SIZE 40 static char time_buffer[TIME_SIZE]; const struct std::tm *tm_ptr; std::time_t now; now = std::time ( NULL ); tm_ptr = std::localtime ( &now ); std::strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm_ptr ); std::cout << time_buffer << "\n"; return; # undef TIME_SIZE }