43 #ifndef __Panzer_EpetraLinearObjFactory_decl_hpp__ 44 #define __Panzer_EpetraLinearObjFactory_decl_hpp__ 46 #define PANZER_USE_BLOCKED_EPETRA_LOF 48 #ifndef PANZER_USE_BLOCKED_EPETRA_LOF 52 #include "Epetra_Map.h" 53 #include "Epetra_CrsGraph.h" 54 #include "Epetra_Import.h" 55 #include "Epetra_Export.h" 57 #include "PanzerDiscFE_config.hpp" 61 #include "Panzer_ScatterResidual_Epetra.hpp" 62 #include "Panzer_ScatterDirichletResidual_Epetra.hpp" 63 #include "Panzer_GatherSolution_Epetra.hpp" 64 #include "Panzer_GatherTangent_Epetra.hpp" 65 #include "Panzer_GatherOrientation.hpp" 69 #include "Teuchos_RCP.hpp" 70 #include "Teuchos_DefaultMpiComm.hpp" 74 template <
typename Traits,
typename LocalOrdinalT>
76 ,
public ThyraObjFactory<double> {
80 const Teuchos::RCP<
const UniqueGlobalIndexer<LocalOrdinalT,int> > & gidProvider,
81 bool useDiscreteAdjoint=
false);
84 const Teuchos::RCP<
const UniqueGlobalIndexer<LocalOrdinalT,int> > & rowProvider,
85 const Teuchos::RCP<
const UniqueGlobalIndexer<LocalOrdinalT,int> > & colProvider,
86 bool useDiscreteAdjoint=
false);
97 virtual void readVector(
const std::string & identifier,LinearObjContainer & loc,
int id)
const;
99 virtual void writeVector(
const std::string & identifier,
const LinearObjContainer & loc,
int id)
const;
112 LinearObjContainer & ghostContainer,
int)
const;
114 LinearObjContainer & container,
int)
const;
123 const LinearObjContainer & globalBCRows,
124 LinearObjContainer & ghostedObjs,
125 bool zeroVectorRows=
false,
bool adjustX=
false)
const;
131 LinearObjContainer & result)
const;
141 virtual Teuchos::MpiComm<int>
getComm()
const;
150 Teuchos::RCP<Thyra::LinearOpBase<double> >
getThyraMatrix()
const;
153 template <
typename EvalT>
154 Teuchos::RCP<panzer::CloneableEvaluator>
buildScatter()
const 155 {
return Teuchos::rcp(
new ScatterResidual_Epetra<EvalT,Traits,LocalOrdinalT,int>(gidProvider_,colGidProvider_,
useDiscreteAdjoint_)); }
158 template <
typename EvalT>
159 Teuchos::RCP<panzer::CloneableEvaluator >
buildGather()
const 160 {
return Teuchos::rcp(
new GatherSolution_Epetra<EvalT,Traits,LocalOrdinalT,int>(gidProvider_)); }
163 template <
typename EvalT>
165 {
return Teuchos::rcp(
new GatherTangent_Epetra<EvalT,Traits,LocalOrdinalT,int>(gidProvider_)); }
168 template <
typename EvalT>
170 {
if(colGidProvider_!=Teuchos::null)
171 return Teuchos::rcp(
new GatherSolution_Epetra<EvalT,Traits,LocalOrdinalT,int>(colGidProvider_));
172 return Teuchos::rcp(
new GatherSolution_Epetra<EvalT,Traits,LocalOrdinalT,int>(gidProvider_)); }
175 template <
typename EvalT>
177 {
return Teuchos::rcp(
new GatherOrientation<EvalT,Traits,LocalOrdinalT,int>(gidProvider_)); }
180 template <
typename EvalT>
182 {
return Teuchos::rcp(
new ScatterDirichletResidual_Epetra<EvalT,Traits,LocalOrdinalT,int>(gidProvider_,colGidProvider_)); }
217 virtual const Teuchos::RCP<Epetra_Map>
getMap()
const;
220 const Teuchos::RCP<Epetra_Map>
getMap(
int)
const {
return getMap(); }
223 virtual const Teuchos::RCP<Epetra_Map>
getColMap()
const;
228 virtual const Teuchos::RCP<Epetra_Map>
getGhostedMap()
const;
239 virtual const Teuchos::RCP<Epetra_CrsGraph>
getGraph()
const;
242 const Teuchos::RCP<Epetra_CrsGraph>
getGraph(
int,
int)
const {
return getGraph(); }
264 virtual const Teuchos::RCP<const Epetra_Comm>
getEpetraComm()
const;
268 {
return colGidProvider_!=Teuchos::null ? colGidProvider_ : gidProvider_; }
272 {
return gidProvider_; }
275 Teuchos::RCP<Epetra_Vector> getGhostedEpetraVector()
const;
276 Teuchos::RCP<Epetra_Vector> getGhostedEpetraColVector()
const;
277 Teuchos::RCP<Epetra_Vector> getEpetraVector()
const;
278 Teuchos::RCP<Epetra_Vector> getEpetraColVector()
const;
287 virtual const Teuchos::RCP<Epetra_Map>
buildMap()
const;
288 virtual const Teuchos::RCP<Epetra_Map>
buildColMap()
const;
290 virtual const Teuchos::RCP<Epetra_Map> buildGhostedColMap()
const;
293 virtual const Teuchos::RCP<Epetra_CrsGraph>
buildGraph()
const;
294 virtual const Teuchos::RCP<Epetra_CrsGraph>
buildGhostedGraph(
bool optimizeStorage)
const;
303 Teuchos::RCP<const Epetra_Comm> comm_;
304 mutable Teuchos::RCP<Epetra_Map> map_;
305 mutable Teuchos::RCP<Epetra_Map> cMap_;
306 mutable Teuchos::RCP<Epetra_Map> ghostedMap_;
307 mutable Teuchos::RCP<Epetra_Map> cGhostedMap_;
308 mutable Teuchos::RCP<Epetra_CrsGraph> graph_;
309 mutable Teuchos::RCP<Epetra_CrsGraph> ghostedGraph_;
312 mutable Teuchos::RCP<Epetra_Import> importer_, colImporter_;
313 mutable Teuchos::RCP<Epetra_Export> exporter_, colExporter_;
315 bool hasColProvider_;
316 Teuchos::RCP<const UniqueGlobalIndexer<LocalOrdinalT,int> > gidProvider_;
317 Teuchos::RCP<const UniqueGlobalIndexer<LocalOrdinalT,int> > colGidProvider_;
318 Teuchos::RCP<const Teuchos::OpaqueWrapper<MPI_Comm> >
rawMpiComm_;
320 mutable Teuchos::RCP<const Thyra::VectorSpaceBase<double> >
rangeSpace_;
321 mutable Teuchos::RCP<const Thyra::VectorSpaceBase<double> >
domainSpace_;
334 template <
typename Traits,
typename LocalOrdinalT>
void ghostToGlobalEpetraVector(int i, const Epetra_Vector &in, Epetra_Vector &out, bool col) const
virtual Teuchos::RCP< LinearObjContainer > buildGhostedLinearObjContainer() const
virtual const Teuchos::RCP< Epetra_Map > buildMap(int i) const
Teuchos::RCP< Epetra_CrsMatrix > getGhostedEpetraMatrix(int i, int j) const
virtual const Teuchos::RCP< Epetra_Export > getGhostedExport(int j) const
get exporter for converting an overalapped object to a "normal" object
Teuchos::RCP< Thyra::LinearOpBase< double > > getThyraMatrix() const
Get a Thyra operator.
virtual void readVector(const std::string &identifier, LinearObjContainer &loc, int id) const
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > domainSpace_
virtual void ghostToGlobalContainer(const LinearObjContainer &ghostContainer, LinearObjContainer &container, int) const
virtual const Teuchos::RCP< Epetra_Map > buildColMap(int i) const
void globalToGhostEpetraVector(int i, const Epetra_Vector &in, Epetra_Vector &out, bool col) const
virtual Teuchos::RCP< LinearObjContainer > buildPrimitiveLinearObjContainer() const
virtual const Teuchos::RCP< Epetra_CrsGraph > buildGhostedGraph(int i, int j, bool optimizeStorage) const
virtual Teuchos::RCP< ReadOnlyVector_GlobalEvaluationData > buildDomainContainer() const
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getThyraRangeSpace() const
Get the range vector space (f)
virtual const Teuchos::RCP< Epetra_Map > getMap(int i) const
get the map from the matrix
void ghostToGlobalEpetraMatrix(int blockRow, const Epetra_CrsMatrix &in, Epetra_CrsMatrix &out) const
virtual const Teuchos::RCP< Epetra_Import > getGhostedImport(int i) const
get importer for converting an overalapped object to a "normal" object
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > rangeSpace_
virtual const Teuchos::RCP< Epetra_CrsGraph > getGhostedGraph(int i, int j) const
get the ghosted graph of the crs matrix
Teuchos::RCP< const panzer::UniqueGlobalIndexerBase > getDomainGlobalIndexer() const
Get the domain global indexer object associated with this factory.
virtual const Teuchos::RCP< Epetra_CrsGraph > buildFilteredGhostedGraph(int i, int j) const
virtual const Teuchos::RCP< Epetra_Map > getColMap(int i) const
get the map from the matrix
virtual void applyDirichletBCs(const LinearObjContainer &counter, LinearObjContainer &result) const
Teuchos::RCP< const panzer::UniqueGlobalIndexerBase > getRangeGlobalIndexer() const
Get the range global indexer object associated with this factory.
BlockedEpetraLinearObjFactory< Traits, LocalOrdinalT > EpetraLinearObjFactory
virtual Teuchos::RCP< LinearObjContainer > buildLinearObjContainer() const
Teuchos::RCP< panzer::CloneableEvaluator > buildGatherTangent() const
Use preconstructed gather evaluators.
Teuchos::RCP< const Teuchos::OpaqueWrapper< MPI_Comm > > rawMpiComm_
virtual void adjustForDirichletConditions(const LinearObjContainer &localBCRows, const LinearObjContainer &globalBCRows, LinearObjContainer &ghostedObjs, bool zeroVectorRows=false, bool adjustX=false) const
virtual const Teuchos::RCP< const Epetra_Comm > getEpetraComm() const
get exporter for converting an overalapped object to a "normal" object
Teuchos::RCP< panzer::CloneableEvaluator > buildScatterDirichlet() const
Use preconstructed dirichlet scatter evaluators.
void initializeGhostedContainer(int, LinearObjContainer &loc) const
virtual Teuchos::MpiComm< int > getComm() const
virtual const Teuchos::RCP< Epetra_Map > getGhostedMap(int i) const
get the ghosted map from the matrix
Teuchos::RCP< Epetra_CrsMatrix > getEpetraMatrix(int i, int j) const
Teuchos::RCP< panzer::CloneableEvaluator > buildScatter() const
Use preconstructed scatter evaluators.
virtual const Teuchos::RCP< Epetra_CrsGraph > buildGraph(int i, int j) const
void initializeContainer(int, LinearObjContainer &loc) const
virtual const Teuchos::RCP< Epetra_Map > buildGhostedMap(int i) const
Teuchos::RCP< panzer::CloneableEvaluator > buildGatherOrientation() const
Use preconstructed gather evaluators.
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getThyraDomainSpace() const
Get the domain vector space (x and dxdt)
Teuchos::RCP< const Teuchos::Comm< int > > comm
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 > getGraph(int i, int j) const
get the graph of the crs matrix
virtual void writeVector(const std::string &identifier, const LinearObjContainer &loc, int id) const
virtual void globalToGhostContainer(const LinearObjContainer &container, LinearObjContainer &ghostContainer, int) const
Teuchos::RCP< panzer::CloneableEvaluator > buildGatherDomain() const
Use preconstructed gather evaluators.
virtual const Teuchos::RCP< Epetra_Map > getGhostedColMap(int i) const
get the ghosted map from the matrix
virtual Teuchos::RCP< LinearObjContainer > buildPrimitiveGhostedLinearObjContainer() const
Teuchos::RCP< panzer::CloneableEvaluator > buildGather() const
Use preconstructed gather evaluators.
virtual const Teuchos::RCP< Epetra_Export > getGhostedColExport(int j) const
get exporter for converting an overalapped object to a "normal" object