$extrastylesheet
dtk_adapter.h
Go to the documentation of this file.
00001 // The libMesh Finite Element Library.
00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
00003 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 of the License, or (at your option) any later version.
00008 
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Lesser General Public License for more details.
00013 
00014 // You should have received a copy of the GNU Lesser General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 
00019 
00020 #ifndef DTKADAPTER_H
00021 #define DTKADAPTER_H
00022 
00023 #include "libmesh/libmesh_config.h"
00024 
00025 #ifdef LIBMESH_HAVE_DTK
00026 
00027 #include "libmesh/dtk_evaluator.h"
00028 
00029 #include <DTK_MeshManager.hpp>
00030 #include <DTK_MeshContainer.hpp>
00031 #include <DTK_MeshTraits.hpp>
00032 #include <DTK_MeshTraitsFieldAdapter.hpp>
00033 #include <DTK_FieldManager.hpp>
00034 #include <DTK_FieldContainer.hpp>
00035 #include <DTK_FieldEvaluator.hpp>
00036 
00037 #include <Teuchos_RCP.hpp>
00038 #include <Teuchos_ArrayRCP.hpp>
00039 
00040 namespace libMesh {
00041 
00042 class DTKAdapter
00043 {
00044 public:
00045   DTKAdapter(Teuchos::RCP<const Teuchos::Comm<int> > in_comm, EquationSystems & in_es);
00046 
00047   typedef DataTransferKit::MeshContainer<int>                                  MeshContainerType;
00048   typedef DataTransferKit::FieldContainer<double>                              FieldContainerType;
00049   typedef DataTransferKit::MeshTraits<MeshContainerType>::global_ordinal_type  GlobalOrdinal;
00050   typedef DataTransferKit::FieldEvaluator<GlobalOrdinal,FieldContainerType>    EvaluatorType;
00051   typedef Teuchos::RCP<EvaluatorType>                                          RCP_Evaluator;
00052 
00053 
00054   Teuchos::RCP<DataTransferKit::MeshManager<MeshContainerType> > get_mesh_manager() { return mesh_manager; }
00055   RCP_Evaluator get_variable_evaluator(std::string var_name);
00056   Teuchos::RCP<DataTransferKit::FieldManager<MeshContainerType> > get_target_coords() { return target_coords; }
00057   Teuchos::RCP<DataTransferKit::FieldManager<FieldContainerType> > get_values_to_fill(std::string var_name);
00058 
00063   void update_variable_values(std::string var_name);
00064 
00065 protected:
00071   System * find_sys(std::string var_name);
00072 
00076   DataTransferKit::DTK_ElementTopology get_element_topology(const Elem * elem);
00077 
00082   void get_semi_local_nodes(std::set<unsigned int> & semi_local_nodes);
00083 
00084   Teuchos::RCP<const Teuchos::Comm<int> > comm;
00085   EquationSystems & es;
00086   const MeshBase & mesh;
00087   unsigned int dim;
00088 
00089   unsigned int num_local_nodes;
00090   Teuchos::ArrayRCP<int> vertices;
00091 
00092   Teuchos::RCP<DataTransferKit::MeshManager<MeshContainerType> > mesh_manager;
00093   RCP_Evaluator field_evaluator;
00094   Teuchos::RCP<DataTransferKit::FieldManager<MeshContainerType> > target_coords;
00095 
00097   std::map<std::string, Teuchos::RCP<DataTransferKit::FieldManager<FieldContainerType> > > values_to_fill;
00098 
00100   std::map<std::string, RCP_Evaluator> evaluators;
00101 };
00102 
00103 } // namespace libMesh
00104 
00105 #endif // #ifdef LIBMESH_HAVE_DTK
00106 
00107 #endif // #define DTKADAPTER_H