Panzer  Version of the Day
Panzer_ResponseEvaluatorFactory_ExtremeValue.hpp
Go to the documentation of this file.
1 #ifndef __Panzer_ResponseEvaluatorFactory_ExtremeValue_hpp__
2 #define __Panzer_ResponseEvaluatorFactory_ExtremeValue_hpp__
3 
4 #include <string>
5 
6 #include "PanzerDiscFE_config.hpp"
8 #include "Panzer_BC.hpp"
9 #include "Panzer_Traits.hpp"
13 
14 #include <mpi.h>
15 
16 namespace panzer {
17 
20 template <typename EvalT,typename LO,typename GO>
22 public:
23 
25  int cubatureDegree=1,
26  bool requiresCellReduction=true,
27  bool useMax=true,
28  const std::string & quadPointField="",
29  const Teuchos::RCP<const panzer::LinearObjFactory<panzer::Traits> > & linearObjFactory=Teuchos::null,
30  const Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > & globalIndexer=Teuchos::null,
31  bool applyDirichletToDerivative=false)
32  : comm_(comm), cubatureDegree_(cubatureDegree), requiresCellExtreme_(requiresCellReduction), useMax_(useMax)
33  , quadPointField_(quadPointField), linearObjFactory_(linearObjFactory), globalIndexer_(globalIndexer)
34  , applyDirichletToDerivative_(applyDirichletToDerivative)
35  {
36  TEUCHOS_ASSERT((linearObjFactory==Teuchos::null && globalIndexer==Teuchos::null) ||
37  (linearObjFactory!=Teuchos::null && globalIndexer!=Teuchos::null));
38  }
39 
41 
51  virtual Teuchos::RCP<ResponseBase> buildResponseObject(const std::string & responseName) const;
52 
53  virtual Teuchos::RCP<ResponseBase> buildResponseObject(const std::string & responseName,
54  const std::vector<WorksetDescriptor> & wkstDesc) const
55  { return buildResponseObject(responseName); }
56 
68  virtual void buildAndRegisterEvaluators(const std::string & responseName,
70  const panzer::PhysicsBlock & physicsBlock,
71  const Teuchos::ParameterList & user_data) const;
72 
80  virtual bool typeSupported() const;
81 
82 protected:
84  int getCubatureDegree() const { return cubatureDegree_; }
85 
86 private:
87  MPI_Comm comm_;
90  bool useMax_;
91  std::string quadPointField_;
92  Teuchos::RCP<const panzer::LinearObjFactory<panzer::Traits> > linearObjFactory_;
93  Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > globalIndexer_;
95 };
96 
97 template <typename LO,typename GO>
99  MPI_Comm comm;
102  bool useMax;
103  std::string quadPointField;
104  bool applyDirichletToDerivative; // if this is set to true, then the dirichlet values will be zerod out in
105  // the DgDx vector
106 
108 
110 
111  void setDerivativeInformation(const Teuchos::RCP<const panzer::LinearObjFactory<panzer::Traits> > & in_linearObjFactory,
112  const Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > & in_globalIndexer)
113  {
114  linearObjFactory = in_linearObjFactory;
115  globalIndexer = in_globalIndexer;
116 
117  TEUCHOS_ASSERT((linearObjFactory==Teuchos::null && globalIndexer==Teuchos::null) ||
118  (linearObjFactory!=Teuchos::null && globalIndexer!=Teuchos::null));
119  }
120 
121  virtual void setDerivativeInformation(const Teuchos::RCP<const panzer::LinearObjFactory<panzer::Traits> > & in_linearObjFactory)
122  {
123  using Teuchos::rcp_dynamic_cast;
124 
125  setDerivativeInformation(in_linearObjFactory,
126  rcp_dynamic_cast<const panzer::UniqueGlobalIndexer<LO,GO> >(in_linearObjFactory->getDomainGlobalIndexer(),true));
127  }
128 
129  template <typename T>
130  Teuchos::RCP<panzer::ResponseEvaluatorFactoryBase> build() const
133 
134  virtual Teuchos::RCP<panzer::ResponseEvaluatorFactoryBase> buildValueFactory() const
135  { return build<panzer::Traits::Residual>(); }
136 
137  virtual Teuchos::RCP<panzer::ResponseEvaluatorFactoryBase> buildDerivativeFactory() const
138  { return build<panzer::Traits::Jacobian>(); }
139 
140  virtual Teuchos::RCP<panzer::ResponseEvaluatorFactoryBase> buildTangentFactory() const
141  { return build<panzer::Traits::Tangent>(); }
142 
143 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
144 
147  virtual Teuchos::RCP<panzer::ResponseEvaluatorFactoryBase> buildHessianFactory() const
148  { return build<panzer::Traits::Hessian>(); }
149 #endif
150 
151 private:
152  Teuchos::RCP<const panzer::LinearObjFactory<panzer::Traits> > linearObjFactory;
153  Teuchos::RCP<const panzer::UniqueGlobalIndexer<LO,GO> > globalIndexer;
154 };
155 
156 
157 }
158 
160 
161 #endif
virtual void buildAndRegisterEvaluators(const std::string &responseName, PHX::FieldManager< panzer::Traits > &fm, const panzer::PhysicsBlock &physicsBlock, const Teuchos::ParameterList &user_data) const
Object that contains information on the physics and discretization of a block of elements with the SA...
int getCubatureDegree() const
Accessor method for Cubature degree (can be used by sub classes)
virtual Teuchos::RCP< ResponseBase > buildResponseObject(const std::string &responseName, const std::vector< WorksetDescriptor > &wkstDesc) const
virtual void setDerivativeInformation(const Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > &in_linearObjFactory)
virtual Teuchos::RCP< panzer::ResponseEvaluatorFactoryBase > buildTangentFactory() const
virtual Teuchos::RCP< panzer::ResponseEvaluatorFactoryBase > buildDerivativeFactory() const
Teuchos::RCP< panzer::ResponseEvaluatorFactoryBase > build() const
Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > globalIndexer_
ResponseEvaluatorFactory_ExtremeValue(MPI_Comm comm, int cubatureDegree=1, bool requiresCellReduction=true, bool useMax=true, const std::string &quadPointField="", const Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > &linearObjFactory=Teuchos::null, const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &globalIndexer=Teuchos::null, bool applyDirichletToDerivative=false)
virtual Teuchos::RCP< panzer::ResponseEvaluatorFactoryBase > buildValueFactory() const
Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > linearObjFactory_
Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > linearObjFactory
void setDerivativeInformation(const Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > &in_linearObjFactory, const Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > &in_globalIndexer)
Teuchos::RCP< const Teuchos::Comm< int > > comm
virtual Teuchos::RCP< ResponseBase > buildResponseObject(const std::string &responseName) const
Teuchos::RCP< const panzer::UniqueGlobalIndexer< LO, GO > > globalIndexer