00001 // @HEADER 00002 // ************************************************************************ 00003 // 00004 // Phalanx: A Partial Differential Equation Field Evaluation 00005 // Kernel for Flexible Management of Complex Dependency Chains 00006 // Copyright (2008) Sandia Corporation 00007 // 00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00009 // the U.S. Government 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 // 00026 // Questions? Contact Roger Pawlowski (rppawlo@sandia.gov), Sandia 00027 // National Laboratories. 00028 // 00029 // ************************************************************************ 00030 // @HEADER 00031 00032 #ifndef PHX_FIELD_EVALUATOR_FACTORY_UFO_HPP 00033 #define PHX_FIELD_EVALUATOR_FACTORY_UFO_HPP 00034 00035 #include <map> 00036 #include <vector> 00037 #include "Sacado_mpl_at.hpp" 00038 #include "Teuchos_RCP.hpp" 00039 #include "Teuchos_ParameterList.hpp" 00040 #include "Phalanx_Evaluator_TemplateManager.hpp" 00041 #include "Phalanx_Evaluator_TemplateBuilder.hpp" 00042 00043 namespace PHX { 00044 00046 template<typename Traits, typename FactoryTraits> 00047 struct UFO { 00048 00049 int object_type; 00050 Teuchos::RCP<Teuchos::ParameterList> params; 00051 Teuchos::RCP< Evaluator_TemplateManager<Traits> >& tm; 00052 bool& found_object; 00053 00054 UFO(int v, const Teuchos::RCP<Teuchos::ParameterList>& p, 00055 Teuchos::RCP< Evaluator_TemplateManager<Traits> >& t, 00056 bool& found) 00057 : object_type(v), params(p), tm(t), found_object(found) {} 00058 00059 template<typename T> void operator()(T t) 00060 { 00061 if (object_type == t) { 00062 typedef typename Sacado::mpl::at<typename FactoryTraits::EvaluatorTypes, T::value >::type type; 00063 PHX::Evaluator_TemplateBuilder<Traits, type> builder(params); 00064 tm->buildObjects(builder); 00065 found_object = true; 00066 } 00067 } 00068 00069 }; 00070 00071 } 00072 00073 #endif