Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_BlockedDOFManager.cpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Panzer: A partial differential equation assembly
4// engine for strongly coupled complex multiphysics systems
5//
6// Copyright 2011 NTESS and the Panzer contributors.
7// SPDX-License-Identifier: BSD-3-Clause
8// *****************************************************************************
9// @HEADER
10
11#ifndef PANZER_BLOCKED_DOF_MANAGER_IMPL_HPP
12#define PANZER_BLOCKED_DOF_MANAGER_IMPL_HPP
13
14#include <map>
15#include <numeric>
16
20#include "Teuchos_DefaultMpiComm.hpp"
21
22namespace panzer {
23
24using Teuchos::RCP;
25
26// ************************************************************
27// class BlockedDOFManager
28// ************************************************************
29
31 : fieldsRegistered_(false), maxSubFieldNum_(-1), requireOrientations_(false), useDOFManagerFEI_(true), useTieBreak_(false)
32{ }
33
34BlockedDOFManager::BlockedDOFManager(const Teuchos::RCP<ConnManager> & connMngr,MPI_Comm mpiComm)
35 : fieldsRegistered_(false), maxSubFieldNum_(-1), requireOrientations_(false), useDOFManagerFEI_(true), useTieBreak_(false)
36{
37 setConnManager(connMngr,mpiComm);
38}
39
42
43int BlockedDOFManager::getFieldNum(const std::string & str) const
44{
45 std::map<std::string,int>::const_iterator itr = fieldStrToNum_.find(str);
46
47 // return based on what was found
48 if(itr==fieldStrToNum_.end()) {
49 // incorrect field name
50 TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,
51 "BlockedDOFManager::getFieldNum No field with the name \"" + str + "\" has been added");
52 }
53 else {
54 return itr->second;
55 }
56}
57
58const std::string & BlockedDOFManager::getFieldString(int number) const
59{
60 std::map<int,std::string>::const_iterator itr = fieldNumToStr_.find(number);
61
62 // return based on what was found
63 if(itr==fieldNumToStr_.end()) {
64 std::stringstream ss; ss << number; // itoa() in c-language
65 // incorrect field name
66 TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,
67 "BlockedDOFManager::getFieldString No field with number \"" + ss.str() + "\" has been added");
68 }
69 else {
70 return itr->second;
71 }
72}
73
74bool BlockedDOFManager::fieldInBlock(const std::string & field,const std::string & block) const
75{
76 // try to find element block
77 std::map<std::string,std::set<std::string> >::const_iterator fieldsItr = blockIdToFieldStrings_.find(block);
78 TEUCHOS_TEST_FOR_EXCEPTION(fieldsItr==blockIdToFieldStrings_.end(),std::logic_error,
79 "BlockedDOFManager::fieldInBlock could not find the element block \""+block+"\"");
80
81 // find field in element block
82 const std::set<std::string> & fields = fieldsItr->second;
83 std::set<std::string>::const_iterator itr = fields.find(field);
84 return itr!=fields.end();
85}
86
89const std::vector<int> & BlockedDOFManager::getBlockFieldNumbers(const std::string & block) const
90{
91 // try to find element block
92 std::map<std::string,std::vector<int> >::const_iterator fieldsItr = blockIdToFieldNumbers_.find(block);
93 if(fieldsItr!=blockIdToFieldNumbers_.end())
94 return fieldsItr->second;
95
96 // nothing to return
97 static std::vector<int> empty;
98 return empty;
99}
100
101void BlockedDOFManager::getElementGIDs(panzer::LocalOrdinal localElmtId,std::vector<GlobalOrdinal> & gids,const std::string & blockIdHint) const
102{
103 // WARNING: there is an assumed ordering being used here it
104 // corresponds directly to the blockGIDOffset_ map and (as
105 // a result) the getBlockGIDOffset function. However for
106 // the sake of speed this conversion is implicit.
107 //
108 // Any changes to the order should be reflected in the
109 // blockGIDOffset_ map.
110
111 gids.resize(0);
112
113 // loop over field block manager and grab indices
114 for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
115 std::vector<panzer::GlobalOrdinal> fieldBlockOwned;
116
117 fieldBlockManagers_[fbm]->getElementGIDs(localElmtId,fieldBlockOwned,blockIdHint);
118
119 TEUCHOS_TEST_FOR_EXCEPTION(true,std::runtime_error,"getElementGIDs() not supported for BlockedDOFManager!")
120 // for(std::size_t i=0;i<fieldBlockOwned.size();i++)
121 // gids.push_back(std::make_pair(fbm,fieldBlockOwned[i]));
122 }
123}
124
125 void BlockedDOFManager::getElementGIDsPair(panzer::LocalOrdinal localElmtId,std::vector<std::pair<int,GlobalOrdinal>> & gids,const std::string & blockIdHint) const
126{
127 // WARNING: there is an assumed ordering being used here it
128 // corresponds directly to the blockGIDOffset_ map and (as
129 // a result) the getBlockGIDOffset function. However for
130 // the sake of speed this conversion is implicit.
131 //
132 // Any changes to the order should be reflected in the
133 // blockGIDOffset_ map.
134
135 gids.resize(0);
136
137 // loop over field block manager and grab indices
138 for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
139 std::vector<panzer::GlobalOrdinal> fieldBlockOwned;
140
141 fieldBlockManagers_[fbm]->getElementGIDs(localElmtId,fieldBlockOwned,blockIdHint);
142
143 for(std::size_t i=0;i<fieldBlockOwned.size();i++)
144 gids.push_back(std::make_pair(fbm,fieldBlockOwned[i]));
145 }
146}
147
148void BlockedDOFManager::getElementOrientation(panzer::LocalOrdinal localElmtId,std::vector<double> & gidsOrientation) const
149{
150 // WARNING: there is an assumed ordering being used here it
151 // corresponds directly to the blockGIDOffset_ map and (as
152 // a result) the getBlockGIDOffset function. However for
153 // the sake of speed this conversion is implicit.
154 //
155 // Any changes to the order should be reflected in the
156 // blockGIDOffset_ map.
157
158 gidsOrientation.resize(0);
159
160 // loop over field block manager and grab indices
161 for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
162 std::vector<double> blkOrientation;
163
164 fieldBlockManagers_[fbm]->getElementOrientation(localElmtId,blkOrientation);
165
166 for(std::size_t i=0;i<blkOrientation.size();i++)
167 gidsOrientation.push_back(blkOrientation[i]);
168 }
169}
170
171const std::vector<int> & BlockedDOFManager::getGIDFieldOffsets(const std::string & blockId,int fieldNum) const
172{
173 typedef std::map<std::string,std::map<int,std::vector<int> > > FieldOffsetsMap;
174
175 FieldOffsetsMap::iterator blockItr = gidFieldOffsets_.find(blockId);
176 if(blockItr!=gidFieldOffsets_.end()) {
177 std::map<int,std::vector<int> > & fieldToVectorMap = blockItr->second;
178 std::map<int,std::vector<int> >::const_iterator itr = fieldToVectorMap.find(fieldNum);
179
180 // we have found the vector, return the precomputed one
181 if(itr!=fieldToVectorMap.end())
182 return itr->second;
183 }
184 else {
185 std::vector<std::string> elementBlocks;
186 getElementBlockIds(elementBlocks);
187 TEUCHOS_TEST_FOR_EXCEPTION(std::find(elementBlocks.begin(),elementBlocks.end(),blockId)==elementBlocks.end(),std::logic_error,
188 "BlockedDOFManager::getGIDFieldOffsets: Block ID \""+blockId+"\" does not exist");
189
190 gidFieldOffsets_[blockId] = std::map<int,std::vector<int> >();
191 blockItr = gidFieldOffsets_.find(blockId);
192 }
193
194 // grab relevant map from iterator
195 std::map<int,std::vector<int> > & fieldToVectorMap = blockItr->second;
196
197 // we have not found the vector, now we need to build one
199
200 // first grab all pieces that are needed for extracting GIDs from sub system
201 int fieldBlock = getFieldBlock(fieldNum);
202 Teuchos::RCP<const GlobalIndexer> dofManager = fieldBlockManagers_[fieldBlock];
203
204 // grab offsets for sub dof manager. Notice you must convert to field number used by sub manager!
205 const std::vector<int> & subGIDOffsets
206 = dofManager->getGIDFieldOffsets(blockId,dofManager->getFieldNum(getFieldString(fieldNum)));
207
208 // increment offsets to correspond with blocked system
209 int gidOffset = getBlockGIDOffset(blockId,fieldBlock);
210 std::vector<int> & finalFieldOffsets = fieldToVectorMap[fieldNum];
211 finalFieldOffsets.resize(subGIDOffsets.size());
212 for(std::size_t i=0;i<finalFieldOffsets.size();i++)
213 finalFieldOffsets[i] = gidOffset+subGIDOffsets[i];
214
215 return finalFieldOffsets;
216}
217
218bool BlockedDOFManager::LessThan
219::operator()(const Teuchos::Tuple<int,3> & a,const Teuchos::Tuple<int,3> & b) const
220{
221 if(a[0] < b[0]) return true;
222 if(a[0] > b[0]) return false;
223
224 // a[0]==b[0]
225 if(a[1] < b[1]) return true;
226 if(a[1] > b[1]) return false;
227
228 // a[1]==b[1] && a[0]==b[0]
229 if(a[2] < b[2]) return true;
230 if(a[2] > b[2]) return false;
231
232 // a[2]==b[2] && a[1]==b[1] && a[0]==b[0]
233 return false; // these are equal to, but not less than!
234}
235
236const std::pair<std::vector<int>,std::vector<int> > &
237BlockedDOFManager::getGIDFieldOffsets_closure(const std::string & blockId,int fieldNum,int subcellDim,int subcellId) const
238{
239 typename std::map<std::string,TupleToVectorPairMap>::iterator blockItr = gidFieldOffsets_closure_.find(blockId);
240 if(blockItr!=gidFieldOffsets_closure_.end()) {
241 TupleToVectorPairMap & fieldToTupleMap = blockItr->second;
242 typename TupleToVectorPairMap::const_iterator itr =
243 fieldToTupleMap.find(Teuchos::tuple(fieldNum,subcellDim,subcellId));
244
245 // we have found the vector, return the precomputed one
246 if(itr!=fieldToTupleMap.end())
247 return itr->second;
248 }
249 else {
250 std::vector<std::string> elementBlocks;
251 getElementBlockIds(elementBlocks);
252 TEUCHOS_TEST_FOR_EXCEPTION(std::find(elementBlocks.begin(),elementBlocks.end(),blockId)==elementBlocks.end(),std::logic_error,
253 "BlockedDOFManager::getGIDFieldOffsets: Block ID \""+blockId+"\" does not exist");
254
256 blockItr = gidFieldOffsets_closure_.find(blockId);
257 }
258
259 // grab relevant map from iterator
260 TupleToVectorPairMap & fieldToTupleMap = blockItr->second;
261
262 // we have not found the vector, now we need to build one
264
265 // first grab all pieces that are needed for extracting GIDs from sub system
266 int fieldBlock = getFieldBlock(fieldNum);
267 Teuchos::RCP<const GlobalIndexer> dofManager = fieldBlockManagers_[fieldBlock];
268
269 // grab offsets for sub dof manager. Notice you must convert to field number used by sub manager!
270 const std::pair<std::vector<int>,std::vector<int> > & subGIDOffsets_closure
271 = dofManager->getGIDFieldOffsets_closure(blockId,dofManager->getFieldNum(getFieldString(fieldNum)),subcellDim,subcellId);
272
273 // increment offsets to correspond with blocked system
274 int gidOffset = getBlockGIDOffset(blockId,fieldBlock);
275 std::pair<std::vector<int>,std::vector<int> > & finalFieldOffsets = fieldToTupleMap[Teuchos::tuple(fieldNum,subcellDim,subcellId)];
276 finalFieldOffsets.first.resize(subGIDOffsets_closure.first.size());
277 finalFieldOffsets.second = subGIDOffsets_closure.second;
278 for(std::size_t i=0;i<finalFieldOffsets.first.size();i++)
279 finalFieldOffsets.first[i] = gidOffset+subGIDOffsets_closure.first[i];
280
281 return finalFieldOffsets;
282}
283
285//
286// getOwnedIndices()
287//
289void BlockedDOFManager::getOwnedIndices(std::vector<GlobalOrdinal>& indices) const
290{
291 using std::make_pair;
292 using std::size_t;
293 using std::vector;
294 for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
295 {
296 vector<panzer::GlobalOrdinal> fieldBlockOwned;
297 fieldBlockManagers_[fbm]->getOwnedIndices(fieldBlockOwned);
298 TEUCHOS_TEST_FOR_EXCEPTION(true,std::runtime_error,"getOwnedIndices() not supported for BlockedDOFManager!")
299 // for (size_t i(0); i < fieldBlockOwned.size(); ++i)
300 // indices.push_back(make_pair(fbm, fieldBlockOwned[i]));
301 }
302}
303
305//
306// getGhostedIndices()
307//
309void BlockedDOFManager::getGhostedIndices(std::vector<GlobalOrdinal>& indices) const
310{
311 using std::make_pair;
312 using std::size_t;
313 using std::vector;
314 for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
315 {
316 vector<panzer::GlobalOrdinal> fieldBlockGhosted;
317 fieldBlockManagers_[fbm]->getGhostedIndices(fieldBlockGhosted);
318 TEUCHOS_TEST_FOR_EXCEPTION(true,std::runtime_error,"getGhostedIndices() not supported for BlockedDOFManager!")
319 // for (size_t i(0); i < fieldBlockGhosted.size(); ++i)
320 // indices.push_back(make_pair(fbm, fieldBlockGhosted[i]));
321 }
322}
323
325//
326// getOwnedAndGhostedIndices()
327//
329void BlockedDOFManager::getOwnedAndGhostedIndices(std::vector<GlobalOrdinal>& indices) const
330{
331 using std::make_pair;
332 using std::size_t;
333 using std::vector;
334 for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
335 {
336 vector<panzer::GlobalOrdinal> fieldBlockOwnedAndGhosted;
337 fieldBlockManagers_[fbm]->getOwnedAndGhostedIndices(
338 fieldBlockOwnedAndGhosted);
339 TEUCHOS_TEST_FOR_EXCEPTION(true,std::runtime_error,"getOwnedAndGhostedIndices() not supported for BlockedDOFManager!")
340 // for (size_t i(0); i < fieldBlockOwnedAndGhosted.size(); ++i)
341 // indices.push_back(make_pair(fbm, fieldBlockOwnedAndGhosted[i]));
342 }
343}
344
346void BlockedDOFManager::getElementGIDsAsInt(panzer::LocalOrdinal localElmtId,std::vector<int> & gids,const std::string & blockIdHint) const
347{
348 // WARNING: there is an assumed ordering being used here it
349 // corresponds directly to the blockGIDOffset_ map and (as
350 // a result) the getBlockGIDOffset function. However for
351 // the sake of speed this conversion is implicit.
352 //
353 // Any changes to the order should be reflected in the
354 // blockGIDOffset_ map.
355
356 gids.resize(0);
357
358 // loop over field block manager and grab indices
359 for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
360 std::vector<int> fieldBlockOwned;
361
362 fieldBlockManagers_[fbm]->getElementGIDsAsInt(localElmtId,fieldBlockOwned,blockIdHint);
363
364 TEUCHOS_TEST_FOR_EXCEPTION(true,std::runtime_error,"getElementGIDsAsInt() not supported for BlockedDOFManager!")
365 // for(std::size_t i=0;i<fieldBlockOwned.size();i++)
366 // gids.push_back(std::make_pair(fbm,fieldBlockOwned[i]));
367 }
368}
369
371void BlockedDOFManager::getOwnedIndicesAsInt(std::vector<int>& indices) const
372{
373 using std::make_pair;
374 using std::size_t;
375 using std::vector;
376 for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
377 {
378 vector<int> fieldBlockOwned;
379 fieldBlockManagers_[fbm]->getOwnedIndicesAsInt(fieldBlockOwned);
380 TEUCHOS_TEST_FOR_EXCEPTION(true,std::runtime_error,"getOwnedIndicesAsInt() not supported for BlockedDOFManager!")
381 // for (size_t i(0); i < fieldBlockOwned.size(); ++i)
382 // indices.push_back(make_pair(fbm, fieldBlockOwned[i]));
383 }
384}
385
387void BlockedDOFManager::getGhostedIndicesAsInt(std::vector<int>& indices) const
388{
389 using std::make_pair;
390 using std::size_t;
391 using std::vector;
392 for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
393 {
394 vector<int> fieldBlockGhosted;
395 fieldBlockManagers_[fbm]->getGhostedIndicesAsInt(fieldBlockGhosted);
396 TEUCHOS_TEST_FOR_EXCEPTION(true,std::runtime_error,"getGhostedIndicesAsInt() not supported for BlockedDOFManager!")
397 // for (size_t i(0); i < fieldBlockGhosted.size(); ++i)
398 // indices.push_back(make_pair(fbm, fieldBlockGhosted[i]));
399 }
400}
401
403void BlockedDOFManager::getOwnedAndGhostedIndicesAsInt(std::vector<int>& indices) const
404{
405 using std::make_pair;
406 using std::size_t;
407 using std::vector;
408 for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
409 {
410 vector<int> fieldBlockOwnedAndGhosted;
411 fieldBlockManagers_[fbm]->getOwnedAndGhostedIndicesAsInt(
412 fieldBlockOwnedAndGhosted);
413 TEUCHOS_TEST_FOR_EXCEPTION(true,std::runtime_error,"getOwnedAndGhostedIndicesAsInt() not supported for BlockedDOFManager!")
414 // for (size_t i(0); i < fieldBlockOwnedAndGhosted.size(); ++i)
415 // indices.push_back(make_pair(fbm, fieldBlockOwnedAndGhosted[i]));
416 }
417}
418
420//
421// getNumOwned()
422//
425{
426 using std::size_t;
427 int result(0);
428 for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
430 return result;
431}
432
434//
435// getNumGhosted()
436//
439{
440 using std::size_t;
441 int result(0);
442 for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
444 return result;
445}
446
448//
449// getNumOwnedAndGhosted()
450//
453{
454 using std::size_t;
455 int result(0);
456 for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
458 return result;
459}
460
461void BlockedDOFManager::ownedIndices(const std::vector<GlobalOrdinal> & indices,std::vector<bool> & isOwned) const
462{
463 isOwned.resize(0);
464
465 std::vector<std::vector<panzer::GlobalOrdinal> > blockIndices(fieldBlockManagers_.size());
466 TEUCHOS_TEST_FOR_EXCEPTION(true,std::runtime_error,"ownedIndices() not supported for BlockedDOFManager!")
467 // for(std::size_t i=0;i<indices.size();i++)
468 // blockIndices[indices[i].first].push_back(indices[i].second);
469
470 // build bool vector stating if each sub block is owned
471 std::vector<std::vector<bool> > blockIsOwned(fieldBlockManagers_.size());
472 std::vector<std::vector<bool>::const_iterator> blockItrs;
473 for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
474 fieldBlockManagers_[fbm]->ownedIndices(blockIndices[fbm],blockIsOwned[fbm]);
475
476 // setup iterators to boolean vectors
477 blockItrs.push_back(blockIsOwned[fbm].begin());
478 }
479
480 // loop over indices, consider their block and look it up
481 // in iterator vector
482 TEUCHOS_TEST_FOR_EXCEPTION(true,std::runtime_error,"ownedIndices() not supported for BlockedDOFManager!")
483/*
484 for(std::size_t i=0;i<indices.size();i++) {
485 int block = indices[i].first;
486
487 // set owned status from iterator of block
488 bool owned = *blockItrs[block];
489 isOwned.push_back(owned);
490
491 // increment block iterator
492 blockItrs[block]++;
493 }
494
495 // quick error sanity check
496 TEUCHOS_ASSERT(isOwned.size()==indices.size());
497 for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
498 TEUCHOS_TEST_FOR_EXCEPTION(blockItrs[fbm]!=blockIsOwned[fbm].end(),std::logic_error,
499 "BlockedDOFManager::ownedIndices: Did not consume all sub block boolean entries as expected.");
500 }
501*/
502}
503
504
507
508
520void BlockedDOFManager::setConnManager(const Teuchos::RCP<ConnManager> & connMngr,MPI_Comm mpiComm)
521{
522 communicator_ = Teuchos::rcp(new Teuchos::MpiComm<int>(Teuchos::opaqueWrapper(mpiComm)));
523
524 // this kills any old connection manager
525 resetIndices();
526
527 connMngr_ = connMngr;
528
529 mpiComm_ = *communicator_->getRawMpiComm();
530}
531
540Teuchos::RCP<ConnManager> BlockedDOFManager::resetIndices()
541{
542 Teuchos::RCP<ConnManager> connMngr = connMngr_;
543
544 connMngr_ = Teuchos::null;
545 //ownedGIDHashTable_.clear();
546 blockGIDOffset_.clear();
547
548 return connMngr;
549}
550
551void BlockedDOFManager::addField(const std::string & str,
552 const Teuchos::RCP<const FieldPattern> & pattern)
553{
554 std::vector<std::string> elementBlockIds;
555 connMngr_->getElementBlockIds(elementBlockIds);
556
557 // loop over blocks adding field pattern to each
558 for(std::size_t i=0;i<elementBlockIds.size();i++)
559 addField(elementBlockIds[i],str,pattern);
560}
561
562void BlockedDOFManager::addField(const std::string & blockId,const std::string & str,
563 const Teuchos::RCP<const FieldPattern> & pattern)
564{
565 TEUCHOS_TEST_FOR_EXCEPTION(fieldsRegistered(),std::logic_error,
566 "BlockedDOFManager::addField: addField cannot be called after registerFields or"
567 "buildGlobalUnknowns has been called");
568
569 fieldStringToPattern_[std::make_pair(blockId,str)] = pattern;
570 blockIdToFieldStrings_[blockId].insert(str);
571}
572
573void BlockedDOFManager::registerFields(bool buildSubUGIs)
574{
575 if(buildSubUGIs)
576 fieldBlockManagers_.clear();
577 fieldStrToNum_.clear();
578 fieldNumToStr_.clear();
579 fieldNumToFieldBlk_.clear();
580 maxSubFieldNum_ = -1;
581
582 fieldsRegistered_ = false;
583
584 // test validity of the field order, build default if none is provided
585 {
586 // build a unique set of fields, so we can compare validate the ordered list
587 std::set<std::string> fields;
588 for(std::map<std::pair<std::string,std::string>,Teuchos::RCP<const FieldPattern> >::const_iterator
589 fieldItr=fieldStringToPattern_.begin(); fieldItr!=fieldStringToPattern_.end();++fieldItr) {
590 std::string fieldName = fieldItr->first.second;
591 fields.insert(fieldName);
592 }
593
594 // construct default field order if neccessary
595 if(fieldOrder_.size()==0) {
596 std::set<std::string>::const_iterator itr;
597 for(itr=fields.begin();itr!=fields.end();itr++) {
598 std::vector<std::string> block;
599 block.push_back(*itr);
600 fieldOrder_.push_back(block);
601 }
602 }
603
604 // check validity of field order: no repeats, and everything is accounted for
605 bool validOrder = validFieldOrder(fieldOrder_,fields);
606 if(!validOrder) {
607 // for outputing
608 std::stringstream ss;
609
610 ss << "BlockedDOFManager::registerFields - Field order is invalid!\n";
611
612 ss << " fields = [ ";
613 for(std::set<std::string>::const_iterator itr=fields.begin();
614 itr!=fields.end();++itr)
615 ss << "\"" << *itr << "\" ";
616 ss << " ]\n";
617
618 ss << " fieldOrder = [ ";
619 for(std::vector<std::vector<std::string> >::const_iterator bitr=fieldOrder_.begin();
620 bitr!=fieldOrder_.end();++bitr) {
621 ss << "[ ";
622 for(std::vector<std::string>::const_iterator itr=bitr->begin();
623 itr!=bitr->end();++itr) {
624 ss << "\"" << *itr << "\" ";
625 }
626 ss << " ], ";
627 }
628 ss << " ]\n";
629
630 TEUCHOS_TEST_FOR_EXCEPTION(!validOrder,std::logic_error,ss.str());
631 }
632 }
633
634 // build sub DOFManagers for each field block
635 if(buildSubUGIs) {
636 for(std::size_t fldBlk=0;fldBlk<fieldOrder_.size();fldBlk++) {
637 Teuchos::RCP<panzer::GlobalIndexer> dofManager = buildNewIndexer(getConnManager(),mpiComm_);
638
639 // add in these fields to the new manager
640 this->addFieldsToFieldBlockManager(fieldOrder_[fldBlk],*dofManager);
641
642 fieldBlockManagers_.push_back(dofManager);
643 }
644 }
645
647 // build field numbers: two stage algorithm
648
649 // 1st Stage: Extract field numbers used by each sub DOFManager.
650 // determine largest of these
651 //
652 // - note at this point since "validFieldOrder" has
653 // been called we are gurranteed to not have repeated fields
654 maxSubFieldNum_ = -1;
655 std::map<std::string,int> tempStrToNum;
656 for(std::size_t fldBlk=0;fldBlk<fieldBlockManagers_.size();fldBlk++) {
657 Teuchos::RCP<const panzer::GlobalIndexer> dofManager =
658 fieldBlockManagers_[fldBlk];
659 const std::vector<std::string> & activeFields = fieldOrder_[fldBlk];
660
661 int fieldNum = 0;
662 for(std::size_t f=0;f<activeFields.size();f++) {
663 fieldNum = dofManager->getFieldNum(activeFields[f]);
664 tempStrToNum[activeFields[f]] = fieldNum;
665
666 maxSubFieldNum_ = (fieldNum>maxSubFieldNum_) ? fieldNum : maxSubFieldNum_;
667 }
668 }
669
670 // 2nd Stage: Using field block index, field number and largest field number
671 // build a up fieldStrToNum_ map and fieldNumToFieldBlk_
672 int numOffset = 0;
673 for(std::size_t fldBlk=0;fldBlk<fieldBlockManagers_.size();fldBlk++) {
674 const std::vector<std::string> & activeFields = fieldOrder_[fldBlk];
675
676 for(std::size_t f=0;f<activeFields.size();f++) {
677 // compute offset field number
678 int fieldNum = tempStrToNum[activeFields[f]]+numOffset;
679
680 // build up map data
681 fieldStrToNum_[activeFields[f]] = fieldNum;
682 fieldNumToStr_[fieldNum] = activeFields[f];
683 fieldNumToFieldBlk_[fieldNum] = fldBlk;
684 }
685
686 // increament field number offset based on largest sub field number
687 numOffset += (maxSubFieldNum_+1);
688 }
689
690 // end build field numbers
692
693 // build block to field numbers: this requires field numbers have been built
694 // and that "getFieldNum" behaves correctly
695 for(std::map<std::string,std::set<std::string> >::const_iterator itr=blockIdToFieldStrings_.begin();
696 itr!=blockIdToFieldStrings_.end();++itr) {
697 const std::set<std::string> & fields = itr->second;
698
699 std::vector<int> & fieldNums = blockIdToFieldNumbers_[itr->first];
700 for(std::set<std::string>::const_iterator fldItr=fields.begin();
701 fldItr!=fields.end();++fldItr) {
702 fieldNums.push_back(getFieldNum(*fldItr));
703 }
704 }
705
706 // everything completed, mark as fields registered
707 fieldsRegistered_ = true;
708}
709
710Teuchos::RCP<GlobalIndexer>
711BlockedDOFManager::buildNewIndexer(const Teuchos::RCP<ConnManager> & connManager,MPI_Comm mpiComm) const
712{
713 Teuchos::RCP<panzer::DOFManager> dofManager = Teuchos::rcp(new panzer::DOFManager);
714 dofManager->enableTieBreak(useTieBreak_);
715 dofManager->setConnManager(connManager,mpiComm);
716 return dofManager;
717}
718
719void BlockedDOFManager::setOrientationsRequired(const Teuchos::RCP<GlobalIndexer> & indexer,bool required) const
720{
721 using Teuchos::RCP;
722 using Teuchos::rcp_dynamic_cast;
723
724 // standard version
725 {
726 RCP<DOFManager> dofManager = rcp_dynamic_cast<DOFManager>(indexer);
727
728 if(dofManager!=Teuchos::null) {
729 dofManager->setOrientationsRequired(required);
730 return;
731 }
732 }
733
734 // you should never get here!
735 TEUCHOS_ASSERT(false);
736}
737
739buildGlobalUnknowns(const Teuchos::RCP<GlobalIndexer> & indexer,const Teuchos::RCP<const FieldPattern> & geomPattern) const
740{
741 using Teuchos::RCP;
742 using Teuchos::rcp_dynamic_cast;
743
744 // standard version
745 {
746 RCP<DOFManager> dofManager = rcp_dynamic_cast<DOFManager>(indexer);
747
748 if(dofManager!=Teuchos::null) {
749 dofManager->buildGlobalUnknowns(geomPattern);
750 return;
751 }
752 }
753
754 // you should never get here!
755 TEUCHOS_ASSERT(false);
756}
757
758void BlockedDOFManager::printFieldInformation(const Teuchos::RCP<GlobalIndexer> & indexer,
759 std::ostream & os) const
760{
761 using Teuchos::RCP;
762 using Teuchos::rcp_dynamic_cast;
763
764 // standard version
765 {
766 RCP<DOFManager> dofManager = rcp_dynamic_cast<DOFManager>(indexer);
767
768 if(dofManager!=Teuchos::null) {
769 dofManager->printFieldInformation(os);
770 return;
771 }
772 }
773
774 // you should never get here!
775 TEUCHOS_ASSERT(false);
776}
777
778int BlockedDOFManager::getElementBlockGIDCount(const Teuchos::RCP<GlobalIndexer> & indexer,
779 const std::string & elementBlock) const
780{
781 using Teuchos::RCP;
782 using Teuchos::rcp_dynamic_cast;
783
784 TEUCHOS_ASSERT(indexer!=Teuchos::null);
785
786 return indexer->getElementBlockGIDCount(elementBlock);
787}
788
789int BlockedDOFManager::getElementBlockGIDCount(const Teuchos::RCP<GlobalIndexer> & indexer,
790 const std::size_t & elementBlock) const
791{
792 using Teuchos::RCP;
793 using Teuchos::rcp_dynamic_cast;
794
795 TEUCHOS_ASSERT(indexer!=Teuchos::null);
796
797 return indexer->getElementBlockGIDCount(elementBlock);
798}
799
800int BlockedDOFManager::getElementBlockGIDCount(const std::string & elementBlock) const
801{
802 int gidCount = 0;
803 for(std::size_t i=0;i<fieldBlockManagers_.size();i++)
804 gidCount += fieldBlockManagers_[i]->getElementBlockGIDCount(elementBlock);
805
806 return gidCount;
807}
808
809int BlockedDOFManager::getElementBlockGIDCount(const std::size_t & elementBlock) const
810{
811 int gidCount = 0;
812 for(std::size_t i=0;i<fieldBlockManagers_.size();i++)
813 gidCount += fieldBlockManagers_[i]->getElementBlockGIDCount(elementBlock);
814
815 return gidCount;
816}
817
818void BlockedDOFManager::addFieldsToFieldBlockManager(const std::vector<std::string> & activeFields,
819 GlobalIndexer & fieldBlockManager) const
820{
821 using Teuchos::Ptr;
822 using Teuchos::ptrFromRef;
823 using Teuchos::ptr_dynamic_cast;
824
825 Ptr<GlobalIndexer> ugi_ptr = ptrFromRef(fieldBlockManager);
826
827 // standard version
828 {
829 Ptr<DOFManager> dofManager_ptr = ptr_dynamic_cast<DOFManager>(ugi_ptr);
830
831 if(dofManager_ptr!=Teuchos::null) {
832 addFieldsToFieldBlockManager(activeFields,*dofManager_ptr);
833 return;
834 }
835 }
836
837 // you should never get here!
838 TEUCHOS_ASSERT(false);
839}
840
842addFieldsToFieldBlockManager(const std::vector<std::string> & activeFields,
843 DOFManager & fieldBlockManager) const
844{
845 std::vector<std::size_t> correctnessCheck(activeFields.size(),0);
846 std::vector<std::string> elementBlocks;
847 this->getElementBlockIds(elementBlocks);
848
849 // loop over element blocks adding each field in this element block and this field block
850 for(std::size_t eb=0;eb<elementBlocks.size();eb++) {
851 std::string elementBlock = elementBlocks[eb];
852
853 // loop over active fields extracting those that are associated with this element block
854 for(std::size_t f=0;f<activeFields.size();f++) {
855 std::string fieldName = activeFields[f];
856 Teuchos::RCP<const FieldPattern> fp = this->getFieldPattern(elementBlock,fieldName);
857
858 if(fp!=Teuchos::null) {
859 fieldBlockManager.addField(elementBlock,fieldName,fp);
860 correctnessCheck[f] = 1; // all active fields should be placed in DOFManager
861 }
862 }
863 }
864
865 // verify correctness check
866 std::size_t correctFlag = std::accumulate(correctnessCheck.begin(),correctnessCheck.end(),0);
867 TEUCHOS_TEST_FOR_EXCEPTION(correctFlag!=activeFields.size(),std::logic_error,
868 "BlockedDOFManager::addFieldsToFieldBlockManager detected inconsistincies in the active fields.");
869
870 // set field order
871 fieldBlockManager.setFieldOrder(activeFields);
872}
873
874void BlockedDOFManager::setFieldOrder(const std::vector<std::vector<std::string> > & fieldOrder)
875{
876 fieldOrder_ = fieldOrder;
877}
878
881void BlockedDOFManager::getFieldOrder(std::vector<std::vector<std::string> > & fieldOrder) const
882{
883 fieldOrder = fieldOrder_;
884}
885
887{
888 if(fieldsRegistered())
889 return fieldStrToNum_.size();
890
891 // more work needs to be done if the fields have not yet been registered
892 // pull it from the (block id x field name) ==> pattern map
893 std::set<std::string> fields;
894 std::map<std::pair<std::string,std::string>,Teuchos::RCP<const FieldPattern> >::const_iterator itr;
895 for(itr=fieldStringToPattern_.begin();itr!=fieldStringToPattern_.end();++itr)
896 fields.insert(itr->first.second);
897
898 return fields.size();
899}
900
901// build the global unknown numberings
902// 1. this builds the pattens
903// 2. initializes the connectivity
904// 3. calls initComplete
906buildGlobalUnknowns(const std::vector<Teuchos::RCP<GlobalIndexer>> & fieldBlockManagers)
907{
908 using Teuchos::RCP;
909 using Teuchos::rcp_dynamic_cast;
910
911 RCP<const FieldPattern> refGeomPattern;
912 RCP<ConnManager> refConnManager = getConnManager();
913
914 // verify the pre-conditions:
915 // 1. all the UGIs are of type DOFManager
916 // 2. the geometric patterns are all the same
917 // 3. the connection managers are all the same
919 {
920 TEUCHOS_ASSERT(fieldBlockManagers.size()>0); // the minimum requirement!
921
922 // get reference values from the initial DOFManager
923 RCP<const DOFManager> refDofManager = rcp_dynamic_cast<const DOFManager>(fieldBlockManagers[0]);
924
925 TEUCHOS_TEST_FOR_EXCEPTION(refDofManager==Teuchos::null,std::runtime_error,
926 "panzer::BlockedDOFManager::buildGlobalUnknowns: UGI at index " << 0 <<
927 " is not of DOFManager type!");
928
929 RCP<const ConnManager> connManager = refDofManager->getConnManager();
930 TEUCHOS_TEST_FOR_EXCEPTION(refConnManager!=connManager,std::runtime_error,
931 "panzer::BlockedDOFManager::buildGlobalUnknowns: connection manager for UGI " << 0 <<
932 " does not match the reference connection manager");
933
934 refGeomPattern = refDofManager->getGeometricFieldPattern();
935
936 for(std::size_t i=1;i<fieldBlockManagers.size();i++) {
937 RCP<const DOFManager> dofManager = rcp_dynamic_cast<const DOFManager>(fieldBlockManagers[i]);
938
939 TEUCHOS_TEST_FOR_EXCEPTION(refDofManager==Teuchos::null,std::runtime_error,
940 "panzer::BlockedDOFManager::buildGlobalUnknowns: UGI at index " << i <<
941 " is not of DOFManager type!");
942
943 RCP<const FieldPattern> geomPattern = dofManager->getGeometricFieldPattern();
944 RCP<const ConnManager> testConnManager = dofManager->getConnManager();
945
946 TEUCHOS_TEST_FOR_EXCEPTION(!refGeomPattern->equals(*geomPattern),std::runtime_error,
947 "panzer::BlockedDOFManager::buildGlobalUnknowns: geometric pattern for UGI " << i <<
948 " does not match the reference pattern (from UGI 0)");
949 TEUCHOS_TEST_FOR_EXCEPTION(refConnManager!=testConnManager,std::runtime_error,
950 "panzer::BlockedDOFManager::buildGlobalUnknowns: connection manager for UGI " << i <<
951 " does not match the reference connection manager (from UGI 0)");
952 }
953 }
954
955 // add all the fields to the blocked dof manager
957 {
958 std::vector<std::string> eblocks;
959 this->getElementBlockIds(eblocks);
960
961 for(std::size_t i=0;i<fieldBlockManagers.size();i++) {
962 RCP<const DOFManager> dofManager
963 = rcp_dynamic_cast<const DOFManager>(fieldBlockManagers[i]);
964
965 for(std::size_t e=0;e<eblocks.size();e++) {
966 const std::vector<int> & fieldIds = dofManager->getBlockFieldNumbers(eblocks[e]);
967
968 // insert the fields into the block dof manager
969 for(std::size_t f=0;f<fieldIds.size();f++) {
970 // get the field name and pattern
971 std::string fieldName = dofManager->getFieldString(fieldIds[f]);
972 Teuchos::RCP<const panzer::FieldPattern> fieldPattern
973 = dofManager->getFieldPattern(eblocks[e],fieldName);
974
975 // add in the field
976 this->addField(eblocks[e],fieldName,fieldPattern);
977 }
978 }
979 }
980 }
981
982 // save and set some of the data
983 fieldBlockManagers_ = fieldBlockManagers;
984
985 registerFields(false);
986
987 geomPattern_ = refGeomPattern;
988
989 // build field block offsets: this helps fast construction
990 // of GID offset vectors. GIDs are ordering by field block.
992 {
993 std::vector<std::string> elementBlocks;
994 getElementBlockIds(elementBlocks);
995 for(std::size_t eb=0;eb<elementBlocks.size();eb++) {
996 int offset = 0;
997 for(std::size_t fb=0;fb<fieldBlockManagers_.size();fb++) {
998 int cnt = getElementBlockGIDCount(fieldBlockManagers_[fb],elementBlocks[eb]);
999 blockGIDOffset_[std::make_pair(elementBlocks[eb],fb)] = offset;
1000 offset += cnt;
1001 }
1002 }
1003 }
1004}
1005
1006// build the global unknown numberings
1007// 1. this builds the pattens
1008// 2. initializes the connectivity
1009// 3. calls initComplete
1010void BlockedDOFManager::buildGlobalUnknowns(const Teuchos::RCP<const FieldPattern> & geomPattern)
1011{
1012 if(!fieldsRegistered()) {
1013 registerFields(true);
1014 }
1015
1016 // save the geometry pattern
1017 geomPattern_ = geomPattern;
1018
1019 // build global unknowns for each field block
1020 for(std::size_t fb=0;fb<fieldBlockManagers_.size();fb++) {
1023 }
1024
1025 // build field block offsets: this helps fast construction
1026 // of GID offset vectors. GIDs are ordering by field block.
1027 std::vector<std::string> elementBlocks;
1028 getElementBlockIds(elementBlocks);
1029 for(std::size_t eb=0;eb<elementBlocks.size();eb++) {
1030 int offset = 0;
1031 for(std::size_t fb=0;fb<fieldBlockManagers_.size();fb++) {
1032 // int cnt = fieldBlockManagers_[fb]->getElementBlockGIDCount(elementBlocks[eb]);
1033 int cnt = getElementBlockGIDCount(fieldBlockManagers_[fb],elementBlocks[eb]);
1034 blockGIDOffset_[std::make_pair(elementBlocks[eb],fb)] = offset;
1035 offset += cnt;
1036 }
1037 }
1038}
1039
1040// build the global unknown numberings
1041// 1. this builds the pattens
1042// 2. initializes the connectivity
1043// 3. calls initComplete
1045{
1046 if(!fieldsRegistered())
1047 registerFields(true);
1048
1049 // build the pattern for the ID layout on the mesh
1050 // NOTE: hard coded to CG-only for now since this class is deprecated
1051 std::vector<std::pair<FieldType,RCP<const FieldPattern>>> patVector;
1052 std::map<std::pair<std::string,std::string>,Teuchos::RCP<const FieldPattern> >::iterator f2p_itr;
1053 for(f2p_itr=fieldStringToPattern_.begin();f2p_itr!=fieldStringToPattern_.end();f2p_itr++)
1054 patVector.push_back(std::make_pair(FieldType::CG,f2p_itr->second));
1055
1056 // if orientations are required, add the nodal field pattern to make it possible to compute them
1058 patVector.push_back(std::make_pair(FieldType::CG,Teuchos::rcp(new NodalFieldPattern(patVector[0].second->getCellTopology()))));
1059
1060 RCP<GeometricAggFieldPattern> aggFieldPattern = Teuchos::rcp(new GeometricAggFieldPattern);
1061 aggFieldPattern->buildPattern(patVector);
1062
1063 // setup connectivity mesh
1064 connMngr_->buildConnectivity(*aggFieldPattern);
1065
1066 // using new geometric pattern, build global unknowns
1067 buildGlobalUnknowns(aggFieldPattern);
1068}
1069
1070void BlockedDOFManager::printFieldInformation(std::ostream & os) const
1071{
1072 os << "BlockedDOFManager Field Information: " << std::endl;
1073
1074 if(fieldsRegistered()) {
1075 // Print field block DOF managers
1076 for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
1077 os << "*************************************************\n";
1078 os << "Field Block Index = " << fbm << std::endl;
1080
1081 // print out mapping between sub field IDs and blocked field IDs
1082 os << " Field String to Field Id (blocked/sub):\n";
1083 for(std::size_t i=0;i<fieldOrder_[fbm].size();i++) {
1084 std::string fieldString = fieldOrder_[fbm][i];
1085 int fieldNum = getFieldNum(fieldString);
1086 os << " \"" << fieldString << "\" is field ID " << fieldNum
1087 << "/" << fieldBlockManagers_[fbm]->getFieldNum(fieldString) << std::endl;
1088 }
1089 os << std::endl;
1090 }
1091 }
1092 else {
1093 // fields are not registered
1094 os << "Fields not yet registered! Unknowns not built (call registerFields or buildGlobalUnknowns)" << std::endl;
1095 }
1096}
1097
1098Teuchos::RCP<const FieldPattern>
1099BlockedDOFManager::getFieldPattern(const std::string & blockId, const std::string & fieldName) const
1100{
1101 std::map<std::pair<std::string,std::string>,Teuchos::RCP<const FieldPattern> >::const_iterator itr;
1102 itr = fieldStringToPattern_.find(std::make_pair(blockId,fieldName));
1103
1104 if(itr==fieldStringToPattern_.end()) // not found
1105 return Teuchos::null;
1106 else // found
1107 return itr->second;
1108}
1109
1118bool BlockedDOFManager::validFieldOrder(const std::vector<std::vector<std::string> > & fieldOrder_ut,
1119 const std::set<std::string> & fields) const
1120{
1121 std::set<std::string> orderedFields;
1122 std::size_t numberInOrder = 0;
1123
1124 for(std::size_t b=0;b<fieldOrder_ut.size();b++) {
1125 numberInOrder += fieldOrder_ut[b].size();
1126 orderedFields.insert(fieldOrder_ut[b].begin(),
1127 fieldOrder_ut[b].end());
1128 }
1129
1130 bool correctCount = (numberInOrder==fields.size());
1131 bool sameFields = (orderedFields==fields);
1132
1133 return correctCount && sameFields;
1134}
1135
1137{
1138 if(fieldOrder_.size()==0)
1139 return 1; // only one field block
1140 return fieldOrder_.size();
1141}
1142
1144
1145}
1146
1147#endif
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.
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 setFieldOrder(const std::vector< std::vector< std::string > > &fieldOrder)
virtual void getGhostedIndicesAsInt(std::vector< int > &indices) const
Get the set of indices ghosted for this processor.
Teuchos::RCP< ConnManager > connMngr_
int getFieldBlock(int fieldNum) const
void addFieldsToFieldBlockManager(const std::vector< std::string > &activeFields, GlobalIndexer &fieldBlockManager) const
virtual int getNumGhosted() const
Get the number of indices ghosted for this processor.
bool validFieldOrder(const std::vector< std::vector< std::string > > &fieldOrder_ut, const std::set< std::string > &fields) const
virtual void getOwnedIndicesAsInt(std::vector< int > &indices) const
Get the set of indices owned by this processor.
virtual void getGhostedIndices(std::vector< GlobalOrdinal > &indices) const
Get the set of indices ghosted for this processor.
void registerFields(bool buildSubUGIs)
virtual const std::vector< int > & getBlockFieldNumbers(const std::string &block) const
Teuchos::RCP< Teuchos::MpiComm< int > > communicator_
std::map< std::string, TupleToVectorPairMap > gidFieldOffsets_closure_
std::map< int, std::string > fieldNumToStr_
field number ==> field string
void getElementGIDsAsInt(panzer::LocalOrdinal localElmtId, std::vector< int > &gids, const std::string &blockIdHint="") const
Get the global IDs for a particular element. This function overwrites the gids variable.
std::map< std::pair< std::string, int >, int > blockGIDOffset_
(element block,field block) ==> gid offset
void getElementGIDsPair(panzer::LocalOrdinal localElmtId, std::vector< std::pair< int, GlobalOrdinal > > &gids, const std::string &blockIdHint="") const
Get the global IDs for a particular element. This function overwrites the gids variable.
virtual int getNumOwnedAndGhosted() const
Get the number of owned and ghosted indices for this processor.
int getBlockGIDOffset(const std::string &elementBlock, int fieldBlock) const
void getElementGIDs(panzer::LocalOrdinal localElmtId, std::vector< GlobalOrdinal > &gids, const std::string &blockIdHint="") const
Get the global IDs for a particular element. This function overwrites the gids variable.
virtual void getElementOrientation(panzer::LocalOrdinal localElmtId, std::vector< double > &gidsOrientation) const
Get a vector containg the orientation of the GIDs relative to the neighbors.
virtual bool fieldInBlock(const std::string &field, const std::string &block) const
void addField(const std::string &str, const Teuchos::RCP< const FieldPattern > &pattern)
Add a field to the DOF manager.
void setConnManager(const Teuchos::RCP< ConnManager > &connMngr, MPI_Comm mpiComm)
Set the connection manager and MPI_Comm objects.
int getNumFields() const
How many fields are handled by this manager.
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.
std::vector< std::vector< std::string > > fieldOrder_
virtual void getOwnedAndGhostedIndicesAsInt(std::vector< int > &indices) const
Get the set of owned and ghosted indices for this processor.
std::map< std::pair< std::string, std::string >, Teuchos::RCP< const FieldPattern > > fieldStringToPattern_
(block ID x field string) ==> pattern
const std::string & getFieldString(int num) const
Get the string name associated with a field number.
Teuchos::RCP< const FieldPattern > geomPattern_
virtual void getElementBlockIds(std::vector< std::string > &elementBlockIds) const
virtual void getOwnedAndGhostedIndices(std::vector< GlobalOrdinal > &indices) const
Get the set of owned and ghosted indices for this processor.
virtual void getOwnedIndices(std::vector< GlobalOrdinal > &indices) const
Get the set of indices owned by this processor.
std::map< Teuchos::Tuple< int, 3 >, std::pair< std::vector< int >, std::vector< int > >, LessThan > TupleToVectorPairMap
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...
int getFieldNum(const std::string &str) const
Get the number used for access to this field.
Teuchos::RCP< ConnManager > resetIndices()
Reset the indicies for this DOF manager.
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 int getNumOwned() const
Get the number of indices owned by this processor.
std::vector< Teuchos::RCP< GlobalIndexer > > fieldBlockManagers_
Teuchos::RCP< GlobalIndexer > buildNewIndexer(const Teuchos::RCP< ConnManager > &connManager, MPI_Comm mpiComm) const
void getFieldOrder(std::vector< std::vector< std::string > > &fieldOrder) const
virtual void ownedIndices(const std::vector< GlobalOrdinal > &indices, std::vector< bool > &isOwned) const
std::map< int, int > fieldNumToFieldBlk_
field number ==> field block
std::map< std::string, int > fieldStrToNum_
field string ==> field number
Teuchos::RCP< const ConnManager > getConnManager() const
std::map< std::string, std::map< int, std::vector< int > > > gidFieldOffsets_
std::map< std::string, std::set< std::string > > blockIdToFieldStrings_
block ID ==> field strings
std::map< std::string, std::vector< int > > blockIdToFieldNumbers_
block ID ==> field numbers
virtual int getElementBlockGIDCount(const std::string &blockId) const
How any GIDs are associate with a particular element block.
void printFieldInformation(std::ostream &os) const
void setFieldOrder(const std::vector< std::string > &fieldOrder)
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.