| 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 |
|
|---|
| 24 | using namespace VMG;
|
|---|
| 25 |
|
|---|
| 26 | class VMGCommandPrintResidualNorm : public Command
|
|---|
| 27 | {
|
|---|
| 28 | public:
|
|---|
| 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 |
|
|---|
| 51 | CREATE_INITIALIZER(VMGCommandPrintResidualNorm)
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.