43 #include "PanzerAdaptersSTK_config.hpp"
48 #include "Kokkos_DynRankView.hpp"
50 #include <stk_mesh/base/FieldBase.hpp>
52 namespace panzer_stk {
54 template <
typename GlobalOrdinal>
56 const Epetra_Vector & x,
const std::vector<std::size_t> & localCellIds,
57 std::map<std::string,Kokkos::DynRankView<double,PHX::Device> > & fc);
60 std::map<std::string,
Teuchos::RCP<std::vector<std::size_t> > > & localIds);
64 std::vector<std::string> blocks;
68 for(std::size_t eb=0;eb<blocks.size();eb++) {
69 const std::string & blockId = blocks[eb];
72 std::vector<stk::mesh::Entity> elements;
76 for(std::size_t el=0;el<elements.size();el++) {
78 double * solnData = stk::mesh::field_data(*field,elements[el]);
80 solnData[0] = data[localId];
85 template <
typename GlobalOrdinal>
93 #ifdef PANZER_HAVE_LONG_LONG_INT
98 template <
typename GlobalOrdinal>
101 typedef Kokkos::DynRankView<double,PHX::Device> FieldContainer;
104 std::map<std::string,Teuchos::RCP<std::vector<std::size_t> > > localIds;
108 std::map<std::string,Teuchos::RCP<std::vector<std::size_t> > >::const_iterator itr;
109 for(itr=localIds.begin();itr!=localIds.end();++itr) {
110 std::string blockId = itr->first;
111 const std::vector<std::size_t> & localCellIds = *(itr->second);
113 std::map<std::string,FieldContainer> data;
119 std::map<std::string,FieldContainer>::iterator dataItr;
120 for(dataItr=data.begin();dataItr!=data.end();++dataItr)
127 #ifdef PANZER_HAVE_LONG_LONG_INT
133 template <
typename GlobalOrdinal>
135 const Epetra_Vector & x,
const std::vector<std::size_t> & localCellIds,
136 std::map<std::string,Kokkos::DynRankView<double,PHX::Device> > & fc)
140 for(std::size_t fieldIndex=0;fieldIndex<fieldNums.size();fieldIndex++) {
141 int fieldNum = fieldNums[fieldIndex];
146 fc[fieldStr] = Kokkos::DynRankView<double,PHX::Device>(
"fc",localCellIds.size(),elmtOffset.size());
149 for(std::size_t worksetCellIndex=0;worksetCellIndex<localCellIds.size();++worksetCellIndex) {
150 std::vector<GlobalOrdinal> GIDs;
151 std::vector<int> LIDs;
152 std::size_t cellLocalId = localCellIds[worksetCellIndex];
157 LIDs.resize(GIDs.size());
158 for(std::size_t i=0;i<GIDs.size();i++)
159 LIDs[i] = x.Map().LID(GIDs[i]);
162 for(std::size_t basis=0;basis<elmtOffset.size();basis++) {
163 int offset = elmtOffset[basis];
164 int lid = LIDs[offset];
165 fc[fieldStr](worksetCellIndex,basis) = x[lid];
172 std::map<std::string,
Teuchos::RCP<std::vector<std::size_t> > > & localIds)
175 std::vector<std::string> blockIds;
178 std::vector<std::string>::const_iterator idItr;
179 for(idItr=blockIds.begin();idItr!=blockIds.end();++idItr) {
180 std::string blockId = *idItr;
182 localIds[blockId] =
Teuchos::rcp(
new std::vector<std::size_t>);
183 std::vector<std::size_t> & localBlockIds = *localIds[blockId];
186 std::vector<stk::mesh::Entity> blockElmts;
189 std::vector<stk::mesh::Entity>::const_iterator itr;
190 for(itr=blockElmts.begin();itr!=blockElmts.end();++itr)
193 std::sort(localBlockIds.begin(),localBlockIds.end());
virtual void getElementGIDs(LocalOrdinalT localElmtId, std::vector< GlobalOrdinalT > &gids, const std::string &blockIdHint="") const =0
Get the global IDs for a particular element. This function overwrites the gids variable.
void setSolutionFieldData(const std::string &fieldName, const std::string &blockId, const std::vector< std::size_t > &localElementIds, const ArrayT &solutionValues, double scaleValue=1.0)
void getElementBlockNames(std::vector< std::string > &names) const
stk::mesh::Field< double > SolutionFieldType
void write_solution_data(const panzer::UniqueGlobalIndexer< int, GlobalOrdinal > &dofMngr, panzer_stk::STK_Interface &mesh, const Epetra_MultiVector &x, const std::string &prefix, const std::string &postfix)
virtual const std::vector< int > & getGIDFieldOffsets(const std::string &blockId, int fieldNum) const =0
Use the field pattern so that you can find a particular field in the GIDs array.
std::size_t elementLocalId(stk::mesh::Entity elmt) const
static void gather_in_block(const std::string &blockId, const panzer::UniqueGlobalIndexer< int, GlobalOrdinal > &dofMngr, const Epetra_Vector &x, const std::vector< std::size_t > &localCellIds, std::map< std::string, Kokkos::DynRankView< double, PHX::Device > > &fc)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
template void write_solution_data< int >(const panzer::UniqueGlobalIndexer< int, int > &dofMngr, panzer_stk::STK_Interface &mesh, const Epetra_MultiVector &x, const std::string &prefix, const std::string &postfix)
static void build_local_ids(const panzer_stk::STK_Interface &mesh, std::map< std::string, Teuchos::RCP< std::vector< std::size_t > > > &localIds)
virtual const std::string & getFieldString(int num) const =0
Reverse lookup of the field string from a field number.
void write_cell_data(panzer_stk::STK_Interface &mesh, const std::vector< double > &data, const std::string &fieldName)
PHX::MDField< ScalarT, panzer::Cell, panzer::BASIS > field
A field to which we'll contribute, or in which we'll store, the result of computing this integral...
virtual const std::vector< int > & getBlockFieldNumbers(const std::string &blockId) const =0
#define TEUCHOS_ASSERT(assertion_test)
void getMyElements(std::vector< stk::mesh::Entity > &elements) const
stk::mesh::Field< double > * getCellField(const std::string &fieldName, const std::string &blockId) const