11 #ifndef PANZER_RESPONSE_SCATTER_EVALUATOR_FUNCTIONAL_HPP
12 #define PANZER_RESPONSE_SCATTER_EVALUATOR_FUNCTIONAL_HPP
17 #include "PanzerDiscFE_config.hpp"
24 #include "Phalanx_Evaluator_Macros.hpp"
25 #include "Phalanx_MDField.hpp"
40 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
48 template <
typename LO,
typename GO>
53 if(globalIndexer!=Teuchos::null)
54 ugis_.push_back(globalIndexer);
65 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
74 std::vector<Teuchos::RCP<const panzer::GlobalIndexer> >
ugis_;
80 template<
typename EvalT,
typename Traits>
106 template <
typename LO,
typename GO>
113 std::string blockId = wda(workset).block_id;
115 std::vector<int> blockOffsets;
120 auto cellIntegral_h = Kokkos::create_mirror_view(cellIntegral.get_view());
121 Kokkos::deep_copy(cellIntegral_h, cellIntegral.get_view());
123 const std::vector<std::size_t> & localCellIds = wda(workset).cell_local_ids;
125 for(std::size_t b=0;b<ugis_.size();b++) {
126 int start = blockOffsets[b];
128 auto LIDs = ugis_[b]->getLIDs();
129 auto LIDs_h = Kokkos::create_mirror_view(LIDs);
130 Kokkos::deep_copy(LIDs_h, LIDs);
135 for(std::size_t worksetCellIndex=0;worksetCellIndex<localCellIds.size();++worksetCellIndex) {
136 std::size_t cellLocalId = localCellIds[worksetCellIndex];
139 for(std::size_t i=0;i<LIDs_h.extent(1);i++) {
140 dgdx_b[LIDs_h(cellLocalId, i)] += cellIntegral_h(worksetCellIndex).dx(start+i);
146 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
147 template <
typename LO,
typename GO>
153 PHX::View<const LO*> LIDs;
156 std::string blockId = wda(workset).block_id;
158 std::vector<int> blockOffsets;
164 const std::vector<std::size_t> & localCellIds = wda(workset).cell_local_ids;
165 for(std::size_t worksetCellIndex=0;worksetCellIndex<localCellIds.size();++worksetCellIndex) {
166 std::size_t cellLocalId = localCellIds[worksetCellIndex];
168 for(std::size_t b=0;b<ugis_.size();b++) {
169 int start = blockOffsets[b];
171 LIDs = ugis_[b]->getElementLIDs(cellLocalId);
176 for(std::size_t i=0;i<LIDs.size();i++) {
177 d2gdx2_b[LIDs[i]] += cellIntegral(worksetCellIndex).dx(start+i).dx(0);
FunctionalScatter(const std::vector< Teuchos::RCP< const panzer::GlobalIndexer > > &ugis)
FunctionalScatter(const Teuchos::RCP< const panzer::GlobalIndexer > &globalIndexer)
virtual ~FunctionalScatterBase()
ResponseScatterEvaluator_Functional(const std::string &name, const CellData &cd, const Teuchos::RCP< FunctionalScatterBase > &functionalScatter)
A constructor with concrete arguments instead of a parameter list.
void scatterDerivative(const PHX::MDField< const panzer::Traits::Jacobian::ScalarT, panzer::Cell > &cellIntegral, panzer::Traits::EvalData workset, WorksetDetailsAccessor &wda, const std::vector< Teuchos::ArrayRCP< double > > &dgdx) const
Teuchos::RCP< FunctionalScatterBase > scatterObj_
virtual void scatterDerivative(const PHX::MDField< const panzer::Traits::Jacobian::ScalarT, panzer::Cell > &cellIntegral, panzer::Traits::EvalData workset, WorksetDetailsAccessor &wda, const std::vector< Teuchos::ArrayRCP< double > > &dgdx) const =0
void preEvaluate(typename Traits::PreEvalData d)
void computeBlockOffsets(const std::string &blockId, const std::vector< Teuchos::RCP< GlobalIndexer >> &ugis, std::vector< int > &blockOffsets)
std::string responseName_
PHX::MDField< const ScalarT, panzer::Cell > cellIntegral_
Data for determining cell topology and dimensionality.
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
void evaluateFields(typename Traits::EvalData d)
Teuchos::RCP< PHX::FieldTag > scatterHolder_
void scatterHessian(const PHX::MDField< const panzer::Traits::Hessian::ScalarT, panzer::Cell > &cellIntegral, panzer::Traits::EvalData workset, WorksetDetailsAccessor &wda, const std::vector< Teuchos::ArrayRCP< double > > &d2gdx2) const
std::vector< Teuchos::RCP< const panzer::GlobalIndexer > > ugis_
#define TEUCHOS_ASSERT(assertion_test)
Teuchos::RCP< Response_Functional< EvalT > > responseObj_
virtual void scatterHessian(const PHX::MDField< const panzer::Traits::Hessian::ScalarT, panzer::Cell > &cellIntegral, panzer::Traits::EvalData workset, WorksetDetailsAccessor &wda, const std::vector< Teuchos::ArrayRCP< double > > &d2gdx2) const =0