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