43 #include "PanzerAdaptersSTK_config.hpp"
44 #ifdef PANZER_HAVE_TEKO
48 namespace panzer_stk {
53 ParameterListCallback::ParameterListCallback(
const std::string & coordFieldName,
57 : coordFieldName_(coordFieldName), fieldPatterns_(fps), connManager_(connManager), ugi_(ugi), coordinatesBuilt_(false)
68 for(itr=inputPL->
begin();itr!=inputPL->
end();++itr)
69 setFieldByKey(itr->first,*outputPL);
74 bool ParameterListCallback::handlesRequest(
const Teko::RequestMesg & rm)
78 if(rm.getName()==
"Parameter List")
return true;
82 void ParameterListCallback::preRequest(
const Teko::RequestMesg & rm)
94 "ParameterListCallback::setFieldByKey: Coordinates have not been built!");
96 double * x =
const_cast<double *
>(&xcoords_[0]);
97 double * y =
const_cast<double *
>(&ycoords_[0]);
98 double * z =
const_cast<double *
>(&zcoords_[0]);
100 if(key==
"x-coordinates")
101 pl.
set<
double*>(key,x);
102 else if(key==
"y-coordinates")
103 pl.
set<
double*>(key,y);
104 else if(key==
"z-coordinates")
105 pl.
set<
double*>(key,z);
108 "ParameterListCallback cannot handle key=\"" << key <<
"\"");
111 void ParameterListCallback::buildArrayToVector()
113 if(arrayToVector_==Teuchos::null)
117 void ParameterListCallback::buildCoordinates()
121 std::map<std::string,Kokkos::DynRankView<double,PHX::Device> > data;
123 std::map<std::string,Teuchos::RCP<const panzer::Intrepid2FieldPattern> >::const_iterator itr;
124 for(itr=fieldPatterns_.begin();itr!=fieldPatterns_.end();++itr) {
125 std::string blockId = itr->first;
127 std::vector<std::size_t> localCellIds;
130 Kokkos::DynRankView<double,PHX::Device> & fieldData = data[blockId];
131 fieldData = Kokkos::DynRankView<double,PHX::Device>(
"fieldData",connManager_->getElementBlock(blockId).size(),fieldPattern->
numberIds());
135 connManager_->getDofCoords(blockId,*fieldPattern,localCellIds,fieldData);
139 out.setOutputToRootOnly(-1);
140 out <<
"WARNING: In ParameterListCallback::buildCoordinates(), the Intrepid2::FieldPattern in "
141 <<
"block \"" << blockId <<
"\" does not support interpolatory coordinates. "
142 <<
"This may be fine if coordinates are not actually needed. However if they are then bad things "
143 <<
"will happen. Enjoy!" << std::endl;
145 coordinatesBuilt_ =
true;
151 = arrayToVector_->template getDataVector<double>(coordFieldName_,data);
153 switch(resultVec->getNumVectors()) {
155 zcoords_.resize(resultVec->getLocalLength());
156 resultVec->getVector(2)->get1dCopy(Teuchos::arrayViewFromVector(zcoords_));
159 ycoords_.resize(resultVec->getLocalLength());
160 resultVec->getVector(1)->get1dCopy(Teuchos::arrayViewFromVector(ycoords_));
163 xcoords_.resize(resultVec->getLocalLength());
164 resultVec->getVector(0)->get1dCopy(Teuchos::arrayViewFromVector(xcoords_));
168 "ParameterListCallback::buildCoordinates: Constructed multivector has nonphysical dimensions.");
172 coordinatesBuilt_ =
true;
ConstIterator end() const
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
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)