source: src/commands/com_check_residual.cpp@ dfed1c

Last change on this file since dfed1c 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.0 KB
Line 
1/**
2 * @file com_check_residual.cpp
3 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
4 * @date Mon Apr 18 12:31:37 2011
5 *
6 * @brief Checks if the residual is small enough to stop
7 * execution.
8 *
9 */
10
11#ifdef HAVE_CONFIG_H
12#include <config.h>
13#endif
14
15#include <cmath>
16
17#include "base/command.hpp"
18#include "base/factory.hpp"
19#include "base/object.hpp"
20#include "comm/comm.hpp"
21#include "grid/multigrid.hpp"
22#include "mg.hpp"
23
24using namespace VMG;
25
26class VMGCommandCheckResidual : public Command
27{
28public:
29 Request Run(Command::argument_vector arguments)
30 {
31 MPE_EVENT_BEGIN()
32
33 const vmg_float& res = MG::GetFactory().GetObjectStorageVal<vmg_float>(arguments[0]);
34 const vmg_float& precision = MG::GetFactory().Get("PRECISION")->Cast< ObjectStorage<vmg_float> >()->Val();
35
36 MPE_EVENT_END()
37
38 if (std::fabs(res) < precision)
39 return StopCycleLater;
40 else
41 return Continue;
42 }
43
44 static const char* Name() {return "CheckResidual";}
45 static int Arguments() {return 1;}
46};
47
48CREATE_INITIALIZER(VMGCommandCheckResidual)
49
Note: See TracBrowser for help on using the repository browser.