43 #ifndef PANZER_DOF_MANAGER2_IMPL_HPP
44 #define PANZER_DOF_MANAGER2_IMPL_HPP
51 #include "PanzerDofMgr_config.hpp"
64 #include "Teuchos_ArrayView.hpp"
66 #include "Tpetra_Map.hpp"
67 #include "Tpetra_Export.hpp"
68 #include "Tpetra_Vector.hpp"
69 #include "Tpetra_MultiVector.hpp"
71 #include <unordered_set>
85 template <
typename LocalOrdinal,
typename GlobalOrdinal>
86 class HashTieBreak :
public Tpetra::Details::TieBreak<LocalOrdinal,GlobalOrdinal> {
90 HashTieBreak(
const unsigned int seed = (2654435761U))
93 virtual std::size_t selectedIndex(GlobalOrdinal GID,
94 const std::vector<std::pair<int,LocalOrdinal> > & pid_and_lid)
const
97 int intkey = (int) ((GID & 0x000000007fffffffLL) +
98 ((GID & 0x7fffffff80000000LL) >> 31));
99 return std::size_t((
seed_ ^ intkey) % pid_and_lid.size());
107 template <
typename LocalOrdinal,
typename GlobalOrdinal>
108 class GreedyTieBreak :
public Tpetra::Details::TieBreak<LocalOrdinal,GlobalOrdinal> {
113 virtual bool mayHaveSideEffects()
const {
117 virtual std::size_t selectedIndex(GlobalOrdinal ,
118 const std::vector<std::pair<int,LocalOrdinal> > & pid_and_lid)
const
121 const std::size_t numLids = pid_and_lid.size();
123 int minpid = pid_and_lid[0].first;
124 std::size_t minidx = 0;
125 for (idx = 0; idx < numLids; ++idx) {
126 if (pid_and_lid[idx].first < minpid) {
127 minpid = pid_and_lid[idx].first;
149 : numFields_(0),buildConnectivityRun_(false),requireOrientations_(false), useTieBreak_(false), useNeighbors_(false)
154 : numFields_(0),buildConnectivityRun_(false),requireOrientations_(false), useTieBreak_(false), useNeighbors_(false)
163 "DOFManager::setConnManager: setConnManager cannot be called after "
164 "buildGlobalUnknowns has been called");
183 "DOFManager::addField: addField cannot be called after "
184 "buildGlobalUnknowns has been called");
207 "DOFManager::addField: addField cannot be called after "
208 "buildGlobalUnknowns has been called");
210 "DOFManager::addField: you must add a ConnManager before"
211 "you can associate a FP with a given block.")
226 std::map<std::string,int>::const_iterator fpIter =
fieldNameToAID_.find(str);
252 std::map<std::string,int>::const_iterator fitr =
fieldNameToAID_.find(name);
254 return Teuchos::null;
259 return Teuchos::null;
265 std::map<std::string,int>::const_iterator fitr =
fieldNameToAID_.find(fieldName);
267 return Teuchos::null;
280 return Teuchos::null;
289 return Teuchos::null;
309 for (
size_t i(0); i <
owned_.size(); ++i)
311 for (
size_t i(0); i <
ghosted_.size(); ++i)
318 const auto & element_ids =
elementGIDs_[localElementID];
319 gids.resize(element_ids.size());
320 for (std::size_t i=0; i < gids.size(); ++i)
321 gids[i] = element_ids[i];
327 indices.resize(
owned_.size());
328 for (std::size_t i=0; i <
owned_.size(); ++i)
336 for (std::size_t i=0; i <
ghosted_.size(); ++i)
344 for (std::size_t i=0; i <
owned_.size(); ++i)
346 for (std::size_t i=0; i <
ghosted_.size(); ++i)
375 const std::vector<int> &
379 "buildGlobalUnknowns has been called");
380 std::map<std::string,int>::const_iterator bitr =
blockNameToID_.find(blockID);
383 int bid=bitr->second;
384 if(
fa_fps_[bid]!=Teuchos::null)
385 return fa_fps_[bid]->localOffsets(fieldNum);
387 static const std::vector<int> empty;
392 const Kokkos::View<const int*,PHX::Device>
396 "buildGlobalUnknowns has been called");
397 std::map<std::string,int>::const_iterator bitr =
blockNameToID_.find(blockID);
400 int bid=bitr->second;
401 if(
fa_fps_[bid]!=Teuchos::null)
402 return fa_fps_[bid]->localOffsetsKokkos(fieldNum);
404 static const Kokkos::View<int*,PHX::Device> empty(
"panzer::DOFManager::getGIDFieldOffsetsKokkos() empty",0);
426 std::vector<std::pair<FieldType,Teuchos::RCP<const FieldPattern>>> tmp;
432 connMngr_->buildConnectivity(*aggFieldPattern);
443 typedef Tpetra::Map<panzer::LocalOrdinal, panzer::GlobalOrdinal, Node> Map;
445 typedef Tpetra::Import<panzer::LocalOrdinal,panzer::GlobalOrdinal,Node> Import;
448 typedef Tpetra::MultiVector<panzer::GlobalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,Node> MultiVector;
450 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns",
buildGlobalUnknowns);
457 "DOFManager::buildGlobalUnknowns: buildGlobalUnknowns cannot be called again "
458 "after buildGlobalUnknowns has been called");
463 std::size_t sz = geomPattern->getSubcellIndices(0,0).size();
466 "DOFManager::buildGlobalUnknowns requires a geometric pattern including "
467 "the nodes when orientations are needed!");
509 Import imp_neighbor(non_overlap_map,overlap_map_neighbor);
512 Tpetra::createMultiVector<panzer::GlobalOrdinal>(overlap_map_neighbor, (size_t)
numFields_);
515 overlap_mv_neighbor->doImport(*non_overlap_mv, imp_neighbor,
519 *overlap_map_neighbor, *overlap_mv_neighbor);
528 panzer::GlobalOrdinal offset = 0xFFFFFFFFLL;
531 const std::vector<panzer::LocalOrdinal> & myElements =
connMngr_->getElementBlock(
blockOrder_[b]);
532 for (std::size_t l = 0; l < myElements.size(); ++l) {
533 std::vector<panzer::GlobalOrdinal> & localGIDs =
elementGIDs_[myElements[l]];
534 for(std::size_t c=0;c<localGIDs.size();c++)
535 localGIDs[c] += offset;
540 for (
int j = 0; j < nvals.
size(); ++j)
547 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns::build_owned_vector",build_owned_vector);
549 typedef std::unordered_set<panzer::GlobalOrdinal> HashTable;
550 HashTable isOwned, remainingOwned;
553 non_overlap_mv->sync_host();
554 tagged_non_overlap_mv->sync_host();
555 PHX::Device().fence();
556 auto nvals = non_overlap_mv->template getLocalView<PHX::Device>();
557 auto tagged_vals = tagged_non_overlap_mv->template getLocalView<PHX::Device>();
559 for (
size_t i = 0; i < nvals.extent(1); ++i) {
560 for (
size_t j = 0; j < nvals.extent(0); ++j) {
561 if (nvals(j,i) != -1) {
562 for(panzer::GlobalOrdinal offset=0;offset<tagged_vals(j,i);++offset)
563 isOwned.insert(nvals(j,i)+offset);
571 remainingOwned = isOwned;
579 const std::vector<panzer::LocalOrdinal> & myElements =
connMngr_->getElementBlock(
blockOrder_[b]);
581 for (
size_t l = 0; l < myElements.size(); ++l) {
582 const std::vector<panzer::GlobalOrdinal> & localOrdering =
elementGIDs_[myElements[l]];
585 for(std::size_t i=0;i<localOrdering.size();i++) {
587 if(isOwned.find(localOrdering[i])==isOwned.end())
591 std::pair<typename HashTable::iterator,bool> insertResult = hashTable.insert(localOrdering[i]);
592 if(insertResult.second) {
593 owned_.push_back(localOrdering[i]);
594 remainingOwned.erase(localOrdering[i]);
603 for(
typename HashTable::const_iterator itr=remainingOwned.begin();itr!=remainingOwned.end();itr++)
606 if(
owned_.size()!=isOwned.size()) {
607 out <<
"I'm about to hang because of unknown numbering failure ... sorry! (line = " << __LINE__ <<
")" << std::endl;
609 "DOFManager::buildGlobalUnkonwns: Failure because not all owned unknowns have been accounted for.");
620 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns::build_ghosted_array",BGA);
623 typedef std::unordered_set<panzer::GlobalOrdinal> HashTable;
625 for (std::size_t i = 0; i <
owned_.size(); i++)
626 hashTable.insert(
owned_[i]);
631 std::vector<ElementBlockAccess> blockAccessVec;
635 for (std::size_t a = 0; a < blockAccessVec.size(); ++a)
641 if (
fa_fps_[b] == Teuchos::null)
643 const std::vector<panzer::LocalOrdinal>& myElements =
645 for (
size_t l = 0; l < myElements.size(); ++l)
647 const std::vector<panzer::GlobalOrdinal>& localOrdering =
elementGIDs_[myElements[l]];
650 for (std::size_t i = 0; i < localOrdering.size(); ++i)
652 std::pair<typename HashTable::iterator, bool> insertResult =
653 hashTable.insert(localOrdering[i]);
657 if(insertResult.second)
658 ghosted_.push_back(localOrdering[i]);
669 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns::build_orientation",BO);
675 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns::build_local_ids_from_owned_and_ghosted",BLOFOG);
679 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns::build_local_ids",BLI);
685 std::pair<Teuchos::RCP<Tpetra::MultiVector<panzer::GlobalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> >,
688 Tpetra::MultiVector<panzer::GlobalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> & overlap_mv)
const
692 typedef Tpetra::Map<panzer::LocalOrdinal, panzer::GlobalOrdinal, Node> Map;
694 typedef Tpetra::Export<panzer::LocalOrdinal,panzer::GlobalOrdinal,Node> Export;
695 typedef Tpetra::Import<panzer::LocalOrdinal,panzer::GlobalOrdinal,Node> Import;
698 typedef Tpetra::MultiVector<panzer::GlobalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,Node> MultiVector;
700 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN",BGU_GUN);
712 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN::line_04 createOneToOne",GUN04);
714 GreedyTieBreak<panzer::LocalOrdinal,panzer::GlobalOrdinal> greedy_tie_break;
715 non_overlap_map = Tpetra::createOneToOne<panzer::LocalOrdinal,panzer::GlobalOrdinal,Node>(overlap_map, greedy_tie_break);
720 HashTieBreak<panzer::LocalOrdinal,panzer::GlobalOrdinal> tie_break;
721 non_overlap_map = Tpetra::createOneToOne<panzer::LocalOrdinal,panzer::GlobalOrdinal,Node>(overlap_map,tie_break);
731 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN::line_05 alloc_unique_mv",GUN05);
733 tagged_non_overlap_mv = Tpetra::createMultiVector<panzer::GlobalOrdinal>(non_overlap_map,(size_t)
numFields_);
744 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN::line_06 export",GUN06);
746 exp =
rcp(
new Export(overlap_map,non_overlap_map));
750 tagged_non_overlap_mv->doExport(tagged_overlap_mv,*exp,Tpetra::ABSMAX);
754 non_overlap_mv =
rcp(
new MultiVector(*tagged_non_overlap_mv,
Teuchos::Copy));
762 panzer::GlobalOrdinal localsum=0;
764 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN::line_07-09 local_count",GUN07_09);
765 auto values = non_overlap_mv->getLocalViewDevice();
766 auto mv_size = values.extent(0);
768 PHX::Device().fence();
776 panzer::GlobalOrdinal myOffset = -1;
778 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN::line_10 prefix_sum",GUN_10);
781 panzer::GlobalOrdinal scanResult = 0;
782 Teuchos::scan<int, panzer::GlobalOrdinal> (*
getComm(),
Teuchos::REDUCE_SUM,
static_cast<panzer::GlobalOrdinal
> (localsum), Teuchos::outArg (scanResult));
783 myOffset = scanResult - localsum;
796 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN::line_13-21 gid_assignment",GUN13_21);
798 if (non_overlap_mv->need_sync_host())
799 non_overlap_mv->sync_host();
800 auto editnonoverlap = non_overlap_mv->getLocalViewHost();
801 for(
size_t i=0; i<non_overlap_mv->getLocalLength(); ++i){
803 if(editnonoverlap(i,j)!=0){
805 int ndof = Teuchos::as<int>(editnonoverlap(i,j));
806 editnonoverlap(i,j)=myOffset+which_id;
810 editnonoverlap(i,j)=-1;
815 non_overlap_mv->modify_host();
816 non_overlap_mv->sync_device();
817 PHX::Device().fence();
829 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN::line_23 final_import",GUN23);
832 overlap_mv.doImport(*non_overlap_mv,*exp,Tpetra::REPLACE);
838 return std::make_pair(non_overlap_mv,tagged_non_overlap_mv);
847 typedef Tpetra::Map<panzer::LocalOrdinal, panzer::GlobalOrdinal, Node> Map;
848 typedef Tpetra::MultiVector<panzer::GlobalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,Node> MultiVector;
850 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildTaggedMultiVector",BTMV);
856 std::vector<std::tuple< int, panzer::FieldType, RCP<const panzer::FieldPattern> > > faConstruct;
871 if(faConstruct.size()>0) {
879 fa_fps_.push_back(Teuchos::null);
885 PHX::Device().fence();
892 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildTaggedMultiVector::allocate_tagged_multivector",ATMV);
894 overlap_mv = Tpetra::createMultiVector<panzer::GlobalOrdinal>(overlapmap,(size_t)
numFields_);
895 overlap_mv->putScalar(0);
896 PHX::Device().fence();
904 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildTaggedMultiVector::fill_tagged_multivector",FTMV);
907 std::vector<int> working(overlap_mv->getNumVectors());
908 overlap_mv->sync_host();
909 PHX::Device().fence();
910 auto edittwoview_host = overlap_mv->getLocalViewHost();
916 const std::vector<panzer::LocalOrdinal> &
numFields=
fa_fps_[b]->numFieldsPerId();
917 const std::vector<panzer::LocalOrdinal> & fieldIds=
fa_fps_[b]->fieldIds();
918 const std::vector<panzer::LocalOrdinal> & myElements =
connMngr_->getElementBlock(
blockOrder_[b]);
919 for (
size_t l = 0; l < myElements.size(); ++l) {
920 auto connSize =
connMngr_->getConnectivitySize(myElements[l]);
921 const auto * elmtConn =
connMngr_->getConnectivity(myElements[l]);
923 for (
int c = 0; c < connSize; ++c) {
924 size_t lid = overlapmap->getLocalElement(elmtConn[c]);
926 for(std::size_t i=0;i<working.size();i++)
928 for (
int n = 0; n < numFields[c]; ++n) {
929 int whichField = fieldIds[offset];
932 working[whichField]++;
935 for(std::size_t i=0;i<working.size();i++) {
936 auto current = edittwoview_host(lid,i);
937 edittwoview_host(lid,i) = (current > working[i]) ? current : working[i];
943 overlap_mv->modify_host();
944 overlap_mv->sync_device();
945 PHX::Device().fence();
988 std::map<std::string,int>::const_iterator fitr =
fieldNameToAID_.find(field);
990 std::stringstream ss;
992 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"DOFManager::fieldInBlock: invalid field name. DOF information is:\n"+ss.str());
994 std::map<std::string,int>::const_iterator bitr =
blockNameToID_.find(block);
996 std::stringstream ss;
998 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"DOFManager::fieldInBlock: invalid block name. DOF information is:\n"+ss.str());
1000 int fid=fitr->second;
1001 int bid=bitr->second;
1019 std::map<std::string,int>::const_iterator bitr =
blockNameToID_.find(blockId);
1022 int bid=bitr->second;
1025 if(
fa_fps_[bid]!=Teuchos::null)
1026 return fa_fps_[bid]->fieldIds();
1029 static std::vector<int> empty;
1034 const std::pair<std::vector<int>,std::vector<int> > &
1038 std::map<std::string,int>::const_iterator bitr =
blockNameToID_.find(blockId);
1043 if(
fa_fps_[bitr->second]!=Teuchos::null)
1044 return fa_fps_[bitr->second]->localOffsets_closure(fieldNum, subcellDim, subcellId);
1046 static std::pair<std::vector<int>,std::vector<int> > empty;
1054 if(indices.size()!=isOwned.size())
1055 isOwned.resize(indices.size(),
false);
1056 typename std::vector<panzer::GlobalOrdinal>::const_iterator endOf =
owned_.end();
1057 for (std::size_t i = 0; i < indices.size(); ++i) {
1058 isOwned[i] = ( std::find(
owned_.begin(),
owned_.end(), indices[i])!=endOf );
1066 "DOFManager::setFieldOrder: setFieldOrder cannot be called after "
1067 "buildGlobalUnknowns has been called");
1089 for (
size_t j = 0; j < proposed_fieldOrder.size(); ++j) {
1118 std::vector<std::string> elementBlockIds;
1119 connMngr_->getElementBlockIds(elementBlockIds);
1122 std::size_t myElementCount = 0;
1123 for(std::vector<std::string>::const_iterator blockItr=elementBlockIds.begin(); blockItr!=elementBlockIds.end();++blockItr)
1124 myElementCount +=
connMngr_->getElementBlock(*blockItr).size();
1130 for(std::vector<std::string>::const_iterator blockItr=elementBlockIds.begin();
1131 blockItr!=elementBlockIds.end();++blockItr) {
1132 const std::string & blockName = *blockItr;
1135 std::map<std::string,int>::const_iterator fap =
blockNameToID_.find(blockName);
1140 int bid=fap->second;
1142 if(
fa_fps_[bid]==Teuchos::null)
1149 std::vector<std::pair<int,int> > topEdgeIndices;
1153 std::vector<std::vector<int> > topFaceIndices;
1158 const std::vector<panzer::LocalOrdinal> & elmts =
connMngr_->getElementBlock(blockName);
1159 for(std::size_t e=0;e<elmts.size();e++) {
1161 std::vector<signed char> & eOrientation =
orientation_[elmts[e]];
1166 eOrientation.resize(fieldPattern.
numberIds());
1167 for(std::size_t s=0;s<eOrientation.size();s++)
1168 eOrientation[s] = 1;
1171 auto connSz =
connMngr_->getConnectivitySize(elmts[e]);
1172 const panzer::GlobalOrdinal * connPtr =
connMngr_->getConnectivity(elmts[e]);
1173 const std::vector<panzer::GlobalOrdinal> connectivity(connPtr,connPtr+connSz);
1188 "DOFManager::getElementOrientations: Orientations were not constructed!");
1190 const std::vector<signed char> & local_o =
orientation_[localElmtId];
1191 gidsOrientation.resize(local_o.size());
1192 for(std::size_t i=0;i<local_o.size();i++) {
1193 gidsOrientation[i] = double(local_o[i]);
1217 std::map<std::string,int>::const_iterator bitr =
blockNameToID_.find(blockId);
1220 return bitr->second;
1226 os <<
"DOFManager Field Information: " << std::endl;
1232 os <<
" Element Block = " <<
blockOrder_[i] << std::endl;
1236 for(std::size_t f=0;f<fieldIds.size();f++)
1237 os <<
" \"" <<
getFieldString(fieldIds[f]) <<
"\" is field ID " << fieldIds[f] << std::endl;
1245 PANZER_FUNC_TIME_MONITOR(
"panzer::DOFManager::builderOverlapMapFromElements");
1252 std::set<panzer::GlobalOrdinal> overlapset;
1255 for (
size_t e = 0; e < myElements.size(); ++e) {
1256 auto connSize =
connMngr_->getConnectivitySize(myElements[e]);
1257 const panzer::GlobalOrdinal * elmtConn =
connMngr_->getConnectivity(myElements[e]);
1258 for (
int k = 0; k < connSize; ++k) {
1259 overlapset.insert(elmtConn[k]);
1265 for (
typename std::set<panzer::GlobalOrdinal>::const_iterator itr = overlapset.begin(); itr!=overlapset.end(); ++itr) {
1271 return Tpetra::createNonContigMap<panzer::LocalOrdinal,panzer::GlobalOrdinal>(overlapVector,
getComm());
1277 std::vector<std::vector< panzer::GlobalOrdinal > > & elementGIDs,
1278 const Tpetra::Map<panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> & overlapmap,
1279 const Tpetra::MultiVector<panzer::GlobalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> & const_overlap_mv)
const
1284 auto overlap_mv =
const_cast<Tpetra::MultiVector<panzer::GlobalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType>&
>(const_overlap_mv);
1285 overlap_mv.sync_host();
1286 PHX::Device().fence();
1287 const auto twoview_host = overlap_mv.getLocalViewHost();
1294 if(
fa_fps_[b]==Teuchos::null) {
1296 for (
size_t l = 0; l < myElements.size(); ++l) {
1297 panzer::LocalOrdinal thisID=myElements[l];
1298 if(elementGIDs.size()<=(size_t)thisID)
1299 elementGIDs.resize(thisID+1);
1305 const std::vector<int> & fieldIds=
fa_fps_[b]->fieldIds();
1308 for (
size_t l = 0; l < myElements.size(); ++l) {
1309 auto connSize =
connMngr_->getConnectivitySize(myElements[l]);
1310 const panzer::GlobalOrdinal * elmtConn =
connMngr_->getConnectivity(myElements[l]);
1311 std::vector<panzer::GlobalOrdinal> localOrdering;
1313 for (
int c = 0; c < connSize; ++c) {
1314 size_t lid = overlapmap.getLocalElement(elmtConn[c]);
1316 for (
int n = 0; n < numFields[c]; ++n) {
1317 int whichField = fieldIds[offset];
1321 localOrdering.push_back(twoview_host(lid,whichField)+dofsPerField[whichField]);
1323 dofsPerField[whichField]++;
1326 panzer::LocalOrdinal thisID=myElements[l];
1327 if(elementGIDs.size()<=(size_t)thisID){
1328 elementGIDs.resize(thisID+1);
1330 elementGIDs[thisID]=localOrdering;
1337 std::vector<std::vector<panzer::LocalOrdinal> > elementLIDs(
elementGIDs_.size());
1339 std::vector<panzer::GlobalOrdinal> ownedAndGhosted;
1343 std::unordered_map<panzer::GlobalOrdinal,panzer::LocalOrdinal> hashMap;
1344 for(std::size_t i = 0; i < ownedAndGhosted.size(); ++i)
1345 hashMap[ownedAndGhosted[i]] = i;
1347 for (std::size_t i = 0; i <
elementGIDs_.size(); ++i) {
1348 const std::vector<panzer::GlobalOrdinal>& gids =
elementGIDs_[i];
1349 std::vector<panzer::LocalOrdinal>&
lids = elementLIDs[i];
1350 lids.resize(gids.size());
1351 for (std::size_t g = 0; g < gids.size(); ++g)
1352 lids[g] = hashMap[gids[g]];
std::vector< std::vector< int > > blockToAssociatedFP_
bool fieldInBlock(const std::string &field, const std::string &block) const
int getNumFields() const
gets the number of fields
virtual int getDimension() const =0
bool getOrientationsRequired() const
int getNumOwnedAndGhosted() const
Get the number of owned and ghosted indices for this processor.
void setFieldOrder(const std::vector< std::string > &fieldOrder)
Sums all entries of a Rank 2 Kokkos View.
std::vector< Teuchos::RCP< panzer::FieldAggPattern > > fa_fps_
const std::vector< panzer::LocalOrdinal > & getElementBlock(const std::string &eBlock) const
Teuchos::RCP< const Tpetra::Map< panzer::LocalOrdinal, panzer::GlobalOrdinal, panzer::TpetraNodeType > > buildOverlapMapFromElements(const ElementBlockAccess &access) const
const Kokkos::View< const int *, PHX::Device > getGIDFieldOffsetsKokkos(const std::string &blockID, int fieldNum) const
basic_FancyOStream & setShowProcRank(const bool showProcRank)
void buildUnknownsOrientation()
std::vector< std::vector< panzer::GlobalOrdinal > > elementGIDs_
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void getOwnedIndices(std::vector< panzer::GlobalOrdinal > &indices) const
Get the set of indices owned by this processor.
Teuchos::RCP< Tpetra::MultiVector< panzer::GlobalOrdinal, panzer::LocalOrdinal, panzer::GlobalOrdinal, panzer::TpetraNodeType > > buildTaggedMultiVector(const ElementBlockAccess &access)
FieldType
The type of discretization to use for a field pattern.
Teuchos::RCP< ConnManager > resetIndices()
Reset the indices for this DOF manager.
void buildGlobalUnknowns()
builds the global unknowns array
Teuchos::RCP< const panzer::FieldPattern > ga_fp_
virtual int numberIds() const
void getFieldOrder(std::vector< std::string > &fieldOrder) const
Kokkos::View< const LO **, PHX::Device > lids
void getGhostedIndicesAsInt(std::vector< int > &indices) const
Get the set of indices ghosted for this processor.
const std::vector< int > & getGIDFieldOffsets(const std::string &blockID, int fieldNum) const
std::vector< int > fieldAIDOrder_
void setConnManager(const Teuchos::RCP< ConnManager > &connMngr, MPI_Comm mpiComm)
Adds a Connection Manager that will be associated with this DOFManager.
std::map< std::string, int > fieldNameToAID_
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
std::vector< int > elementBlockGIDCount_
bool buildConnectivityRun_
Teuchos::RCP< Teuchos::Comm< int > > communicator_
Kokkos::Compat::KokkosDeviceWrapperNode< PHX::Device > TpetraNodeType
void printFieldInformation(std::ostream &os) const
void computeCellEdgeOrientations(const std::vector< std::pair< int, int > > &topEdgeIndices, const std::vector< panzer::GlobalOrdinal > &topology, const FieldPattern &fieldPattern, std::vector< signed char > &orientation)
std::vector< Teuchos::RCP< const FieldPattern > > fieldPatterns_
std::pair< Teuchos::RCP< Tpetra::MultiVector< panzer::GlobalOrdinal, panzer::LocalOrdinal, panzer::GlobalOrdinal, panzer::TpetraNodeType > >, Teuchos::RCP< Tpetra::MultiVector< panzer::GlobalOrdinal, panzer::LocalOrdinal, panzer::GlobalOrdinal, panzer::TpetraNodeType > > > buildGlobalUnknowns_GUN(const Tpetra::MultiVector< panzer::GlobalOrdinal, panzer::LocalOrdinal, panzer::GlobalOrdinal, panzer::TpetraNodeType > &tagged_overlap_mv, Tpetra::MultiVector< panzer::GlobalOrdinal, panzer::LocalOrdinal, panzer::GlobalOrdinal, panzer::TpetraNodeType > &overlap_mv) const
void getOwnedIndicesAsInt(std::vector< int > &indices) const
Get the set of indices owned by this processor.
basic_FancyOStream & setOutputToRootOnly(const int rootRank)
void fillGIDsFromOverlappedMV(const ElementBlockAccess &access, std::vector< std::vector< panzer::GlobalOrdinal > > &elementGIDs, const Tpetra::Map< panzer::LocalOrdinal, panzer::GlobalOrdinal, panzer::TpetraNodeType > &overlapmap, const Tpetra::MultiVector< panzer::GlobalOrdinal, panzer::LocalOrdinal, panzer::GlobalOrdinal, panzer::TpetraNodeType > &overlap_mv) const
void setLocalIds(const std::vector< std::vector< panzer::LocalOrdinal > > &localIDs)
void computePatternFaceIndices(const FieldPattern &pattern, std::vector< std::vector< int > > &faceIndices)
int getNumGhosted() const
Get the number of indices ghosted for this processor.
std::vector< panzer::GlobalOrdinal > owned_
void ownedIndices(const std::vector< panzer::GlobalOrdinal > &indices, std::vector< bool > &isOwned) const
std::vector< std::string > blockOrder_
std::vector< panzer::GlobalOrdinal > ghosted_
void push_back(const value_type &x)
void computeCellFaceOrientations(const std::vector< std::vector< int > > &topFaceIndices, const std::vector< panzer::GlobalOrdinal > &topology, const FieldPattern &fieldPattern, std::vector< signed char > &orientation)
Teuchos::RCP< Teuchos::Comm< int > > getComm() const
std::size_t blockIdToIndex(const std::string &blockId) const
Teuchos::RCP< ConnManager > connMngr_
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...
void buildLocalIdsFromOwnedAndGhostedElements()
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...
int getFieldNum(const std::string &string) const
Get the number used for access to this field.
const std::string & getFieldString(int num) const
Reverse lookup of the field string from a field number.
void getGhostedIndices(std::vector< panzer::GlobalOrdinal > &indices) const
Get the set of indices ghosted for this processor.
std::vector< std::string > fieldStringOrder_
void getElementGIDsAsInt(panzer::LocalOrdinal localElementID, std::vector< int > &gids, const std::string &blockIdHint="") const
Get the global IDs for a particular element. This function overwrites the gids variable.
int getNumOwned() const
Get the number of indices owned by this processor.
void getOwnedAndGhostedIndicesAsInt(std::vector< int > &indices) const
Get the set of owned and ghosted indices for this processor.
void getElementOrientation(panzer::LocalOrdinal localElmtId, std::vector< double > &gidsOrientation) const
Get a vector containg the orientation of the GIDs relative to the neighbors.
const std::vector< int > & getBlockFieldNumbers(const std::string &blockId) const
void getOwnedAndGhostedIndices(std::vector< panzer::GlobalOrdinal > &indices) const
Get the set of owned and ghosted indices for this processor.
#define TEUCHOS_ASSERT(assertion_test)
bool validFieldOrder(const std::vector< std::string > &proposed_fieldOrder)
std::vector< std::vector< signed char > > orientation_
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.
bool requireOrientations_
Teuchos::RCP< const FieldPattern > getFieldPattern(const std::string &name) const
Find a field pattern stored for a particular block and field number. This will retrive the pattern ad...
void computePatternEdgeIndices(const FieldPattern &pattern, std::vector< std::pair< int, int > > &edgeIndices)
void getElementGIDs(panzer::LocalOrdinal localElementID, std::vector< panzer::GlobalOrdinal > &gids, const std::string &blockIdHint="") const
get associated GIDs for a given local element
std::vector< FieldType > fieldTypes_
std::map< std::string, int > blockNameToID_