31initialize(
const Teuchos::RCP<const GlobalIndexer> & ugi,
32 const std::vector<panzer::GlobalOrdinal>& filtered)
34 using GO = panzer::GlobalOrdinal;
35 using LO = panzer::LocalOrdinal;
37 using Map = Tpetra::Map<LO, GO, Node>;
38 using Vector = Tpetra::Vector<GO,LO,GO,Node>;
39 using Export = Tpetra::Export<LO,GO,Node>;
43 using HashTable = std::unordered_set<panzer::GlobalOrdinal>;
51 vector<panzer::GlobalOrdinal> baseOwned, baseGhosted;
52 base_->getOwnedIndices(baseOwned);
53 base_->getGhostedIndices(baseGhosted);
55 RCP<const Map> ownedMap
56 = Tpetra::createNonContigMapWithNode<LO,GO,Node>(baseOwned,
getComm());
57 RCP<const Map> ghostedMap
58 = Tpetra::createNonContigMapWithNode<LO,GO,Node>(baseGhosted,
getComm());
60 Vector ownedFiltered(ownedMap);
61 Vector ghostedFiltered(ghostedMap);
63 ownedFiltered.putScalar(0.0);
64 ghostedFiltered.putScalar(0.0);
67 auto ownedFiltered_host = ownedFiltered.getLocalViewHost(Tpetra::Access::ReadWrite);
68 auto ghostedFiltered_host = ghostedFiltered.getLocalViewHost(Tpetra::Access::ReadWrite);
70 for(panzer::GlobalOrdinal f : filtered) {
71 bool isOwned = std::find(baseOwned.begin(),baseOwned.end(),f)!=baseOwned.end();
72 bool isGhosted = std::find(baseGhosted.begin(),baseGhosted.end(),f)!=baseGhosted.end();
75 ownedFiltered_host(ownedMap->getLocalElement(f),0) = 1.0;
77 ghostedFiltered_host(ghostedMap->getLocalElement(f),0) = 1.0;
82 Export exporter(ghostedMap,ownedMap);
83 ownedFiltered.doExport(ghostedFiltered, exporter, Tpetra::ADD);
85 Teuchos::ArrayRCP<const panzer::GlobalOrdinal> data = ownedFiltered.getData();
88 HashTable filteredHash;
89 for(
int i(0); i < data.size(); ++i) {
91 filteredHash.insert(baseOwned[i]);
99 for (
size_t i(0); i < baseOwned.size(); ++i)
101 auto itr = filteredHash.find(baseOwned[i]);
102 if (itr == filteredHash.end())
103 owned_.push_back(baseOwned[i]);
121 using GO = panzer::GlobalOrdinal;
122 using LO = panzer::LocalOrdinal;
124 using Map = Tpetra::Map<LO, GO, Node>;
125 using Vector = Tpetra::Vector<GO,LO,GO,Node>;
126 using Import = Tpetra::Import<LO,GO,Node>;
129 std::vector<panzer::GlobalOrdinal> ghostedIndices;
135 RCP<const Map> ownedMap
137 RCP<const Map> ghostedMap
138 = Tpetra::createNonContigMapWithNode<LO,GO,Node>(ghostedIndices,
getComm());
142 Vector ownedActive(ownedMap);
143 ownedActive.putScalar(1);
146 Vector ghostedActive(ghostedMap);
147 ghostedActive.putScalar(0);
151 Import importer(ownedMap,ghostedMap);
152 ghostedActive.doImport(ownedActive,importer,Tpetra::INSERT);
154 Teuchos::ArrayRCP<const GO> data = ghostedActive.getData();
158 indicator.insert(indicator.end(),data.begin(),data.end());
186ownedIndices(
const std::vector<panzer::GlobalOrdinal> & indices,std::vector<bool> & isOwned)
const
189 if(indices.size()!=isOwned.size())
190 isOwned.resize(indices.size(),
false);
191 typename std::vector<panzer::GlobalOrdinal>::const_iterator endOf =
owned_.end();
192 for (std::size_t i = 0; i < indices.size(); ++i) {
193 isOwned[i] = ( std::find(
owned_.begin(),
owned_.end(), indices[i])!=endOf );