Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_EvaluatorsRegistrar.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_EVALUATORS_REGISTRAR_HPP
12 #define PANZER_EVALUATORS_REGISTRAR_HPP
13 
14 #include "Phalanx_FieldManager.hpp"
15 
17 
18 namespace panzer {
19 
26 public:
31  int setDetailsIndex(const int details_index) {
32  int old_di = details_index_;
33  details_index_ = details_index;
34  return old_di;
35  }
37  int getDetailsIndex() const { return details_index_; }
38 
39 protected:
42  virtual ~EvaluatorsRegistrar() {}
43 
46  template <typename EvalT>
48  const Teuchos::RCP< PHX::Evaluator<panzer::Traits> >& op) const;
49 
50 private:
52 };
53 
54 template<typename EvalT>
58 {
60  pop = Teuchos::rcp_dynamic_cast< panzer::EvaluatorWithBaseImpl<panzer::Traits> >(op);
61  // Temporarily allow casting failure so that Charon continues to work.
62 #if 0
63  TEUCHOS_TEST_FOR_EXCEPTION(pop.is_null(), std::runtime_error,
64  op->getName() + " does not inherit from panzer::EvaluatorWithBaseImpl.");
65  pop->setDetailsIndex(details_index_);
66 #else
67  if (Teuchos::nonnull(pop))
68  pop->setDetailsIndex(details_index_);
69 #endif
70  fm.template registerEvaluator<EvalT>(op);
71 }
72 
73 }
74 
75 #endif
int setDetailsIndex(const int details_index)
bool nonnull(const std::shared_ptr< T > &p)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
int getDetailsIndex() const
Get the WorksetDetails index.
EvaluatorsRegistrar()
Default ctor initializes WorksetDetails index to 0.
void registerEvaluator(PHX::FieldManager< panzer::Traits > &fm, const Teuchos::RCP< PHX::Evaluator< panzer::Traits > > &op) const
bool is_null() const