11 #include "PanzerAdaptersSTK_config.hpp"
12 #ifdef PANZER_HAVE_TEKO
16 namespace panzer_stk {
21 ParameterListCallback::ParameterListCallback(
const std::string & coordFieldName,
25 : coordFieldName_(coordFieldName), fieldPatterns_(fps), connManager_(connManager), ugi_(ugi), coordinatesBuilt_(false)
36 for(itr=inputPL->
begin();itr!=inputPL->
end();++itr)
37 setFieldByKey(itr->first,*outputPL);
42 bool ParameterListCallback::handlesRequest(
const Teko::RequestMesg & rm)
46 if(rm.getName()==
"Parameter List")
return true;
50 void ParameterListCallback::preRequest(
const Teko::RequestMesg & rm)
62 "ParameterListCallback::setFieldByKey: Coordinates have not been built!");
64 double * x =
const_cast<double *
>(&xcoords_[0]);
65 double * y =
const_cast<double *
>(&ycoords_[0]);
66 double * z =
const_cast<double *
>(&zcoords_[0]);
68 if(key==
"x-coordinates")
69 pl.
set<
double*>(key,x);
70 else if(key==
"y-coordinates")
71 pl.
set<
double*>(key,y);
72 else if(key==
"z-coordinates")
73 pl.
set<
double*>(key,z);
76 "ParameterListCallback cannot handle key=\"" << key <<
"\"");
79 void ParameterListCallback::buildArrayToVector()
81 if(arrayToVector_==Teuchos::null)
85 void ParameterListCallback::buildCoordinates()
89 std::map<std::string,Kokkos::DynRankView<double,PHX::Device> > data;
91 std::map<std::string,Teuchos::RCP<const panzer::Intrepid2FieldPattern> >::const_iterator itr;
92 for(itr=fieldPatterns_.begin();itr!=fieldPatterns_.end();++itr) {
93 std::string blockId = itr->first;
95 std::vector<std::size_t> localCellIds;
98 Kokkos::DynRankView<double,PHX::Device> & fieldData = data[blockId];
99 fieldData = Kokkos::DynRankView<double,PHX::Device>(
"fieldData",connManager_->getElementBlock(blockId).size(),fieldPattern->
numberIds());
103 connManager_->getDofCoords(blockId,*fieldPattern,localCellIds,fieldData);
107 out.setOutputToRootOnly(-1);
108 out <<
"WARNING: In ParameterListCallback::buildCoordinates(), the Intrepid2::FieldPattern in "
109 <<
"block \"" << blockId <<
"\" does not support interpolatory coordinates. "
110 <<
"This may be fine if coordinates are not actually needed. However if they are then bad things "
111 <<
"will happen. Enjoy!" << std::endl;
113 coordinatesBuilt_ =
true;
119 = arrayToVector_->template getDataVector<double>(coordFieldName_,data);
121 switch(resultVec->getNumVectors()) {
123 zcoords_.resize(resultVec->getLocalLength());
124 resultVec->getVector(2)->get1dCopy(Teuchos::arrayViewFromVector(zcoords_));
127 ycoords_.resize(resultVec->getLocalLength());
128 resultVec->getVector(1)->get1dCopy(Teuchos::arrayViewFromVector(ycoords_));
131 xcoords_.resize(resultVec->getLocalLength());
132 resultVec->getVector(0)->get1dCopy(Teuchos::arrayViewFromVector(xcoords_));
136 "ParameterListCallback::buildCoordinates: Constructed multivector has nonphysical dimensions.");
140 coordinatesBuilt_ =
true;
ConstIterator end() const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
virtual int numberIds() const
bool supportsInterpolatoryCoordinates() const
Does this field pattern support interpolatory coordinates?
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
params_t::ConstIterator ConstIterator
ConstIterator begin() const
#define TEUCHOS_ASSERT(assertion_test)