11 #ifndef PANZER_DOF_MANAGER2_IMPL_HPP
12 #define PANZER_DOF_MANAGER2_IMPL_HPP
19 #include "PanzerDofMgr_config.hpp"
32 #include "Teuchos_ArrayView.hpp"
34 #include "Tpetra_Map.hpp"
35 #include "Tpetra_Export.hpp"
36 #include "Tpetra_Vector.hpp"
37 #include "Tpetra_MultiVector.hpp"
39 #include <unordered_set>
53 template <
typename LocalOrdinal,
typename GlobalOrdinal>
54 class HashTieBreak :
public Tpetra::Details::TieBreak<LocalOrdinal,GlobalOrdinal> {
58 HashTieBreak(
const unsigned int seed = (2654435761U))
61 virtual std::size_t selectedIndex(GlobalOrdinal GID,
62 const std::vector<std::pair<int,LocalOrdinal> > & pid_and_lid)
const
65 int intkey = (int) ((GID & 0x000000007fffffffLL) +
66 ((GID & 0x7fffffff80000000LL) >> 31));
67 return std::size_t((
seed_ ^ intkey) % pid_and_lid.size());
75 template <
typename LocalOrdinal,
typename GlobalOrdinal>
76 class GreedyTieBreak :
public Tpetra::Details::TieBreak<LocalOrdinal,GlobalOrdinal> {
81 virtual bool mayHaveSideEffects()
const {
85 virtual std::size_t selectedIndex(GlobalOrdinal ,
86 const std::vector<std::pair<int,LocalOrdinal> > & pid_and_lid)
const
89 const std::size_t numLids = pid_and_lid.size();
91 int minpid = pid_and_lid[0].first;
92 std::size_t minidx = 0;
93 for (idx = 0; idx < numLids; ++idx) {
94 if (pid_and_lid[idx].first < minpid) {
95 minpid = pid_and_lid[idx].first;
117 : numFields_(0),buildConnectivityRun_(false),requireOrientations_(false), useTieBreak_(false), useNeighbors_(false)
122 : numFields_(0),buildConnectivityRun_(false),requireOrientations_(false), useTieBreak_(false), useNeighbors_(false)
131 "DOFManager::setConnManager: setConnManager cannot be called after "
132 "buildGlobalUnknowns has been called");
151 "DOFManager::addField: addField cannot be called after "
152 "buildGlobalUnknowns has been called");
175 "DOFManager::addField: addField cannot be called after "
176 "buildGlobalUnknowns has been called");
178 "DOFManager::addField: you must add a ConnManager before"
179 "you can associate a FP with a given block.")
194 std::map<std::string,int>::const_iterator fpIter =
fieldNameToAID_.find(str);
220 std::map<std::string,int>::const_iterator fitr =
fieldNameToAID_.find(name);
222 return Teuchos::null;
227 return Teuchos::null;
233 std::map<std::string,int>::const_iterator fitr =
fieldNameToAID_.find(fieldName);
235 return Teuchos::null;
248 return Teuchos::null;
257 return Teuchos::null;
277 for (
size_t i(0); i <
owned_.size(); ++i)
279 for (
size_t i(0); i <
ghosted_.size(); ++i)
286 const auto & element_ids =
elementGIDs_[localElementID];
287 gids.resize(element_ids.size());
288 for (std::size_t i=0; i < gids.size(); ++i)
289 gids[i] = element_ids[i];
295 indices.resize(
owned_.size());
296 for (std::size_t i=0; i <
owned_.size(); ++i)
304 for (std::size_t i=0; i <
ghosted_.size(); ++i)
312 for (std::size_t i=0; i <
owned_.size(); ++i)
314 for (std::size_t i=0; i <
ghosted_.size(); ++i)
343 const std::vector<int> &
347 "buildGlobalUnknowns has been called");
348 std::map<std::string,int>::const_iterator bitr =
blockNameToID_.find(blockID);
351 int bid=bitr->second;
352 if(
fa_fps_[bid]!=Teuchos::null)
353 return fa_fps_[bid]->localOffsets(fieldNum);
355 static const std::vector<int> empty;
360 const PHX::View<const int*>
364 "buildGlobalUnknowns has been called");
365 std::map<std::string,int>::const_iterator bitr =
blockNameToID_.find(blockID);
370 int bid=bitr->second;
371 if(
fa_fps_[bid]!=Teuchos::null)
372 return fa_fps_[bid]->localOffsetsKokkos(fieldNum);
374 static const PHX::View<int*> empty(
"panzer::DOFManager::getGIDFieldOffsetsKokkos() empty",0);
383 "buildGlobalUnknowns has been called");
384 std::map<std::string,int>::const_iterator bitr =
blockNameToID_.find(blockID);
392 int bid=bitr->second;
394 for (
size_t i=0; i < fieldNums.size(); ++i) {
395 if(
fa_fps_[bid]!=Teuchos::null) {
396 vov.addView(
fa_fps_[bid]->localOffsetsKokkos(fieldNums[i]),i);
399 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::runtime_error,
"panzer::DOFManager::getGIDFieldOffsets() - no field pattern exists in block "
400 << blockID <<
"for field number " << fieldNums[i] <<
" exists!");
405 vov.syncHostToDevice();
428 std::vector<std::pair<FieldType,Teuchos::RCP<const FieldPattern>>> tmp;
434 connMngr_->buildConnectivity(*aggFieldPattern);
445 typedef Tpetra::Map<panzer::LocalOrdinal, panzer::GlobalOrdinal, Node> Map;
447 typedef Tpetra::Import<panzer::LocalOrdinal,panzer::GlobalOrdinal,Node> Import;
450 typedef Tpetra::MultiVector<panzer::GlobalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,Node> MultiVector;
452 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns",
buildGlobalUnknowns);
459 "DOFManager::buildGlobalUnknowns: buildGlobalUnknowns cannot be called again "
460 "after buildGlobalUnknowns has been called");
465 std::size_t sz = geomPattern->getSubcellIndices(0,0).size();
468 "DOFManager::buildGlobalUnknowns requires a geometric pattern including "
469 "the nodes when orientations are needed!");
511 Import imp_neighbor(non_overlap_map,overlap_map_neighbor);
514 Tpetra::createMultiVector<panzer::GlobalOrdinal>(overlap_map_neighbor, (size_t)
numFields_);
517 overlap_mv_neighbor->doImport(*non_overlap_mv, imp_neighbor,
521 *overlap_map_neighbor, *overlap_mv_neighbor);
530 panzer::GlobalOrdinal offset = 0xFFFFFFFFLL;
533 const std::vector<panzer::LocalOrdinal> & myElements =
connMngr_->getElementBlock(
blockOrder_[b]);
534 for (std::size_t l = 0; l < myElements.size(); ++l) {
535 std::vector<panzer::GlobalOrdinal> & localGIDs =
elementGIDs_[myElements[l]];
536 for(std::size_t c=0;c<localGIDs.size();c++)
537 localGIDs[c] += offset;
542 for (
int j = 0; j < nvals.
size(); ++j)
549 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns::build_owned_vector",build_owned_vector);
551 typedef std::unordered_set<panzer::GlobalOrdinal> HashTable;
552 HashTable isOwned, remainingOwned;
555 auto nvals = non_overlap_mv->getLocalViewHost(Tpetra::Access::ReadOnly);
556 auto tagged_vals = tagged_non_overlap_mv->getLocalViewHost(Tpetra::Access::ReadOnly);
558 for (
size_t i = 0; i < nvals.extent(1); ++i) {
559 for (
size_t j = 0; j < nvals.extent(0); ++j) {
560 if (nvals(j,i) != -1) {
561 for(panzer::GlobalOrdinal offset=0;offset<tagged_vals(j,i);++offset)
562 isOwned.insert(nvals(j,i)+offset);
570 remainingOwned = isOwned;
578 const std::vector<panzer::LocalOrdinal> & myElements =
connMngr_->getElementBlock(
blockOrder_[b]);
580 for (
size_t l = 0; l < myElements.size(); ++l) {
581 const std::vector<panzer::GlobalOrdinal> & localOrdering =
elementGIDs_[myElements[l]];
584 for(std::size_t i=0;i<localOrdering.size();i++) {
586 if(isOwned.find(localOrdering[i])==isOwned.end())
590 std::pair<typename HashTable::iterator,bool> insertResult = hashTable.insert(localOrdering[i]);
591 if(insertResult.second) {
592 owned_.push_back(localOrdering[i]);
593 remainingOwned.erase(localOrdering[i]);
602 for(
typename HashTable::const_iterator itr=remainingOwned.begin();itr!=remainingOwned.end();itr++)
605 if(
owned_.size()!=isOwned.size()) {
606 out <<
"I'm about to hang because of unknown numbering failure ... sorry! (line = " << __LINE__ <<
")" << std::endl;
608 "DOFManager::buildGlobalUnkonwns: Failure because not all owned unknowns have been accounted for.");
619 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns::build_ghosted_array",BGA);
622 typedef std::unordered_set<panzer::GlobalOrdinal> HashTable;
624 for (std::size_t i = 0; i <
owned_.size(); i++)
625 hashTable.insert(
owned_[i]);
630 std::vector<ElementBlockAccess> blockAccessVec;
634 for (std::size_t a = 0; a < blockAccessVec.size(); ++a)
640 if (
fa_fps_[b] == Teuchos::null)
642 const std::vector<panzer::LocalOrdinal>& myElements =
644 for (
size_t l = 0; l < myElements.size(); ++l)
646 const std::vector<panzer::GlobalOrdinal>& localOrdering =
elementGIDs_[myElements[l]];
649 for (std::size_t i = 0; i < localOrdering.size(); ++i)
651 std::pair<typename HashTable::iterator, bool> insertResult =
652 hashTable.insert(localOrdering[i]);
656 if(insertResult.second)
657 ghosted_.push_back(localOrdering[i]);
668 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns::build_orientation",BO);
674 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns::build_local_ids_from_owned_and_ghosted",BLOFOG);
678 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns::build_local_ids",BLI);
684 std::pair<Teuchos::RCP<Tpetra::MultiVector<panzer::GlobalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> >,
687 Tpetra::MultiVector<panzer::GlobalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> & overlap_mv)
const
691 typedef Tpetra::Map<panzer::LocalOrdinal, panzer::GlobalOrdinal, Node> Map;
693 typedef Tpetra::Export<panzer::LocalOrdinal,panzer::GlobalOrdinal,Node> Export;
694 typedef Tpetra::Import<panzer::LocalOrdinal,panzer::GlobalOrdinal,Node> Import;
697 typedef Tpetra::MultiVector<panzer::GlobalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,Node> MultiVector;
699 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN",BGU_GUN);
711 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN::line_04 createOneToOne",GUN04);
713 GreedyTieBreak<panzer::LocalOrdinal,panzer::GlobalOrdinal> greedy_tie_break;
714 non_overlap_map = Tpetra::createOneToOne<panzer::LocalOrdinal,panzer::GlobalOrdinal,Node>(overlap_map, greedy_tie_break);
719 HashTieBreak<panzer::LocalOrdinal,panzer::GlobalOrdinal> tie_break;
720 non_overlap_map = Tpetra::createOneToOne<panzer::LocalOrdinal,panzer::GlobalOrdinal,Node>(overlap_map,tie_break);
730 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN::line_05 alloc_unique_mv",GUN05);
732 tagged_non_overlap_mv = Tpetra::createMultiVector<panzer::GlobalOrdinal>(non_overlap_map,(size_t)
numFields_);
743 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN::line_06 export",GUN06);
745 exp =
rcp(
new Export(overlap_map,non_overlap_map));
749 tagged_non_overlap_mv->doExport(tagged_overlap_mv,*exp,Tpetra::ABSMAX);
753 non_overlap_mv =
rcp(
new MultiVector(*tagged_non_overlap_mv,
Teuchos::Copy));
761 panzer::GlobalOrdinal localsum=0;
763 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN::line_07-09 local_count",GUN07_09);
764 auto values = non_overlap_mv->getLocalViewDevice(Tpetra::Access::ReadOnly);
773 panzer::GlobalOrdinal myOffset = -1;
775 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN::line_10 prefix_sum",GUN_10);
778 panzer::GlobalOrdinal scanResult = 0;
779 Teuchos::scan<int, panzer::GlobalOrdinal> (*
getComm(),
Teuchos::REDUCE_SUM,
static_cast<panzer::GlobalOrdinal
> (localsum), Teuchos::outArg (scanResult));
780 myOffset = scanResult - localsum;
793 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN::line_13-21 gid_assignment",GUN13_21);
795 auto editnonoverlap = non_overlap_mv->getLocalViewHost(Tpetra::Access::ReadWrite);
796 for(
size_t i=0; i<non_overlap_mv->getLocalLength(); ++i){
798 if(editnonoverlap(i,j)!=0){
800 int ndof = Teuchos::as<int>(editnonoverlap(i,j));
801 editnonoverlap(i,j)=myOffset+which_id;
805 editnonoverlap(i,j)=-1;
821 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildGlobalUnknowns_GUN::line_23 final_import",GUN23);
824 overlap_mv.doImport(*non_overlap_mv,*exp,Tpetra::REPLACE);
830 return std::make_pair(non_overlap_mv,tagged_non_overlap_mv);
839 typedef Tpetra::Map<panzer::LocalOrdinal, panzer::GlobalOrdinal, Node> Map;
840 typedef Tpetra::MultiVector<panzer::GlobalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,Node> MultiVector;
842 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildTaggedMultiVector",BTMV);
848 std::vector<std::tuple< int, panzer::FieldType, RCP<const panzer::FieldPattern> > > faConstruct;
863 if(faConstruct.size()>0) {
871 fa_fps_.push_back(Teuchos::null);
883 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildTaggedMultiVector::allocate_tagged_multivector",ATMV);
885 overlap_mv = Tpetra::createMultiVector<panzer::GlobalOrdinal>(overlapmap,(size_t)
numFields_);
886 overlap_mv->putScalar(0);
894 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::DOFManager::buildTaggedMultiVector::fill_tagged_multivector",FTMV);
897 std::vector<int> working(overlap_mv->getNumVectors());
898 auto edittwoview_host = overlap_mv->getLocalViewHost(Tpetra::Access::ReadWrite);
904 const std::vector<panzer::LocalOrdinal> &
numFields=
fa_fps_[b]->numFieldsPerId();
905 const std::vector<panzer::LocalOrdinal> & fieldIds=
fa_fps_[b]->fieldIds();
906 const std::vector<panzer::LocalOrdinal> & myElements =
connMngr_->getElementBlock(
blockOrder_[b]);
907 for (
size_t l = 0; l < myElements.size(); ++l) {
908 auto connSize =
connMngr_->getConnectivitySize(myElements[l]);
909 const auto * elmtConn =
connMngr_->getConnectivity(myElements[l]);
911 for (
int c = 0; c < connSize; ++c) {
912 size_t lid = overlapmap->getLocalElement(elmtConn[c]);
913 for(std::size_t i=0;i<working.size();i++)
915 for (
int n = 0; n < numFields[c]; ++n) {
916 int whichField = fieldIds[offset];
919 working[whichField]++;
922 for(std::size_t i=0;i<working.size();i++) {
923 auto current = edittwoview_host(lid,i);
924 edittwoview_host(lid,i) = (current > working[i]) ? current : working[i];
971 std::map<std::string,int>::const_iterator fitr =
fieldNameToAID_.find(field);
973 std::stringstream ss;
975 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"DOFManager::fieldInBlock: invalid field name. DOF information is:\n"+ss.str());
977 std::map<std::string,int>::const_iterator bitr =
blockNameToID_.find(block);
979 std::stringstream ss;
981 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"DOFManager::fieldInBlock: invalid block name. DOF information is:\n"+ss.str());
983 int fid=fitr->second;
984 int bid=bitr->second;
1002 std::map<std::string,int>::const_iterator bitr =
blockNameToID_.find(blockId);
1005 int bid=bitr->second;
1008 if(
fa_fps_[bid]!=Teuchos::null)
1009 return fa_fps_[bid]->fieldIds();
1012 static std::vector<int> empty;
1017 const std::pair<std::vector<int>,std::vector<int> > &
1021 std::map<std::string,int>::const_iterator bitr =
blockNameToID_.find(blockId);
1026 if(
fa_fps_[bitr->second]!=Teuchos::null)
1027 return fa_fps_[bitr->second]->localOffsets_closure(fieldNum, subcellDim, subcellId);
1029 static std::pair<std::vector<int>,std::vector<int> > empty;
1037 if(indices.size()!=isOwned.size())
1038 isOwned.resize(indices.size(),
false);
1039 typename std::vector<panzer::GlobalOrdinal>::const_iterator endOf =
owned_.end();
1040 for (std::size_t i = 0; i < indices.size(); ++i) {
1041 isOwned[i] = ( std::find(
owned_.begin(),
owned_.end(), indices[i])!=endOf );
1049 "DOFManager::setFieldOrder: setFieldOrder cannot be called after "
1050 "buildGlobalUnknowns has been called");
1072 for (
size_t j = 0; j < proposed_fieldOrder.size(); ++j) {
1101 std::vector<std::string> elementBlockIds;
1102 connMngr_->getElementBlockIds(elementBlockIds);
1105 std::size_t myElementCount = 0;
1106 for(std::vector<std::string>::const_iterator blockItr=elementBlockIds.begin(); blockItr!=elementBlockIds.end();++blockItr)
1107 myElementCount +=
connMngr_->getElementBlock(*blockItr).size();
1113 for(std::vector<std::string>::const_iterator blockItr=elementBlockIds.begin();
1114 blockItr!=elementBlockIds.end();++blockItr) {
1115 const std::string & blockName = *blockItr;
1118 std::map<std::string,int>::const_iterator fap =
blockNameToID_.find(blockName);
1123 int bid=fap->second;
1125 if(
fa_fps_[bid]==Teuchos::null)
1132 std::vector<std::pair<int,int> > topEdgeIndices;
1136 std::vector<std::vector<int> > topFaceIndices;
1141 const std::vector<panzer::LocalOrdinal> & elmts =
connMngr_->getElementBlock(blockName);
1142 for(std::size_t e=0;e<elmts.size();e++) {
1144 std::vector<signed char> & eOrientation =
orientation_[elmts[e]];
1149 eOrientation.resize(fieldPattern.
numberIds());
1150 for(std::size_t s=0;s<eOrientation.size();s++)
1151 eOrientation[s] = 1;
1154 auto connSz =
connMngr_->getConnectivitySize(elmts[e]);
1155 const panzer::GlobalOrdinal * connPtr =
connMngr_->getConnectivity(elmts[e]);
1156 const std::vector<panzer::GlobalOrdinal> connectivity(connPtr,connPtr+connSz);
1171 "DOFManager::getElementOrientations: Orientations were not constructed!");
1173 const std::vector<signed char> & local_o =
orientation_[localElmtId];
1174 gidsOrientation.resize(local_o.size());
1175 for(std::size_t i=0;i<local_o.size();i++) {
1176 gidsOrientation[i] = double(local_o[i]);
1200 std::map<std::string,int>::const_iterator bitr =
blockNameToID_.find(blockId);
1203 return bitr->second;
1209 os <<
"DOFManager Field Information: " << std::endl;
1215 os <<
" Element Block = " <<
blockOrder_[i] << std::endl;
1219 for(std::size_t f=0;f<fieldIds.size();f++)
1220 os <<
" \"" <<
getFieldString(fieldIds[f]) <<
"\" is field ID " << fieldIds[f] << std::endl;
1228 PANZER_FUNC_TIME_MONITOR(
"panzer::DOFManager::builderOverlapMapFromElements");
1235 std::set<panzer::GlobalOrdinal> overlapset;
1238 for (
size_t e = 0; e < myElements.size(); ++e) {
1239 auto connSize =
connMngr_->getConnectivitySize(myElements[e]);
1240 const panzer::GlobalOrdinal * elmtConn =
connMngr_->getConnectivity(myElements[e]);
1241 for (
int k = 0; k < connSize; ++k) {
1242 overlapset.insert(elmtConn[k]);
1248 for (
typename std::set<panzer::GlobalOrdinal>::const_iterator itr = overlapset.begin(); itr!=overlapset.end(); ++itr) {
1254 return Tpetra::createNonContigMapWithNode<panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType>(overlapVector,
getComm());
1260 std::vector<std::vector< panzer::GlobalOrdinal > > & elementGIDs,
1261 const Tpetra::Map<panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> & overlapmap,
1262 const Tpetra::MultiVector<panzer::GlobalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> & const_overlap_mv)
const
1267 auto overlap_mv =
const_cast<Tpetra::MultiVector<panzer::GlobalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType>&
>(const_overlap_mv);
1268 const auto twoview_host = overlap_mv.getLocalViewHost(Tpetra::Access::ReadOnly);
1275 if(
fa_fps_[b]==Teuchos::null) {
1277 for (
size_t l = 0; l < myElements.size(); ++l) {
1278 panzer::LocalOrdinal thisID=myElements[l];
1279 if(elementGIDs.size()<=(size_t)thisID)
1280 elementGIDs.resize(thisID+1);
1286 const std::vector<int> & fieldIds=
fa_fps_[b]->fieldIds();
1289 for (
size_t l = 0; l < myElements.size(); ++l) {
1290 auto connSize =
connMngr_->getConnectivitySize(myElements[l]);
1291 const panzer::GlobalOrdinal * elmtConn =
connMngr_->getConnectivity(myElements[l]);
1292 std::vector<panzer::GlobalOrdinal> localOrdering;
1294 for (
int c = 0; c < connSize; ++c) {
1295 size_t lid = overlapmap.getLocalElement(elmtConn[c]);
1297 for (
int n = 0; n < numFields[c]; ++n) {
1298 int whichField = fieldIds[offset];
1302 localOrdering.push_back(twoview_host(lid,whichField)+dofsPerField[whichField]);
1304 dofsPerField[whichField]++;
1307 panzer::LocalOrdinal thisID=myElements[l];
1308 if(elementGIDs.size()<=(size_t)thisID){
1309 elementGIDs.resize(thisID+1);
1311 elementGIDs[thisID]=localOrdering;
1318 std::vector<std::vector<panzer::LocalOrdinal> > elementLIDs(
elementGIDs_.size());
1320 std::vector<panzer::GlobalOrdinal> ownedAndGhosted;
1324 std::unordered_map<panzer::GlobalOrdinal,panzer::LocalOrdinal> hashMap;
1325 for(std::size_t i = 0; i < ownedAndGhosted.size(); ++i)
1326 hashMap[ownedAndGhosted[i]] = i;
1328 for (std::size_t i = 0; i <
elementGIDs_.size(); ++i) {
1329 const std::vector<panzer::GlobalOrdinal>& gids =
elementGIDs_[i];
1330 std::vector<panzer::LocalOrdinal>&
lids = elementLIDs[i];
1331 lids.resize(gids.size());
1332 for (std::size_t g = 0; g < gids.size(); ++g)
1333 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
virtual Teuchos::RCP< const Tpetra::Map< panzer::LocalOrdinal, panzer::GlobalOrdinal, panzer::TpetraNodeType > > buildOverlapMapFromElements(const ElementBlockAccess &access) const
const PHX::View< const int * > 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.
virtual 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.
void disableSafetyCheck()
Teuchos::RCP< ConnManager > resetIndices()
Reset the indices for this DOF manager.
virtual 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
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_
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_
virtual 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)
virtual 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()
void apply(ReductionDataType &sum) const
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_
Tpetra::KokkosCompat::KokkosDeviceWrapperNode< PHX::Device > TpetraNodeType
Kokkos::View< const LO **, Kokkos::LayoutRight, PHX::Device > lids
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_