Debian Codegraph @

packages/nox/examples/epetra/LOCA_ContinuationManager/main.C

raw
1 // @HEADER
2 // *****************************************************************************
3 // LOCA: Library of Continuation Algorithms Package
4 //
5 // Copyright 2001-2005 NTESS and the LOCA contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 // Trilinos headers
11 #ifdef HAVE_MPI
12 #include "mpi.h"
13 #include "Epetra_MpiComm.h"
14 #else
15 #include "Epetra_SerialComm.h"
16 #endif
17 #include "Teuchos_ParameterList.hpp"
18 #include "Teuchos_RCP.hpp"
19 #include "Teuchos_GlobalMPISession.hpp"
20 #include "Teuchos_StandardCatchMacros.hpp"
21
22 // ParaCont headers
23 #include "ContinuationManager.H"
24 #include "LinearSystem.H"
25
26 // Main driver
27 int main( int argc, char **argv )
28 {
29
30 // Initialise MPI
31 Teuchos::GlobalMPISession mpiSession(&argc,&argv);
32
33 bool success = false;
34 bool verbose = false;
35 try {
36
37 #ifdef HAVE_MPI
38 // Create a communicator
39 Teuchos::RCP <Epetra_MpiComm> comm =
40 Teuchos::rcp(new Epetra_MpiComm(MPI_COMM_WORLD));
41 #else
42 // Create a communicator
43 Teuchos::RCP <Epetra_SerialComm> comm =
44 Teuchos::rcp(new Epetra_SerialComm);
45 #endif
46
47 std::string fileName = "task.xml";
48 if (argc>1)
49 fileName = argv[1];
50
51 // Instantiate the continuation manager
52 Teuchos::RCP <ContinuationManager> contManager =
53 Teuchos::rcp(new ContinuationManager(comm,fileName));
54
55 // Instantiate the problem
56 Teuchos::RCP <LinearSystem> problem =
57 Teuchos::rcp(new LinearSystem(comm));
58
59 // Set the problem in the continuation manager
60 contManager->SetLOCAProblem(problem);
61
62 // Prepare to run LOCA
63 contManager->BuildLOCAStepper();
64
65 // Run LOCA
66 success = contManager->RunLOCAStepper();
67
68 if (success)
69 std::cout << "\nAll tests passed" << std::endl;
70
71 }
72 TEUCHOS_STANDARD_CATCH_STATEMENTS(verbose, std::cerr, success);
73
74 return ( success ? EXIT_SUCCESS : EXIT_FAILURE );
75 }