SundanceWatchFlag.cpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                              Sundance
00005 //                 Copyright (2005) Sandia Corporation
00006 // 
00007 // Copyright (year first published) Sandia Corporation.  Under the terms 
00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 
00009 // retains certain rights in this software.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //                                                                                 
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA                                                                                
00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 
00026 // Sandia National Laboratories, Livermore, California, USA
00027 // 
00028 // ************************************************************************
00029 /* @HEADER@ */
00030 
00031 #include "SundanceWatchFlag.hpp"
00032 #include "SundanceOut.hpp"
00033 
00034 using namespace Sundance;
00035 
00036 
00037 WatchFlag::WatchFlag(const std::string& name,
00038   const ParameterList& params)
00039   : name_(name), params_(rcp(new ParameterList(params)))
00040 {
00041   if (name_.size() > 0) isActiveMap().put(name, true);
00042   else isActiveMap().put(name, false);
00043 }
00044 
00045 void WatchFlag::activate() 
00046 {
00047   isActiveMap()[name()] = true;
00048 }
00049 
00050 void WatchFlag::deactivate() 
00051 {
00052   isActiveMap()[name()] = false;
00053 }
00054 
00055 bool WatchFlag::isActive() const 
00056 {
00057   return isActiveMap().get(name());
00058 }
00059 
00060 XMLObject WatchFlag::toXML() const 
00061 {
00062   XMLObject xml("WatchFlag");
00063   xml.addAttribute("name", name());
00064   return xml;
00065 }
00066 
00067 int WatchFlag::param(const std::string& name) const 
00068 {
00069   return params_->get<int>(name);
00070 }
00071 
00072 
00073 void WatchFlag::setParam(const std::string& name, int val)
00074 {
00075   params_->set<int>(name, val);
00076 }
00077 
00078 
00079 
00080 
00081 RCP<ParameterList> WatchFlag::defaultParams()
00082 {
00083   static RCP<ParameterList> rtn=rcp(new ParameterList());
00084   static bool first=true;
00085   if (first)
00086   {
00087     rtn->set<int>("evaluation", 0);
00088     rtn->set<int>("evaluator setup", 0);
00089     rtn->set<int>("discrete function evaluation", 0);
00090     rtn->set<int>("symbolic preprocessing", 0);
00091     rtn->set<int>("equation set setup", 0);
00092     rtn->set<int>("assembler setup", 0);
00093     rtn->set<int>("assembly loop", 0);
00094     rtn->set<int>("dof map setup", 0);
00095     rtn->set<int>("dof map access", 0);
00096     rtn->set<int>("eval mediator", 0);
00097     rtn->set<int>("integration setup", 0);
00098     rtn->set<int>("integration", 0);
00099     rtn->set<int>("integral transformation", 0);    
00100     rtn->set<int>("fill", 0);
00101     rtn->set<int>("matrix config", 0);
00102     rtn->set<int>("vector config", 0);
00103     rtn->set<int>("solve control", 0);
00104     first = false;
00105   }
00106   return rtn;
00107 }

Site Contact