41 if(geomAggPattern==Teuchos::null) {
42 std::vector<std::pair<FieldType,FPPtr>> patternVec;
45 auto itr = patterns.cbegin();
46 for(;itr!=patterns.cend();++itr)
47 patternVec.push_back(std::make_pair(std::get<1>(*itr),std::get<2>(*itr)));
66 "Geometric field pattern not yet set, call buildPatterns first");
68 return geomPattern->getDimension();
75 "Geometric field pattern not yet set, call buildPatterns first");
77 return geomPattern->getCellTopology();
93 "FieldAggPattern::getSubcellClosureIndices should not be called");
100 os <<
"FieldPattern: FieldAggPattern" << std::endl;
101 os <<
"FieldPattern: |numFields| = " <<
numFields_.size() << std::endl;
102 os <<
"FieldPattern: numFields = [ ";
104 for(std::size_t i=0;i<
numFields_.size();i++) {
106 total += numFields_[i];
108 os <<
"]" << std::endl;
109 os <<
"FieldPattern: |fieldIds| = " <<
fieldIds_.size() <<
" (" << total <<
")" << std::endl;
110 os <<
"FieldPattern: fieldIds = [ ";
111 for(std::size_t i=0;i<
fieldIds_.size();i++)
113 os <<
"]" << std::endl;
114 os <<
"FieldPattern: local offsets\n";
116 std::map<int,int>::const_iterator itr;
118 int fieldId = itr->first;
120 os <<
"FieldPattern: field " << itr->first <<
" = [ ";
121 for(std::size_t i=0;i<offsets.size();i++)
122 os << offsets[i] <<
" ";
123 os <<
"]" << std::endl;
131 "FieldID = " << fieldId <<
" not defined in this pattern");
133 return std::get<2>(
patterns_[idxIter->second]);
140 "FieldID = " << fieldId <<
" not defined in this pattern");
142 return std::get<1>(
patterns_[idxIter->second]);
150 for(;itr!=
patterns_.cend();++itr,++index)
160 numFields_.resize(geomAggPattern->numberIds(),0);
180 for(
int dim=0;dim<numDimensions;dim++) {
181 int numSubcell = geomAggPattern->getSubcellCount(dim);
182 for(
int subcell=0;subcell<numSubcell;subcell++) {
187 const std::vector<int> * geomIndices =
nullptr;
193 if (geomIndices->size() > 0) {
194 const int geomIndex = (*geomIndices)[0];
199 if (std::get<1>(*itr) == fieldType) {
200 const std::size_t fieldSize = std::get<2>(*itr)->getSubcellIndices(dim,subcell).size();
203 for (std::size_t i=0;i<fieldSize;++i)
225 for(
int d=0;d<dimension+1;d++) {
226 int numSubcell = geomIdsPattern->getSubcellCount(d);
230 for(
int sc=0;sc<numSubcell;sc++) {
233 const std::vector<int> & geomIds = geomIdsPattern->getSubcellIndices(d,sc);
235 if (geomIds.size() > 0) {
236 const int geomId = geomIds[0];
248 std::map<int,std::vector<int> >::const_iterator itr =
fieldOffsets_.find(fieldId);
264 const auto hostOffsetsStdVector = this->localOffsets(fieldId);
265 PHX::View<int*>
offsets(
"panzer::FieldAggPattern::localOffsetsKokkos",hostOffsetsStdVector.size());
266 auto hostOffsets = Kokkos::create_mirror_view(
offsets);
267 for (
size_t i=0; i < hostOffsetsStdVector.size(); ++i)
268 hostOffsets(i) = hostOffsetsStdVector[i];
269 Kokkos::deep_copy(
offsets,hostOffsets);
276 if(a[0] < b[0])
return true;
277 if(a[0] > b[0])
return false;
280 if(a[1] < b[1])
return true;
281 if(a[1] > b[1])
return false;
284 if(a[2] < b[2])
return true;
285 if(a[2] > b[2])
return false;
292 const std::pair<std::vector<int>,std::vector<int> > &
296 typedef std::map<Teuchos::Tuple<int,3>, std::pair<std::vector<int>,std::vector<int> >,
LessThan> OffsetMap;
300 OffsetMap::const_iterator itr
307 "FieldAggPattern::localOffsets_closure precondition subcellDim<getDimension() failed");
309 "FieldAggPattern::localOffsets_closure precondition subcellId>=0 failed");
311 "FieldAggPattern::localOffsets_closure precondition subcellId<getSubcellCount(subcellDim) failed");
315 const std::vector<int> & fieldOffsets =
localOffsets(fieldId);
318 std::vector<int> closureOffsets;
320 fieldPattern->getSubcellClosureIndices(subcellDim,subcellId,closureOffsets);
323 std::pair<std::vector<int>,std::vector<int> > & indicesPair
326 std::vector<int> & closureIndices = indicesPair.first;
327 for(std::size_t i=0;i<closureOffsets.size();i++)
328 closureIndices.push_back(fieldOffsets[closureOffsets[i]]);
330 std::vector<int> & basisIndices = indicesPair.second;
331 basisIndices.assign(closureOffsets.begin(),closureOffsets.end());
352 offsets.resize(fieldPattern->numberIds(),-111111);
356 std::vector<int> fieldIdsGeomOrder;
357 for(std::size_t i=0;i<
fieldIds_.size();++i) {
359 fieldIdsGeomOrder.push_back(i);
363 TEUCHOS_ASSERT((
int) fieldIdsGeomOrder.size()==fieldPattern->numberIds());
368 for(
int dim=0;dim<geomPattern.getDimension()+1;dim++) {
369 for(
int sc=0;sc<geomPattern.getSubcellCount(dim);sc++) {
370 const std::vector<int> & fIndices = fieldPattern->getSubcellIndices(dim,sc);
372 for(std::size_t i=0;i<fIndices.size();i++)
373 offsets[fIndices[i]] = fieldIdsGeomOrder[cnt++];
378 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< 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.
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)
PHX::View< const int * > offsets
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.
std::map< int, PHX::View< int * > > fieldOffsetsKokkos_
Stores the Field offsets for the fieldId key. Note that the key is the fieldId, not the index into th...
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
const PHX::View< const int * > localOffsetsKokkos(int fieldId) const
void buildFieldIdsVector()
virtual const std::vector< int > & getSubcellIndices(int dimension, int subcell) const
#define TEUCHOS_ASSERT(assertion_test)
virtual shards::CellTopology getCellTopology() const
std::vector< int > fieldIds_
void mergeFieldPatterns(const FieldType &fieldType)
const std::vector< int > & localOffsets(int fieldId) const