Debian Codegraph @

packages/muelu/test/maxwell/Maxwell3D.cpp

raw
1 // @HEADER
2 // *****************************************************************************
3 // MueLu: A package for multigrid based preconditioning
4 //
5 // Copyright 2012 NTESS and the MueLu contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 #include <iostream>
11 #include <map>
12
13 // Teuchos
14 #include <Teuchos_StandardCatchMacros.hpp>
15 #include <Teuchos_XMLParameterListHelpers.hpp>
16 #include <Teuchos_StackedTimer.hpp>
17
18 // Xpetra
19 #include <Xpetra_Map.hpp>
20 #include <Xpetra_MapFactory.hpp>
21 #include <Xpetra_MultiVector.hpp>
22 #include <Xpetra_Vector.hpp>
23 #include <Xpetra_MultiVectorFactory.hpp>
24 #include <Xpetra_CrsMatrix.hpp>
25 #include <Xpetra_CrsMatrixFactory.hpp>
26 #include <Xpetra_Parameters.hpp>
27 #include <Xpetra_IO.hpp>
28
29 // MueLu
30 #include <MueLu_RefMaxwell.hpp>
31 #include <MueLu_Maxwell1.hpp>
32 #include <MueLu_Maxwell_Utils.hpp>
33 #include <MueLu_TestHelpers_Common.hpp>
34 #include <MueLu_Exceptions.hpp>
35
36 using Teuchos::RCP;
37 using Teuchos::rcp;
38 using Teuchos::TimeMonitor;
39
40 #include <MueLu_TpetraOperator.hpp>
41
42 // Belos
43 #ifdef HAVE_MUELU_BELOS
44 #include <BelosConfigDefs.hpp>
45 #include <BelosLinearProblem.hpp>
46 #include <BelosSolverFactory.hpp>
47 #include <BelosTpetraAdapter.hpp>
48 #endif
49 #include <BelosXpetraAdapter.hpp> // => This header defines Belos::XpetraOp
50
51 // Stratimikos
52 #if defined(HAVE_MUELU_STRATIMIKOS) && defined(HAVE_MUELU_THYRA)
53 // Thyra includes
54 #include <Thyra_LinearOpWithSolveBase.hpp>
55 #include <Thyra_VectorBase.hpp>
56 #include <Thyra_SolveSupportTypes.hpp>
57 // Stratimikos includes
58 #include <Stratimikos_LinearSolverBuilder.hpp>
59 #include <Stratimikos_MueLuHelpers.hpp>
60 #endif
61
62 // Support for ML interface
63 #if defined(HAVE_MUELU_ML) and defined(HAVE_MUELU_EPETRA)
64 #include <Xpetra_EpetraOperator.hpp>
65 #include "ml_MultiLevelPreconditioner.h"
66 #include "ml_MultiLevelOperator.h"
67 #include "ml_RefMaxwell.h"
68 #endif
69
70 // Helper functions for compilation purposes
71 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
72 struct EpetraSolvers_Wrapper {
73 static void Generate_ML_MaxwellPreconditioner(Teuchos::RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& SM,
74 Teuchos::RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& D0,
75 Teuchos::RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& Kn,
76 Teuchos::RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& nullspace,
77 Teuchos::RCP<Xpetra::MultiVector<typename Teuchos::ScalarTraits<Scalar>::coordinateType, LocalOrdinal, GlobalOrdinal, Node> >& coords,
78 Teuchos::ParameterList& mueluList,
79 Teuchos::RCP<Xpetra::Operator<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& mlopX) {
80 throw std::runtime_error("Template parameter mismatch");
81 }
82
83 static void Generate_ML_RefMaxwellPreconditioner(Teuchos::RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& SM,
84 Teuchos::RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& D0,
85 Teuchos::RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& Ms,
86 Teuchos::RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& M0inv,
87 Teuchos::RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& M1,
88 Teuchos::RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& nullspace,
89 Teuchos::RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& node_material,
90 Teuchos::RCP<Xpetra::MultiVector<typename Teuchos::ScalarTraits<Scalar>::coordinateType, LocalOrdinal, GlobalOrdinal, Node> >& coords,
91 Teuchos::ParameterList& mueluList,
92 Teuchos::RCP<Xpetra::Operator<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& mlopX) {
93 throw std::runtime_error("Template parameter mismatch");
94 }
95 };
96
97 #if defined(HAVE_MUELU_EPETRA)
98 template <class GlobalOrdinal>
99 struct EpetraSolvers_Wrapper<double, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> {
100 static void Generate_ML_MaxwellPreconditioner(Teuchos::RCP<Xpetra::Matrix<double, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& SM,
101 Teuchos::RCP<Xpetra::Matrix<double, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& D0,
102 Teuchos::RCP<Xpetra::Matrix<double, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& Kn,
103 Teuchos::RCP<Xpetra::MultiVector<double, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& nullspace,
104 Teuchos::RCP<Xpetra::MultiVector<typename Teuchos::ScalarTraits<double>::coordinateType, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& coords,
105 Teuchos::ParameterList& mueluList,
106 Teuchos::RCP<Xpetra::Operator<double, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& mlopX) {
107 #if defined(HAVE_MUELU_ML)
108 typedef double SC;
109 typedef int LO;
110 typedef GlobalOrdinal GO;
111 typedef Tpetra::KokkosCompat::KokkosSerialWrapperNode NO;
112 typedef typename Teuchos::ScalarTraits<SC>::coordinateType coordinate_type;
113 typedef typename Xpetra::Matrix<SC, LO, GO, NO> Matrix;
114
115 RCP<const Epetra_CrsMatrix> epetraSM = Xpetra::Helpers<SC, LO, GO, NO>::Op2EpetraCrs(SM);
116 RCP<const Epetra_CrsMatrix> epetraD0 = Xpetra::Helpers<SC, LO, GO, NO>::Op2EpetraCrs(D0);
117 if (!coords.is_null()) {
118 RCP<const Epetra_MultiVector> epetraCoord = MueLu::Utilities<coordinate_type, LO, GO, NO>::MV2EpetraMV(coords);
119 if (epetraCoord->NumVectors() > 0) mueluList.set("x-coordinates", (*epetraCoord)[0]);
120 if (epetraCoord->NumVectors() > 1) mueluList.set("y-coordinates", (*epetraCoord)[1]);
121 if (epetraCoord->NumVectors() > 2) mueluList.set("z-coordinates", (*epetraCoord)[2]);
122 }
123 if (!nullspace.is_null()) {
124 RCP<const Epetra_MultiVector> epetraNullspace = MueLu::Utilities<SC, LO, GO, NO>::MV2EpetraMV(nullspace);
125 mueluList.set("null space: dimension", epetraNullspace->NumVectors());
126 mueluList.set("null space: vectors", (*epetraNullspace)[0]);
127 mueluList.set("null space: type", "pre-computed");
128 }
129 RCP<const Epetra_CrsMatrix> epetraKn;
130 if (Kn.is_null()) {
131 RCP<Matrix> temp = Xpetra::MatrixFactory<SC, LO, GO, NO>::Build(SM->getRangeMap());
132 Xpetra::MatrixMatrix<SC, LO, GO, NO>::Multiply(*SM, false, *D0, false, *temp, true, true);
133 RCP<Matrix> Kn2 = Xpetra::MatrixFactory<SC, LO, GO, NO>::Build(D0->getDomainMap());
134 Xpetra::MatrixMatrix<SC, LO, GO, NO>::Multiply(*D0, true, *temp, false, *Kn2, true, true);
135 epetraKn = Xpetra::Helpers<SC, LO, GO, NO>::Op2EpetraCrs(Kn2);
136 } else
137 epetraKn = Xpetra::Helpers<SC, LO, GO, NO>::Op2EpetraCrs(Kn);
138
139 RCP<Epetra_Operator> mlop = rcp<Epetra_Operator>(new ML_Epetra::MultiLevelPreconditioner(*epetraSM, *epetraD0, *epetraKn, mueluList, true));
140 #if defined(HAVE_MUELU_BELOS)
141 // NOTE: Belos needs the Apply() and AppleInverse() routines of ML swapped. So...
142 mlop = rcp<Belos::EpetraPrecOp>(new Belos::EpetraPrecOp(mlop));
143 #endif
144
145 mlopX = rcp(new Xpetra::EpetraOperator<GO, NO>(mlop));
146 #else
147 TEUCHOS_TEST_FOR_EXCEPTION(true, std::runtime_error,
148 "Need ML & Epetra support");
149 #endif
150 }
151
152 static void Generate_ML_RefMaxwellPreconditioner(Teuchos::RCP<Xpetra::Matrix<double, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& SM,
153 Teuchos::RCP<Xpetra::Matrix<double, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& D0,
154 Teuchos::RCP<Xpetra::Matrix<double, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& Ms,
155 Teuchos::RCP<Xpetra::Matrix<double, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& M0inv,
156 Teuchos::RCP<Xpetra::Matrix<double, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& M1,
157 Teuchos::RCP<Xpetra::MultiVector<double, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& nullspace,
158 Teuchos::RCP<Xpetra::MultiVector<double, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& node_material,
159 Teuchos::RCP<Xpetra::MultiVector<typename Teuchos::ScalarTraits<double>::coordinateType, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& coords,
160 Teuchos::ParameterList& mueluList,
161 Teuchos::RCP<Xpetra::Operator<double, int, GlobalOrdinal, Tpetra::KokkosCompat::KokkosSerialWrapperNode> >& mlopX) {
162 #if defined(HAVE_MUELU_ML)
163 typedef double SC;
164 typedef int LO;
165 typedef GlobalOrdinal GO;
166 typedef Tpetra::KokkosCompat::KokkosSerialWrapperNode NO;
167 typedef typename Teuchos::ScalarTraits<SC>::coordinateType coordinate_type;
168
169 RCP<const Epetra_CrsMatrix> epetraSM = Xpetra::Helpers<SC, LO, GO, NO>::Op2EpetraCrs(SM);
170 RCP<const Epetra_CrsMatrix> epetraD0 = Xpetra::Helpers<SC, LO, GO, NO>::Op2EpetraCrs(D0);
171 RCP<const Epetra_CrsMatrix> epetraM0inv = Xpetra::Helpers<SC, LO, GO, NO>::Op2EpetraCrs(M0inv);
172 RCP<const Epetra_CrsMatrix> epetraMs;
173 RCP<const Epetra_CrsMatrix> epetraM1 = Xpetra::Helpers<SC, LO, GO, NO>::Op2EpetraCrs(M1);
174 if (!Ms.is_null())
175 epetraMs = Xpetra::Helpers<SC, LO, GO, NO>::Op2EpetraCrs(Ms);
176 else
177 epetraMs = epetraM1;
178 mueluList.set("D0", epetraD0);
179 mueluList.set("Ms", epetraMs);
180 mueluList.set("M0inv", epetraM0inv);
181 mueluList.set("M1", epetraM1);
182 if (!coords.is_null()) {
183 RCP<const Epetra_MultiVector> epetraCoord = MueLu::Utilities<coordinate_type, LO, GO, NO>::MV2EpetraMV(coords);
184 if (epetraCoord->NumVectors() > 0) mueluList.sublist("refmaxwell: 11list").set("x-coordinates", (*epetraCoord)[0]);
185 if (epetraCoord->NumVectors() > 1) mueluList.sublist("refmaxwell: 11list").set("y-coordinates", (*epetraCoord)[1]);
186 if (epetraCoord->NumVectors() > 2) mueluList.sublist("refmaxwell: 11list").set("z-coordinates", (*epetraCoord)[2]);
187 }
188 if (!node_material.is_null()) {
189 RCP<const Epetra_MultiVector> epetraMaterial = MueLu::Utilities<coordinate_type, LO, GO, NO>::MV2EpetraMV(node_material);
190 mueluList.sublist("refmaxwell: 11list").set("material coordinates", (*epetraMaterial)[0]);
191 }
192 if (!nullspace.is_null()) {
193 RCP<const Epetra_MultiVector> epetraNullspace = MueLu::Utilities<SC, LO, GO, NO>::MV2EpetraMV(nullspace);
194 mueluList.sublist("refmaxwell: 11list").set("null space: dimension", epetraNullspace->NumVectors());
195 mueluList.sublist("refmaxwell: 11list").set("null space: vectors", (*epetraNullspace)[0]);
196 mueluList.sublist("refmaxwell: 11list").set("null space: type", "pre-computed");
197 }
198
199 RCP<Epetra_Operator> mlop = rcp<Epetra_Operator>(new ML_Epetra::RefMaxwellPreconditioner(*epetraSM, mueluList, true));
200 #if defined(HAVE_MUELU_BELOS)
201 // NOTE: Belos needs the Apply() and AppleInverse() routines of ML swapped. So...
202 mlop = rcp<Belos::EpetraPrecOp>(new Belos::EpetraPrecOp(mlop));
203 #endif
204
205 mlopX = rcp(new Xpetra::EpetraOperator<GO, NO>(mlop));
206 #else
207 TEUCHOS_TEST_FOR_EXCEPTION(true, std::runtime_error,
208 "Need ML & Epetra support");
209 #endif
210 }
211 };
212 #endif // HAVE_MUELU_EPETRA
213
214 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
215 bool SetupSolve(std::map<std::string, void*> inputs) {
216 #include <MueLu_UseShortNames.hpp>
217
218 typedef Xpetra::MultiVector<typename Teuchos::ScalarTraits<Scalar>::magnitudeType, LO, GO, NO> coordMV;
219
220 RCP<Matrix> SM_Matrix = *static_cast<RCP<Matrix>*>(inputs["SM"]);
221 RCP<Matrix> GmhdA_Matrix = *static_cast<RCP<Matrix>*>(inputs["GmhdA"]);
222 RCP<Matrix> D0_Matrix = *static_cast<RCP<Matrix>*>(inputs["D0"]);
223 RCP<Matrix> M1_Matrix = *static_cast<RCP<Matrix>*>(inputs["M1"]);
224 RCP<Matrix> Ms_Matrix = *static_cast<RCP<Matrix>*>(inputs["Ms"]);
225 RCP<Matrix> M0inv_Matrix = *static_cast<RCP<Matrix>*>(inputs["M0inv"]);
226 RCP<Matrix> Kn_Matrix = *static_cast<RCP<Matrix>*>(inputs["Kn"]);
227
228 RCP<coordMV> coords = *static_cast<RCP<coordMV>*>(inputs["coordinates"]);
229 RCP<MultiVector> nullspace = *static_cast<RCP<MultiVector>*>(inputs["nullspace"]);
230 RCP<MultiVector> material = *static_cast<RCP<MultiVector>*>(inputs["material"]);
231
232 RCP<MultiVector> B = *static_cast<RCP<MultiVector>*>(inputs["B"]);
233 RCP<MultiVector> X = *static_cast<RCP<MultiVector>*>(inputs["X"]);
234 RCP<MultiVector> X0 = *static_cast<RCP<MultiVector>*>(inputs["X0"]);
235
236 Teuchos::ParameterList params = *static_cast<Teuchos::ParameterList*>(inputs["params"]);
237 Teuchos::ParameterList belosParams = *static_cast<Teuchos::ParameterList*>(inputs["belosParams"]);
238 Teuchos::ParameterList stratimikosParams = *static_cast<Teuchos::ParameterList*>(inputs["stratimikosParams"]);
239 std::string solverName = *static_cast<std::string*>(inputs["solverName"]);
240 std::string belosSolverType = *static_cast<std::string*>(inputs["belosSolverType"]);
241 std::string precType = *static_cast<std::string*>(inputs["precType"]);
242 int numResolves = *static_cast<int*>(inputs["numResolves"]);
243 bool reuse = *static_cast<bool*>(inputs["reuse"]);
244
245 RCP<const Teuchos::Comm<int> > comm = *static_cast<RCP<const Teuchos::Comm<int> >*>(inputs["comm"]);
246 RCP<Teuchos::FancyOStream> out = *static_cast<RCP<Teuchos::FancyOStream>*>(inputs["out"]);
247
248 bool success = false;
249
250 auto tm2 = TimeMonitor::getNewTimer("Maxwell: 2 - Build solver and preconditioner");
251 #ifdef HAVE_MUELU_BELOS
252 if (solverName == "Belos") {
253 // construct preconditioner
254 RCP<Operator> preconditioner;
255 if (precType == "MueLu-RefMaxwell") {
256 preconditioner = rcp(new MueLu::RefMaxwell<SC, LO, GO, NO>(SM_Matrix, D0_Matrix, Ms_Matrix, M0inv_Matrix,
257 M1_Matrix, nullspace, coords, material, params));
258 } else if (precType == "MueLu-Maxwell1" || precType == "MueLu-Reitzinger") {
259 if (GmhdA_Matrix.is_null()) // are we doing MHD as opposed to GMHD?
260 preconditioner = rcp(new MueLu::Maxwell1<SC, LO, GO, NO>(SM_Matrix, D0_Matrix, Kn_Matrix, nullspace, coords, material, params));
261 else
262 preconditioner = rcp(new MueLu::Maxwell1<SC, LO, GO, NO>(SM_Matrix, D0_Matrix, Kn_Matrix, nullspace, coords, params, GmhdA_Matrix));
263
264 }
265 #ifdef HAVE_MUELU_EPETRA
266 else if (precType == "ML-RefMaxwell") {
267 Xpetra::UnderlyingLib lib = *static_cast<Xpetra::UnderlyingLib*>(inputs["lib"]);
268 TEUCHOS_ASSERT(lib == Xpetra::UseEpetra);
269 EpetraSolvers_Wrapper<SC, LO, GO, NO>::Generate_ML_RefMaxwellPreconditioner(SM_Matrix, D0_Matrix, Ms_Matrix, M0inv_Matrix,
270 M1_Matrix, nullspace, material, coords, params, preconditioner);
271 } else if (precType == "ML-Maxwell") {
272 Xpetra::UnderlyingLib lib = *static_cast<Xpetra::UnderlyingLib*>(inputs["lib"]);
273 TEUCHOS_ASSERT(lib == Xpetra::UseEpetra);
274 EpetraSolvers_Wrapper<SC, LO, GO, NO>::Generate_ML_MaxwellPreconditioner(SM_Matrix, D0_Matrix, Kn_Matrix,
275 nullspace, coords, params, preconditioner);
276 }
277 #endif
278
279 {
280 // A test to make sure we can wrap this guy as a MueLu::TpetraOperator
281 RCP<Operator> precOp = Teuchos::rcp_dynamic_cast<Operator>(preconditioner);
282 MueLu::TpetraOperator<SC, LO, GO, NO> OpT(precOp);
283 }
284
285 // Belos linear problem
286 typedef MultiVector MV;
287 typedef Belos::OperatorT<MV> OP;
288 RCP<OP> belosOp;
289 if (GmhdA_Matrix.is_null()) // are we doing MHD as opposed to GMHD?
290 belosOp = Teuchos::rcp(new Belos::XpetraOp<SC, LO, GO, NO>(SM_Matrix)); // Turns a Xpetra::Matrix object into a Belos operator
291 else
292 belosOp = Teuchos::rcp(new Belos::XpetraOp<SC, LO, GO, NO>(GmhdA_Matrix)); // Turns a Xpetra::Matrix object into a Belos operator
293
294 RCP<Belos::LinearProblem<SC, MV, OP> > problem = rcp(new Belos::LinearProblem<SC, MV, OP>());
295 problem->setOperator(belosOp);
296 RCP<OP> belosPrecOp;
297 if (precType != "none") {
298 belosPrecOp = Teuchos::rcp(new Belos::XpetraOp<SC, LO, GO, NO>(preconditioner)); // Turns a Xpetra::Matrix object into a Belos operator
299 problem->setRightPrec(belosPrecOp);
300 }
301 problem->setProblem(X, B);
302
303 bool set = problem->setProblem();
304 if (set == false) {
305 *out << "\nERROR: Belos::LinearProblem failed to set up correctly!" << std::endl;
306 return false;
307 }
308
309 // Belos solver
310 RCP<Belos::SolverManager<SC, MV, OP> > solver;
311 RCP<Belos::SolverFactory<SC, MV, OP> > factory = rcp(new Belos::SolverFactory<SC, MV, OP>());
312 solver = factory->create(belosSolverType, Teuchos::rcpFromRef(belosParams.sublist(belosSolverType)));
313
314 comm->barrier();
315 tm2 = Teuchos::null;
316
317 auto tm3 = TimeMonitor::getNewTimer("Maxwell: 3 - Solve");
318
319 // set problem and solve
320 solver->setProblem(problem);
321 for (int solveno = 0; solveno <= numResolves; solveno++) {
322 if (X0.is_null())
323 X->putScalar(Teuchos::ScalarTraits<Scalar>::zero());
324 else
325 X = X0;
326 Belos::ReturnType status = solver->solve();
327 int iters = solver->getNumIters();
328 success = (iters < 50 && status == Belos::Converged);
329 if (status == Belos::Converged)
330 *out << "Belos converged in " << iters << " iterations." << std::endl;
331 if (success)
332 *out << "SUCCESS!" << std::endl;
333 else
334 *out << "FAILURE! Belos did not converge fast enough." << std::endl;
335 }
336
337 if (reuse) {
338 TEUCHOS_ASSERT(precType == "MueLu-RefMaxwell");
339 for (int solveno = 0; solveno < 2; solveno++) {
340 // SM_Matrix->resumeFill();
341 // SM_Matrix->fillComplete();
342 if (X0.is_null())
343 X->putScalar(Teuchos::ScalarTraits<Scalar>::zero());
344 else
345 X = X0;
346 problem->setProblem(X, B);
347 if (GmhdA_Matrix.is_null()) // are we doing MHD as opposed to GMHD?
348 Teuchos::rcp_dynamic_cast<MueLu::RefMaxwell<SC, LO, GO, NO> >(preconditioner)->resetMatrix(SM_Matrix);
349 else
350 Teuchos::rcp_dynamic_cast<MueLu::RefMaxwell<SC, LO, GO, NO> >(preconditioner)->resetMatrix(GmhdA_Matrix);
351 Belos::ReturnType status = solver->solve();
352 int iters = solver->getNumIters();
353 success = (iters < 50 && status == Belos::Converged);
354 if (status == Belos::Converged)
355 *out << "Belos converged in " << iters << " iterations." << std::endl;
356 if (success)
357 *out << "SUCCESS!" << std::endl;
358 else
359 *out << "FAILURE! Belos did not converge fast enough." << std::endl;
360 }
361 }
362 }
363 #endif // HAVE_MUELU_BELOS
364 #if defined(HAVE_MUELU_STRATIMIKOS) && defined(HAVE_MUELU_THYRA)
365 if (solverName == "Stratimikos") {
366 using Teuchos::ParameterList;
367 using Teuchos::rcp_dynamic_cast;
368
369 // Add matrices to parameterlist
370 Teuchos::ParameterList& precTypesPL = stratimikosParams.sublist("Preconditioner Types");
371 std::list<Teuchos::ParameterList*> sublists;
372 sublists.push_back(&precTypesPL);
373 while (sublists.size() > 0) {
374 Teuchos::ParameterList* sublist = sublists.front();
375 sublists.pop_front();
376 std::list<std::string> keys;
377 for (Teuchos::ParameterList::ConstIterator it = sublist->begin(); it != sublist->end(); ++it) {
378 const std::string& entryName = sublist->name(it);
379 const Teuchos::ParameterEntry& theEntry = sublist->entry(it);
380 if (theEntry.isList()) {
381 Teuchos::ParameterList& sl = sublist->sublist(entryName);
382 sublists.push_back(&sl);
383 } else if (theEntry.isType<std::string>() && Teuchos::getValue<std::string>(theEntry).find("substitute ") != std::string::npos) {
384 keys.push_back(entryName);
385 }
386 }
387 for (auto key_it = keys.begin(); key_it != keys.end(); ++key_it) {
388 std::string value = sublist->get<std::string>(*key_it).substr(11, std::string::npos);
389 if (value == "D0")
390 sublist->set(*key_it, D0_Matrix);
391 else if (value == "M0inv")
392 sublist->set(*key_it, M0inv_Matrix);
393 else if (value == "M1")
394 sublist->set(*key_it, M1_Matrix);
395 else if (value == "Ms")
396 sublist->set(*key_it, Ms_Matrix);
397 else if (value == "Kn")
398 sublist->set(*key_it, Kn_Matrix);
399 else if (value == "Coordinates")
400 sublist->set(*key_it, coords);
401 // else if (*key_it == "Nullspace")
402 // sublist->set(*key_it, Nullspace);
403 #ifdef HAVE_MUELU_EPETRA
404 else if (value == "eD0") {
405 auto eD0 = Teuchos::rcp_dynamic_cast<EpetraCrsMatrix>(Teuchos::rcp_dynamic_cast<CrsMatrixWrap>(D0_Matrix, true)->getCrsMatrix(), true)->getEpetra_CrsMatrix();
406 sublist->set(*key_it, eD0);
407 } else if (value == "eCoordinates")
408 sublist->set(*key_it, Teuchos::rcp_dynamic_cast<Xpetra::EpetraMultiVectorT<GlobalOrdinal, Node> >(coords, true)->getEpetra_MultiVector());
409 #endif
410 else if (value == "tD0") {
411 auto tD0 = toTpetra(D0_Matrix);
412 sublist->set(*key_it, tD0);
413 } else if (value == "tCoordinates") {
414 sublist->set(*key_it, toTpetra(coords));
415 }
416 }
417 }
418
419 // Build Thyra linear algebra objects
420 RCP<const Thyra::LinearOpBase<Scalar> > thyraA;
421 if (GmhdA_Matrix.is_null()) // are we doing MHD as opposed to GMHD?
422 thyraA = Xpetra::ThyraUtils<Scalar, LocalOrdinal, GlobalOrdinal, Node>::toThyra(Teuchos::rcp_dynamic_cast<CrsMatrixWrap>(SM_Matrix)->getCrsMatrix());
423 else
424 thyraA = Xpetra::ThyraUtils<Scalar, LocalOrdinal, GlobalOrdinal, Node>::toThyra(Teuchos::rcp_dynamic_cast<CrsMatrixWrap>(GmhdA_Matrix)->getCrsMatrix());
425 RCP<Thyra::VectorBase<Scalar> > thyraX = Teuchos::rcp_const_cast<Thyra::VectorBase<Scalar> >(Xpetra::ThyraUtils<Scalar, LocalOrdinal, GlobalOrdinal, Node>::toThyraVector(X->getVectorNonConst(0)));
426 // TODO: Why do we loose a reference when running this with Epetra?
427 RCP<const Thyra::VectorBase<Scalar> > thyraB = Xpetra::ThyraUtils<Scalar, LocalOrdinal, GlobalOrdinal, Node>::toThyraVector(B->getVector(0));
428
429 // Build Stratimikos solver
430 Stratimikos::LinearSolverBuilder<Scalar> linearSolverBuilder; // This is the Stratimikos main class (= factory of solver factory).
431 Stratimikos::enableMueLuRefMaxwell<Scalar, LocalOrdinal, GlobalOrdinal, Node>(linearSolverBuilder); // Register MueLu as a Stratimikos preconditioner strategy.
432 Stratimikos::enableMueLuMaxwell1<Scalar, LocalOrdinal, GlobalOrdinal, Node>(linearSolverBuilder);
433 linearSolverBuilder.setParameterList(rcp(&stratimikosParams, false)); // Setup solver parameters using a Stratimikos parameter list.
434
435 // Build a new "solver factory" according to the previously specified parameter list.
436 RCP<Thyra::LinearOpWithSolveFactoryBase<Scalar> > solverFactory = Thyra::createLinearSolveStrategy(linearSolverBuilder);
437 auto precFactory = solverFactory->getPreconditionerFactory();
438 auto prec = precFactory->createPrec();
439
440 // Build a Thyra operator corresponding to A^{-1} computed using the Stratimikos solver.
441 Thyra::initializePrec<Scalar>(*precFactory, thyraA, prec.ptr());
442 Teuchos::RCP<Thyra::LinearOpWithSolveBase<Scalar> > thyraInverseA = solverFactory->createOp();
443 Thyra::initializePreconditionedOp<Scalar>(*solverFactory, thyraA, prec, thyraInverseA.ptr());
444
445 comm->barrier();
446 tm2 = Teuchos::null;
447
448 auto tm5 = TimeMonitor::getNewTimer("Maxwell: 3 - Solve");
449
450 // Solve Ax = b.
451 Thyra::SolveStatus<Scalar> status = Thyra::solve<Scalar>(*thyraInverseA, Thyra::NOTRANS, *thyraB, thyraX.ptr());
452 comm->barrier();
453 tm5 = Teuchos::null;
454
455 std::cout << status << std::endl;
456
457 success = (status.solveStatus == Thyra::SOLVE_STATUS_CONVERGED);
458
459 if (reuse) {
460 for (int solveno = 0; solveno < 2; solveno++) {
461 auto tm6 = TimeMonitor::getNewTimer("Maxwell: 4 - Setup Re");
462 Thyra::initializePrec<Scalar>(*precFactory, thyraA, prec.ptr());
463 comm->barrier();
464 tm6 = Teuchos::null;
465
466 auto tm7 = TimeMonitor::getNewTimer("Maxwell: 5 - Solve Re");
467 status = Thyra::solve<Scalar>(*thyraInverseA, Thyra::NOTRANS, *thyraB, thyraX.ptr());
468 comm->barrier();
469 tm7 = Teuchos::null;
470 }
471 }
472
473 } // HAVE_MUELU_STRATIMIKOS && HAVE_MUELU_THYRA
474 #endif
475 comm->barrier();
476
477 return success;
478 } // SetupSolve
479
480 template <typename Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
481 int main_(Teuchos::CommandLineProcessor& clp, Xpetra::UnderlyingLib lib, int argc, char* argv[]) {
482 #include <MueLu_UseShortNames.hpp>
483
484 RCP<const Teuchos::Comm<int> > comm = Teuchos::DefaultComm<int>::getComm();
485 RCP<Teuchos::FancyOStream> out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout));
486 out->setOutputToRootOnly(0);
487
488 bool printTimings = true;
489 clp.setOption("timings", "notimings", &printTimings, "print timings to screen");
490 std::string timingsFormat = "table-fixed";
491 clp.setOption("time-format", &timingsFormat, "timings format (table-fixed | table-scientific | yaml)");
492 double scaling = 1.0;
493 clp.setOption("scaling", &scaling, "scale mass term");
494 std::string solverName = "Belos";
495 clp.setOption("solverName", &solverName,
496 "Name of iterative linear solver "
497 "to use for solving the linear system. "
498 "(\"Belos\" or \"Stratimikos\")");
499 std::string belosSolverType = "Block CG";
500 clp.setOption("belosSolverType", &belosSolverType, "Name of the Belos linear solver");
501 std::string precType = "MueLu-RefMaxwell";
502 clp.setOption("precType", &precType, "preconditioner to use (MueLu-RefMaxwell|MueLu-Maxwell1|ML-RefMaxwell|none)");
503 std::string xml = "";
504 clp.setOption("xml", &xml, "xml file with solver parameters (default: \"Maxwell.xml\")");
505 std::string belos_xml = "Belos.xml";
506 clp.setOption("belos_xml", &belos_xml, "xml file with Belos solver parameters (default: \"Belos.xml\")");
507 std::string stratimikos_xml = "Stratimikos.xml";
508 clp.setOption("stratimikos_xml", &stratimikos_xml, "xml file with Stratimikos solver parameters (default: \"Stratimikos.xml\")");
509 int numResolves = 0;
510 clp.setOption("resolve", &numResolves, "#times to redo solve");
511 bool reuse = false;
512 clp.setOption("reuse", "no-reuse", &reuse, "test reuse");
513 double tol = 1e-10;
514 clp.setOption("tol", &tol, "solver convergence tolerance");
515 int maxIts = 200;
516 clp.setOption("its", &maxIts, "maximum number of solver iterations");
517 bool use_stacked_timer = false;
518 clp.setOption("stacked-timer",
519 "no-stacked-timer", &use_stacked_timer, "use stacked timer");
520 bool ensure_kn = false;
521 clp.setOption("ensure-kn",
522 "no-ensure-kn", &ensure_kn, "generate a kn matrix if the user doesn't provide one");
523
524 std::string S_file, D0_file, M1_file, M0_file;
525 if (!Teuchos::ScalarTraits<Scalar>::isComplex) {
526 S_file = "S.mat";
527 D0_file = "D0.mat";
528 M1_file = "M1.mat";
529 M0_file = "M0.mat";
530 } else {
531 S_file = "S_complex.mat";
532 D0_file = "D0_complex.mat";
533 M1_file = "M1_complex.mat";
534 M0_file = "M0_complex.mat";
535 }
536 clp.setOption("S", &S_file);
537 std::string SM_file = "";
538 clp.setOption("SM", &SM_file);
539 std::string Kn_file = "";
540 clp.setOption("Kn", &Kn_file);
541 clp.setOption("D0", &D0_file);
542 clp.setOption("M1", &M1_file);
543 std::string Ms_file = "";
544 clp.setOption("Ms", &Ms_file);
545 clp.setOption("M0", &M0_file);
546 std::string M0inv_file = "";
547 clp.setOption("M0inv", &M0inv_file);
548
549 std::string coords_file = "coords.mat";
550 clp.setOption("coords", &coords_file);
551 std::string nullspace_file = "";
552 clp.setOption("nullspace", &nullspace_file);
553 std::string material_file = "";
554 clp.setOption("material", &material_file);
555
556 std::string rhs_file = "";
557 clp.setOption("rhs", &rhs_file);
558 std::string x0_file = "";
559 clp.setOption("x0", &x0_file);
560 std::string GmhdA_file = "";
561 clp.setOption("GmhdA", &GmhdA_file);
562
563 clp.recogniseAllOptions(true);
564 switch (clp.parse(argc, argv)) {
565 case Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED: return EXIT_SUCCESS;
566 case Teuchos::CommandLineProcessor::PARSE_ERROR:
567 case Teuchos::CommandLineProcessor::PARSE_UNRECOGNIZED_OPTION: return EXIT_FAILURE;
568 case Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL: break;
569 }
570
571 if (precType == "MueLu-Reitzinger" || precType == "MueLu-Maxwell1" || precType == "ML-Maxwell") {
572 if (SM_file != "")
573 M1_file = "";
574 M0_file = "";
575 }
576
577 if (xml == "") {
578 if (precType == "MueLu-RefMaxwell")
579 xml = "Maxwell.xml";
580 else if (precType == "MueLu-Reitzinger" || precType == "MueLu-Maxwell1")
581 xml = "Maxwell_Reitzinger.xml";
582 else if (precType == "ML-RefMaxwell")
583 xml = "Maxwell_ML.xml";
584 else if (precType == "ML-Maxwell")
585 xml = "Maxwell_ML1.xml";
586 else if (precType == "Hypre")
587
588 xml = "Hypre.xml";
589 }
590
591 RCP<Teuchos::StackedTimer> stacked_timer;
592 if (use_stacked_timer)
593 stacked_timer = rcp(new Teuchos::StackedTimer("Maxwell Driver"));
594 TimeMonitor::setStackedTimer(stacked_timer);
595
596 auto globalTimeMonitor = TimeMonitor::getNewTimer("Maxwell: S - Global Time");
597 auto tm = TimeMonitor::getNewTimer("Maxwell: 1 - Read and Build Matrices");
598
599 // Read matrices in from files
600 RCP<Matrix> D0_Matrix, SM_Matrix, M1_Matrix, Ms_Matrix, M0inv_Matrix, Kn_Matrix, GmhdA_Matrix;
601
602 // maps for nodal and edge matrices
603 RCP<const Map> node_map;
604 RCP<const Map> edge_map;
605 RCP<const Map> Gmhd_map;
606 RCP<const Map> edgeOrGmhdMap;
607
608 // gradient matrix
609 try {
610 std::string base = D0_file.substr(0, D0_file.find_last_of('/') + 1);
611 std::string D0_filename = D0_file.substr(D0_file.find_last_of('/') + 1, std::string::npos);
612 std::string edgeMap_file = base + "rowmap_" + D0_filename;
613 std::string nodeMap_file = base + "domainmap_" + D0_filename;
614 std::string colMap_file = base + "colmap_" + D0_filename;
615 node_map = Xpetra::IO<SC, LO, GO, NO>::ReadMap(nodeMap_file, lib, comm);
616 edge_map = Xpetra::IO<SC, LO, GO, NO>::ReadMap(edgeMap_file, lib, comm);
617 RCP<const Map> colMap;
618 if (comm->getSize() > 1)
619 colMap = Xpetra::IO<SC, LO, GO, NO>::ReadMap(colMap_file, lib, comm);
620 D0_Matrix = Xpetra::IO<SC, LO, GO, NO>::Read(D0_file, edge_map, colMap, node_map, edge_map);
621 } catch (const std::exception&) {
622 // *out << "Skipping D0 maps, because: " << e.what() << std::endl;
623 D0_Matrix = Xpetra::IO<SC, LO, GO, NO>::Read(D0_file, lib, comm);
624 node_map = D0_Matrix->getDomainMap();
625 edge_map = D0_Matrix->getRangeMap();
626 }
627
628 // build stiffness plus mass matrix (SM_Matrix)
629 if (SM_file == "") {
630 // edge stiffness matrix
631 RCP<Matrix> S_Matrix = Xpetra::IO<SC, LO, GO, NO>::Read(S_file, edge_map);
632 M1_Matrix = Xpetra::IO<SC, LO, GO, NO>::Read(M1_file, edge_map);
633 Xpetra::MatrixMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::TwoMatrixAdd(*S_Matrix, false, (SC)1.0, *M1_Matrix, false, scaling, SM_Matrix, *out);
634 SM_Matrix->fillComplete();
635 } else {
636 SM_Matrix = Xpetra::IO<SC, LO, GO, NO>::Read(SM_file, edge_map);
637 if (M1_file != "")
638 M1_Matrix = Xpetra::IO<SC, LO, GO, NO>::Read(M1_file, edge_map);
639 }
640 if (GmhdA_file != "") {
641 Teuchos::ArrayView<const GO> edgeMapEleList = edge_map->getLocalElementList();
642 Teuchos::Array<GO> elementList(edgeMapEleList.size() * 2);
643 for (int i = 0; i < edgeMapEleList.size(); i++) {
644 elementList[2 * i] = 2 * edgeMapEleList[i];
645 elementList[2 * i + 1] = 2 * edgeMapEleList[i] + 1;
646 }
647 edgeOrGmhdMap = MapFactory::Build(edge_map->lib(), edge_map->getGlobalNumElements() * 2, elementList, edge_map->getIndexBase(), edge_map->getComm());
648 GmhdA_Matrix = Xpetra::IO<SC, LO, GO, NO>::Read(GmhdA_file, edgeOrGmhdMap);
649 } else
650 edgeOrGmhdMap = edge_map;
651
652 if (Ms_file != "")
653 Ms_Matrix = Xpetra::IO<SC, LO, GO, NO>::Read(Ms_file, edge_map);
654 else
655 Ms_Matrix = M1_Matrix;
656 if (Kn_file != "") {
657 *out << "User provided Kn matrix" << std::endl;
658 Kn_Matrix = Xpetra::IO<SC, LO, GO, NO>::Read(Kn_file, node_map);
659 } else if (ensure_kn) {
660 // The user requested we generate Kn_Matrix with an SpGEMM
661 Teuchos::ParameterList params;
662 *out << "Making Kn Matrix as requested by yser" << std::endl;
663 Kn_Matrix = MueLu::Maxwell_Utils<SC, LO, GO, NO>::PtAPWrapper(SM_Matrix, D0_Matrix, params, "User Kn");
664 } else {
665 *out << "NOT using a Kn matrix" << std::endl;
666 }
667
668 if ((M0inv_file == "") && (M0_file != "")) {
669 // nodal mass matrix
670 RCP<Matrix> M0_Matrix = Xpetra::IO<SC, LO, GO, NO>::Read(M0_file, node_map);
671 // build lumped mass matrix inverse (M0inv_Matrix)
672 RCP<Vector> diag = Utilities::GetLumpedMatrixDiagonal(*M0_Matrix);
673 RCP<CrsMatrixWrap> M0inv_MatrixWrap = rcp(new CrsMatrixWrap(node_map, node_map, 0));
674 RCP<CrsMatrix> M0inv_CrsMatrix = M0inv_MatrixWrap->getCrsMatrix();
675 Teuchos::ArrayRCP<size_t> rowPtr;
676 Teuchos::ArrayRCP<LO> colInd;
677 Teuchos::ArrayRCP<SC> values;
678 Teuchos::ArrayRCP<const SC> diags = diag->getData(0);
679 size_t nodeNumElements = node_map->getLocalNumElements();
680 M0inv_CrsMatrix->allocateAllValues(nodeNumElements, rowPtr, colInd, values);
681 SC ONE = Teuchos::ScalarTraits<Scalar>::one();
682 for (size_t i = 0; i < nodeNumElements; i++) {
683 rowPtr[i] = i;
684 colInd[i] = i;
685 values[i] = ONE / diags[i];
686 }
687 rowPtr[nodeNumElements] = nodeNumElements;
688 M0inv_CrsMatrix->setAllValues(rowPtr, colInd, values);
689 M0inv_CrsMatrix->expertStaticFillComplete(node_map, node_map);
690 M0inv_Matrix = Teuchos::rcp_dynamic_cast<Matrix>(M0inv_MatrixWrap);
691 } else if (M0inv_file != "") {
692 M0inv_Matrix = Xpetra::IO<SC, LO, GO, NO>::Read(M0inv_file, node_map);
693 }
694
695 // coordinates
696 RCP<Xpetra::MultiVector<typename Teuchos::ScalarTraits<Scalar>::magnitudeType, LO, GO, NO> > coords = Xpetra::IO<typename Teuchos::ScalarTraits<Scalar>::magnitudeType, LO, GO, NO>::ReadMultiVector(coords_file, node_map);
697
698 RCP<MultiVector> nullspace = Teuchos::null;
699 if (nullspace_file != "")
700 nullspace = Xpetra::IO<SC, LO, GO, NO>::ReadMultiVector(nullspace_file, edge_map);
701
702 RCP<MultiVector> material = Teuchos::null;
703 if (material_file != "") {
704 material = Xpetra::IO<SC, LO, GO, NO>::ReadMultiVector(material_file, node_map);
705 }
706
707 // set parameters
708 Teuchos::ParameterList params, belosParams, stratimikosParams;
709 Teuchos::updateParametersFromXmlFileAndBroadcast(xml, Teuchos::Ptr<Teuchos::ParameterList>(&params), *comm);
710 Teuchos::updateParametersFromXmlFileAndBroadcast(belos_xml, Teuchos::Ptr<Teuchos::ParameterList>(&belosParams), *comm);
711 Teuchos::updateParametersFromXmlFileAndBroadcast(stratimikos_xml, Teuchos::Ptr<Teuchos::ParameterList>(&stratimikosParams), *comm);
712 belosParams.sublist(belosSolverType).set("Maximum Iterations", maxIts);
713 belosParams.sublist(belosSolverType).set("Convergence Tolerance", tol);
714
715 // setup LHS, RHS
716 RCP<MultiVector> X, X0, B;
717 if (rhs_file == "") {
718 B = MultiVectorFactory::Build(edgeOrGmhdMap, 1);
719 RCP<MultiVector> vec = MultiVectorFactory::Build(edgeOrGmhdMap, 1);
720 vec->putScalar(Teuchos::ScalarTraits<Scalar>::one());
721 if (GmhdA_Matrix.is_null()) // are we doing MHD as opposed to GMHD?
722 SM_Matrix->apply(*vec, *B);
723 else
724 GmhdA_Matrix->apply(*vec, *B);
725 } else
726 B = Xpetra::IO<SC, LO, GO, NO>::ReadMultiVector(rhs_file, edgeOrGmhdMap);
727
728 X = MultiVectorFactory::Build(edgeOrGmhdMap, 1);
729 X->putScalar(Teuchos::ScalarTraits<Scalar>::zero());
730 if (x0_file != "")
731 X0 = Xpetra::IO<SC, LO, GO, NO>::ReadMultiVector(x0_file, edgeOrGmhdMap);
732
733 comm->barrier();
734 tm = Teuchos::null;
735
736 std::map<std::string, void*> inputs;
737 inputs["SM"] = &SM_Matrix;
738 inputs["GmhdA"] = &GmhdA_Matrix;
739 inputs["D0"] = &D0_Matrix;
740 inputs["M1"] = &M1_Matrix;
741 inputs["Ms"] = &Ms_Matrix;
742 inputs["M0inv"] = &M0inv_Matrix;
743 inputs["Kn"] = &Kn_Matrix;
744
745 inputs["coordinates"] = &coords;
746 inputs["nullspace"] = &nullspace;
747 inputs["material"] = &material;
748
749 inputs["B"] = &B;
750 inputs["X"] = &X;
751 inputs["X0"] = &X0;
752
753 inputs["params"] = &params;
754 inputs["solverName"] = &solverName;
755 inputs["belosSolverType"] = &belosSolverType;
756 inputs["precType"] = &precType;
757 inputs["belosParams"] = &belosParams;
758 inputs["stratimikosParams"] = &stratimikosParams;
759 inputs["numResolves"] = &numResolves;
760 inputs["reuse"] = &reuse;
761
762 inputs["lib"] = &lib;
763 inputs["comm"] = &comm;
764 inputs["out"] = &out;
765
766 bool success = SetupSolve<Scalar, LocalOrdinal, GlobalOrdinal, Node>(inputs);
767
768 globalTimeMonitor = Teuchos::null;
769
770 if (printTimings) {
771 if (use_stacked_timer) {
772 stacked_timer->stop("Maxwell Driver");
773 Teuchos::StackedTimer::OutputOptions options;
774 options.output_fraction = options.output_histogram = options.output_minmax = true;
775 stacked_timer->report(*out, comm, options);
776 } else {
777 RCP<Teuchos::ParameterList> reportParams = rcp(new Teuchos::ParameterList);
778 if (timingsFormat == "yaml") {
779 reportParams->set("Report format", "YAML"); // "Table" or "YAML"
780 reportParams->set("YAML style", "compact"); // "spacious" or "compact"
781 }
782 reportParams->set("How to merge timer sets", "Union");
783 reportParams->set("alwaysWriteLocal", false);
784 reportParams->set("writeGlobalStats", true);
785 reportParams->set("writeZeroTimers", false);
786 // FIXME: no "ignoreZeroTimers"
787
788 const std::string filter = "";
789
790 std::ios_base::fmtflags ff(out->flags());
791 if (timingsFormat == "table-fixed")
792 *out << std::fixed;
793 else
794 *out << std::scientific;
795 TimeMonitor::report(comm.ptr(), *out, filter, reportParams);
796 *out << std::setiosflags(ff);
797 }
798 }
799
800 TimeMonitor::clearCounters();
801
802 return (success ? EXIT_SUCCESS : EXIT_FAILURE);
803 }
804
805 //- -- --------------------------------------------------------
806 #define MUELU_AUTOMATIC_TEST_ETI_NAME main_
807 #include "MueLu_Test_ETI.hpp"
808
809 int main(int argc, char* argv[]) {
810 return Automatic_Test_ETI(argc, argv);
811 }