Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_BlockedDOFManager_impl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Panzer: A partial differential equation assembly
5 // engine for strongly coupled complex multiphysics systems
6 // Copyright (2011) Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Roger P. Pawlowski (rppawlo@sandia.gov) and
39 // Eric C. Cyr (eccyr@sandia.gov)
40 // ***********************************************************************
41 // @HEADER
42 
43 #ifndef PANZER_BLOCKED_DOF_MANAGER_IMPL_HPP
44 #define PANZER_BLOCKED_DOF_MANAGER_IMPL_HPP
45 
46 #include <map>
47 #include <numeric>
48 
51 
53 
54 namespace panzer {
55 
56 using Teuchos::RCP;
57 
58 // ************************************************************
59 // class BlockedDOFManager
60 // ************************************************************
61 
62 template <typename LocalOrdinalT,typename GlobalOrdinalT>
64  : fieldsRegistered_(false), maxSubFieldNum_(-1), requireOrientations_(false), useDOFManagerFEI_(true), useTieBreak_(false)
65 { }
66 
67 template <typename LocalOrdinalT,typename GlobalOrdinalT>
69  : fieldsRegistered_(false), maxSubFieldNum_(-1), requireOrientations_(false), useDOFManagerFEI_(true), useTieBreak_(false)
70 {
71  setConnManager(connMngr,mpiComm);
72 }
73 
76 
77 template <typename LocalOrdinalT,typename GlobalOrdinalT>
79 {
80  std::map<std::string,int>::const_iterator itr = fieldStrToNum_.find(str);
81 
82  // return based on what was found
83  if(itr==fieldStrToNum_.end()) {
84  // incorrect field name
85  TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,
86  "BlockedDOFManager::getFieldNum No field with the name \"" + str + "\" has been added");
87  }
88  else {
89  return itr->second;
90  }
91 }
92 
93 template <typename LocalOrdinalT,typename GlobalOrdinalT>
95 {
96  std::map<int,std::string>::const_iterator itr = fieldNumToStr_.find(number);
97 
98  // return based on what was found
99  if(itr==fieldNumToStr_.end()) {
100  std::stringstream ss; ss << number; // itoa() in c-language
101  // incorrect field name
102  TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,
103  "BlockedDOFManager::getFieldString No field with number \"" + ss.str() + "\" has been added");
104  }
105  else {
106  return itr->second;
107  }
108 }
109 
110 template <typename LocalOrdinalT,typename GlobalOrdinalT>
111 bool BlockedDOFManager<LocalOrdinalT,GlobalOrdinalT>::fieldInBlock(const std::string & field,const std::string & block) const
112 {
113  // try to find element block
114  std::map<std::string,std::set<std::string> >::const_iterator fieldsItr = blockIdToFieldStrings_.find(block);
115  TEUCHOS_TEST_FOR_EXCEPTION(fieldsItr==blockIdToFieldStrings_.end(),std::logic_error,
116  "BlockedDOFManager::fieldInBlock could not find the element block \""+block+"\"");
117 
118  // find field in element block
119  const std::set<std::string> & fields = fieldsItr->second;
120  std::set<std::string>::const_iterator itr = fields.find(field);
121  return itr!=fields.end();
122 }
123 
126 template <typename LocalOrdinalT,typename GlobalOrdinalT>
127 const std::vector<int> & BlockedDOFManager<LocalOrdinalT,GlobalOrdinalT>::getBlockFieldNumbers(const std::string & block) const
128 {
129  // try to find element block
130  std::map<std::string,std::vector<int> >::const_iterator fieldsItr = blockIdToFieldNumbers_.find(block);
131  if(fieldsItr!=blockIdToFieldNumbers_.end())
132  return fieldsItr->second;
133 
134  // nothing to return
135  static std::vector<int> empty;
136  return empty;
137 }
138 
139 template <typename LocalOrdinalT,typename GlobalOrdinalT>
140 void BlockedDOFManager<LocalOrdinalT,GlobalOrdinalT>::getElementGIDs(LocalOrdinalT localElmtId,std::vector<GlobalOrdinal> & gids,const std::string & blockIdHint) const
141 {
142  // WARNING: there is an assumed ordering being used here it
143  // corresponds directly to the blockGIDOffset_ map and (as
144  // a result) the getBlockGIDOffset function. However for
145  // the sake of speed this conversion is implicit.
146  //
147  // Any changes to the order should be reflected in the
148  // blockGIDOffset_ map.
149 
150  gids.resize(0);
151 
152  // loop over field block manager and grab indices
153  for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
154  std::vector<GlobalOrdinalT> fieldBlockOwned;
155 
156  fieldBlockManagers_[fbm]->getElementGIDs(localElmtId,fieldBlockOwned,blockIdHint);
157 
158  for(std::size_t i=0;i<fieldBlockOwned.size();i++)
159  gids.push_back(std::make_pair(fbm,fieldBlockOwned[i]));
160  }
161 }
162 
163 template <typename LocalOrdinalT,typename GlobalOrdinalT>
164 void BlockedDOFManager<LocalOrdinalT,GlobalOrdinalT>::getElementOrientation(LocalOrdinalT localElmtId,std::vector<double> & gidsOrientation) const
165 {
166  // WARNING: there is an assumed ordering being used here it
167  // corresponds directly to the blockGIDOffset_ map and (as
168  // a result) the getBlockGIDOffset function. However for
169  // the sake of speed this conversion is implicit.
170  //
171  // Any changes to the order should be reflected in the
172  // blockGIDOffset_ map.
173 
174  gidsOrientation.resize(0);
175 
176  // loop over field block manager and grab indices
177  for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
178  std::vector<double> blkOrientation;
179 
180  fieldBlockManagers_[fbm]->getElementOrientation(localElmtId,blkOrientation);
181 
182  for(std::size_t i=0;i<blkOrientation.size();i++)
183  gidsOrientation.push_back(blkOrientation[i]);
184  }
185 }
186 
187 template <typename LocalOrdinalT,typename GlobalOrdinalT>
188 const std::vector<int> & BlockedDOFManager<LocalOrdinalT,GlobalOrdinalT>::getGIDFieldOffsets(const std::string & blockId,int fieldNum) const
189 {
190  typedef std::map<std::string,std::map<int,std::vector<int> > > FieldOffsetsMap;
191 
192  FieldOffsetsMap::iterator blockItr = gidFieldOffsets_.find(blockId);
193  if(blockItr!=gidFieldOffsets_.end()) {
194  std::map<int,std::vector<int> > & fieldToVectorMap = blockItr->second;
195  std::map<int,std::vector<int> >::const_iterator itr = fieldToVectorMap.find(fieldNum);
196 
197  // we have found the vector, return the precomputed one
198  if(itr!=fieldToVectorMap.end())
199  return itr->second;
200  }
201  else {
202  std::vector<std::string> elementBlocks;
203  getElementBlockIds(elementBlocks);
204  TEUCHOS_TEST_FOR_EXCEPTION(std::find(elementBlocks.begin(),elementBlocks.end(),blockId)==elementBlocks.end(),std::logic_error,
205  "BlockedDOFManager::getGIDFieldOffsets: Block ID \""+blockId+"\" does not exist");
206 
207  gidFieldOffsets_[blockId] = std::map<int,std::vector<int> >();
208  blockItr = gidFieldOffsets_.find(blockId);
209  }
210 
211  // grab relevant map from iterator
212  std::map<int,std::vector<int> > & fieldToVectorMap = blockItr->second;
213 
214  // we have not found the vector, now we need to build one
216 
217  // first grab all pieces that are needed for extracting GIDs from sub system
218  int fieldBlock = getFieldBlock(fieldNum);
219  Teuchos::RCP<const UniqueGlobalIndexer<LocalOrdinalT,GlobalOrdinalT> > dofManager = fieldBlockManagers_[fieldBlock];
220 
221  // grab offsets for sub dof manager. Notice you must convert to field number used by sub manager!
222  const std::vector<int> & subGIDOffsets
223  = dofManager->getGIDFieldOffsets(blockId,dofManager->getFieldNum(getFieldString(fieldNum)));
224 
225  // increment offsets to correspond with blocked system
226  int gidOffset = getBlockGIDOffset(blockId,fieldBlock);
227  std::vector<int> & finalFieldOffsets = fieldToVectorMap[fieldNum];
228  finalFieldOffsets.resize(subGIDOffsets.size());
229  for(std::size_t i=0;i<finalFieldOffsets.size();i++)
230  finalFieldOffsets[i] = gidOffset+subGIDOffsets[i];
231 
232  return finalFieldOffsets;
233 }
234 
235 template <typename LocalOrdinalT,typename GlobalOrdinalT>
238 {
239  if(a[0] < b[0]) return true;
240  if(a[0] > b[0]) return false;
241 
242  // a[0]==b[0]
243  if(a[1] < b[1]) return true;
244  if(a[1] > b[1]) return false;
245 
246  // a[1]==b[1] && a[0]==b[0]
247  if(a[2] < b[2]) return true;
248  if(a[2] > b[2]) return false;
249 
250  // a[2]==b[2] && a[1]==b[1] && a[0]==b[0]
251  return false; // these are equal to, but not less than!
252 }
253 
254 template <typename LocalOrdinalT,typename GlobalOrdinalT>
255 const std::pair<std::vector<int>,std::vector<int> > &
256 BlockedDOFManager<LocalOrdinalT,GlobalOrdinalT>::getGIDFieldOffsets_closure(const std::string & blockId,int fieldNum,int subcellDim,int subcellId) const
257 {
258  typename std::map<std::string,TupleToVectorPairMap>::iterator blockItr = gidFieldOffsets_closure_.find(blockId);
259  if(blockItr!=gidFieldOffsets_closure_.end()) {
260  TupleToVectorPairMap & fieldToTupleMap = blockItr->second;
261  typename TupleToVectorPairMap::const_iterator itr =
262  fieldToTupleMap.find(Teuchos::tuple(fieldNum,subcellDim,subcellId));
263 
264  // we have found the vector, return the precomputed one
265  if(itr!=fieldToTupleMap.end())
266  return itr->second;
267  }
268  else {
269  std::vector<std::string> elementBlocks;
270  getElementBlockIds(elementBlocks);
271  TEUCHOS_TEST_FOR_EXCEPTION(std::find(elementBlocks.begin(),elementBlocks.end(),blockId)==elementBlocks.end(),std::logic_error,
272  "BlockedDOFManager::getGIDFieldOffsets: Block ID \""+blockId+"\" does not exist");
273 
274  gidFieldOffsets_closure_[blockId] = TupleToVectorPairMap();
275  blockItr = gidFieldOffsets_closure_.find(blockId);
276  }
277 
278  // grab relevant map from iterator
279  TupleToVectorPairMap & fieldToTupleMap = blockItr->second;
280 
281  // we have not found the vector, now we need to build one
283 
284  // first grab all pieces that are needed for extracting GIDs from sub system
285  int fieldBlock = getFieldBlock(fieldNum);
286  Teuchos::RCP<const UniqueGlobalIndexer<LocalOrdinalT,GlobalOrdinalT> > dofManager = fieldBlockManagers_[fieldBlock];
287 
288  // grab offsets for sub dof manager. Notice you must convert to field number used by sub manager!
289  const std::pair<std::vector<int>,std::vector<int> > & subGIDOffsets_closure
290  = dofManager->getGIDFieldOffsets_closure(blockId,dofManager->getFieldNum(getFieldString(fieldNum)),subcellDim,subcellId);
291 
292  // increment offsets to correspond with blocked system
293  int gidOffset = getBlockGIDOffset(blockId,fieldBlock);
294  std::pair<std::vector<int>,std::vector<int> > & finalFieldOffsets = fieldToTupleMap[Teuchos::tuple(fieldNum,subcellDim,subcellId)];
295  finalFieldOffsets.first.resize(subGIDOffsets_closure.first.size());
296  finalFieldOffsets.second = subGIDOffsets_closure.second;
297  for(std::size_t i=0;i<finalFieldOffsets.first.size();i++)
298  finalFieldOffsets.first[i] = gidOffset+subGIDOffsets_closure.first[i];
299 
300  return finalFieldOffsets;
301 }
302 
304 //
305 // getOwnedIndices()
306 //
308 template<typename LocalOrdinalT, typename GlobalOrdinalT>
309 void
312  std::vector<GlobalOrdinal>& indices) const
313 {
314  using std::make_pair;
315  using std::size_t;
316  using std::vector;
317  for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
318  {
319  vector<GlobalOrdinalT> fieldBlockOwned;
320  fieldBlockManagers_[fbm]->getOwnedIndices(fieldBlockOwned);
321  for (size_t i(0); i < fieldBlockOwned.size(); ++i)
322  indices.push_back(make_pair(fbm, fieldBlockOwned[i]));
323  } // end loop over fieldBlockManagers_
324 } // end of getOwnedIndices()
325 
327 //
328 // getGhostedIndices()
329 //
331 template<typename LocalOrdinalT, typename GlobalOrdinalT>
332 void
335  std::vector<GlobalOrdinal>& indices) const
336 {
337  using std::make_pair;
338  using std::size_t;
339  using std::vector;
340  for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
341  {
342  vector<GlobalOrdinalT> fieldBlockGhosted;
343  fieldBlockManagers_[fbm]->getGhostedIndices(fieldBlockGhosted);
344  for (size_t i(0); i < fieldBlockGhosted.size(); ++i)
345  indices.push_back(make_pair(fbm, fieldBlockGhosted[i]));
346  } // end loop over fieldBlockManagers_
347 } // end of getGhostedIndices()
348 
350 //
351 // getOwnedAndGhostedIndices()
352 //
354 template<typename LocalOrdinalT, typename GlobalOrdinalT>
355 void
358  std::vector<GlobalOrdinal>& indices) const
359 {
360  using std::make_pair;
361  using std::size_t;
362  using std::vector;
363  for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
364  {
365  vector<GlobalOrdinalT> fieldBlockOwnedAndGhosted;
366  fieldBlockManagers_[fbm]->getOwnedAndGhostedIndices(
367  fieldBlockOwnedAndGhosted);
368  for (size_t i(0); i < fieldBlockOwnedAndGhosted.size(); ++i)
369  indices.push_back(make_pair(fbm, fieldBlockOwnedAndGhosted[i]));
370  } // end loop over fieldBlockManagers_
371 } // end of getOwnedAndGhostedIndices()
372 
374 //
375 // getNumOwned()
376 //
378 template<typename LocalOrdinalT, typename GlobalOrdinalT>
379 int
381 getNumOwned() const
382 {
383  using std::size_t;
384  int result(0);
385  for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
386  result += fieldBlockManagers_[fbm]->getNumOwned();
387  return result;
388 } // end of getNumOwned()
389 
391 //
392 // getNumGhosted()
393 //
395 template<typename LocalOrdinalT, typename GlobalOrdinalT>
396 int
399 {
400  using std::size_t;
401  int result(0);
402  for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
403  result += fieldBlockManagers_[fbm]->getNumGhosted();
404  return result;
405 } // end of getNumGhosted()
406 
408 //
409 // getNumOwnedAndGhosted()
410 //
412 template<typename LocalOrdinalT, typename GlobalOrdinalT>
413 int
416 {
417  using std::size_t;
418  int result(0);
419  for (size_t fbm(0); fbm < fieldBlockManagers_.size(); ++fbm)
420  result += fieldBlockManagers_[fbm]->getNumOwnedAndGhosted();
421  return result;
422 } // end of getNumOwnedAndGhosted()
423 
424 template <typename LocalOrdinalT,typename GlobalOrdinalT>
425 void BlockedDOFManager<LocalOrdinalT,GlobalOrdinalT>::ownedIndices(const std::vector<GlobalOrdinal> & indices,std::vector<bool> & isOwned) const
426 {
427  isOwned.resize(0);
428 
429  std::vector<std::vector<GlobalOrdinalT> > blockIndices(fieldBlockManagers_.size());
430  for(std::size_t i=0;i<indices.size();i++)
431  blockIndices[indices[i].first].push_back(indices[i].second);
432 
433  // build bool vector stating if each sub block is owned
434  std::vector<std::vector<bool> > blockIsOwned(fieldBlockManagers_.size());
435  std::vector<std::vector<bool>::const_iterator> blockItrs;
436  for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
437  fieldBlockManagers_[fbm]->ownedIndices(blockIndices[fbm],blockIsOwned[fbm]);
438 
439  // setup iterators to boolean vectors
440  blockItrs.push_back(blockIsOwned[fbm].begin());
441  }
442 
443  // loop over indices, consider their block and look it up
444  // in iterator vector
445  for(std::size_t i=0;i<indices.size();i++) {
446  int block = indices[i].first;
447 
448  // set owned status from iterator of block
449  bool owned = *blockItrs[block];
450  isOwned.push_back(owned);
451 
452  // increment block iterator
453  blockItrs[block]++;
454  }
455 
456  // quick error sanity check
457  TEUCHOS_ASSERT(isOwned.size()==indices.size());
458  for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
459  TEUCHOS_TEST_FOR_EXCEPTION(blockItrs[fbm]!=blockIsOwned[fbm].end(),std::logic_error,
460  "BlockedDOFManager::ownedIndices: Did not consume all sub block boolean entries as expected.");
461  }
462 
463 }
464 
465 
468 
469 
481 template <typename LocalOrdinalT,typename GlobalOrdinalT>
483 {
484  communicator_ = Teuchos::rcp(new Teuchos::MpiComm<int>(Teuchos::opaqueWrapper(mpiComm)));
485 
486  // this kills any old connection manager as well as the old FEI objects
487  resetIndices();
488 
489  connMngr_ = connMngr;
490 
491  mpiComm_ = *communicator_->getRawMpiComm();
492 }
493 
502 template <typename LocalOrdinalT,typename GlobalOrdinalT>
504 {
506 
507  connMngr_ = Teuchos::null;
508  ownedGIDHashTable_.clear();
509  blockGIDOffset_.clear();
510 
511  return connMngr;
512 }
513 
514 template <typename LocalOrdinalT,typename GlobalOrdinalT>
516  const Teuchos::RCP<const FieldPattern> & pattern)
517 {
518  std::vector<std::string> elementBlockIds;
519  connMngr_->getElementBlockIds(elementBlockIds);
520 
521  // loop over blocks adding field pattern to each
522  for(std::size_t i=0;i<elementBlockIds.size();i++)
523  addField(elementBlockIds[i],str,pattern);
524 }
525 
526 template <typename LocalOrdinalT,typename GlobalOrdinalT>
527 void BlockedDOFManager<LocalOrdinalT,GlobalOrdinalT>::addField(const std::string & blockId,const std::string & str,
528  const Teuchos::RCP<const FieldPattern> & pattern)
529 {
530  TEUCHOS_TEST_FOR_EXCEPTION(fieldsRegistered(),std::logic_error,
531  "BlockedDOFManager::addField: addField cannot be called after registerFields or"
532  "buildGlobalUnknowns has been called");
533 
534  fieldStringToPattern_[std::make_pair(blockId,str)] = pattern;
535  blockIdToFieldStrings_[blockId].insert(str);
536 }
537 
538 template <typename LocalOrdinalT,typename GlobalOrdinalT>
540 {
541  if(buildSubUGIs)
542  fieldBlockManagers_.clear();
543  fieldStrToNum_.clear();
544  fieldNumToStr_.clear();
545  fieldNumToFieldBlk_.clear();
546  maxSubFieldNum_ = -1;
547 
548  fieldsRegistered_ = false;
549 
550  // test validity of the field order, build default if none is provided
551  {
552  // build a unique set of fields, so we can compare validate the ordered list
553  std::set<std::string> fields;
554  for(std::map<std::pair<std::string,std::string>,Teuchos::RCP<const FieldPattern> >::const_iterator
555  fieldItr=fieldStringToPattern_.begin(); fieldItr!=fieldStringToPattern_.end();++fieldItr) {
556  std::string fieldName = fieldItr->first.second;
557  fields.insert(fieldName);
558  }
559 
560  // construct default field order if neccessary
561  if(fieldOrder_.size()==0) {
562  std::set<std::string>::const_iterator itr;
563  for(itr=fields.begin();itr!=fields.end();itr++) {
564  std::vector<std::string> block;
565  block.push_back(*itr);
566  fieldOrder_.push_back(block);
567  }
568  }
569 
570  // check validity of field order: no repeats, and everything is accounted for
571  bool validOrder = validFieldOrder(fieldOrder_,fields);
572  if(!validOrder) {
573  // for outputing
574  std::stringstream ss;
575 
576  ss << "BlockedDOFManager::registerFields - Field order is invalid!\n";
577 
578  ss << " fields = [ ";
579  for(std::set<std::string>::const_iterator itr=fields.begin();
580  itr!=fields.end();++itr)
581  ss << "\"" << *itr << "\" ";
582  ss << " ]\n";
583 
584  ss << " fieldOrder = [ ";
585  for(std::vector<std::vector<std::string> >::const_iterator bitr=fieldOrder_.begin();
586  bitr!=fieldOrder_.end();++bitr) {
587  ss << "[ ";
588  for(std::vector<std::string>::const_iterator itr=bitr->begin();
589  itr!=bitr->end();++itr) {
590  ss << "\"" << *itr << "\" ";
591  }
592  ss << " ], ";
593  }
594  ss << " ]\n";
595 
596  TEUCHOS_TEST_FOR_EXCEPTION(!validOrder,std::logic_error,ss.str());
597  }
598  }
599 
600  // build sub DOFManagers for each field block
601  if(buildSubUGIs) {
602  for(std::size_t fldBlk=0;fldBlk<fieldOrder_.size();fldBlk++) {
603  Teuchos::RCP<panzer::UniqueGlobalIndexer<LocalOrdinalT,GlobalOrdinalT> > dofManager = buildNewIndexer(getConnManager(),mpiComm_);
604 
605  // add in these fields to the new manager
606  this->addFieldsToFieldBlockManager(fieldOrder_[fldBlk],*dofManager);
607 
608  fieldBlockManagers_.push_back(dofManager);
609  }
610  }
611 
613  // build field numbers: two stage algorithm
614 
615  // 1st Stage: Extract field numbers used by each sub DOFManager.
616  // determine largest of these
617  //
618  // - note at this point since "validFieldOrder" has
619  // been called we are gurranteed to not have repeated fields
620  maxSubFieldNum_ = -1;
621  std::map<std::string,int> tempStrToNum;
622  for(std::size_t fldBlk=0;fldBlk<fieldBlockManagers_.size();fldBlk++) {
624  fieldBlockManagers_[fldBlk];
625  const std::vector<std::string> & activeFields = fieldOrder_[fldBlk];
626 
627  int fieldNum = 0;
628  for(std::size_t f=0;f<activeFields.size();f++) {
629  fieldNum = dofManager->getFieldNum(activeFields[f]);
630  tempStrToNum[activeFields[f]] = fieldNum;
631 
632  maxSubFieldNum_ = (fieldNum>maxSubFieldNum_) ? fieldNum : maxSubFieldNum_;
633  }
634  }
635 
636  // 2nd Stage: Using field block index, field number and largest field number
637  // build a up fieldStrToNum_ map and fieldNumToFieldBlk_
638  int numOffset = 0;
639  for(std::size_t fldBlk=0;fldBlk<fieldBlockManagers_.size();fldBlk++) {
640  const std::vector<std::string> & activeFields = fieldOrder_[fldBlk];
641 
642  for(std::size_t f=0;f<activeFields.size();f++) {
643  // compute offset field number
644  int fieldNum = tempStrToNum[activeFields[f]]+numOffset;
645 
646  // build up map data
647  fieldStrToNum_[activeFields[f]] = fieldNum;
648  fieldNumToStr_[fieldNum] = activeFields[f];
649  fieldNumToFieldBlk_[fieldNum] = fldBlk;
650  }
651 
652  // increament field number offset based on largest sub field number
653  numOffset += (maxSubFieldNum_+1);
654  }
655 
656  // end build field numbers
658 
659  // build block to field numbers: this requires field numbers have been built
660  // and that "getFieldNum" behaves correctly
661  for(std::map<std::string,std::set<std::string> >::const_iterator itr=blockIdToFieldStrings_.begin();
662  itr!=blockIdToFieldStrings_.end();++itr) {
663  const std::set<std::string> & fields = itr->second;
664 
665  std::vector<int> & fieldNums = blockIdToFieldNumbers_[itr->first];
666  for(std::set<std::string>::const_iterator fldItr=fields.begin();
667  fldItr!=fields.end();++fldItr) {
668  fieldNums.push_back(getFieldNum(*fldItr));
669  }
670  }
671 
672  // everything completed, mark as fields registered
673  fieldsRegistered_ = true;
674 }
675 
676 template <typename LocalOrdinalT,typename GlobalOrdinalT>
679 buildNewIndexer(const Teuchos::RCP<ConnManager<LocalOrdinalT,GlobalOrdinalT> > & connManager,MPI_Comm mpiComm) const
680 {
682  dofManager->enableTieBreak(useTieBreak_);
683  dofManager->setConnManager(connManager,mpiComm);
684 
685  return dofManager;
686 
687 }
688 
689 template <typename LocalOrdinalT,typename GlobalOrdinalT>
692 {
693  using Teuchos::RCP;
694  using Teuchos::rcp_dynamic_cast;
695 
696  // standard version
697  {
699 
700  if(dofManager!=Teuchos::null) {
701  dofManager->setOrientationsRequired(required);
702  return;
703  }
704  }
705 
706  // you should never get here!
707  TEUCHOS_ASSERT(false);
708 }
709 
710 template <typename LocalOrdinalT,typename GlobalOrdinalT>
713 {
714  using Teuchos::RCP;
715  using Teuchos::rcp_dynamic_cast;
716 
717  // standard version
718  {
720 
721  if(dofManager!=Teuchos::null) {
722  dofManager->buildGlobalUnknowns(geomPattern);
723  return;
724  }
725  }
726 
727  // you should never get here!
728  TEUCHOS_ASSERT(false);
729 }
730 
731 template <typename LocalOrdinalT,typename GlobalOrdinalT>
734 {
735  using Teuchos::RCP;
736  using Teuchos::rcp_dynamic_cast;
737 
738  // standard version
739  {
741 
742  if(dofManager!=Teuchos::null) {
743  dofManager->printFieldInformation(os);
744  return;
745  }
746  }
747 
748  // you should never get here!
749  TEUCHOS_ASSERT(false);
750 }
751 
752 template <typename LocalOrdinalT,typename GlobalOrdinalT>
754 getElementBlockGIDCount(const Teuchos::RCP<UniqueGlobalIndexer<LocalOrdinalT,GlobalOrdinalT> > & indexer,const std::string & elementBlock) const
755 {
756  using Teuchos::RCP;
757  using Teuchos::rcp_dynamic_cast;
758 
759  TEUCHOS_ASSERT(indexer!=Teuchos::null);
760 
761  return indexer->getElementBlockGIDCount(elementBlock);
762 }
763 
764 template <typename LocalOrdinalT,typename GlobalOrdinalT>
766 getElementBlockGIDCount(const Teuchos::RCP<UniqueGlobalIndexer<LocalOrdinalT,GlobalOrdinalT> > & indexer,const std::size_t & elementBlock) const
767 {
768  using Teuchos::RCP;
769  using Teuchos::rcp_dynamic_cast;
770 
771  TEUCHOS_ASSERT(indexer!=Teuchos::null);
772 
773  return indexer->getElementBlockGIDCount(elementBlock);
774 }
775 
776 template <typename LocalOrdinalT,typename GlobalOrdinalT>
778 getElementBlockGIDCount(const std::string & elementBlock) const
779 {
780  int gidCount = 0;
781  for(std::size_t i=0;i<fieldBlockManagers_.size();i++)
782  gidCount += fieldBlockManagers_[i]->getElementBlockGIDCount(elementBlock);
783 
784  return gidCount;
785 }
786 
787 template <typename LocalOrdinalT,typename GlobalOrdinalT>
789 getElementBlockGIDCount(const std::size_t & elementBlock) const
790 {
791  int gidCount = 0;
792  for(std::size_t i=0;i<fieldBlockManagers_.size();i++)
793  gidCount += fieldBlockManagers_[i]->getElementBlockGIDCount(elementBlock);
794 
795  return gidCount;
796 }
797 
798 template <typename LocalOrdinalT,typename GlobalOrdinalT>
800 addFieldsToFieldBlockManager(const std::vector<std::string> & activeFields,
801  UniqueGlobalIndexer<LocalOrdinalT,GlobalOrdinalT> & fieldBlockManager) const
802 {
803  using Teuchos::Ptr;
804  using Teuchos::ptrFromRef;
805  using Teuchos::ptr_dynamic_cast;
806 
807  Ptr<UniqueGlobalIndexer<LocalOrdinalT,GlobalOrdinalT> > ugi_ptr = ptrFromRef(fieldBlockManager);
808 
809  // standard version
810  {
811  Ptr<DOFManager<LocalOrdinalT,GlobalOrdinalT> > dofManager_ptr = ptr_dynamic_cast<DOFManager<LocalOrdinalT,GlobalOrdinalT> >(ugi_ptr);
812 
813  if(dofManager_ptr!=Teuchos::null) {
814  addFieldsToFieldBlockManager(activeFields,*dofManager_ptr);
815  return;
816  }
817  }
818 
819  // you should never get here!
820  TEUCHOS_ASSERT(false);
821 }
822 
823 template <typename LocalOrdinalT,typename GlobalOrdinalT>
825 addFieldsToFieldBlockManager(const std::vector<std::string> & activeFields,
826  DOFManager<LocalOrdinalT,GlobalOrdinalT> & fieldBlockManager) const
827 {
828  std::vector<std::size_t> correctnessCheck(activeFields.size(),0);
829  std::vector<std::string> elementBlocks;
830  this->getElementBlockIds(elementBlocks);
831 
832  // loop over element blocks adding each field in this element block and this field block
833  for(std::size_t eb=0;eb<elementBlocks.size();eb++) {
834  std::string elementBlock = elementBlocks[eb];
835 
836  // loop over active fields extracting those that are associated with this element block
837  for(std::size_t f=0;f<activeFields.size();f++) {
838  std::string fieldName = activeFields[f];
839  Teuchos::RCP<const FieldPattern> fp = this->getFieldPattern(elementBlock,fieldName);
840 
841  if(fp!=Teuchos::null) {
842  fieldBlockManager.addField(elementBlock,fieldName,fp);
843  correctnessCheck[f] = 1; // all active fields should be placed in DOFManager
844  }
845  }
846  }
847 
848  // verify correctness check
849  std::size_t correctFlag = std::accumulate(correctnessCheck.begin(),correctnessCheck.end(),0);
850  TEUCHOS_TEST_FOR_EXCEPTION(correctFlag!=activeFields.size(),std::logic_error,
851  "BlockedDOFManager::addFieldsToFieldBlockManager detected inconsistincies in the active fields.");
852 
853  // set field order
854  fieldBlockManager.setFieldOrder(activeFields);
855 }
856 
857 template <typename LocalOrdinalT,typename GlobalOrdinalT>
858 void BlockedDOFManager<LocalOrdinalT,GlobalOrdinalT>::setFieldOrder(const std::vector<std::vector<std::string> > & fieldOrder)
859 {
860  fieldOrder_ = fieldOrder;
861 }
862 
865 template <typename LocalOrdinalT,typename GlobalOrdinalT>
866 void BlockedDOFManager<LocalOrdinalT,GlobalOrdinalT>::getFieldOrder(std::vector<std::vector<std::string> > & fieldOrder) const
867 {
868  fieldOrder = fieldOrder_;
869 }
870 
871 template <typename LocalOrdinalT,typename GlobalOrdinalT>
873 {
874  if(fieldsRegistered())
875  return fieldStrToNum_.size();
876 
877  // more work needs to be done if the fields have not yet been registered
878  // pull it from the (block id x field name) ==> pattern map
879  std::set<std::string> fields;
880  std::map<std::pair<std::string,std::string>,Teuchos::RCP<const FieldPattern> >::const_iterator itr;
881  for(itr=fieldStringToPattern_.begin();itr!=fieldStringToPattern_.end();++itr)
882  fields.insert(itr->first.second);
883 
884  return fields.size();
885 }
886 
887 // build the global unknown numberings
888 // 1. this builds the pattens
889 // 2. initializes the connectivity
890 // 3. calls initComplete
891 template <typename LocalOrdinalT,typename GlobalOrdinalT>
893  const std::vector<Teuchos::RCP<UniqueGlobalIndexer<LocalOrdinalT,GlobalOrdinalT> > > & fieldBlockManagers)
894 {
895  using Teuchos::RCP;
896  using Teuchos::rcp_dynamic_cast;
897 
898  RCP<const FieldPattern> refGeomPattern;
899  RCP<ConnManager<LocalOrdinalT,GlobalOrdinalT> > refConnManager = getConnManager();
900 
901  // verify the pre-conditions:
902  // 1. all the UGIs are of type DOFManager
903  // 2. the geometric patterns are all the same
904  // 3. the connection managers are all the same
906  {
907  TEUCHOS_ASSERT(fieldBlockManagers.size()>0); // the minimum requirement!
908 
909  // get reference values from the initial DOFManager
911  = rcp_dynamic_cast<const DOFManager<LocalOrdinalT,GlobalOrdinalT> >(fieldBlockManagers[0]);
912 
913  TEUCHOS_TEST_FOR_EXCEPTION(refDofManager==Teuchos::null,std::runtime_error,
914  "panzer::BlockedDOFManager::buildGlobalUnknowns: UGI at index " << 0 <<
915  " is not of DOFManager type!");
916 
917  RCP<const ConnManager<LocalOrdinalT,GlobalOrdinalT> > connManager = refDofManager->getConnManager();
918  TEUCHOS_TEST_FOR_EXCEPTION(refConnManager!=connManager,std::runtime_error,
919  "panzer::BlockedDOFManager::buildGlobalUnknowns: connection manager for UGI " << 0 <<
920  " does not match the reference connection manager");
921 
922  refGeomPattern = refDofManager->getGeometricFieldPattern();
923 
924  for(std::size_t i=1;i<fieldBlockManagers.size();i++) {
926  = rcp_dynamic_cast<const DOFManager<LocalOrdinalT,GlobalOrdinalT> >(fieldBlockManagers[i]);
927 
928  TEUCHOS_TEST_FOR_EXCEPTION(refDofManager==Teuchos::null,std::runtime_error,
929  "panzer::BlockedDOFManager::buildGlobalUnknowns: UGI at index " << i <<
930  " is not of DOFManager type!");
931 
932  RCP<const FieldPattern> geomPattern = dofManager->getGeometricFieldPattern();
933  RCP<const ConnManager<LocalOrdinalT,GlobalOrdinalT> > testConnManager = dofManager->getConnManager();
934 
935  TEUCHOS_TEST_FOR_EXCEPTION(!refGeomPattern->equals(*geomPattern),std::runtime_error,
936  "panzer::BlockedDOFManager::buildGlobalUnknowns: geometric pattern for UGI " << i <<
937  " does not match the reference pattern (from UGI 0)");
938  TEUCHOS_TEST_FOR_EXCEPTION(refConnManager!=testConnManager,std::runtime_error,
939  "panzer::BlockedDOFManager::buildGlobalUnknowns: connection manager for UGI " << i <<
940  " does not match the reference connection manager (from UGI 0)");
941  }
942  }
943 
944  // add all the fields to the blocked dof manager
946  {
947  std::vector<std::string> eblocks;
948  this->getElementBlockIds(eblocks);
949 
950  for(std::size_t i=0;i<fieldBlockManagers.size();i++) {
952  = rcp_dynamic_cast<const DOFManager<LocalOrdinalT,GlobalOrdinalT> >(fieldBlockManagers[i]);
953 
954  for(std::size_t e=0;e<eblocks.size();e++) {
955  const std::vector<int> & fieldIds = dofManager->getBlockFieldNumbers(eblocks[e]);
956 
957  // insert the fields into the block dof manager
958  for(std::size_t f=0;f<fieldIds.size();f++) {
959  // get the field name and pattern
960  std::string fieldName = dofManager->getFieldString(fieldIds[f]);
962  = dofManager->getFieldPattern(eblocks[e],fieldName);
963 
964  // add in the field
965  this->addField(eblocks[e],fieldName,fieldPattern);
966  }
967  }
968  }
969  }
970 
971  // save and set some of the data
972  fieldBlockManagers_ = fieldBlockManagers;
973 
974  registerFields(false);
975 
976  geomPattern_ = refGeomPattern;
977 
978  // build field block offsets: this helps fast construction
979  // of GID offset vectors. GIDs are ordering by field block.
981  {
982  std::vector<std::string> elementBlocks;
983  getElementBlockIds(elementBlocks);
984  for(std::size_t eb=0;eb<elementBlocks.size();eb++) {
985  int offset = 0;
986  for(std::size_t fb=0;fb<fieldBlockManagers_.size();fb++) {
987  int cnt = getElementBlockGIDCount(fieldBlockManagers_[fb],elementBlocks[eb]);
988  blockGIDOffset_[std::make_pair(elementBlocks[eb],fb)] = offset;
989  offset += cnt;
990  }
991  }
992  }
993 }
994 
995 // build the global unknown numberings
996 // 1. this builds the pattens
997 // 2. initializes the connectivity
998 // 3. calls initComplete
999 template <typename LocalOrdinalT,typename GlobalOrdinalT>
1001 {
1002  if(!fieldsRegistered()) {
1003  registerFields(true);
1004  }
1005 
1006  // save the geometry pattern
1007  geomPattern_ = geomPattern;
1008 
1009  // build global unknowns for each field block
1010  for(std::size_t fb=0;fb<fieldBlockManagers_.size();fb++) {
1011  setOrientationsRequired(fieldBlockManagers_[fb],getOrientationsRequired());
1012  buildGlobalUnknowns(fieldBlockManagers_[fb],geomPattern_);
1013  }
1014 
1015  // build field block offsets: this helps fast construction
1016  // of GID offset vectors. GIDs are ordering by field block.
1017  std::vector<std::string> elementBlocks;
1018  getElementBlockIds(elementBlocks);
1019  for(std::size_t eb=0;eb<elementBlocks.size();eb++) {
1020  int offset = 0;
1021  for(std::size_t fb=0;fb<fieldBlockManagers_.size();fb++) {
1022  // int cnt = fieldBlockManagers_[fb]->getElementBlockGIDCount(elementBlocks[eb]);
1023  int cnt = getElementBlockGIDCount(fieldBlockManagers_[fb],elementBlocks[eb]);
1024  blockGIDOffset_[std::make_pair(elementBlocks[eb],fb)] = offset;
1025  offset += cnt;
1026  }
1027  }
1028 }
1029 
1030 // build the global unknown numberings
1031 // 1. this builds the pattens
1032 // 2. initializes the connectivity
1033 // 3. calls initComplete
1034 template <typename LocalOrdinalT,typename GlobalOrdinalT>
1036 {
1037  if(!fieldsRegistered())
1038  registerFields(true);
1039 
1040  // build the pattern for the ID layout on the mesh
1041  // NOTE: hard coded to CG-only for now since this class is deprecated
1042  std::vector<std::pair<FieldType,RCP<const FieldPattern>>> patVector;
1043  std::map<std::pair<std::string,std::string>,Teuchos::RCP<const FieldPattern> >::iterator f2p_itr;
1044  for(f2p_itr=fieldStringToPattern_.begin();f2p_itr!=fieldStringToPattern_.end();f2p_itr++)
1045  patVector.push_back(std::make_pair(FieldType::CG,f2p_itr->second));
1046 
1047  // if orientations are required, add the nodal field pattern to make it possible to compute them
1048  if(requireOrientations_)
1049  patVector.push_back(std::make_pair(FieldType::CG,Teuchos::rcp(new NodalFieldPattern(patVector[0].second->getCellTopology()))));
1050 
1052  aggFieldPattern->buildPattern(patVector);
1053 
1054  // setup connectivity mesh
1055  connMngr_->buildConnectivity(*aggFieldPattern);
1056 
1057  // using new geometric pattern, build global unknowns
1058  buildGlobalUnknowns(aggFieldPattern);
1059 }
1060 
1061 template <typename LocalOrdinalT,typename GlobalOrdinalT>
1063 {
1064  os << "BlockedDOFManager Field Information: " << std::endl;
1065 
1066  if(fieldsRegistered()) {
1067  // Print field block DOF managers
1068  for(std::size_t fbm=0;fbm<fieldBlockManagers_.size();fbm++) {
1069  os << "*************************************************\n";
1070  os << "Field Block Index = " << fbm << std::endl;
1071  printFieldInformation(fieldBlockManagers_[fbm],os);
1072 
1073  // print out mapping between sub field IDs and blocked field IDs
1074  os << " Field String to Field Id (blocked/sub):\n";
1075  for(std::size_t i=0;i<fieldOrder_[fbm].size();i++) {
1076  std::string fieldString = fieldOrder_[fbm][i];
1077  int fieldNum = getFieldNum(fieldString);
1078  os << " \"" << fieldString << "\" is field ID " << fieldNum
1079  << "/" << fieldBlockManagers_[fbm]->getFieldNum(fieldString) << std::endl;
1080  }
1081  os << std::endl;
1082  }
1083  }
1084  else {
1085  // fields are not registered
1086  os << "Fields not yet registered! Unknowns not built (call registerFields or buildGlobalUnknowns)" << std::endl;
1087  }
1088 }
1089 
1090 template <typename LocalOrdinalT,typename GlobalOrdinalT>
1092 BlockedDOFManager<LocalOrdinalT,GlobalOrdinalT>::getFieldPattern(const std::string & blockId, const std::string & fieldName) const
1093 {
1094  std::map<std::pair<std::string,std::string>,Teuchos::RCP<const FieldPattern> >::const_iterator itr;
1095  itr = fieldStringToPattern_.find(std::make_pair(blockId,fieldName));
1096 
1097  if(itr==fieldStringToPattern_.end()) // not found
1098  return Teuchos::null;
1099  else // found
1100  return itr->second;
1101 }
1102 
1111 template <typename LocalOrdinalT,typename GlobalOrdinalT>
1112 bool BlockedDOFManager<LocalOrdinalT,GlobalOrdinalT>::validFieldOrder(const std::vector<std::vector<std::string> > & fieldOrder_ut,
1113  const std::set<std::string> & fields) const
1114 {
1115  std::set<std::string> orderedFields;
1116  std::size_t numberInOrder = 0;
1117 
1118  for(std::size_t b=0;b<fieldOrder_ut.size();b++) {
1119  numberInOrder += fieldOrder_ut[b].size();
1120  orderedFields.insert(fieldOrder_ut[b].begin(),
1121  fieldOrder_ut[b].end());
1122  }
1123 
1124  bool correctCount = (numberInOrder==fields.size());
1125  bool sameFields = (orderedFields==fields);
1126 
1127  return correctCount && sameFields;
1128 }
1129 
1130 template <typename LocalOrdinalT,typename GlobalOrdinalT>
1132 {
1133  if(fieldOrder_.size()==0)
1134  return 1; // only one field block
1135  return fieldOrder_.size();
1136 }
1137 
1139 
1140 }
1141 
1142 #endif
int getFieldNum(const std::string &str) const
Get the number used for access to this field.
bool operator()(const Teuchos::Tuple< int, 3 > &a, const Teuchos::Tuple< int, 3 > &b) const
virtual bool fieldInBlock(const std::string &field, const std::string &block) const
int getFieldBlock(const std::string &fieldName, const std::vector< Teuchos::RCP< UniqueGlobalIndexer< LocalOrdinalT, GlobalOrdinalT > > > &ugis)
virtual int getNumGhosted() const
Get the number of indices ghosted for this processor.
const std::string & getFieldString(int num) const
Get the string name associated with a field number.
bool validFieldOrder(const std::vector< std::vector< std::string > > &fieldOrder_ut, const std::set< std::string > &fields) const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void setConnManager(const Teuchos::RCP< ConnManager< LocalOrdinalT, GlobalOrdinalT > > &connMngr, MPI_Comm mpiComm)
Set the connection manager and MPI_Comm objects.
virtual const std::vector< int > & getBlockFieldNumbers(const std::string &block) const
void getElementGIDs(LocalOrdinalT localElmtId, std::vector< GlobalOrdinal > &gids, const std::string &blockIdHint="") const
Get the global IDs for a particular element. This function overwrites the gids variable.
void addField(const std::string &str, const Teuchos::RCP< const FieldPattern > &pattern)
Add a field to the DOF manager.
virtual int getNumOwned() const
Get the number of indices owned by this processor.
Teuchos::RCP< ConnManager< LocalOrdinalT, GlobalOrdinalT > > resetIndices()
Reset the indicies for this DOF manager.
virtual void getGhostedIndices(std::vector< GlobalOrdinal > &indices) const
Get the set of indices ghosted for this processor.
PHX::MDField< ScalarT, panzer::Cell, panzer::IP > result
A field that will be used to build up the result of the integral we&#39;re performing.
virtual void getElementOrientation(LocalOrdinalT localElmtId, std::vector< double > &gidsOrientation) const
Get a vector containg the orientation of the GIDs relative to the neighbors.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
int getNumFields() const
How many fields are handled by this manager.
int addField(const std::string &str, const Teuchos::RCP< const FieldPattern > &pattern, const panzer::FieldType &type=panzer::FieldType::CG)
Add a field to the DOF manager.
virtual int getElementBlockGIDCount(const std::string &blockId) const
How any GIDs are associate with a particular element block.
void setFieldOrder(const std::vector< std::string > &fieldOrder)
virtual void getOwnedAndGhostedIndices(std::vector< GlobalOrdinal > &indices) const
Get the set of owned and ghosted indices for this processor.
void printFieldInformation(std::ostream &os) const
virtual void getOwnedIndices(std::vector< GlobalOrdinal > &indices) const
Get the set of indices owned by this processor.
Teuchos::RCP< UniqueGlobalIndexer< LocalOrdinalT, GlobalOrdinalT > > buildNewIndexer(const Teuchos::RCP< ConnManager< LocalOrdinalT, GlobalOrdinalT > > &connManager, MPI_Comm mpiComm) const
virtual int getNumOwnedAndGhosted() const
Get the number of owned and ghosted indices for this processor.
virtual void ownedIndices(const std::vector< GlobalOrdinal > &indices, std::vector< bool > &isOwned) const
void setFieldOrder(const std::vector< std::vector< std::string > > &fieldOrder)
virtual bool equals(const FieldPattern &fp) const
PHX::MDField< ScalarT, panzer::Cell, panzer::BASIS > field
A field to which we&#39;ll contribute, or in which we&#39;ll store, the result of computing this integral...
virtual const std::vector< int > & getGIDFieldOffsets(const std::string &blockId, int fieldNum) const
Use the field pattern so that you can find a particular field in the GIDs array.
virtual void buildPattern(const std::vector< std::pair< FieldType, Teuchos::RCP< const FieldPattern >>> &patterns)
#define TEUCHOS_ASSERT(assertion_test)
TransListIter end
void getFieldOrder(std::vector< std::vector< std::string > > &fieldOrder) const
std::map< Teuchos::Tuple< int, 3 >, std::pair< std::vector< int >, std::vector< int > >, LessThan > TupleToVectorPairMap
Teuchos::RCP< const FieldPattern > getFieldPattern(const std::string &blockId, const std::string &fieldName) const
Find a field pattern stored for a particular block and field number. This will retrive the pattern ad...
virtual const std::pair< std::vector< int >, std::vector< int > > & getGIDFieldOffsets_closure(const std::string &blockId, int fieldNum, int subcellDim, int subcellId) const
Use the field pattern so that you can find a particular field in the GIDs array. This version lets yo...
void addFieldsToFieldBlockManager(const std::vector< std::string > &activeFields, UniqueGlobalIndexer< LocalOrdinalT, GlobalOrdinalT > &fieldBlockManager) const