73 if(geomAggPattern==Teuchos::null) {
74 std::vector<std::pair<FieldType,FPPtr>> patternVec;
77 auto itr = patterns.cbegin();
78 for(;itr!=patterns.cend();++itr)
79 patternVec.push_back(std::make_pair(std::get<1>(*itr),std::get<2>(*itr)));
98 "Geometric field pattern not yet set, call buildPatterns first");
100 return geomPattern->getDimension();
107 "Geometric field pattern not yet set, call buildPatterns first");
109 return geomPattern->getCellTopology();
125 "FieldAggPattern::getSubcellClosureIndices should not be called");
132 os <<
"FieldPattern: FieldAggPattern" << std::endl;
133 os <<
"FieldPattern: |numFields| = " <<
numFields_.size() << std::endl;
134 os <<
"FieldPattern: numFields = [ ";
136 for(std::size_t i=0;i<
numFields_.size();i++) {
138 total += numFields_[i];
140 os <<
"]" << std::endl;
141 os <<
"FieldPattern: |fieldIds| = " <<
fieldIds_.size() <<
" (" << total <<
")" << std::endl;
142 os <<
"FieldPattern: fieldIds = [ ";
143 for(std::size_t i=0;i<
fieldIds_.size();i++)
145 os <<
"]" << std::endl;
146 os <<
"FieldPattern: local offsets\n";
148 std::map<int,int>::const_iterator itr;
150 int fieldId = itr->first;
152 os <<
"FieldPattern: field " << itr->first <<
" = [ ";
153 for(std::size_t i=0;i<offsets.size();i++)
154 os << offsets[i] <<
" ";
155 os <<
"]" << std::endl;
163 "FieldID = " << fieldId <<
" not defined in this pattern");
165 return std::get<2>(
patterns_[idxIter->second]);
172 "FieldID = " << fieldId <<
" not defined in this pattern");
174 return std::get<1>(
patterns_[idxIter->second]);
182 for(;itr!=
patterns_.cend();++itr,++index)
192 numFields_.resize(geomAggPattern->numberIds(),0);
212 for(
int dim=0;dim<numDimensions;dim++) {
213 int numSubcell = geomAggPattern->getSubcellCount(dim);
214 for(
int subcell=0;subcell<numSubcell;subcell++) {
219 const std::vector<int> * geomIndices =
nullptr;
225 if (geomIndices->size() > 0) {
226 const int geomIndex = (*geomIndices)[0];
231 if (std::get<1>(*itr) == fieldType) {
232 const std::size_t fieldSize = std::get<2>(*itr)->getSubcellIndices(dim,subcell).size();
235 for (std::size_t i=0;i<fieldSize;++i)
257 for(
int d=0;d<dimension+1;d++) {
258 int numSubcell = geomIdsPattern->getSubcellCount(d);
262 for(
int sc=0;sc<numSubcell;sc++) {
265 const std::vector<int> & geomIds = geomIdsPattern->getSubcellIndices(d,sc);
267 if (geomIds.size() > 0) {
268 const int geomId = geomIds[0];
280 std::map<int,std::vector<int> >::const_iterator itr =
fieldOffsets_.find(fieldId);
292 std::map<int,Kokkos::View<int*,PHX::Device> >::const_iterator itr =
fieldOffsetsKokkos_.find(fieldId);
296 const auto hostOffsetsStdVector = this->localOffsets(fieldId);
297 Kokkos::View<int*,PHX::Device>
offsets(
"panzer::FieldAggPattern::localOffsetsKokkos",hostOffsetsStdVector.size());
298 auto hostOffsets = Kokkos::create_mirror_view(
offsets);
299 for (
size_t i=0; i < hostOffsetsStdVector.size(); ++i)
300 hostOffsets(i) = hostOffsetsStdVector[i];
301 Kokkos::deep_copy(
offsets,hostOffsets);
302 PHX::Device::fence();
310 if(a[0] < b[0])
return true;
311 if(a[0] > b[0])
return false;
314 if(a[1] < b[1])
return true;
315 if(a[1] > b[1])
return false;
318 if(a[2] < b[2])
return true;
319 if(a[2] > b[2])
return false;
326 const std::pair<std::vector<int>,std::vector<int> > &
330 typedef std::map<Teuchos::Tuple<int,3>, std::pair<std::vector<int>,std::vector<int> >,
LessThan> OffsetMap;
334 OffsetMap::const_iterator itr
341 "FieldAggPattern::localOffsets_closure precondition subcellDim<getDimension() failed");
343 "FieldAggPattern::localOffsets_closure precondition subcellId>=0 failed");
345 "FieldAggPattern::localOffsets_closure precondition subcellId<getSubcellCount(subcellDim) failed");
349 const std::vector<int> & fieldOffsets =
localOffsets(fieldId);
352 std::vector<int> closureOffsets;
354 fieldPattern->getSubcellClosureIndices(subcellDim,subcellId,closureOffsets);
357 std::pair<std::vector<int>,std::vector<int> > & indicesPair
360 std::vector<int> & closureIndices = indicesPair.first;
361 for(std::size_t i=0;i<closureOffsets.size();i++)
362 closureIndices.push_back(fieldOffsets[closureOffsets[i]]);
364 std::vector<int> & basisIndices = indicesPair.second;
365 basisIndices.assign(closureOffsets.begin(),closureOffsets.end());
386 offsets.resize(fieldPattern->numberIds(),-111111);
390 std::vector<int> fieldIdsGeomOrder;
391 for(std::size_t i=0;i<
fieldIds_.size();++i) {
393 fieldIdsGeomOrder.push_back(i);
397 TEUCHOS_ASSERT((
int) fieldIdsGeomOrder.size()==fieldPattern->numberIds());
402 for(
int dim=0;dim<geomPattern.getDimension()+1;dim++) {
403 for(
int sc=0;sc<geomPattern.getSubcellCount(dim);sc++) {
404 const std::vector<int> & fIndices = fieldPattern->getSubcellIndices(dim,sc);
406 for(std::size_t i=0;i<fIndices.size();i++)
407 offsets[fIndices[i]] = fieldIdsGeomOrder[cnt++];
412 for(std::size_t i=0;i<offsets.size();i++) {
void buildFieldPatternData()
const std::pair< std::vector< int >, std::vector< int > > & localOffsets_closure(int fieldId, int subcellDim, int subcellId) const
std::map< int, std::vector< int > > fieldOffsets_
Stores the Field offsets for the fieldId key. Note that the key is the fieldId, not the index into th...
std::map< int, Kokkos::View< int *, PHX::Device > > fieldOffsetsKokkos_
Stores the Field offsets for the fieldId key. Note that the key is the fieldId, not the index into th...
std::map< Teuchos::Tuple< int, 3 >, std::pair< std::vector< int >, std::vector< int > >, LessThan > fieldSubcellOffsets_closure_
std::vector< int > numFields_
virtual Teuchos::RCP< const FieldPattern > getFieldPattern(int fieldId) const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual Teuchos::RCP< const FieldPattern > getGeometricAggFieldPattern() const
std::map< int, int > fieldIdToPatternIdx_
virtual int getSubcellCount(int dimension) const
std::vector< std::vector< std::vector< int > > > patternData_
FieldType
The type of discretization to use for a field pattern.
const Kokkos::View< const int *, PHX::Device > localOffsetsKokkos(int fieldId) const
virtual FieldType getFieldType(int fieldId) const
virtual int getDimension() const
Teuchos::RCP< const FieldPattern > geomAggPattern_
virtual void getSubcellClosureIndices(int, int, std::vector< int > &) const
virtual void buildPattern(const std::vector< std::tuple< int, panzer::FieldType, Teuchos::RCP< const FieldPattern > > > &patterns, const Teuchos::RCP< const FieldPattern > &geomAggPattern=Teuchos::null)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void buildFieldIdToPatternIdx()
void localOffsets_build(int fieldId, std::vector< int > &offsets) const
Continuous Galerkin Formulation.
virtual void print(std::ostream &os) const
virtual void print(std::ostream &os) const
Print this pattern.
std::vector< std::tuple< int, panzer::FieldType, Teuchos::RCP< const FieldPattern > > > patterns_
bool operator()(const Teuchos::Tuple< int, 3 > &a, const Teuchos::Tuple< int, 3 > &b) const
void buildFieldIdsVector()
virtual const std::vector< int > & getSubcellIndices(int dimension, int subcell) const
#define TEUCHOS_ASSERT(assertion_test)
virtual shards::CellTopology getCellTopology() const
Kokkos::View< const int *, PHX::Device > offsets
std::vector< int > fieldIds_
void mergeFieldPatterns(const FieldType &fieldType)
const std::vector< int > & localOffsets(int fieldId) const