Debian Codegraph @

packages/muelu/research/max/AdditiveMG/SmoothedAdditiveBricks.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 //
11 // To compile and run this example, Trilinos must be configured with
12 // Tpetra, Amesos2, MueLu, Ifpack2, and Belos.
13 //
14 // This example will only work with Tpetra, not Epetra.
15 //
16 // Commonly used options are
17 // --matrixType
18 // --nx
19 // --ny
20 // --xmlFile
21 //
22 // "./MueLu_Repartition_ADR.exe --help" shows all supported command line options.
23 //
24 #include <iostream>
25 #include <cmath>
26
27 extern clock_t Timers_Max[4];
28
29 // Belos provides Krylov solvers
30 #include <BelosConfigDefs.hpp>
31 #include <BelosLinearProblem.hpp>
32 #include <BelosBlockCGSolMgr.hpp>
33 #include <BelosPseudoBlockCGSolMgr.hpp>
34 #include <BelosBlockGmresSolMgr.hpp>
35 #include <BelosBiCGStabSolMgr.hpp>
36 #include <BelosTpetraAdapter.hpp>
37
38 // Galeri
39 #include <Galeri_XpetraParameters.hpp>
40 #include <Galeri_XpetraProblemFactory.hpp>
41 #include <Galeri_XpetraUtils.hpp>
42 #include <Galeri_XpetraMaps.hpp>
43
44 // ADR subdirectory
45 #include "CreateADRMatrix.hpp"
46 #include <CreateADRMatrix.hpp>
47 #include <ADRProblemFactory.hpp>
48 #include <ADR_XpetraParameters.hpp>
49
50 #include "Smooth_Prolongation.cpp"
51 //#include "coloring.hpp"
52 #include "BAP.hpp"
53 #include "CreateBrickMap.hpp"
54
55 int main(int argc, char* argv[]) {
56 // Define default types
57 typedef double scalar_type;
58 typedef int local_ordinal_type;
59 typedef int global_ordinal_type;
60 typedef Tpetra::KokkosClassic::DefaultNode::DefaultNodeType node_type;
61
62 // Convenient typedef's
63 typedef Tpetra::Operator<scalar_type, local_ordinal_type, global_ordinal_type, node_type> operator_type;
64 typedef Tpetra::CrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> crs_matrix_type;
65 typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> row_matrix_type;
66 typedef Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type> vector_type;
67 typedef Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type> multivector_type;
68 typedef Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type> driver_map_type;
69
70 typedef MueLu::TpetraOperator<scalar_type, local_ordinal_type, global_ordinal_type, node_type> muelu_tpetra_operator_type;
71 typedef MueLu::Utilities<scalar_type, local_ordinal_type, global_ordinal_type, node_type> MueLuUtilities;
72
73 typedef Belos::LinearProblem<scalar_type, multivector_type, operator_type> linear_problem_type;
74 typedef Belos::SolverManager<scalar_type, multivector_type, operator_type> belos_solver_manager_type;
75 typedef Belos::PseudoBlockCGSolMgr<scalar_type, multivector_type, operator_type> belos_pseudocg_manager_type;
76 typedef Belos::BlockGmresSolMgr<scalar_type, multivector_type, operator_type> belos_gmres_manager_type;
77 typedef Belos::BiCGStabSolMgr<scalar_type, multivector_type, operator_type> belos_bicgstab_manager_type;
78
79 typedef Ifpack2::Preconditioner<scalar_type, local_ordinal_type, global_ordinal_type, node_type> precond_type;
80
81 // MueLu_UseShortNames.hpp wants these typedefs.
82 typedef scalar_type Scalar;
83 typedef local_ordinal_type LocalOrdinal;
84 typedef global_ordinal_type GlobalOrdinal;
85 typedef node_type Node;
86 #include <MueLu_UseShortNames.hpp>
87
88 typedef Galeri::Xpetra::Problem<Map, CrsMatrixWrap, MultiVector> GaleriXpetraProblem;
89 typedef ADR::Xpetra::Problem<Map, CrsMatrixWrap, MultiVector> ADRXpetraProblem;
90
91 using Teuchos::RCP; // reference count pointers
92 using Teuchos::rcp; // reference count pointers
93
94 //
95 // MPI initialization using Teuchos
96 //
97
98 Teuchos::GlobalMPISession mpiSession(&argc, &argv, NULL);
99 RCP<const Teuchos::Comm<int>> comm = Teuchos::DefaultComm<int>::getComm();
100 int mypid = comm->getRank();
101 /*
102 int subCommRank[3]={0,1,2};
103 Teuchos::ArrayView<int> arraySubCommRank(subCommRank, 3);
104 auto subComm = comm->createSubcommunicator(arraySubCommRank);
105 */
106 Teuchos::CommandLineProcessor clp(false);
107
108 global_ordinal_type maxIts = 10000;
109 scalar_type tol = 1e-10;
110 std::string solverOptionsFile = "final_parser.xml";
111 std::string krylovSolverType = "bicgstab";
112
113 clp.setOption("xmlFile", &solverOptionsFile, "XML file containing MueLu solver parameters");
114 clp.setOption("maxits", &maxIts, "maximum number of Krylov iterations");
115 clp.setOption("tol", &tol, "tolerance for Krylov solver");
116 clp.setOption("krylovType", &krylovSolverType, "cg or gmres solver");
117
118 switch (clp.parse(argc, argv)) {
119 case Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED: return EXIT_SUCCESS;
120 case Teuchos::CommandLineProcessor::PARSE_ERROR:
121 case Teuchos::CommandLineProcessor::PARSE_UNRECOGNIZED_OPTION: return EXIT_FAILURE;
122 case Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL: break;
123 }
124
125 Teuchos::ParameterList xmlParams;
126 Teuchos::ParameterList mueluParams;
127 Teuchos::ParameterList problemParams;
128 Teuchos::updateParametersFromXmlFile(solverOptionsFile, Teuchos::inoutArg(xmlParams));
129 mueluParams = xmlParams.sublist(static_cast<const std::string>("MueLu"));
130 problemParams = xmlParams.sublist(static_cast<const std::string>("Problem"));
131
132 // Problem definition
133 std::string problem_type = problemParams.get<std::string>(static_cast<const std::string>("problem type"));
134
135 // Parameters
136
137 Scalar Lx = problemParams.get<scalar_type>(static_cast<const std::string>("domain size in x-direction"));
138 Scalar Ly = problemParams.get<scalar_type>(static_cast<const std::string>("domain size in y-direction"));
139 Scalar Lz = problemParams.get<scalar_type>(static_cast<const std::string>("domain size in z-direction"));
140
141 global_ordinal_type nx = problemParams.get<int>(static_cast<const std::string>("nodes in x-direction"));
142 global_ordinal_type ny = problemParams.get<int>(static_cast<const std::string>("nodes in y-direction"));
143 global_ordinal_type nz = problemParams.get<int>(static_cast<const std::string>("nodes in z-direction"));
144
145 global_ordinal_type number_runs = problemParams.get<int>(static_cast<const std::string>("number of runs"));
146
147 MueLu::DomainPartitioning domain;
148
149 int keep_boundary = 0;
150 Scalar stretchx = (Scalar)Lx / nx;
151 Scalar stretchy = (Scalar)Ly / ny;
152 Scalar stretchz = (Scalar)Lz / nz;
153
154 ADR::Xpetra::Parameters<GO> matrixParameters(clp, nx, ny, nz, problem_type, keep_boundary, stretchx, stretchy, stretchz); // manage parameters of the test case
155 Xpetra::Parameters xpetraParameters(clp); // manage parameters of xpetra
156
157 if (xpetraParameters.GetLib() == Xpetra::UseEpetra) {
158 throw std::invalid_argument("This example only supports Tpetra.");
159 }
160
161 //
162 // Construct the problem
163 //
164
165 global_ordinal_type indexBase = 0;
166 RCP<const Map> xpetraMap;
167 std::vector<global_ordinal_type> ind;
168
169 // BRICK SIZE
170 int brick_sizex = mueluParams.get<int>(static_cast<const std::string>("aggregation: brick x size"));
171 int brick_sizey = mueluParams.get<int>(static_cast<const std::string>("aggregation: brick y size"));
172 int brick_sizez = mueluParams.get<int>(static_cast<const std::string>("aggregation: brick z size"));
173
174 // Creation of the map where processor 0 gets nothing at the fine level
175 if (comm->getSize() > 1) {
176 if (problem_type == "ADR1D")
177 createBrickMap1D(matrixParameters.GetNumGlobalElements(), ind, comm);
178
179 else if (problem_type == "ADR2D")
180 createBrickMap2D(nx, brick_sizex, brick_sizey, ind, comm);
181
182 else if (problem_type == "ADR3D")
183 createBrickMap3D(nx, ny, brick_sizex, brick_sizey, brick_sizez, ind, comm);
184
185 ind.shrink_to_fit();
186
187 Teuchos::ArrayView<const global_ordinal_type> elementList(ind);
188 xpetraMap = MapFactory::Build(Xpetra::UseTpetra, matrixParameters.GetNumGlobalElements(), elementList, indexBase, comm);
189 } else if (comm->getSize() == 1)
190 xpetraMap = MapFactory::Build(Xpetra::UseTpetra, matrixParameters.GetNumGlobalElements(), indexBase, comm);
191
192 RCP<MultiVector> coordinates;
193
194 if (problem_type == "ADR1D")
195 coordinates = Galeri::Xpetra::Utils::CreateCartesianCoordinates<scalar_type, local_ordinal_type, global_ordinal_type, Map, MultiVector>("1D", xpetraMap, matrixParameters.GetParameterList());
196 else if (problem_type == "ADR2D")
197 coordinates = Galeri::Xpetra::Utils::CreateCartesianCoordinates<scalar_type, local_ordinal_type, global_ordinal_type, Map, MultiVector>("2D", xpetraMap, matrixParameters.GetParameterList());
198 else if (problem_type == "ADR3D")
199 coordinates = Galeri::Xpetra::Utils::CreateCartesianCoordinates<scalar_type, local_ordinal_type, global_ordinal_type, Map, MultiVector>("3D", xpetraMap, matrixParameters.GetParameterList());
200
201 RCP<ADRXpetraProblem> Pr = ADR::Xpetra::BuildProblem<scalar_type, local_ordinal_type, global_ordinal_type, Map, CrsMatrixWrap, MultiVector>(matrixParameters.GetMatrixType(), xpetraMap, matrixParameters.GetParameterList());
202 RCP<Matrix> xpetraA = Pr->BuildMatrix();
203
204 RCP<crs_matrix_type> A = toTpetra(xpetraA);
205 RCP<const driver_map_type> map = toTpetra(xpetraMap);
206
207 // ===================================================
208 // Domain Decomposition Preconditioner
209 // ===================================
210
211 // Creation of the MueLu list for the DD preconditioner
212 RCP<Teuchos::ParameterList> dd_list = rcp(new Teuchos::ParameterList());
213 dd_list->setName("MueLu");
214 dd_list->set("verbosity", "low");
215 dd_list->set("number of equations", 1);
216 dd_list->set("max levels", 1);
217 dd_list->set("coarse: type", "SCHWARZ"); // FOR A ONE LEVEL PRECONDITIONER THE COARSE LEVEL IS INTERPRETED AS SMOOTHING LEVEL
218
219 Teuchos::ParameterList& dd_smooth_sublist = dd_list->sublist("coarse: params");
220 dd_smooth_sublist.set("schwarz: overlap level", 0);
221 dd_smooth_sublist.set("schwarz: combine mode", "Zero");
222 dd_smooth_sublist.set("subdomain solver name", "RILUK");
223
224 Teuchos::ParameterList& coarse_subdomain_solver = dd_smooth_sublist.sublist("subdomain solver parameters");
225 coarse_subdomain_solver.set("fact: iluk level-of-fill", 10);
226 coarse_subdomain_solver.set("fact: absolute thresh/old", 0.);
227 coarse_subdomain_solver.set("fact: relative threshold", 1.);
228 coarse_subdomain_solver.set("fact: relax value", 0.);
229
230 RCP<muelu_tpetra_operator_type> B_DD = MueLu::CreateTpetraPreconditioner((RCP<operator_type>)A, *dd_list);
231
232 // ===================================================
233 // Multi Grid Preconditioner
234 // ===================================
235
236 RCP<muelu_tpetra_operator_type> M;
237
238 // Manual set up of the prolongation and restriction
239 MueLu::ParameterListInterpreter<scalar_type> mueLuFactory(mueluParams);
240 RCP<MueLu::Hierarchy<scalar_type>> H = mueLuFactory.CreateHierarchy();
241 H->setVerbLevel(Teuchos::VERB_HIGH);
242
243 H->GetLevel(0)->Set("A", xpetraA);
244 H->GetLevel(0)->Set("Coordinates", coordinates);
245
246 // Multigrid setup phase
247 mueLuFactory.SetupHierarchy(*H);
248
249 RCP<Level> L = H->GetLevel(1);
250
251 RCP<Xpetra::Matrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type>> prolong, restr;
252
253 if (L->IsAvailable("P"))
254 prolong = L->template Get<RCP<Xpetra::Matrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type>>>("P");
255
256 if (L->IsAvailable("R"))
257 restr = L->template Get<RCP<Xpetra::Matrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type>>>("R");
258
259 RCP<crs_matrix_type> tpetra_prolong = toTpetra(prolong);
260 RCP<crs_matrix_type> tpetra_restr = toTpetra(restr);
261
262 #include <Teuchos_TimeMonitor.hpp>
263 RCP<Teuchos::Time> PbarSetUp = Teuchos::TimeMonitor::getNewCounter("Pbar: SetUp");
264 PbarSetUp->start();
265 RCP<Matrix> mueluPbar;
266
267 // We have to transform P into a condensed multivector
268 RCP<multivector_type> identity_shrunk = rcp(new multivector_type(tpetra_prolong->getDomainMap(), std::pow(3, coordinates->getNumVectors())));
269 Teuchos::ArrayView<const global_ordinal_type> myIdentityGlobalElements = tpetra_prolong->getDomainMap()->getLocalElementList();
270 typedef typename Teuchos::ArrayView<const global_ordinal_type>::const_iterator iter_type;
271
272 for (int trial = 1; trial <= number_runs; ++trial) {
273 if (1 == coordinates->getNumVectors()) {
274 for (int j = 0; j < 3; ++j) {
275 int color = j;
276
277 Teuchos::ArrayRCP<scalar_type> localMV = identity_shrunk->getDataNonConst(color);
278
279 for (iter_type it = myIdentityGlobalElements.begin(); it != myIdentityGlobalElements.end(); ++it) {
280 const local_ordinal_type i_local = *it;
281 const local_ordinal_type aux = identity_shrunk->getMap()->getLocalElement(i_local);
282 int local_color = (i_local) % 3;
283
284 if (local_color == color)
285 localMV[aux] = 1.0;
286 }
287 }
288 } else if (2 == coordinates->getNumVectors()) {
289 for (int j = 0; j < 9; ++j) {
290 int color = j;
291
292 Teuchos::ArrayRCP<scalar_type> localMV = identity_shrunk->getDataNonConst(color);
293
294 for (iter_type it = myIdentityGlobalElements.begin(); it != myIdentityGlobalElements.end(); ++it) {
295 const local_ordinal_type i_local = *it;
296 const local_ordinal_type aux = identity_shrunk->getMap()->getLocalElement(i_local);
297 const local_ordinal_type local_color = coloring2D(i_local + 1, std::sqrt(tpetra_prolong->getGlobalNumCols()));
298
299 if (local_color == color)
300 localMV[aux] = 1.0;
301 }
302 }
303 } else if (3 == coordinates->getNumVectors()) {
304 // const local_ordinal_type local_color = coloring3D( mypid, std::cbrt( tpetra_prolong->getGlobalNumCols() ), std::cbrt( tpetra_prolong->getGlobalNumCols() ) );
305
306 for (int j = 0; j < 27; ++j) {
307 int color = j;
308
309 Teuchos::ArrayRCP<scalar_type> localMV = identity_shrunk->getDataNonConst(color);
310
311 for (iter_type it = myIdentityGlobalElements.begin(); it != myIdentityGlobalElements.end(); ++it) {
312 const local_ordinal_type i_local = *it;
313 const local_ordinal_type aux = identity_shrunk->getMap()->getLocalElement(i_local);
314 const local_ordinal_type local_color = coloring3D(i_local + 1, std::cbrt(tpetra_prolong->getGlobalNumCols()), std::cbrt(tpetra_prolong->getGlobalNumCols()));
315
316 if (local_color == color)
317 localMV[aux] = 1.0;
318 }
319 }
320 }
321
322 RCP<multivector_type> P_shrunk = rcp(new multivector_type(tpetra_prolong->getRangeMap(), std::pow(3, coordinates->getNumVectors())));
323 tpetra_prolong->apply(*identity_shrunk, *P_shrunk);
324 RCP<multivector_type> AP_shrunk = rcp(new multivector_type(A->getRangeMap(), std::pow(3, coordinates->getNumVectors())));
325 A->apply(*P_shrunk, *AP_shrunk);
326
327 //========================================================================================================
328
329 // CREATION OF BAP
330
331 RCP<multivector_type> BAP_shrunk = rcp(new multivector_type(B_DD->getRangeMap(), AP_shrunk->getNumVectors()));
332 B_DD->apply(*AP_shrunk, *BAP_shrunk, Teuchos::NO_TRANS, Teuchos::ScalarTraits<scalar_type>::one(), Teuchos::ScalarTraits<scalar_type>::zero());
333
334 // Columns Map for BAP
335 std::vector<int> indBAPcolMap;
336 if (1 == coordinates->getNumVectors())
337 neighbours1D(tpetra_prolong, indBAPcolMap, comm);
338 else if (2 == coordinates->getNumVectors())
339 neighbours2D(tpetra_prolong, indBAPcolMap, comm, std::sqrt(tpetra_prolong->getGlobalNumCols()));
340 else if (3 == coordinates->getNumVectors())
341 neighbours3D(tpetra_prolong, indBAPcolMap, comm, std::cbrt(tpetra_prolong->getGlobalNumCols()), std::cbrt(tpetra_prolong->getGlobalNumCols()));
342
343 Teuchos::ArrayView<const global_ordinal_type> elementListBAP(indBAPcolMap);
344 Teuchos::RCP<Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type>> BAPcolMap = rcp(new Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type>(static_cast<size_t>(tpetra_prolong->getGlobalNumCols()), elementListBAP, indexBase, comm));
345
346 RCP<crs_matrix_type> BAP = rcp(new crs_matrix_type(tpetra_prolong->getRowMap(), BAPcolMap, tpetra_prolong->getGlobalNumCols()));
347 Teuchos::ArrayView<const global_ordinal_type> myLocalElements = BAP->getRowMap()->getLocalElementList();
348
349 if (1 == coordinates->getNumVectors())
350 BAP1D(BAP, tpetra_prolong, BAP_shrunk, comm);
351 else if (2 == coordinates->getNumVectors())
352 BAP2D(BAP, tpetra_prolong, BAP_shrunk, comm, std::sqrt(tpetra_prolong->getGlobalNumCols()));
353 else if (3 == coordinates->getNumVectors())
354 BAP3D(BAP, tpetra_prolong, BAP_shrunk, comm, std::cbrt(tpetra_prolong->getGlobalNumCols()), std::cbrt(tpetra_prolong->getGlobalNumCols()));
355
356 BAP->fillComplete(tpetra_prolong->getDomainMap(), tpetra_prolong->getRangeMap());
357
358 //=============================================================================================================
359 RCP<crs_matrix_type> Pbar = Tpetra::MatrixMatrix::add(1.0, false, *tpetra_prolong, -1.0, false, *BAP);
360 mueluPbar = MueLu::TpetraCrs_To_XpetraMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type>(Pbar);
361 }
362 PbarSetUp->stop();
363
364 H->GetLevel(1)->Set("Pbar", mueluPbar);
365
366 H->IsPreconditioner(true);
367
368 M = rcp(new muelu_tpetra_operator_type(H));
369
370 // Intermediate print before zeroing out the global timers (needed to split set up timing and solve timing)
371 Teuchos::TimeMonitor::summarize();
372 Teuchos::TimeMonitor::zeroOutTimers();
373 //===============================================================================================================
374
375 // Linear Solver
376
377 RCP<multivector_type> X_muelu = rcp(new multivector_type(map, 1));
378 RCP<multivector_type> B = rcp(new multivector_type(map, 1));
379 RCP<linear_problem_type> Problem_muelu;
380 X_muelu->putScalar((scalar_type)0.0);
381 B->randomize();
382
383 Problem_muelu = rcp(new linear_problem_type(A, X_muelu, B));
384
385 RCP<Teuchos::ParameterList> belosList = rcp(new Teuchos::ParameterList());
386 belosList->set("Maximum Iterations", maxIts); // Maximum number of iterations allowed
387 belosList->set("Convergence Tolerance", tol); // Relative convergence tolerance requested
388 // belosList->set("Verbosity", Belos::Errors + Belos::Warnings + Belos::StatusTestDetails);
389 belosList->set("Verbosity", Belos::Errors);
390 belosList->set("Output Frequency", 1);
391 belosList->set("Output Style", Belos::Brief);
392 belosList->set("Implicit Residual Scaling", "None");
393 RCP<belos_solver_manager_type> solver;
394 if (krylovSolverType == "cg")
395 solver = rcp(new belos_pseudocg_manager_type(Problem_muelu, belosList));
396 else if (krylovSolverType == "gmres")
397 solver = rcp(new belos_gmres_manager_type(Problem_muelu, belosList));
398 else if (krylovSolverType == "bicgstab")
399 solver = rcp(new belos_bicgstab_manager_type(Problem_muelu, belosList));
400 else
401 throw std::invalid_argument("bad Krylov solver type");
402
403 for (int trial = 1; trial <= number_runs; ++trial) {
404 X_muelu->putScalar((scalar_type)0.0);
405 B->randomize();
406
407 //
408 // Set up Krylov solver and iterate.
409 //
410
411 Problem_muelu = rcp(new linear_problem_type(A, X_muelu, B));
412 Problem_muelu->setRightPrec(M);
413 Problem_muelu->setProblem();
414
415 solver->setProblem(Problem_muelu);
416 solver->solve();
417 int numIterations_muelu = solver->getNumIters();
418
419 Teuchos::Array<typename Teuchos::ScalarTraits<scalar_type>::magnitudeType> normVec_muelu(1);
420 multivector_type residual_muelu(B->getMap(), 1);
421 A->apply(*X_muelu, residual_muelu);
422 residual_muelu.update(1.0, *B, -1.0);
423 residual_muelu.norm2(normVec_muelu);
424 if (mypid == 0) {
425 std::cout << "number of iterations with MueLu preconditioner= " << numIterations_muelu << std::endl;
426 std::cout << "||Residual|| = " << normVec_muelu[0] << std::endl;
427 }
428 }
429
430 Teuchos::TimeMonitor::summarize();
431 /*
432 //Row Map for Timers vectors
433 std::vector<int> indTimerMap;
434
435 indTimerMap.emplace_back(mypid);
436
437 Teuchos::ArrayView<const global_ordinal_type> elementListTimer (indTimerMap);
438 Teuchos::RCP< Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > TimerMap = rcp( new Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type >( static_cast<size_t>(comm->getSize()), elementListTimer, indexBase, comm ) );
439
440 RCP<multivector_type> TimerRestr = rcp(new multivector_type(TimerMap,1));
441 RCP<multivector_type> TimerProlong = rcp(new multivector_type(TimerMap,1));
442 RCP<multivector_type> TimerFine = rcp(new multivector_type(TimerMap,1));
443 RCP<multivector_type> TimerCoarse = rcp(new multivector_type(TimerMap,1));
444
445 Teuchos::ArrayRCP<scalar_type> localMV = TimerRestr->getDataNonConst(0);
446 const local_ordinal_type aux = TimerMap->getLocalElement (mypid);
447 localMV[aux] = (static_cast<double>(Timers_Max[0])/CLOCKS_PER_SEC/number_runs);
448 localMV = TimerProlong->getDataNonConst(0);
449 localMV[aux] = (static_cast<double>(Timers_Max[1])/CLOCKS_PER_SEC/number_runs);
450 localMV = TimerFine->getDataNonConst(0);
451 localMV[aux] = (static_cast<double>(Timers_Max[2])/CLOCKS_PER_SEC/number_runs);
452 localMV = TimerCoarse->getDataNonConst(0);
453 localMV[aux] = (static_cast<double>(Timers_Max[3])/CLOCKS_PER_SEC/number_runs);
454
455 Tpetra::MatrixMarket::Writer<multivector_type>::writeDenseFile("TimeRestr.mtx", TimerRestr);
456 Tpetra::MatrixMarket::Writer<multivector_type>::writeDenseFile("TimeProlong.mtx", TimerProlong);
457 Tpetra::MatrixMarket::Writer<multivector_type>::writeDenseFile("TimeFine.mtx", TimerFine);
458 Tpetra::MatrixMarket::Writer<multivector_type>::writeDenseFile("TimeCoarse.mtx", TimerCoarse);
459 */
460 return EXIT_SUCCESS;
461 }