43 #ifndef PANZER_BLOCKED_DOF_MANAGER_IMPL_HPP
44 #define PANZER_BLOCKED_DOF_MANAGER_IMPL_HPP
62 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
64 : fieldsRegistered_(false), maxSubFieldNum_(-1), requireOrientations_(false), useDOFManagerFEI_(true), useTieBreak_(false)
67 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
69 : fieldsRegistered_(false), maxSubFieldNum_(-1), requireOrientations_(false), useDOFManagerFEI_(true), useTieBreak_(false)
77 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
80 std::map<std::string,int>::const_iterator itr = fieldStrToNum_.find(str);
83 if(itr==fieldStrToNum_.end()) {
86 "BlockedDOFManager::getFieldNum No field with the name \"" + str +
"\" has been added");
93 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
96 std::map<int,std::string>::const_iterator itr = fieldNumToStr_.find(number);
99 if(itr==fieldNumToStr_.end()) {
100 std::stringstream ss; ss << number;
103 "BlockedDOFManager::getFieldString No field with number \"" + ss.str() +
"\" has been added");
110 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
114 std::map<std::string,std::set<std::string> >::const_iterator fieldsItr = blockIdToFieldStrings_.find(block);
116 "BlockedDOFManager::fieldInBlock could not find the element block \""+block+
"\"");
119 const std::set<std::string> & fields = fieldsItr->second;
120 std::set<std::string>::const_iterator itr = fields.find(field);
121 return itr!=fields.end();
126 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
130 std::map<std::string,std::vector<int> >::const_iterator fieldsItr = blockIdToFieldNumbers_.find(block);
131 if(fieldsItr!=blockIdToFieldNumbers_.end())
132 return fieldsItr->second;
135 static std::vector<int> empty;
139 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
153 for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
154 std::vector<GlobalOrdinalT> fieldBlockOwned;
156 fieldBlockManagers_[fbm]->getElementGIDs(localElmtId,fieldBlockOwned,blockIdHint);
158 for(std::size_t i=0;i<fieldBlockOwned.size();i++)
159 gids.push_back(std::make_pair(fbm,fieldBlockOwned[i]));
163 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
174 gidsOrientation.resize(0);
177 for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
178 std::vector<double> blkOrientation;
180 fieldBlockManagers_[fbm]->getElementOrientation(localElmtId,blkOrientation);
182 for(std::size_t i=0;i<blkOrientation.size();i++)
183 gidsOrientation.push_back(blkOrientation[i]);
187 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
190 typedef std::map<std::string,std::map<int,std::vector<int> > > FieldOffsetsMap;
192 FieldOffsetsMap::iterator blockItr = gidFieldOffsets_.find(blockId);
193 if(blockItr!=gidFieldOffsets_.end()) {
194 std::map<int,std::vector<int> > & fieldToVectorMap = blockItr->second;
195 std::map<int,std::vector<int> >::const_iterator itr = fieldToVectorMap.find(fieldNum);
198 if(itr!=fieldToVectorMap.end())
202 std::vector<std::string> elementBlocks;
203 getElementBlockIds(elementBlocks);
204 TEUCHOS_TEST_FOR_EXCEPTION(std::find(elementBlocks.begin(),elementBlocks.end(),blockId)==elementBlocks.end(),std::logic_error,
205 "BlockedDOFManager::getGIDFieldOffsets: Block ID \""+blockId+
"\" does not exist");
207 gidFieldOffsets_[blockId] = std::map<int,std::vector<int> >();
208 blockItr = gidFieldOffsets_.find(blockId);
212 std::map<int,std::vector<int> > & fieldToVectorMap = blockItr->second;
222 const std::vector<int> & subGIDOffsets
223 = dofManager->getGIDFieldOffsets(blockId,dofManager->getFieldNum(getFieldString(fieldNum)));
226 int gidOffset = getBlockGIDOffset(blockId,fieldBlock);
227 std::vector<int> & finalFieldOffsets = fieldToVectorMap[fieldNum];
228 finalFieldOffsets.resize(subGIDOffsets.size());
229 for(std::size_t i=0;i<finalFieldOffsets.size();i++)
230 finalFieldOffsets[i] = gidOffset+subGIDOffsets[i];
232 return finalFieldOffsets;
235 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
239 if(a[0] < b[0])
return true;
240 if(a[0] > b[0])
return false;
243 if(a[1] < b[1])
return true;
244 if(a[1] > b[1])
return false;
247 if(a[2] < b[2])
return true;
248 if(a[2] > b[2])
return false;
254 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
255 const std::pair<std::vector<int>,std::vector<int> > &
258 typename std::map<std::string,TupleToVectorPairMap>::iterator blockItr = gidFieldOffsets_closure_.find(blockId);
259 if(blockItr!=gidFieldOffsets_closure_.end()) {
261 typename TupleToVectorPairMap::const_iterator itr =
262 fieldToTupleMap.find(Teuchos::tuple(fieldNum,subcellDim,subcellId));
265 if(itr!=fieldToTupleMap.end())
269 std::vector<std::string> elementBlocks;
270 getElementBlockIds(elementBlocks);
271 TEUCHOS_TEST_FOR_EXCEPTION(std::find(elementBlocks.begin(),elementBlocks.end(),blockId)==elementBlocks.end(),std::logic_error,
272 "BlockedDOFManager::getGIDFieldOffsets: Block ID \""+blockId+
"\" does not exist");
275 blockItr = gidFieldOffsets_closure_.find(blockId);
289 const std::pair<std::vector<int>,std::vector<int> > & subGIDOffsets_closure
290 = dofManager->getGIDFieldOffsets_closure(blockId,dofManager->getFieldNum(getFieldString(fieldNum)),subcellDim,subcellId);
293 int gidOffset = getBlockGIDOffset(blockId,fieldBlock);
294 std::pair<std::vector<int>,std::vector<int> > & finalFieldOffsets = fieldToTupleMap[Teuchos::tuple(fieldNum,subcellDim,subcellId)];
295 finalFieldOffsets.first.resize(subGIDOffsets_closure.first.size());
296 finalFieldOffsets.second = subGIDOffsets_closure.second;
297 for(std::size_t i=0;i<finalFieldOffsets.first.size();i++)
298 finalFieldOffsets.first[i] = gidOffset+subGIDOffsets_closure.first[i];
300 return finalFieldOffsets;
308 template<
typename LocalOrdinalT,
typename GlobalOrdinalT>
312 std::vector<GlobalOrdinal>& indices)
const
314 using std::make_pair;
317 for (
size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
319 vector<GlobalOrdinalT> fieldBlockOwned;
320 fieldBlockManagers_[fbm]->getOwnedIndices(fieldBlockOwned);
321 for (
size_t i(0); i < fieldBlockOwned.size(); ++i)
322 indices.push_back(make_pair(fbm, fieldBlockOwned[i]));
331 template<
typename LocalOrdinalT,
typename GlobalOrdinalT>
335 std::vector<GlobalOrdinal>& indices)
const
337 using std::make_pair;
340 for (
size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
342 vector<GlobalOrdinalT> fieldBlockGhosted;
343 fieldBlockManagers_[fbm]->getGhostedIndices(fieldBlockGhosted);
344 for (
size_t i(0); i < fieldBlockGhosted.size(); ++i)
345 indices.push_back(make_pair(fbm, fieldBlockGhosted[i]));
354 template<
typename LocalOrdinalT,
typename GlobalOrdinalT>
358 std::vector<GlobalOrdinal>& indices)
const
360 using std::make_pair;
363 for (
size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
365 vector<GlobalOrdinalT> fieldBlockOwnedAndGhosted;
366 fieldBlockManagers_[fbm]->getOwnedAndGhostedIndices(
367 fieldBlockOwnedAndGhosted);
368 for (
size_t i(0); i < fieldBlockOwnedAndGhosted.size(); ++i)
369 indices.push_back(make_pair(fbm, fieldBlockOwnedAndGhosted[i]));
378 template<
typename LocalOrdinalT,
typename GlobalOrdinalT>
385 for (
size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
386 result += fieldBlockManagers_[fbm]->getNumOwned();
395 template<
typename LocalOrdinalT,
typename GlobalOrdinalT>
402 for (
size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
403 result += fieldBlockManagers_[fbm]->getNumGhosted();
412 template<
typename LocalOrdinalT,
typename GlobalOrdinalT>
419 for (
size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
420 result += fieldBlockManagers_[fbm]->getNumOwnedAndGhosted();
424 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
429 std::vector<std::vector<GlobalOrdinalT> > blockIndices(fieldBlockManagers_.size());
430 for(std::size_t i=0;i<indices.size();i++)
431 blockIndices[indices[i].first].push_back(indices[i].second);
434 std::vector<std::vector<bool> > blockIsOwned(fieldBlockManagers_.size());
435 std::vector<std::vector<bool>::const_iterator> blockItrs;
436 for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
437 fieldBlockManagers_[fbm]->ownedIndices(blockIndices[fbm],blockIsOwned[fbm]);
440 blockItrs.push_back(blockIsOwned[fbm].begin());
445 for(std::size_t i=0;i<indices.size();i++) {
446 int block = indices[i].first;
449 bool owned = *blockItrs[block];
450 isOwned.push_back(owned);
458 for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
460 "BlockedDOFManager::ownedIndices: Did not consume all sub block boolean entries as expected.");
481 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
489 connMngr_ = connMngr;
491 mpiComm_ = *communicator_->getRawMpiComm();
502 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
507 connMngr_ = Teuchos::null;
508 ownedGIDHashTable_.clear();
509 blockGIDOffset_.clear();
514 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
518 std::vector<std::string> elementBlockIds;
519 connMngr_->getElementBlockIds(elementBlockIds);
522 for(std::size_t i=0;i<elementBlockIds.size();i++)
523 addField(elementBlockIds[i],str,pattern);
526 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
531 "BlockedDOFManager::addField: addField cannot be called after registerFields or"
532 "buildGlobalUnknowns has been called");
534 fieldStringToPattern_[std::make_pair(blockId,str)] = pattern;
535 blockIdToFieldStrings_[blockId].insert(str);
538 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
542 fieldBlockManagers_.clear();
543 fieldStrToNum_.clear();
544 fieldNumToStr_.clear();
545 fieldNumToFieldBlk_.clear();
546 maxSubFieldNum_ = -1;
548 fieldsRegistered_ =
false;
553 std::set<std::string> fields;
555 fieldItr=fieldStringToPattern_.begin(); fieldItr!=fieldStringToPattern_.end();++fieldItr) {
556 std::string fieldName = fieldItr->first.second;
557 fields.insert(fieldName);
561 if(fieldOrder_.size()==0) {
562 std::set<std::string>::const_iterator itr;
563 for(itr=fields.begin();itr!=fields.end();itr++) {
564 std::vector<std::string> block;
565 block.push_back(*itr);
566 fieldOrder_.push_back(block);
571 bool validOrder = validFieldOrder(fieldOrder_,fields);
574 std::stringstream ss;
576 ss <<
"BlockedDOFManager::registerFields - Field order is invalid!\n";
578 ss <<
" fields = [ ";
579 for(std::set<std::string>::const_iterator itr=fields.begin();
580 itr!=fields.end();++itr)
581 ss <<
"\"" << *itr <<
"\" ";
584 ss <<
" fieldOrder = [ ";
585 for(std::vector<std::vector<std::string> >::const_iterator bitr=fieldOrder_.begin();
586 bitr!=fieldOrder_.end();++bitr) {
588 for(std::vector<std::string>::const_iterator itr=bitr->begin();
589 itr!=bitr->end();++itr) {
590 ss <<
"\"" << *itr <<
"\" ";
602 for(std::size_t fldBlk=0;fldBlk<fieldOrder_.size();fldBlk++) {
606 this->addFieldsToFieldBlockManager(fieldOrder_[fldBlk],*dofManager);
608 fieldBlockManagers_.push_back(dofManager);
620 maxSubFieldNum_ = -1;
621 std::map<std::string,int> tempStrToNum;
622 for(std::size_t fldBlk=0;fldBlk<fieldBlockManagers_.size();fldBlk++) {
624 fieldBlockManagers_[fldBlk];
625 const std::vector<std::string> & activeFields = fieldOrder_[fldBlk];
628 for(std::size_t f=0;f<activeFields.size();f++) {
629 fieldNum = dofManager->getFieldNum(activeFields[f]);
630 tempStrToNum[activeFields[f]] = fieldNum;
632 maxSubFieldNum_ = (fieldNum>maxSubFieldNum_) ? fieldNum : maxSubFieldNum_;
639 for(std::size_t fldBlk=0;fldBlk<fieldBlockManagers_.size();fldBlk++) {
640 const std::vector<std::string> & activeFields = fieldOrder_[fldBlk];
642 for(std::size_t f=0;f<activeFields.size();f++) {
644 int fieldNum = tempStrToNum[activeFields[f]]+numOffset;
647 fieldStrToNum_[activeFields[f]] = fieldNum;
648 fieldNumToStr_[fieldNum] = activeFields[f];
649 fieldNumToFieldBlk_[fieldNum] = fldBlk;
653 numOffset += (maxSubFieldNum_+1);
661 for(std::map<std::string,std::set<std::string> >::const_iterator itr=blockIdToFieldStrings_.begin();
662 itr!=blockIdToFieldStrings_.end();++itr) {
663 const std::set<std::string> & fields = itr->second;
665 std::vector<int> & fieldNums = blockIdToFieldNumbers_[itr->first];
666 for(std::set<std::string>::const_iterator fldItr=fields.begin();
667 fldItr!=fields.end();++fldItr) {
668 fieldNums.push_back(getFieldNum(*fldItr));
673 fieldsRegistered_ =
true;
676 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
682 dofManager->enableTieBreak(useTieBreak_);
683 dofManager->setConnManager(connManager,mpiComm);
689 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
694 using Teuchos::rcp_dynamic_cast;
700 if(dofManager!=Teuchos::null) {
701 dofManager->setOrientationsRequired(required);
710 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
715 using Teuchos::rcp_dynamic_cast;
721 if(dofManager!=Teuchos::null) {
722 dofManager->buildGlobalUnknowns(geomPattern);
731 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
736 using Teuchos::rcp_dynamic_cast;
742 if(dofManager!=Teuchos::null) {
743 dofManager->printFieldInformation(os);
752 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
757 using Teuchos::rcp_dynamic_cast;
761 return indexer->getElementBlockGIDCount(elementBlock);
764 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
769 using Teuchos::rcp_dynamic_cast;
773 return indexer->getElementBlockGIDCount(elementBlock);
776 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
781 for(std::size_t i=0;i<fieldBlockManagers_.size();i++)
782 gidCount += fieldBlockManagers_[i]->getElementBlockGIDCount(elementBlock);
787 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
792 for(std::size_t i=0;i<fieldBlockManagers_.size();i++)
793 gidCount += fieldBlockManagers_[i]->getElementBlockGIDCount(elementBlock);
798 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
804 using Teuchos::ptrFromRef;
805 using Teuchos::ptr_dynamic_cast;
807 Ptr<UniqueGlobalIndexer<LocalOrdinalT,GlobalOrdinalT> > ugi_ptr = ptrFromRef(fieldBlockManager);
813 if(dofManager_ptr!=Teuchos::null) {
814 addFieldsToFieldBlockManager(activeFields,*dofManager_ptr);
823 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
828 std::vector<std::size_t> correctnessCheck(activeFields.size(),0);
829 std::vector<std::string> elementBlocks;
830 this->getElementBlockIds(elementBlocks);
833 for(std::size_t eb=0;eb<elementBlocks.size();eb++) {
834 std::string elementBlock = elementBlocks[eb];
837 for(std::size_t f=0;f<activeFields.size();f++) {
838 std::string fieldName = activeFields[f];
841 if(fp!=Teuchos::null) {
842 fieldBlockManager.
addField(elementBlock,fieldName,fp);
843 correctnessCheck[f] = 1;
849 std::size_t correctFlag = std::accumulate(correctnessCheck.begin(),correctnessCheck.end(),0);
851 "BlockedDOFManager::addFieldsToFieldBlockManager detected inconsistincies in the active fields.");
857 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
860 fieldOrder_ = fieldOrder;
865 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
868 fieldOrder = fieldOrder_;
871 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
874 if(fieldsRegistered())
875 return fieldStrToNum_.size();
879 std::set<std::string> fields;
881 for(itr=fieldStringToPattern_.begin();itr!=fieldStringToPattern_.end();++itr)
882 fields.insert(itr->first.second);
884 return fields.size();
891 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
896 using Teuchos::rcp_dynamic_cast;
914 "panzer::BlockedDOFManager::buildGlobalUnknowns: UGI at index " << 0 <<
915 " is not of DOFManager type!");
918 TEUCHOS_TEST_FOR_EXCEPTION(refConnManager!=connManager,std::runtime_error,
919 "panzer::BlockedDOFManager::buildGlobalUnknowns: connection manager for UGI " << 0 <<
920 " does not match the reference connection manager");
922 refGeomPattern = refDofManager->getGeometricFieldPattern();
924 for(std::size_t i=1;i<fieldBlockManagers.size();i++) {
928 TEUCHOS_TEST_FOR_EXCEPTION(refDofManager==Teuchos::null,std::runtime_error,
929 "panzer::BlockedDOFManager::buildGlobalUnknowns: UGI at index " << i <<
930 " is not of DOFManager type!");
935 TEUCHOS_TEST_FOR_EXCEPTION(!refGeomPattern->
equals(*geomPattern),std::runtime_error,
936 "panzer::BlockedDOFManager::buildGlobalUnknowns: geometric pattern for UGI " << i <<
937 " does not match the reference pattern (from UGI 0)");
938 TEUCHOS_TEST_FOR_EXCEPTION(refConnManager!=testConnManager,std::runtime_error,
939 "panzer::BlockedDOFManager::buildGlobalUnknowns: connection manager for UGI " << i <<
940 " does not match the reference connection manager (from UGI 0)");
947 std::vector<std::string> eblocks;
948 this->getElementBlockIds(eblocks);
950 for(std::size_t i=0;i<fieldBlockManagers.size();i++) {
954 for(std::size_t e=0;e<eblocks.size();e++) {
955 const std::vector<int> & fieldIds = dofManager->getBlockFieldNumbers(eblocks[e]);
958 for(std::size_t f=0;f<fieldIds.size();f++) {
960 std::string fieldName = dofManager->getFieldString(fieldIds[f]);
962 = dofManager->getFieldPattern(eblocks[e],fieldName);
965 this->addField(eblocks[e],fieldName,fieldPattern);
972 fieldBlockManagers_ = fieldBlockManagers;
974 registerFields(
false);
976 geomPattern_ = refGeomPattern;
982 std::vector<std::string> elementBlocks;
983 getElementBlockIds(elementBlocks);
984 for(std::size_t eb=0;eb<elementBlocks.size();eb++) {
986 for(std::size_t fb=0;fb<fieldBlockManagers_.size();fb++) {
987 int cnt = getElementBlockGIDCount(fieldBlockManagers_[fb],elementBlocks[eb]);
988 blockGIDOffset_[std::make_pair(elementBlocks[eb],fb)] = offset;
999 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
1002 if(!fieldsRegistered()) {
1003 registerFields(
true);
1007 geomPattern_ = geomPattern;
1010 for(std::size_t fb=0;fb<fieldBlockManagers_.size();fb++) {
1011 setOrientationsRequired(fieldBlockManagers_[fb],getOrientationsRequired());
1012 buildGlobalUnknowns(fieldBlockManagers_[fb],geomPattern_);
1017 std::vector<std::string> elementBlocks;
1018 getElementBlockIds(elementBlocks);
1019 for(std::size_t eb=0;eb<elementBlocks.size();eb++) {
1021 for(std::size_t fb=0;fb<fieldBlockManagers_.size();fb++) {
1023 int cnt = getElementBlockGIDCount(fieldBlockManagers_[fb],elementBlocks[eb]);
1024 blockGIDOffset_[std::make_pair(elementBlocks[eb],fb)] = offset;
1034 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
1037 if(!fieldsRegistered())
1038 registerFields(
true);
1042 std::vector<std::pair<FieldType,RCP<const FieldPattern>>> patVector;
1044 for(f2p_itr=fieldStringToPattern_.begin();f2p_itr!=fieldStringToPattern_.end();f2p_itr++)
1045 patVector.push_back(std::make_pair(
FieldType::CG,f2p_itr->second));
1048 if(requireOrientations_)
1055 connMngr_->buildConnectivity(*aggFieldPattern);
1058 buildGlobalUnknowns(aggFieldPattern);
1061 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
1064 os <<
"BlockedDOFManager Field Information: " << std::endl;
1066 if(fieldsRegistered()) {
1068 for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
1069 os <<
"*************************************************\n";
1070 os <<
"Field Block Index = " << fbm << std::endl;
1071 printFieldInformation(fieldBlockManagers_[fbm],os);
1074 os <<
" Field String to Field Id (blocked/sub):\n";
1075 for(std::size_t i=0;i<fieldOrder_[fbm].size();i++) {
1076 std::string fieldString = fieldOrder_[fbm][i];
1077 int fieldNum = getFieldNum(fieldString);
1078 os <<
" \"" << fieldString <<
"\" is field ID " << fieldNum
1079 <<
"/" << fieldBlockManagers_[fbm]->getFieldNum(fieldString) << std::endl;
1086 os <<
"Fields not yet registered! Unknowns not built (call registerFields or buildGlobalUnknowns)" << std::endl;
1090 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
1095 itr = fieldStringToPattern_.find(std::make_pair(blockId,fieldName));
1097 if(itr==fieldStringToPattern_.end())
1098 return Teuchos::null;
1111 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
1113 const std::set<std::string> & fields)
const
1115 std::set<std::string> orderedFields;
1116 std::size_t numberInOrder = 0;
1118 for(std::size_t b=0;b<fieldOrder_ut.size();b++) {
1119 numberInOrder += fieldOrder_ut[b].size();
1120 orderedFields.insert(fieldOrder_ut[b].begin(),
1121 fieldOrder_ut[b].
end());
1124 bool correctCount = (numberInOrder==fields.size());
1125 bool sameFields = (orderedFields==fields);
1127 return correctCount && sameFields;
1130 template <
typename LocalOrdinalT,
typename GlobalOrdinalT>
1133 if(fieldOrder_.size()==0)
1135 return fieldOrder_.size();
int getFieldNum(const std::string &str) const
Get the number used for access to this field.
bool operator()(const Teuchos::Tuple< int, 3 > &a, const Teuchos::Tuple< int, 3 > &b) const
virtual bool fieldInBlock(const std::string &field, const std::string &block) const
int getFieldBlock(const std::string &fieldName, const std::vector< Teuchos::RCP< UniqueGlobalIndexer< LocalOrdinalT, GlobalOrdinalT > > > &ugis)
virtual int getNumGhosted() const
Get the number of indices ghosted for this processor.
const std::string & getFieldString(int num) const
Get the string name associated with a field number.
void setOrientationsRequired(bool ro)
bool validFieldOrder(const std::vector< std::vector< std::string > > &fieldOrder_ut, const std::set< std::string > &fields) const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void setConnManager(const Teuchos::RCP< ConnManager< LocalOrdinalT, GlobalOrdinalT > > &connMngr, MPI_Comm mpiComm)
Set the connection manager and MPI_Comm objects.
virtual const std::vector< int > & getBlockFieldNumbers(const std::string &block) const
void getElementGIDs(LocalOrdinalT localElmtId, std::vector< GlobalOrdinal > &gids, const std::string &blockIdHint="") const
Get the global IDs for a particular element. This function overwrites the gids variable.
void addField(const std::string &str, const Teuchos::RCP< const FieldPattern > &pattern)
Add a field to the DOF manager.
virtual int getNumOwned() const
Get the number of indices owned by this processor.
virtual void buildGlobalUnknowns()
Teuchos::RCP< ConnManager< LocalOrdinalT, GlobalOrdinalT > > resetIndices()
Reset the indicies for this DOF manager.
virtual void getGhostedIndices(std::vector< GlobalOrdinal > &indices) const
Get the set of indices ghosted for this processor.
PHX::MDField< ScalarT, panzer::Cell, panzer::IP > result
A field that will be used to build up the result of the integral we're performing.
virtual void getElementOrientation(LocalOrdinalT localElmtId, std::vector< double > &gidsOrientation) const
Get a vector containg the orientation of the GIDs relative to the neighbors.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
int getNumFields() const
How many fields are handled by this manager.
int addField(const std::string &str, const Teuchos::RCP< const FieldPattern > &pattern, const panzer::FieldType &type=panzer::FieldType::CG)
Add a field to the DOF manager.
virtual int getElementBlockGIDCount(const std::string &blockId) const
How any GIDs are associate with a particular element block.
void setFieldOrder(const std::vector< std::string > &fieldOrder)
virtual void getOwnedAndGhostedIndices(std::vector< GlobalOrdinal > &indices) const
Get the set of owned and ghosted indices for this processor.
void printFieldInformation(std::ostream &os) const
virtual void getOwnedIndices(std::vector< GlobalOrdinal > &indices) const
Get the set of indices owned by this processor.
void registerFields(bool buildSubUGIs)
Teuchos::RCP< UniqueGlobalIndexer< LocalOrdinalT, GlobalOrdinalT > > buildNewIndexer(const Teuchos::RCP< ConnManager< LocalOrdinalT, GlobalOrdinalT > > &connManager, MPI_Comm mpiComm) const
virtual int getNumOwnedAndGhosted() const
Get the number of owned and ghosted indices for this processor.
virtual void ownedIndices(const std::vector< GlobalOrdinal > &indices, std::vector< bool > &isOwned) const
void setFieldOrder(const std::vector< std::vector< std::string > > &fieldOrder)
virtual bool equals(const FieldPattern &fp) const
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 > & getGIDFieldOffsets(const std::string &blockId, int fieldNum) const
Use the field pattern so that you can find a particular field in the GIDs array.
virtual void buildPattern(const std::vector< std::pair< FieldType, Teuchos::RCP< const FieldPattern >>> &patterns)
#define TEUCHOS_ASSERT(assertion_test)
void getFieldOrder(std::vector< std::vector< std::string > > &fieldOrder) const
std::map< Teuchos::Tuple< int, 3 >, std::pair< std::vector< int >, std::vector< int > >, LessThan > TupleToVectorPairMap
int getNumFieldBlocks() const
Teuchos::RCP< const FieldPattern > getFieldPattern(const std::string &blockId, const std::string &fieldName) const
Find a field pattern stored for a particular block and field number. This will retrive the pattern ad...
virtual const std::pair< std::vector< int >, std::vector< int > > & getGIDFieldOffsets_closure(const std::string &blockId, int fieldNum, int subcellDim, int subcellId) const
Use the field pattern so that you can find a particular field in the GIDs array. This version lets yo...
void addFieldsToFieldBlockManager(const std::vector< std::string > &activeFields, UniqueGlobalIndexer< LocalOrdinalT, GlobalOrdinalT > &fieldBlockManager) const