source: src/commands/com_print_residual_norm.cpp@ ab63b6

Last change on this file since ab63b6 was dfed1c, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Major vmg update.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1136 5161e1c8-67bf-11de-9fd5-51895aff932f

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * @file com_print_residual_norm.cpp
3 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
4 * @date Mon Apr 18 12:47:22 2011
5 *
6 * @brief Writes the current discrete L2-norm of the residual
7 * to standard output.
8 *
9 */
10
11#ifdef HAVE_CONFIG_H
12#include <config.h>
13#endif
14
15#include <sstream>
16
17#include "base/command.hpp"
18#include "comm/comm.hpp"
19#include "grid/grid.hpp"
20#include "grid/multigrid.hpp"
21#include "level/level_operator.hpp"
22#include "mg.hpp"
23
24using namespace VMG;
25
26class VMGCommandPrintResidualNorm : public Command
27{
28public:
29 Request Run(Command::argument_vector arguments)
30 {
31 MPE_EVENT_BEGIN()
32
33 Multigrid* sol = MG::GetSol();
34 Multigrid* rhs = MG::GetRhs();
35 Comm* comm = MG::GetComm();
36
37 if ((*sol)(sol->MaxLevel()).IsActive()) {
38 vmg_float residual = comm->ComputeResidualNorm(*sol, *rhs);
39 comm->PrintStringOnce("Residual: %e", residual);
40 }
41
42 MPE_EVENT_END()
43
44 return Continue;
45 }
46
47 static const char* Name() {return "PrintResidualNorm";}
48 static int Arguments() {return 0;}
49};
50
51CREATE_INITIALIZER(VMGCommandPrintResidualNorm)
Note: See TracBrowser for help on using the repository browser.