Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_STK_IOClosureModel_Factory_impl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Panzer: A partial differential equation assembly
4 // engine for strongly coupled complex multiphysics systems
5 //
6 // Copyright 2011 NTESS and the Panzer contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 
11 #ifndef PANZER_STK_IOCLOSURE_MODEL_FACTORY_IMPL_HPP
12 #define PANZER_STK_IOCLOSURE_MODEL_FACTORY_IMPL_HPP
13 
15 
16 #include "Panzer_STK_ScatterCellAvgQuantity.hpp"
17 #include "Panzer_STK_ScatterCellQuantity.hpp"
18 
19 // ********************************************************************
20 // ********************************************************************
21 template<typename EvalT>
24  const Teuchos::RCP<STK_Interface> & mesh,
25  const Teuchos::ParameterList & outputList)
26  : mesh_(mesh), userCMF_(userCMF)
27 {
28  parseOutputList(outputList.sublist("Cell Average Quantities"),blockIdToCellAvgFields_);
29  parseOutputList(outputList.sublist("Cell Average Vectors"),blockIdToCellAvgVectors_);
30  parseOutputList(outputList.sublist("Cell Quantities"),blockIdToCellFields_);
31  parseOutputList(outputList.sublist("Nodal Quantities"),blockIdToNodalFields_);
32 }
33 
34 // ********************************************************************
35 // ********************************************************************
36 template<typename EvalT>
39  const Teuchos::RCP<STK_Interface> & mesh,
40  const std::map<std::string,std::vector<std::string> > & nodalFields,
41  const std::map<std::string,std::vector<std::string> > & cellFields)
42  : mesh_(mesh), userCMF_(userCMF)
43 {
44  blockIdToNodalFields_ = nodalFields;
45  blockIdToCellFields_ = cellFields;
46 
47  typedef std::map<std::string,std::vector<std::string> >::const_iterator const_iterator;
48 
49  for(const_iterator itr=nodalFields.begin();itr!=nodalFields.end();++itr)
50  blockIdEvaluated_[itr->first] = false;
51  for(const_iterator itr=cellFields.begin();itr!=cellFields.end();++itr)
52  blockIdEvaluated_[itr->first] = false;
53 }
54 
55 // ********************************************************************
56 // ********************************************************************
57 template<typename EvalT>
60  std::map<std::string,std::vector<std::string> > & blockIdToFields) const
61 {
63  itr!=pl.end();++itr) {
64  const std::string & blockId = itr->first;
65  const std::string & fields = Teuchos::any_cast<std::string>(itr->second.getAny());
66  std::vector<std::string> & tokens = blockIdToFields[blockId];
67 
68  // break up comma seperated fields
69  panzer::StringTokenizer(tokens,fields,",",true);
70 
71  blockIdEvaluated_[blockId] = false; // initialize this value
72  }
73 }
74 
75 // ********************************************************************
76 // ********************************************************************
77 template<typename EvalT>
80 buildClosureModels(const std::string& model_id,
81  const Teuchos::ParameterList& models,
84  const Teuchos::ParameterList& default_params,
85  const Teuchos::ParameterList& user_data,
86  const Teuchos::RCP<panzer::GlobalData>& global_data,
88 {
89  // Note that the Residual version of this is in the cpp file!!!!
90 
91  return userCMF_->buildClosureModels(model_id,models,fl,ir,default_params,user_data,global_data,fm);
92 }
93 
94 // ********************************************************************
95 // ********************************************************************
96 
97 #endif
std::map< std::string, std::vector< std::string > > blockIdToCellAvgVectors_
Map showing which cell averaged vector fields need to be written out for each element block...
ConstIterator end() const
std::map< std::string, std::vector< std::string > > blockIdToCellFields_
Map showing which cell fields need to be written out for each element block.
std::map< std::string, std::vector< std::string > > blockIdToNodalFields_
Map showing which nodal fields need to be written out for each element block.
params_t::ConstIterator ConstIterator
ConstIterator begin() const
std::map< std::string, std::vector< std::string > > blockIdToCellAvgFields_
Map showing which cell averaged fields need to be written out for each element block.
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
void StringTokenizer(std::vector< std::string > &tokens, const std::string &str, const std::string delimiters, bool trim)
Tokenize a string, put tokens in a vector.
Teuchos::RCP< std::vector< Teuchos::RCP< PHX::Evaluator< panzer::Traits > > > > buildClosureModels(const std::string &model_id, const Teuchos::ParameterList &models, const panzer::FieldLayoutLibrary &fl, const Teuchos::RCP< panzer::IntegrationRule > &ir, const Teuchos::ParameterList &default_params, const Teuchos::ParameterList &user_data, const Teuchos::RCP< panzer::GlobalData > &global_data, PHX::FieldManager< panzer::Traits > &fm) const
IOClosureModelFactory(const Teuchos::RCP< const panzer::ClosureModelFactory< EvalT > > userCMF_, const Teuchos::RCP< STK_Interface > &mesh, const Teuchos::ParameterList &outputList)
void parseOutputList(const Teuchos::ParameterList &pl, std::map< std::string, std::vector< std::string > > &blockIdToFields) const