43#ifndef __Panzer_BlockedEpetraLinearObjFactory_hpp__
44#define __Panzer_BlockedEpetraLinearObjFactory_hpp__
49#include "Epetra_Map.h"
50#include "Epetra_CrsGraph.h"
51#include "Epetra_Import.h"
52#include "Epetra_Export.h"
54#include "PanzerDiscFE_config.hpp"
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"
75#include "Thyra_BlockedLinearOpBase.hpp"
76#include "Thyra_ProductVectorBase.hpp"
78#include "Teuchos_RCP.hpp"
79#include "Teuchos_DefaultMpiComm.hpp"
80#include "Teuchos_OpaqueWrapper.hpp"
85template <
typename Traits,
typename LocalOrdinalT>
91 const Teuchos::RCP<const GlobalIndexer> & gidProvider,
92 bool useDiscreteAdjoint=
false);
95 const Teuchos::RCP<const GlobalIndexer> & gidProvider,
96 const Teuchos::RCP<const GlobalIndexer> & colGidProvider,
97 bool useDiscreteAdjoint=
false);
131 bool zeroVectorRows=
false,
bool adjustX=
false)
const;
154 template <
typename EvalT>
169 template <
typename EvalT>
179 template <
typename EvalT>
189 template <
typename EvalT>
198 template <
typename EvalT>
203 template <
typename EvalT>
245 Teuchos::RCP<Thyra::LinearOpBase<double> >
getThyraMatrix()
const;
263 Teuchos::RCP<const Thyra::VectorSpaceBase<double>>
281 virtual const Teuchos::RCP<Epetra_Map>
getMap(
int i)
const;
284 virtual const Teuchos::RCP<Epetra_Map>
getColMap(
int i)
const;
287 virtual const Teuchos::RCP<Epetra_Map>
getGhostedMap(
int i)
const;
299 virtual const Teuchos::RCP<Epetra_Map>
316 virtual const Teuchos::RCP<Epetra_Map>
321 virtual const Teuchos::RCP<Epetra_CrsGraph>
getGraph(
int i,
int j)
const;
324 virtual const Teuchos::RCP<Epetra_CrsGraph>
getGhostedGraph(
int i,
int j)
const;
340 virtual const Teuchos::RCP<Epetra_Import>
358 virtual const Teuchos::RCP<Epetra_Import>
376 virtual const Teuchos::RCP<Epetra_Export>
394 virtual const Teuchos::RCP<Epetra_Export>
399 virtual const Teuchos::RCP<const Epetra_Comm>
getEpetraComm()
const;
463 using Teuchos::rcp_dynamic_cast;
465 auto blockedDOFManager = rcp_dynamic_cast<const BlockedDOFManager>(ugi);
466 auto flatDOFManager = rcp_dynamic_cast<const GlobalIndexer>(ugi);
468 if(blockedDOFManager!=Teuchos::null) {
474 for(
auto itr=dofManagers.begin();itr!=dofManagers.end();++itr)
477 else if(flatDOFManager!=Teuchos::null) {
485 TEUCHOS_ASSERT(
false);
552 mutable Teuchos::RCP<const Thyra::VectorSpaceBase<double> >
rangeSpace_;
553 mutable Teuchos::RCP<const Thyra::VectorSpaceBase<double> >
domainSpace_;
562 const Teuchos::Ptr<Epetra_Vector> & f,
563 const Teuchos::Ptr<Epetra_CrsMatrix> & A,
564 bool zeroVectorRows)
const;
580 virtual const Teuchos::RCP<Epetra_Map>
592 virtual const Teuchos::RCP<Epetra_Map>
604 virtual const Teuchos::RCP<Epetra_Map>
618 virtual const Teuchos::RCP<Epetra_Map>
630 virtual const Teuchos::RCP<Epetra_Map>
642 virtual const Teuchos::RCP<Epetra_Map>
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;
653 Teuchos::RCP<const Teuchos::OpaqueWrapper<MPI_Comm> >
rawMpiComm_;
654 Teuchos::RCP<Teuchos::MpiComm<int> >
tComm_;
660 mutable std::vector<Teuchos::RCP<Epetra_Map>>
maps_;
690 mutable std::vector<Teuchos::RCP<Epetra_Map>>
colMaps_;
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.
Teuchos::RCP< const GlobalIndexer > getGlobalIndexer() const
Get the "parent" global indexer (if getFieldBlocks()>1 this will be blocked, otherwise it may be eith...
bool containsBlockedDOFManager() const
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 BlockedDOFManager > getBlockedIndexer() const
Get the "parent" global indexer (if containsBlockedDOFManager()==false this will throw)
std::vector< Teuchos::RCP< const GlobalIndexer > > gidProviders_
DOFManagerContainer(const Teuchos::RCP< const GlobalIndexer > &ugi)
Teuchos::RCP< const BlockedDOFManager > blockedDOFManager_
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
virtual Teuchos::MpiComm< int > getComm() const
void globalToGhostEpetraVector(int i, const Epetra_Vector &in, Epetra_Vector &out, bool col) const
void initializeGhostedContainer(int, LinearObjContainer &loc) const
Teuchos::RCP< const Epetra_Comm > eComm_
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
Teuchos::RCP< const panzer::BlockedDOFManager > getGlobalIndexer() const
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
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 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.
int getBlockColCount() const
how many block columns
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
const std::vector< Teuchos::RCP< const GlobalIndexer > > & getRangeGlobalIndexers() const
Get global indexers associated with the blocks.
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 ~BlockedEpetraLinearObjFactory()
const std::vector< Teuchos::RCP< const GlobalIndexer > > & getDomainGlobalIndexers() const
Get global indexers associated with the blocks.
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.
int getBlockRowCount() const
how many block rows
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< 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 > buildGatherTangent() 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< panzer::CloneableEvaluator > buildScatterDirichlet() const
Use preconstructed dirichlet scatter evaluators.
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > ghostedDomainSpace_
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > domainSpace_
Teuchos::RCP< Thyra::VectorBase< double > > getGhostedThyraRangeVector() const
Get a range vector.
virtual void applyDirichletBCs(const LinearObjContainer &counter, LinearObjContainer &result) const
std::unordered_map< std::pair< int, int >, Teuchos::RCP< Epetra_CrsGraph >, panzer::pair_hash > graphs_
virtual Teuchos::RCP< LinearObjContainer > buildPrimitiveGhostedLinearObjContainer() const
std::vector< Teuchos::RCP< Epetra_Map > > ghostedMaps2_
The list of ghosted maps corresponding to the ghosted indices of the global indexers.
virtual Teuchos::RCP< LinearObjContainer > buildPrimitiveLinearObjContainer() const
void initializeGhostedContainer_internal(int mem, ThyraObjContainer< double > &loc) const
virtual Teuchos::RCP< ReadOnlyVector_GlobalEvaluationData > buildReadOnlyDomainContainer() const
Teuchos::RCP< panzer::CloneableEvaluator > buildScatter() const
Use preconstructed scatter evaluators.
virtual void globalToGhostContainer(const LinearObjContainer &container, LinearObjContainer &ghostContainer, int) const
Teuchos::RCP< Epetra_CrsMatrix > getGhostedEpetraMatrix(int i, int j) const
Teuchos::RCP< panzer::CloneableEvaluator > buildGather() const
Use preconstructed gather evaluators.
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.
Teuchos::RCP< Teuchos::MpiComm< int > > tComm_
Teuchos::RCP< panzer::CloneableEvaluator > buildGatherDomain() const
Use preconstructed gather evaluators.
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
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_.
Teuchos::RCP< const panzer::GlobalIndexer > getDomainGlobalIndexer() const
Get the domain global indexer object associated with this factory.
Teuchos::RCP< const panzer::GlobalIndexer > getRangeGlobalIndexer() const
Get the range global indexer object associated with this factory.
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
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 void writeVector(const std::string &identifier, const LinearObjContainer &loc, int id) const
Teuchos::RCP< panzer::CloneableEvaluator > buildGatherOrientation() const
Use preconstructed gather evaluators.
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.
GatherTangent_BlockedEpetra.
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.