-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmain.cc
More file actions
82 lines (76 loc) · 2.55 KB
/
Copy pathmain.cc
File metadata and controls
82 lines (76 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "claw.h"
#include <deal.II/base/timer.h>
using namespace dealii;
// @sect3{main()}
// The following ``main'' function is
// similar to previous examples and
// need not to be commented on. Note
// that the program aborts if no input
// file name is given on the command
// line.
int main (int argc, char *argv[])
{
deallog.depth_console(0);
if (argc != 2 && argc != 3)
{
std::cout << "Usage:" << argv[0] << " input_file" << std::endl;
std::cout << " " << argv[0] << " input_file num_threads" << std::endl;
std::exit(1);
}
unsigned int n_threads = 1;
if(argc==3) n_threads = atoi(argv[2]);
try
{
Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, n_threads);
ParameterHandler prm;
Parameters::AllParameters<2>::declare_parameters (prm);
bool status = prm.read_input (argv[1], true);
AssertThrow( status, ExcFileNotOpen(argv[1]) );
prm.print_parameters(std::cout, ParameterHandler::Text);
unsigned int degree = prm.get_integer("degree"); // Degree of FEM
std::string basis = prm.get("basis");
Timer timer;
timer.start ();
if(basis=="Qk")
{
const FE_DGQArbitraryNodes<2> fe_scalar(QGauss<1>(degree+1));
//const FE_DGQ<2> fe_scalar(1);
ConservationLaw<2> cons (argv[1], degree, fe_scalar);
cons.run ();
}
else
{
const FE_DGP<2> fe_scalar(degree);
ConservationLaw<2> cons (argv[1], degree, fe_scalar);
cons.run ();
}
timer.stop ();
std::cout << std::endl;
std::cout << "Elapsed CPU time : " << timer()/60 << " min.\n";
std::cout << "Elapsed wall time: " << timer.wall_time()/60 << " min.\n";
}
catch (std::exception &exc)
{
std::cerr << std::endl << std::endl
<< "----------------------------------------------------"
<< std::endl;
std::cerr << "Exception on processing: " << std::endl
<< exc.what() << std::endl
<< "Aborting!" << std::endl
<< "----------------------------------------------------"
<< std::endl;
return 1;
}
catch (...)
{
std::cerr << std::endl << std::endl
<< "----------------------------------------------------"
<< std::endl;
std::cerr << "Unknown exception!" << std::endl
<< "Aborting!" << std::endl
<< "----------------------------------------------------"
<< std::endl;
return 1;
};
return 0;
}