Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_BCStrategy_Dirichlet_Utilities.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_BCSTRATEGY_DIRCHLET_UTILITIES_HPP
12 #define PANZER_BCSTRATEGY_DIRCHLET_UTILITIES_HPP
13 
14 #include "Phalanx_FieldManager.hpp"
15 #include "Panzer_PhysicsBlock.hpp"
18 #include <vector>
19 #include <list>
20 #include <string>
21 #include <algorithm>
22 
23 namespace panzer {
24 
25 
45 template<typename EvalT>
46 void
48  const panzer::PhysicsBlock& pb,
50  const std::string comma_sep_closure_model_list,
51  const Teuchos::ParameterList& models,
52  const Teuchos::ParameterList& user_data)
53 {
54 
55  std::vector<std::string> closure_model_vector;
56  panzer::StringTokenizer(closure_model_vector,comma_sep_closure_model_list,",");
57 
58  // copy into list
59  std::list<std::string> closure_model_list;
60  for (std::vector<std::string>::iterator i=closure_model_vector.begin(); i != closure_model_vector.end(); ++i)
61  closure_model_list.push_back(*i);
62 
63  Teuchos::ParameterList models_to_build;
64 
65  for (Teuchos::ParameterList::ConstIterator model = models.begin(); model != models.end(); ++model) {
66 
67  std::list<std::string>::iterator search =
68  std::find(closure_model_list.begin(), closure_model_list.end(), model->first);
69 
70  if (search != closure_model_list.end()) {
71  closure_model_list.erase(search);
72  models_to_build.sublist(model->first) = models.sublist(model->first);
73  }
74  else
75  models_to_build.sublist(model->first);
76  }
77 
78  TEUCHOS_TEST_FOR_EXCEPTION(closure_model_list.size() != 0, std::logic_error,
79  "Error - the list of closure models \"" << comma_sep_closure_model_list << "\" contains an invalid model.");
80 
81  pb.buildAndRegisterClosureModelEvaluatorsForType<EvalT>(fm,factory,models_to_build,user_data);
82 
83 }
84 
85 } // namespace panzer
86 
87 #endif
ConstIterator end() const
Object that contains information on the physics and discretization of a block of elements with the SA...
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void buildAndRegisterClosureModelEvaluatorsForType(PHX::FieldManager< panzer::Traits > &fm, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &factory, const Teuchos::ParameterList &models, const Teuchos::ParameterList &user_data) const
params_t::ConstIterator ConstIterator
ConstIterator begin() const
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.
void buildAndRegisterSubsetOfClosureModelEvaluatorsForType(PHX::FieldManager< panzer::Traits > &fm, const panzer::PhysicsBlock &pb, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &factory, const std::string comma_sep_closure_model_list, const Teuchos::ParameterList &models, const Teuchos::ParameterList &user_data)
Builds the closure models for a particular physics block for a dirichlet bc.