Panzer  Version of the Day
Panzer_BlockedEpetraLinearObjFactory.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_BlockedEpetraLinearObjFactory_hpp__
44 #define __Panzer_BlockedEpetraLinearObjFactory_hpp__
45 
46 #include <map>
47 
48 // Epetra includes
49 #include "Epetra_Map.h"
50 #include "Epetra_CrsGraph.h"
51 #include "Epetra_Import.h"
52 #include "Epetra_Export.h"
53 
54 #include "PanzerDiscFE_config.hpp"
55 #include "Panzer_GlobalIndexer.hpp"
61 
62 #include "Panzer_GatherOrientation.hpp"
63 #include "Panzer_GatherSolution_BlockedEpetra.hpp"
64 #include "Panzer_GatherTangent_BlockedEpetra.hpp"
65 #include "Panzer_ScatterResidual_BlockedEpetra.hpp"
66 #include "Panzer_ScatterDirichletResidual_BlockedEpetra.hpp"
67 #include "Panzer_ScatterResidual_Epetra.hpp"
68 #include "Panzer_ScatterDirichletResidual_Epetra.hpp"
69 #include "Panzer_GatherSolution_Epetra.hpp"
70 #include "Panzer_GatherTangent_Epetra.hpp"
71 #include "Panzer_GatherOrientation.hpp"
73 #include "Panzer_HashUtils.hpp"
74 
75 #include "Thyra_BlockedLinearOpBase.hpp"
76 #include "Thyra_ProductVectorBase.hpp"
77 
78 #include "Teuchos_RCP.hpp"
79 #include "Teuchos_DefaultMpiComm.hpp"
80 #include "Teuchos_OpaqueWrapper.hpp"
81 
82 namespace panzer
83 {
84 
85 template <typename Traits,typename LocalOrdinalT>
87  , public ThyraObjFactory<double> {
88 public:
89 
90  BlockedEpetraLinearObjFactory(const Teuchos::RCP<const Teuchos::MpiComm<int> > & comm,
91  const Teuchos::RCP<const GlobalIndexer> & gidProvider,
92  bool useDiscreteAdjoint=false);
93 
94  BlockedEpetraLinearObjFactory(const Teuchos::RCP<const Teuchos::MpiComm<int> > & comm,
95  const Teuchos::RCP<const GlobalIndexer> & gidProvider,
96  const Teuchos::RCP<const GlobalIndexer> & colGidProvider,
97  bool useDiscreteAdjoint=false);
98 
100 
101 /*************** Linear object factory methods *******************/
102 
103  virtual void readVector(const std::string & identifier,LinearObjContainer & loc,int id) const;
104 
105  virtual void writeVector(const std::string & identifier,const LinearObjContainer & loc,int id) const;
106 
107  virtual Teuchos::RCP<LinearObjContainer> buildLinearObjContainer() const;
108 
109  virtual Teuchos::RCP<LinearObjContainer> buildPrimitiveLinearObjContainer() const
110  { return buildLinearObjContainer(); }
111 
112  virtual Teuchos::RCP<LinearObjContainer> buildGhostedLinearObjContainer() const;
113 
114  virtual Teuchos::RCP<LinearObjContainer> buildPrimitiveGhostedLinearObjContainer() const
115  { return buildGhostedLinearObjContainer(); }
116 
117  virtual void globalToGhostContainer(const LinearObjContainer & container,
118  LinearObjContainer & ghostContainer,int) const;
119  virtual void ghostToGlobalContainer(const LinearObjContainer & ghostContainer,
120  LinearObjContainer & container,int) const;
121 
128  virtual void adjustForDirichletConditions(const LinearObjContainer & localBCRows,
129  const LinearObjContainer & globalBCRows,
130  LinearObjContainer & ghostedObjs,
131  bool zeroVectorRows=false, bool adjustX=false) const;
132 
136  virtual void applyDirichletBCs(const LinearObjContainer & counter,
137  LinearObjContainer & result) const;
138 
143  virtual Teuchos::RCP<ReadOnlyVector_GlobalEvaluationData> buildReadOnlyDomainContainer() const;
144 
149  virtual Teuchos::RCP<WriteVector_GlobalEvaluationData> buildWriteDomainContainer() const;
150 
151  virtual Teuchos::MpiComm<int> getComm() const;
152 
154  template <typename EvalT>
155  Teuchos::RCP<panzer::CloneableEvaluator> buildScatter() const
156  {
157  if(!colDOFManagerContainer_->containsBlockedDOFManager() &&
158  !rowDOFManagerContainer_->containsBlockedDOFManager())
159  return Teuchos::rcp(new ScatterResidual_Epetra<EvalT,Traits,LocalOrdinalT,int>(rowDOFManagerContainer_->getFieldDOFManagers()[0],
160  colDOFManagerContainer_->getFieldDOFManagers()[0],
162 
163  return Teuchos::rcp(new ScatterResidual_BlockedEpetra<EvalT,Traits,LocalOrdinalT,int>(rowDOFManagerContainer_->getFieldDOFManagers(),
164  colDOFManagerContainer_->getFieldDOFManagers(),
166  }
167 
169  template <typename EvalT>
170  Teuchos::RCP<panzer::CloneableEvaluator > buildGather() const
171  {
172  if(!colDOFManagerContainer_->containsBlockedDOFManager() &&
173  !rowDOFManagerContainer_->containsBlockedDOFManager())
174  return Teuchos::rcp(new GatherSolution_Epetra<EvalT,Traits,LocalOrdinalT,int>(rowDOFManagerContainer_->getFieldDOFManagers()[0]));
175  return Teuchos::rcp(new GatherSolution_BlockedEpetra<EvalT,Traits,LocalOrdinalT,int>(rowDOFManagerContainer_->getFieldDOFManagers()));
176  }
177 
179  template <typename EvalT>
180  Teuchos::RCP<panzer::CloneableEvaluator > buildGatherTangent() const
181  {
182  if(!colDOFManagerContainer_->containsBlockedDOFManager() &&
183  !rowDOFManagerContainer_->containsBlockedDOFManager())
184  return Teuchos::rcp(new GatherTangent_Epetra<EvalT,Traits,LocalOrdinalT,int>(rowDOFManagerContainer_->getFieldDOFManagers()[0]));
185  return Teuchos::rcp(new GatherTangent_BlockedEpetra<EvalT,Traits,LocalOrdinalT,int>(rowDOFManagerContainer_->getFieldDOFManagers()));
186  }
187 
189  template <typename EvalT>
190  Teuchos::RCP<panzer::CloneableEvaluator > buildGatherDomain() const
191  {
192  if(!colDOFManagerContainer_->containsBlockedDOFManager())
193  return Teuchos::rcp(new GatherSolution_Epetra<EvalT,Traits,LocalOrdinalT,int>(colDOFManagerContainer_->getFieldDOFManagers()[0]));
194  return Teuchos::rcp(new GatherSolution_BlockedEpetra<EvalT,Traits,LocalOrdinalT,int>(colDOFManagerContainer_->getFieldDOFManagers()));
195  }
196 
198  template <typename EvalT>
199  Teuchos::RCP<panzer::CloneableEvaluator > buildGatherOrientation() const
200  { return Teuchos::rcp(new GatherOrientation<EvalT,Traits,LocalOrdinalT,panzer::GlobalOrdinal>(rowDOFManagerContainer_->getFieldDOFManagers())); }
201 
203  template <typename EvalT>
204  Teuchos::RCP<panzer::CloneableEvaluator> buildScatterDirichlet() const
205  {
206  if(!colDOFManagerContainer_->containsBlockedDOFManager() &&
207  !rowDOFManagerContainer_->containsBlockedDOFManager())
208  return Teuchos::rcp(new ScatterDirichletResidual_Epetra<EvalT,Traits,LocalOrdinalT,int>(rowDOFManagerContainer_->getFieldDOFManagers()[0],
209  colDOFManagerContainer_->getFieldDOFManagers()[0]));
211  colDOFManagerContainer_->getFieldDOFManagers()));
212  }
213 
214 /*************** Generic helper functions for container setup *******************/
215 
221  void initializeContainer(int,LinearObjContainer & loc) const;
222 
228  void initializeGhostedContainer(int,LinearObjContainer & loc) const;
229 
230 /*************** Thyra based methods *******************/
231 
233  Teuchos::RCP<const Thyra::VectorSpaceBase<double> > getThyraDomainSpace() const;
234 
236  Teuchos::RCP<const Thyra::VectorSpaceBase<double> > getThyraRangeSpace() const;
237 
239  Teuchos::RCP<Thyra::VectorBase<double> > getThyraDomainVector() const;
240 
242  Teuchos::RCP<Thyra::VectorBase<double> > getThyraRangeVector() const;
243 
245  Teuchos::RCP<Thyra::LinearOpBase<double> > getThyraMatrix() const;
246 
247  // and now the ghosted versions
248 
250  Teuchos::RCP<const Thyra::VectorSpaceBase<double> > getGhostedThyraDomainSpace() const;
251 
263  Teuchos::RCP<const Thyra::VectorSpaceBase<double>>
265 
267  Teuchos::RCP<const Thyra::VectorSpaceBase<double> > getGhostedThyraRangeSpace() const;
268 
270  Teuchos::RCP<Thyra::VectorBase<double> > getGhostedThyraDomainVector() const;
271 
273  Teuchos::RCP<Thyra::VectorBase<double> > getGhostedThyraRangeVector() const;
274 
276  Teuchos::RCP<Thyra::LinearOpBase<double> > getGhostedThyraMatrix() const;
277 
278 /*************** Epetra based methods *******************/
279 
281  virtual const Teuchos::RCP<Epetra_Map> getMap(int i) const;
282 
284  virtual const Teuchos::RCP<Epetra_Map> getColMap(int i) const;
285 
287  virtual const Teuchos::RCP<Epetra_Map> getGhostedMap(int i) const;
288 
299  virtual const Teuchos::RCP<Epetra_Map>
301  int i) const;
302 
304  virtual const Teuchos::RCP<Epetra_Map> getGhostedColMap(int i) const;
305 
316  virtual const Teuchos::RCP<Epetra_Map>
318  int i) const;
319 
321  virtual const Teuchos::RCP<Epetra_CrsGraph> getGraph(int i,int j) const;
322 
324  virtual const Teuchos::RCP<Epetra_CrsGraph> getGhostedGraph(int i,int j) const;
325 
327  virtual const Teuchos::RCP<Epetra_Import> getGhostedImport(int i) const;
328 
340  virtual const Teuchos::RCP<Epetra_Import>
342  int i) const;
343 
345  virtual const Teuchos::RCP<Epetra_Import> getGhostedColImport(int i) const;
346 
358  virtual const Teuchos::RCP<Epetra_Import>
360  int i) const;
361 
363  virtual const Teuchos::RCP<Epetra_Export> getGhostedExport(int j) const;
364 
376  virtual const Teuchos::RCP<Epetra_Export>
378  int i) const;
379 
381  virtual const Teuchos::RCP<Epetra_Export> getGhostedColExport(int j) const;
382 
394  virtual const Teuchos::RCP<Epetra_Export>
396  int i) const;
397 
399  virtual const Teuchos::RCP<const Epetra_Comm> getEpetraComm() const;
400 
401  Teuchos::RCP<Epetra_CrsMatrix> getEpetraMatrix(int i,int j) const;
402  Teuchos::RCP<Epetra_CrsMatrix> getGhostedEpetraMatrix(int i,int j) const;
403 
405  int getBlockRowCount() const;
406 
408  int getBlockColCount() const;
409 
410  Teuchos::RCP<const panzer::BlockedDOFManager> getGlobalIndexer() const
411  { return rowDOFManagerContainer_->getBlockedIndexer(); }
412 
413  Teuchos::RCP<const panzer::GlobalIndexer> getRangeGlobalIndexer() const
414  { return rowDOFManagerContainer_->getGlobalIndexer(); }
415 
416  Teuchos::RCP<const panzer::GlobalIndexer> getDomainGlobalIndexer() const
417  { return colDOFManagerContainer_->getGlobalIndexer(); }
418 
420  const std::vector<Teuchos::RCP<const GlobalIndexer> > & getRangeGlobalIndexers() const
421  { return rowDOFManagerContainer_->getFieldDOFManagers(); }
422 
424  const std::vector<Teuchos::RCP<const GlobalIndexer> > & getDomainGlobalIndexers() const
425  { return colDOFManagerContainer_->getFieldDOFManagers(); }
426 
428  void addExcludedPair(int rowBlock,int colBlock);
429 
431  void addExcludedPairs(const std::vector<std::pair<int,int> > & exPairs);
432 
433 protected:
434 
441 
448 
449 /*************** Utility class for handling blocked and nonblocked DOF managers *******************/
450 
455  public:
457  DOFManagerContainer(const Teuchos::RCP<const GlobalIndexer> & ugi)
458  { setGlobalIndexer(ugi); }
459 
460  void setGlobalIndexer(const Teuchos::RCP<const GlobalIndexer> & ugi)
461  {
462  using Teuchos::RCP;
463  using Teuchos::rcp_dynamic_cast;
464 
465  auto blockedDOFManager = rcp_dynamic_cast<const BlockedDOFManager>(ugi);
466  auto flatDOFManager = rcp_dynamic_cast<const GlobalIndexer>(ugi);
467 
468  if(blockedDOFManager!=Teuchos::null) {
469  // set BlockedDOFManager
470  blockedDOFManager_ = blockedDOFManager;
471 
472  // get all GID providers
473  auto dofManagers = blockedDOFManager_->getFieldDOFManagers();
474  for(auto itr=dofManagers.begin();itr!=dofManagers.end();++itr)
475  gidProviders_.push_back(*itr);
476  }
477  else if(flatDOFManager!=Teuchos::null) {
478  // for absolute clarity, nullify the blockedDOFManager_
479  blockedDOFManager_ = Teuchos::null;
480 
481  // you have only a single GID provider
482  gidProviders_.push_back(flatDOFManager);
483  }
484  else {
485  TEUCHOS_ASSERT(false);
486  }
487  }
488 
490  int getFieldBlocks() const
491  { return Teuchos::as<int>(gidProviders_.size()); }
492 
498  { return blockedDOFManager_ !=Teuchos::null; }
499 
501  Teuchos::RCP<const BlockedDOFManager> getBlockedIndexer() const
502  {
503  TEUCHOS_ASSERT(containsBlockedDOFManager());
504  return blockedDOFManager_;
505  }
506 
508  Teuchos::RCP<const GlobalIndexer> getGlobalIndexer() const
509  {
510  if(blockedDOFManager_!=Teuchos::null)
511  return blockedDOFManager_;
512 
513  TEUCHOS_ASSERT(gidProviders_.size()==1);
514  return gidProviders_[0];
515  }
516 
518  const std::vector<Teuchos::RCP<const GlobalIndexer> > & getFieldDOFManagers() const
519  { return gidProviders_; }
520 
521  private:
522  Teuchos::RCP<const BlockedDOFManager> blockedDOFManager_;
523  std::vector<Teuchos::RCP<const GlobalIndexer> > gidProviders_;
524  };
525 
526 /*************** Generic methods/members *******************/
527 
528  // Get the global indexer associated with a particular block
529  Teuchos::RCP<const GlobalIndexer> getGlobalIndexer(int i) const;
530 
531  Teuchos::RCP<const GlobalIndexer> getColGlobalIndexer(int i) const;
532 
534  void makeRoomForBlocks(std::size_t blockCnt,std::size_t colBlockCnt=0);
535 
536  Teuchos::RCP<const DOFManagerContainer> rowDOFManagerContainer_;
537  Teuchos::RCP<const DOFManagerContainer> colDOFManagerContainer_;
538 
540 
541  // which block entries are ignored
542  std::unordered_set<std::pair<int,int>,panzer::pair_hash> excludedPairs_;
543 
544 /*************** Thyra based methods/members *******************/
545 
546  void ghostToGlobalThyraVector(const Teuchos::RCP<const Thyra::VectorBase<double> > & in,
547  const Teuchos::RCP<Thyra::VectorBase<double> > & out,bool col) const;
549  void globalToGhostThyraVector(const Teuchos::RCP<const Thyra::VectorBase<double> > & in,
550  const Teuchos::RCP<Thyra::VectorBase<double> > & out,bool col) const;
551 
552  mutable Teuchos::RCP<const Thyra::VectorSpaceBase<double> > rangeSpace_;
553  mutable Teuchos::RCP<const Thyra::VectorSpaceBase<double> > domainSpace_;
554 
555  mutable Teuchos::RCP<const Thyra::VectorSpaceBase<double> > ghostedRangeSpace_;
556  mutable Teuchos::RCP<const Thyra::VectorSpaceBase<double> > ghostedDomainSpace_;
557 
558 /*************** Epetra based methods/members *******************/
559 
560  void adjustForDirichletConditions(const Epetra_Vector & local_bcs,
561  const Epetra_Vector & global_bcs,
562  const Teuchos::Ptr<Epetra_Vector> & f,
563  const Teuchos::Ptr<Epetra_CrsMatrix> & A,
564  bool zeroVectorRows) const;
565 
566  void ghostToGlobalEpetraVector(int i,const Epetra_Vector & in,Epetra_Vector & out,bool col) const;
567  void globalToGhostEpetraVector(int i,const Epetra_Vector & in,Epetra_Vector & out,bool col) const;
568  void ghostToGlobalEpetraMatrix(int blockRow,const Epetra_CrsMatrix & in,Epetra_CrsMatrix & out) const;
569 
570  // get the map from the matrix
571 
580  virtual const Teuchos::RCP<Epetra_Map>
581  buildMap(
582  int i) const;
583 
592  virtual const Teuchos::RCP<Epetra_Map>
594  int i) const;
595 
604  virtual const Teuchos::RCP<Epetra_Map>
606  int i) const;
607 
608  // get the map from the matrix
609 
618  virtual const Teuchos::RCP<Epetra_Map>
619  buildColMap(
620  int i) const;
621 
630  virtual const Teuchos::RCP<Epetra_Map>
632  int i) const;
633 
642  virtual const Teuchos::RCP<Epetra_Map>
644  int i) const;
645 
646  // get the graph of the crs matrix
647  virtual const Teuchos::RCP<Epetra_CrsGraph> buildGraph(int i,int j) const;
648  virtual const Teuchos::RCP<Epetra_CrsGraph> buildGhostedGraph(int i,int j,bool optimizeStorage) const;
649  virtual const Teuchos::RCP<Epetra_CrsGraph> buildFilteredGhostedGraph(int i,int j) const;
650 
651  // storage for Epetra graphs and maps
652  Teuchos::RCP<const Epetra_Comm> eComm_;
653  Teuchos::RCP<const Teuchos::OpaqueWrapper<MPI_Comm> > rawMpiComm_;
654  Teuchos::RCP<Teuchos::MpiComm<int> > tComm_;
655 
660  mutable std::vector<Teuchos::RCP<Epetra_Map>> maps_;
661 
666  mutable std::vector<Teuchos::RCP<Epetra_Map>> ghostedMaps_;
667 
672  mutable std::vector<Teuchos::RCP<Epetra_Map>> ghostedMaps2_;
673 
677  mutable std::vector<Teuchos::RCP<Epetra_Import>> importers_;
678 
682  mutable std::vector<Teuchos::RCP<Epetra_Import>> importers2_;
683 
684  mutable std::vector<Teuchos::RCP<Epetra_Export>> exporters_;
685 
690  mutable std::vector<Teuchos::RCP<Epetra_Map>> colMaps_;
691 
696  mutable std::vector<Teuchos::RCP<Epetra_Map>> colGhostedMaps_;
697 
702  mutable std::vector<Teuchos::RCP<Epetra_Map>> colGhostedMaps2_;
703 
707  mutable std::vector<Teuchos::RCP<Epetra_Import>> colImporters_;
708 
713  mutable std::vector<Teuchos::RCP<Epetra_Import>> colImporters2_;
714 
715  mutable std::vector<Teuchos::RCP<Epetra_Export>> colExporters_;
716 
717  mutable std::unordered_map<std::pair<int,int>,Teuchos::RCP<Epetra_CrsGraph>,panzer::pair_hash> graphs_ ;
718  mutable std::unordered_map<std::pair<int,int>,Teuchos::RCP<Epetra_CrsGraph>,panzer::pair_hash> ghostedGraphs_;
719 
721 };
722 
723 } // end of namespace panzer
724 
725 #endif // __Panzer_BlockedEpetraLinearObjFactory_hpp__
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.
const std::vector< Teuchos::RCP< const GlobalIndexer > > & getFieldDOFManagers() const
Get DOFManagers associated with the blocks.
int getFieldBlocks() const
Get the number of global indexers (not including the blocked one) contained.
void setGlobalIndexer(const Teuchos::RCP< const GlobalIndexer > &ugi)
Teuchos::RCP< const GlobalIndexer > getGlobalIndexer() const
Get the "parent" global indexer (if getFieldBlocks()>1 this will be blocked, otherwise it may be eith...
Teuchos::RCP< const BlockedDOFManager > getBlockedIndexer() const
Get the "parent" global indexer (if containsBlockedDOFManager()==false this will throw)
virtual const Teuchos::RCP< Epetra_Map > buildGhostedMap2(int i) const
Build the i-th ghosted map from the ghosted indices of the i-th global indexer.
void ghostToGlobalEpetraMatrix(int blockRow, const Epetra_CrsMatrix &in, Epetra_CrsMatrix &out) const
void globalToGhostEpetraVector(int i, const Epetra_Vector &in, Epetra_Vector &out, bool col) const
Teuchos::RCP< panzer::CloneableEvaluator > buildGatherOrientation() const
Use preconstructed gather evaluators.
void initializeGhostedContainer(int, LinearObjContainer &loc) const
Teuchos::RCP< Thyra::LinearOpBase< double > > getThyraMatrix() const
Get a Thyra operator.
virtual const Teuchos::RCP< Epetra_Export > getGhostedColExport(int j) const
get exporter for converting an overalapped object to a "normal" object
virtual const Teuchos::RCP< Epetra_Map > buildMap(int i) const
Build the i-th owned map from the owned indices of the i-th global indexer.
virtual const Teuchos::RCP< Epetra_Map > getGhostedColMap(int i) const
get the ghosted map from the matrix
virtual const Teuchos::RCP< Epetra_CrsGraph > buildFilteredGhostedGraph(int i, int j) const
std::vector< Teuchos::RCP< Epetra_Export > > colExporters_
void ghostToGlobalThyraVector(const Teuchos::RCP< const Thyra::VectorBase< double > > &in, const Teuchos::RCP< Thyra::VectorBase< double > > &out, bool col) const
void addExcludedPair(int rowBlock, int colBlock)
exclude a block pair from the matrix
virtual const Teuchos::RCP< const Epetra_Comm > getEpetraComm() const
get exporter for converting an overalapped object to a "normal" object
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getGhostedThyraDomainSpace2() const
Get or create the ghosted Thyra domain space.
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getGhostedThyraRangeSpace() const
Get the range vector space (f)
virtual const Teuchos::RCP< Epetra_Map > buildColGhostedMap2(int i) const
Build the i-th ghosted column map from the ghosted indices of the i-th (column) global indexer.
void makeRoomForBlocks(std::size_t blockCnt, std::size_t colBlockCnt=0)
Allocate the space in the std::vector objects so we can fill with appropriate Epetra data.
virtual void readVector(const std::string &identifier, LinearObjContainer &loc, int id) const
Teuchos::RCP< const panzer::GlobalIndexer > getDomainGlobalIndexer() const
Get the domain global indexer object associated with this factory.
std::vector< Teuchos::RCP< Epetra_Map > > maps_
The list of owned maps corresponding to the owned indices of the global indexers.
virtual const Teuchos::RCP< Epetra_Map > getGhostedMap(int i) const
get the ghosted map from the matrix
virtual const Teuchos::RCP< Epetra_Import > getGhostedColImport2(int i) const
Get or create the i-th ghosted column importer corresponding to the i-th ghosted column map.
std::vector< Teuchos::RCP< Epetra_Import > > importers2_
The list of ghosted importers corresponding to ghostedMaps2_.
void addExcludedPairs(const std::vector< std::pair< int, int > > &exPairs)
exclude a vector of pairs from the matrix
Teuchos::RCP< const panzer::BlockedDOFManager > getGlobalIndexer() const
Teuchos::RCP< const DOFManagerContainer > colDOFManagerContainer_
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > rangeSpace_
Teuchos::RCP< const DOFManagerContainer > rowDOFManagerContainer_
std::vector< Teuchos::RCP< Epetra_Map > > colGhostedMaps2_
The list of ghosted column maps corresponding to the ghosted indices of the (column) global indexers.
Teuchos::RCP< panzer::CloneableEvaluator > buildScatter() const
Use preconstructed scatter evaluators.
Teuchos::RCP< panzer::CloneableEvaluator > buildScatterDirichlet() const
Use preconstructed dirichlet scatter evaluators.
const std::vector< Teuchos::RCP< const GlobalIndexer > > & getDomainGlobalIndexers() const
Get global indexers associated with the blocks.
Teuchos::RCP< Thyra::VectorBase< double > > getThyraRangeVector() const
Get a range vector.
std::unordered_set< std::pair< int, int >, panzer::pair_hash > excludedPairs_
virtual const Teuchos::RCP< Epetra_CrsGraph > getGraph(int i, int j) const
get the graph of the crs matrix
virtual Teuchos::RCP< LinearObjContainer > buildGhostedLinearObjContainer() const
virtual const Teuchos::RCP< Epetra_Map > buildGhostedMap(int i) const
Build the i-th ghosted map from the owned and ghosted indices of the i-th global indexer.
void initializeContainer(int, LinearObjContainer &loc) const
void ghostToGlobalEpetraVector(int i, const Epetra_Vector &in, Epetra_Vector &out, bool col) const
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getThyraRangeSpace() const
Get the range vector space (f)
virtual void ghostToGlobalContainer(const LinearObjContainer &ghostContainer, LinearObjContainer &container, int) const
void ghostToGlobalThyraMatrix(const Thyra::LinearOpBase< double > &in, Thyra::LinearOpBase< double > &out) const
Teuchos::RCP< const Teuchos::OpaqueWrapper< MPI_Comm > > rawMpiComm_
virtual const Teuchos::RCP< Epetra_Import > getGhostedImport2(int i) const
Get or create the i-th ghosted importer corresponding to the i-th ghosted map.
std::vector< Teuchos::RCP< Epetra_Map > > ghostedMaps_
The list of ghosted maps corresponding to the owned and ghosted indices of the global indexers.
void initializeContainer_internal(int mem, ThyraObjContainer< double > &loc) const
virtual const Teuchos::RCP< Epetra_Map > getMap(int i) const
get the map from the matrix
Teuchos::RCP< Thyra::VectorBase< double > > getGhostedThyraDomainVector() const
Get a domain vector.
virtual const Teuchos::RCP< Epetra_Map > buildColMap(int i) const
Build the i-th owned column map from the owned indices of the i-th (column) global indexer.
std::vector< Teuchos::RCP< Epetra_Map > > colMaps_
The list of owned column maps corresponding to the owned indices of the (column) global indexers.
virtual const Teuchos::RCP< Epetra_Export > getGhostedExport2(int i) const
Get or create the i-th ghosted exporter corresponding to the i-th ghosted map.
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > ghostedRangeSpace_
virtual const Teuchos::RCP< Epetra_Import > getGhostedImport(int i) const
get importer for converting an overalapped object to a "normal" object
Teuchos::RCP< panzer::CloneableEvaluator > buildGatherDomain() const
Use preconstructed gather evaluators.
Teuchos::RCP< Thyra::VectorBase< double > > getThyraDomainVector() const
Get a domain vector.
virtual const Teuchos::RCP< Epetra_CrsGraph > buildGhostedGraph(int i, int j, bool optimizeStorage) const
virtual const Teuchos::RCP< Epetra_Map > buildColGhostedMap(int i) const
Build the i-th ghosted column map from the owned and ghosted indices of the i-th (column) global inde...
Teuchos::RCP< panzer::CloneableEvaluator > buildGather() const
Use preconstructed gather evaluators.
virtual void adjustForDirichletConditions(const LinearObjContainer &localBCRows, const LinearObjContainer &globalBCRows, LinearObjContainer &ghostedObjs, bool zeroVectorRows=false, bool adjustX=false) const
std::vector< Teuchos::RCP< Epetra_Import > > importers_
The list of ghosted importers corresponding to ghostedMaps_.
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > ghostedDomainSpace_
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > domainSpace_
BlockedEpetraLinearObjFactory(const Teuchos::RCP< const Teuchos::MpiComm< int > > &comm, const Teuchos::RCP< const GlobalIndexer > &gidProvider, bool useDiscreteAdjoint=false)
Teuchos::RCP< Thyra::VectorBase< double > > getGhostedThyraRangeVector() const
Get a range vector.
virtual void applyDirichletBCs(const LinearObjContainer &counter, LinearObjContainer &result) const
Teuchos::RCP< panzer::CloneableEvaluator > buildGatherTangent() const
Use preconstructed gather evaluators.
std::unordered_map< std::pair< int, int >, Teuchos::RCP< Epetra_CrsGraph >, panzer::pair_hash > graphs_
std::vector< Teuchos::RCP< Epetra_Map > > ghostedMaps2_
The list of ghosted maps corresponding to the ghosted indices of the global indexers.
void initializeGhostedContainer_internal(int mem, ThyraObjContainer< double > &loc) const
virtual Teuchos::RCP< ReadOnlyVector_GlobalEvaluationData > buildReadOnlyDomainContainer() const
virtual void globalToGhostContainer(const LinearObjContainer &container, LinearObjContainer &ghostContainer, int) const
Teuchos::RCP< Epetra_CrsMatrix > getGhostedEpetraMatrix(int i, int j) const
std::vector< Teuchos::RCP< Epetra_Export > > exporters_
virtual const Teuchos::RCP< Epetra_Import > getGhostedColImport(int i) const
get importer for converting an overalapped object to a "normal" object
virtual const Teuchos::RCP< Epetra_CrsGraph > getGhostedGraph(int i, int j) const
get the ghosted graph of the crs matrix
virtual const Teuchos::RCP< Epetra_Export > getGhostedColExport2(int i) const
Get or create the i-th ghosted column exporter corresponding to the i-th ghosted column map.
std::vector< Teuchos::RCP< Epetra_Import > > colImporters2_
The list of ghosted importers corresponding to colGhostedMaps2_.
virtual const Teuchos::RCP< Epetra_CrsGraph > buildGraph(int i, int j) const
Teuchos::RCP< Thyra::LinearOpBase< double > > getGhostedThyraMatrix() const
Get a Thyra operator.
virtual const Teuchos::RCP< Epetra_Map > getColMap(int i) const
get the map from the matrix
void globalToGhostThyraVector(const Teuchos::RCP< const Thyra::VectorBase< double > > &in, const Teuchos::RCP< Thyra::VectorBase< double > > &out, bool col) const
Teuchos::RCP< const panzer::GlobalIndexer > getRangeGlobalIndexer() const
Get the range global indexer object associated with this factory.
virtual const Teuchos::RCP< Epetra_Map > getGhostedMap2(int i) const
Get or create the i-th ghosted map.
std::vector< Teuchos::RCP< Epetra_Map > > colGhostedMaps_
The list of ghosted column maps corresponding to the owned and ghosted indices of the (column) global...
virtual Teuchos::RCP< LinearObjContainer > buildLinearObjContainer() const
std::vector< Teuchos::RCP< Epetra_Import > > colImporters_
The list of ghosted importers corresponding to colGhostedMaps_.
virtual Teuchos::RCP< LinearObjContainer > buildPrimitiveLinearObjContainer() const
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getThyraDomainSpace() const
Get the domain vector space (x and dxdt)
virtual const Teuchos::RCP< Epetra_Map > getGhostedColMap2(int i) const
Get or create the i-th ghosted column map.
virtual Teuchos::RCP< WriteVector_GlobalEvaluationData > buildWriteDomainContainer() const
Teuchos::RCP< const GlobalIndexer > getColGlobalIndexer(int i) const
const std::vector< Teuchos::RCP< const GlobalIndexer > > & getRangeGlobalIndexers() const
Get global indexers associated with the blocks.
virtual const Teuchos::RCP< Epetra_Export > getGhostedExport(int j) const
get exporter for converting an overalapped object to a "normal" object
Teuchos::RCP< Epetra_CrsMatrix > getEpetraMatrix(int i, int j) const
virtual Teuchos::RCP< LinearObjContainer > buildPrimitiveGhostedLinearObjContainer() const
virtual void writeVector(const std::string &identifier, const LinearObjContainer &loc, int id) const
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getGhostedThyraDomainSpace() const
Get the domain vector space (x and dxdt)
std::unordered_map< std::pair< int, int >, Teuchos::RCP< Epetra_CrsGraph >, panzer::pair_hash > ghostedGraphs_
Gathers orientations per field from the global indexer and stores them in the field manager.
Gathers solution values from the Newton solution vector into the nodal fields of the field manager.
Gathers solution values from the Newton solution vector into the nodal fields of the field manager.
Pushes residual values into the residual vector for a Newton-based solve.
Pushes residual values into the residual vector for a Newton-based solve.
Pushes residual values into the residual vector for a Newton-based solve.
Pushes residual values into the residual vector for a Newton-based solve.