/** * @file com_initialize_residual_norm.cpp * @author Julian Iseringhausen * @date Mon Apr 18 12:40:12 2011 * * @brief Computes the residual in the discrete L2-norm * and hands the value over to the factory. * */ #ifdef HAVE_CONFIG_H #include #endif #include "base/command.hpp" #include "base/object.hpp" #include "comm/comm.hpp" #include "grid/multigrid.hpp" #include "mg.hpp" using namespace VMG; class VMGCommandInitializeResidualNorm : public Command { public: Request Run(Command::argument_vector arguments) { MPE_EVENT_BEGIN() vmg_float residual = MG::GetComm()->ComputeResidualNorm(*MG::GetSol(), *MG::GetRhs()); new ObjectStorage(arguments[0], residual); #ifdef DEBUG_OUTPUT MG::GetComm()->PrintStringOnce("Initial residual: %e", residual); #endif /* DEBUG_OUTPUT */ MPE_EVENT_END() return Continue; } static const char* Name() {return "InitializeResidualNorm";} static int Arguments() {return 1;} }; CREATE_INITIALIZER(VMGCommandInitializeResidualNorm)