11 #ifndef __Panzer_BlockedTpetraLinearObjFactory_impl_hpp__
12 #define __Panzer_BlockedTpetraLinearObjFactory_impl_hpp__
16 #ifdef PANZER_HAVE_EPETRA_STACK
23 #include "Thyra_DefaultBlockedLinearOp.hpp"
24 #include "Thyra_DefaultProductVectorSpace.hpp"
25 #include "Thyra_SpmdVectorBase.hpp"
26 #include "Thyra_TpetraLinearOp.hpp"
27 #include "Thyra_TpetraThyraWrappers.hpp"
30 #include "Tpetra_CrsMatrix.hpp"
31 #include "Tpetra_MultiVector.hpp"
32 #include "Tpetra_Vector.hpp"
42 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
46 : blockProvider_(gidProvider), blockedDOFManager_(gidProvider), comm_(comm)
48 for(std::size_t i=0;i<gidProvider->getFieldDOFManagers().size();i++)
49 gidProviders_.push_back(gidProvider->getFieldDOFManagers()[i]);
58 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
62 : gidProviders_(gidProviders), comm_(comm)
67 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
75 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
80 std::vector<Teuchos::RCP<const MapType> > blockMaps;
81 std::size_t blockDim = gidProviders_.size();
82 for(std::size_t i=0;i<blockDim;i++)
83 blockMaps.push_back(getMap(i));
86 container->setMapsForBlocks(blockMaps);
91 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
96 std::vector<Teuchos::RCP<const MapType> > blockMaps;
97 std::size_t blockDim = gidProviders_.size();
98 for(std::size_t i=0;i<blockDim;i++)
99 blockMaps.push_back(getGhostedMap(i));
102 container->setMapsForBlocks(blockMaps);
107 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
121 globalToGhostThyraVector(b_in.
get_x(),b_out.get_x());
124 globalToGhostThyraVector(b_in.
get_dxdt(),b_out.get_dxdt());
127 globalToGhostThyraVector(b_in.
get_f(),b_out.get_f());
130 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
144 ghostToGlobalThyraVector(b_in.
get_x(),b_out.get_x());
147 ghostToGlobalThyraVector(b_in.
get_f(),b_out.get_f());
150 ghostToGlobalThyraMatrix(*b_in.
get_A(),*b_out.get_A());
153 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
158 bool zeroVectorRows,
bool adjustX)
const
161 using Teuchos::rcp_dynamic_cast;
163 using Thyra::PhysicallyBlockedLinearOpBase;
167 std::size_t blockDim = gidProviders_.size();
183 if(adjustX) f = rcp_dynamic_cast<ProductVectorBase<ScalarT> >(b_ghosted.get_x());
186 if(A!=Teuchos::null)
TEUCHOS_ASSERT(A->productRange()->numBlocks()==(int) blockDim);
187 if(A!=Teuchos::null)
TEUCHOS_ASSERT(A->productDomain()->numBlocks()==(int) blockDim);
188 if(f!=Teuchos::null)
TEUCHOS_ASSERT(f->productSpace()->numBlocks()==(int) blockDim);
189 TEUCHOS_ASSERT(local_bcs->productSpace()->numBlocks()==(int) blockDim);
190 TEUCHOS_ASSERT(global_bcs->productSpace()->numBlocks()==(int) blockDim);
192 for(std::size_t i=0;i<blockDim;i++) {
195 RCP<const VectorType> t_global_bcs = rcp_dynamic_cast<
const ThyraVector>(global_bcs->getVectorBlock(i),
true)->getConstTpetraVector();
200 if(th_f==Teuchos::null)
203 t_f = rcp_dynamic_cast<ThyraVector>(th_f,
true)->getTpetraVector();
205 for(std::size_t j=0;j<blockDim;j++) {
214 if(th_A==Teuchos::null)
222 if(t_A!=Teuchos::null) {
226 adjustForDirichletConditions(*t_local_bcs,*t_global_bcs,t_f.
ptr(),t_A.
ptr(),zeroVectorRows);
228 if(t_A!=Teuchos::null) {
237 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
243 bool zeroVectorRows)
const
245 if(f==Teuchos::null && A==Teuchos::null)
253 TEUCHOS_ASSERT(local_bcs.getLocalLength()==global_bcs.getLocalLength());
254 for(std::size_t i=0;i<local_bcs.getLocalLength();i++) {
255 if(global_bcs_array[i]==0.0)
258 if(local_bcs_array[i]==0.0 || zeroVectorRows) {
265 std::size_t numEntries = 0;
266 std::size_t sz = A->getNumEntriesInLocalRow(i);
267 typename CrsMatrixType::nonconst_local_inds_host_view_type indices(
"indices", sz);
268 typename CrsMatrixType::nonconst_values_host_view_type values(
"values", sz);
270 A->getLocalRowCopy(i,indices,values,numEntries);
272 for(std::size_t c=0;c<numEntries;c++)
275 A->replaceLocalValues(i,indices,values);
281 ScalarT scaleFactor = global_bcs_array[i];
285 f_array[i] /= scaleFactor;
287 std::size_t numEntries = 0;
288 std::size_t sz = A->getNumEntriesInLocalRow(i);
289 typename CrsMatrixType::nonconst_local_inds_host_view_type indices(
"indices", sz);
290 typename CrsMatrixType::nonconst_values_host_view_type values(
"values", sz);
292 A->getLocalRowCopy(i,indices,values,numEntries);
294 for(std::size_t c=0;c<numEntries;c++)
295 values(c) /= scaleFactor;
297 A->replaceLocalValues(i,indices,values);
303 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
316 template<
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
317 typename GlobalOrdinalT,
typename NodeT>
321 buildReadOnlyDomainContainer()
const
328 LocalOrdinalT, GlobalOrdinalT, NodeT>;
329 vector<RCP<ReadOnlyVector_GlobalEvaluationData>> gedBlocks;
330 for (
int i(0); i < getBlockColCount(); ++i)
332 auto tvroged =
rcp(
new TVROGED);
333 tvroged->initialize(getGhostedImport(i), getGhostedMap(i), getMap(i));
334 gedBlocks.push_back(tvroged);
336 auto ged =
rcp(
new BVROGED);
337 ged->initialize(getGhostedThyraDomainSpace(), getThyraDomainSpace(),
342 #ifdef PANZER_HAVE_EPETRA_STACK
348 template<
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
349 typename GlobalOrdinalT,
typename NodeT>
353 buildWriteDomainContainer()
const
355 using std::logic_error;
358 auto ged =
rcp(
new EVWGED);
362 #endif // PANZER_HAVE_EPETRA_STACK
364 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
371 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
376 initializeContainer(mem,bloc);
379 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
384 initializeGhostedContainer(mem,bloc);
390 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
398 if((mem & LOC::X) == LOC::X)
399 loc.
set_x(getThyraDomainVector());
401 if((mem & LOC::DxDt) == LOC::DxDt)
402 loc.
set_dxdt(getThyraDomainVector());
404 if((mem & LOC::F) == LOC::F)
405 loc.
set_f(getThyraRangeVector());
407 if((mem & LOC::Mat) == LOC::Mat)
408 loc.
set_A(getThyraMatrix());
411 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
419 if((mem & LOC::X) == LOC::X)
420 loc.
set_x(getGhostedThyraDomainVector());
422 if((mem & LOC::DxDt) == LOC::DxDt)
423 loc.
set_dxdt(getGhostedThyraDomainVector());
425 if((mem & LOC::F) == LOC::F) {
426 loc.
set_f(getGhostedThyraRangeVector());
430 if((mem & LOC::Mat) == LOC::Mat) {
431 loc.
set_A(getGhostedThyraMatrix());
436 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
440 excludedPairs_.insert(std::make_pair(rowBlock,colBlock));
443 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
447 for(std::size_t i=0;i<exPairs.size();i++)
448 excludedPairs_.insert(exPairs[i]);
451 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
456 return gidProviders_[i];
459 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
463 maps_.resize(blockCnt);
464 ghostedMaps_.resize(blockCnt);
465 importers_.resize(blockCnt);
466 exporters_.resize(blockCnt);
472 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
477 if(domainSpace_==Teuchos::null) {
479 std::vector<Teuchos::RCP<const Thyra::VectorSpaceBase<ScalarT> > > vsArray;
480 for(std::size_t i=0;i<gidProviders_.size();i++)
481 vsArray.push_back(Thyra::createVectorSpace<ScalarT,LocalOrdinalT,GlobalOrdinalT,NodeT>(getMap(i)));
483 domainSpace_ = Thyra::productVectorSpace<ScalarT>(vsArray);
489 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
494 if(rangeSpace_==Teuchos::null) {
496 std::vector<Teuchos::RCP<const Thyra::VectorSpaceBase<ScalarT> > > vsArray;
497 for(std::size_t i=0;i<gidProviders_.size();i++)
498 vsArray.push_back(Thyra::createVectorSpace<ScalarT,LocalOrdinalT,GlobalOrdinalT,NodeT>(getMap(i)));
500 rangeSpace_ = Thyra::productVectorSpace<ScalarT>(vsArray);
506 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
511 if(domainSpace_==Teuchos::null) {
512 getThyraDomainSpace();
515 return domainSpace_->getBlock(blk);
518 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
523 if(rangeSpace_==Teuchos::null) {
524 getThyraRangeSpace();
527 return rangeSpace_->getBlock(blk);
530 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
536 Thyra::createMember<ScalarT>(*getThyraDomainSpace());
537 Thyra::assign(vec.
ptr(),0.0);
540 for(std::size_t i=0;i<gidProviders_.size();i++) {
541 TEUCHOS_ASSERT(Teuchos::rcp_dynamic_cast<Thyra::SpmdVectorBase<ScalarT> >(p_vec->getNonconstVectorBlock(i))->spmdSpace()->localSubDim()==
542 Teuchos::as<int>(getMap(i)->getLocalNumElements()));
548 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
554 Thyra::createMember<ScalarT>(*getThyraRangeSpace());
555 Thyra::assign(vec.
ptr(),0.0);
560 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
568 std::size_t blockDim = gidProviders_.size();
571 blockedOp->beginBlockFill(blockDim,blockDim);
574 for(std::size_t i=0;i<blockDim;i++) {
575 for(std::size_t j=0;j<blockDim;j++) {
576 if(excludedPairs_.find(std::make_pair(i,j))==excludedPairs_.end()) {
579 blockedOp->setNonconstBlock(i,j,block);
585 blockedOp->endBlockFill();
590 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
595 if(ghostedDomainSpace_==Teuchos::null) {
597 std::vector<Teuchos::RCP<const Thyra::VectorSpaceBase<ScalarT> > > vsArray;
598 for(std::size_t i=0;i<gidProviders_.size();i++)
599 vsArray.push_back(Thyra::createVectorSpace<ScalarT,LocalOrdinalT,GlobalOrdinalT,NodeT>(getGhostedMap(i)));
601 ghostedDomainSpace_ = Thyra::productVectorSpace<ScalarT>(vsArray);
604 return ghostedDomainSpace_;
607 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
612 if(ghostedRangeSpace_==Teuchos::null) {
614 std::vector<Teuchos::RCP<const Thyra::VectorSpaceBase<ScalarT> > > vsArray;
615 for(std::size_t i=0;i<gidProviders_.size();i++)
616 vsArray.push_back(Thyra::createVectorSpace<ScalarT,LocalOrdinalT,GlobalOrdinalT,NodeT>(getGhostedMap(i)));
618 ghostedRangeSpace_ = Thyra::productVectorSpace<ScalarT>(vsArray);
621 return ghostedRangeSpace_;
624 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
630 Thyra::createMember<ScalarT>(*getGhostedThyraDomainSpace());
631 Thyra::assign(vec.
ptr(),0.0);
636 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
642 Thyra::createMember<ScalarT>(*getGhostedThyraRangeSpace());
643 Thyra::assign(vec.
ptr(),0.0);
648 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
656 std::size_t blockDim = gidProviders_.size();
659 blockedOp->beginBlockFill(blockDim,blockDim);
662 for(std::size_t i=0;i<blockDim;i++) {
663 for(std::size_t j=0;j<blockDim;j++) {
664 if(excludedPairs_.find(std::make_pair(i,j))==excludedPairs_.end()) {
667 blockedOp->setNonconstBlock(i,j,block);
673 blockedOp->endBlockFill();
678 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
684 using Teuchos::rcp_dynamic_cast;
687 std::size_t blockDim = gidProviders_.size();
693 TEUCHOS_ASSERT(prod_in->productSpace()->numBlocks()==(int) blockDim);
694 TEUCHOS_ASSERT(prod_out->productSpace()->numBlocks()==(int) blockDim);
696 for(std::size_t i=0;i<blockDim;i++) {
699 RCP<VectorType> tp_out = rcp_dynamic_cast<ThyraVector>(prod_out->getNonconstVectorBlock(i),
true)->getTpetraVector();
702 ghostToGlobalTpetraVector(i,*tp_in,*tp_out);
706 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
711 using Teuchos::rcp_dynamic_cast;
714 using Thyra::PhysicallyBlockedLinearOpBase;
716 std::size_t blockDim = gidProviders_.size();
719 const PhysicallyBlockedLinearOpBase<ScalarT> & prod_in =
dyn_cast<
const PhysicallyBlockedLinearOpBase<ScalarT> >(in);
720 PhysicallyBlockedLinearOpBase<ScalarT> & prod_out =
dyn_cast<PhysicallyBlockedLinearOpBase<ScalarT> >(out);
722 TEUCHOS_ASSERT(prod_in.productRange()->numBlocks()==(int) blockDim);
723 TEUCHOS_ASSERT(prod_in.productDomain()->numBlocks()==(int) blockDim);
724 TEUCHOS_ASSERT(prod_out.productRange()->numBlocks()==(int) blockDim);
725 TEUCHOS_ASSERT(prod_out.productDomain()->numBlocks()==(int) blockDim);
727 for(std::size_t i=0;i<blockDim;i++) {
728 for(std::size_t j=0;j<blockDim;j++) {
729 if(excludedPairs_.find(std::make_pair(i,j))==excludedPairs_.end()) {
740 RCP<OperatorType> tp_op_out = rcp_dynamic_cast<ThyraLinearOp>(th_out,
true)->getTpetraOperator();
746 ghostToGlobalTpetraMatrix(i,*tp_in,*tp_out);
752 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
758 using Teuchos::rcp_dynamic_cast;
761 std::size_t blockDim = gidProviders_.size();
767 TEUCHOS_ASSERT(prod_in->productSpace()->numBlocks()==(int) blockDim);
768 TEUCHOS_ASSERT(prod_out->productSpace()->numBlocks()==(int) blockDim);
770 for(std::size_t i=0;i<blockDim;i++) {
773 RCP<VectorType> tp_out = rcp_dynamic_cast<ThyraVector>(prod_out->getNonconstVectorBlock(i),
true)->getTpetraVector();
776 globalToGhostTpetraVector(i,*tp_in,*tp_out);
783 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
792 out.doExport(in,*exporter,Tpetra::ADD);
795 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
808 out.setAllToScalar(0.0);
809 out.doExport(in,*exporter,Tpetra::ADD);
810 out.fillComplete(map_j,map_i);
813 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
822 out.doImport(in,*importer,Tpetra::INSERT);
826 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
831 if(maps_[i]==Teuchos::null)
832 maps_[i] = buildTpetraMap(i);
837 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
842 if(ghostedMaps_[i]==Teuchos::null)
843 ghostedMaps_[i] = buildTpetraGhostedMap(i);
845 return ghostedMaps_[i];
849 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
856 typename GraphMap::const_iterator itr = graphs_.find(std::make_pair(i,j));
857 Teuchos::RCP<const CrsGraphType> graph;
858 if(itr==graphs_.end()) {
859 graph = buildTpetraGraph(i,j);
860 graphs_[std::make_pair(i,j)] = graph;
869 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
876 typename GraphMap::const_iterator itr = ghostedGraphs_.find(std::make_pair(i,j));
877 Teuchos::RCP<const CrsGraphType> ghostedGraph;
878 if(itr==ghostedGraphs_.end()) {
879 ghostedGraph = buildTpetraGhostedGraph(i,j);
880 ghostedGraphs_[std::make_pair(i,j)] = ghostedGraph;
883 ghostedGraph = itr->second;
889 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
894 if(importers_[i]==Teuchos::null)
897 return importers_[i];
900 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
905 if(exporters_[i]==Teuchos::null)
908 return exporters_[i];
911 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
916 std::vector<GlobalOrdinalT> indices;
919 getGlobalIndexer(i)->getOwnedIndices(indices);
925 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
930 std::vector<GlobalOrdinalT> indices;
933 getGlobalIndexer(i)->getOwnedAndGhostedIndices(indices);
939 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
957 graph->doExport( *oGraph, *exporter, Tpetra::INSERT );
958 graph->fillComplete(map_j,map_i);
963 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
976 std::vector<std::string> elementBlockIds;
980 rowProvider = getGlobalIndexer(i);
981 colProvider = getGlobalIndexer(j);
983 gidProviders_[0]->getElementBlockIds(elementBlockIds);
987 std::vector<size_t> nEntriesPerRow(map_i->getLocalNumElements(), 0);
988 std::vector<std::string>::const_iterator blockItr;
989 for(blockItr=elementBlockIds.begin();blockItr!=elementBlockIds.end();++blockItr) {
990 std::string blockId = *blockItr;
992 const std::vector<LocalOrdinalT> & elements = gidProviders_[0]->getElementBlock(blockId);
996 std::vector<GlobalOrdinalT> row_gids;
997 std::vector<GlobalOrdinalT> col_gids;
1000 for(std::size_t elmt=0;elmt<elements.size();elmt++) {
1004 for(std::size_t row=0;row<row_gids.size();row++) {
1005 LocalOrdinalT lid = map_i->getLocalElement(row_gids[row]);
1006 nEntriesPerRow[lid] += col_gids.size();
1016 for(blockItr=elementBlockIds.begin();blockItr!=elementBlockIds.end();++blockItr) {
1017 std::string blockId = *blockItr;
1020 const std::vector<LocalOrdinalT> & elements = gidProviders_[0]->getElementBlock(blockId);
1024 std::vector<GlobalOrdinalT> row_gids;
1025 std::vector<GlobalOrdinalT> col_gids;
1028 for(std::size_t elmt=0;elmt<elements.size();elmt++) {
1032 for(std::size_t row=0;row<row_gids.size();row++)
1033 graph->insertGlobalIndices(row_gids[row],col_gids);
1039 graph->fillComplete(getMap(j),getMap(i));
1044 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
1054 mat->fillComplete(map_j,map_i);
1059 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
1069 mat->fillComplete(getMap(j),getMap(i));
1074 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
1083 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
1092 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
1101 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
1110 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
1115 return gidProviders_.size();
1118 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
1123 return gidProviders_.size();
1126 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
1131 if(tloc.
get_A()!=Teuchos::null)
1135 template <
typename Traits,
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
1140 if(tloc.
get_A()!=Teuchos::null)
1146 #endif // __Panzer_BlockedTpetraLinearObjFactory_impl_hpp__
void initializeContainer(int, LinearObjContainer &loc) const
Teuchos::RCP< CrsMatrixType > getTpetraMatrix(int i, int j) const
Thyra::TpetraVector< ScalarT, LocalOrdinalT, GlobalOrdinalT, NodeT > ThyraVector
Teuchos::RCP< VectorType > get_dxdt() const
bool is_null(const boost::shared_ptr< T > &p)
Teuchos::RCP< VectorType > get_x() const
virtual ~BlockedTpetraLinearObjFactory()
virtual Teuchos::RCP< const ExportType > getGhostedExport(int j) const
get exporter for converting an overalapped object to a "normal" object
Thyra::TpetraLinearOp< ScalarT, LocalOrdinalT, GlobalOrdinalT, NodeT > ThyraLinearOp
void set_dxdt(const Teuchos::RCP< VectorType > &in)
virtual void adjustForDirichletConditions(const LinearObjContainer &localBCRows, const LinearObjContainer &globalBCRows, LinearObjContainer &ghostedObjs, bool zeroVectorRows=false, bool adjustX=false) const
bool is_null(const std::shared_ptr< T > &p)
Teuchos::RCP< VectorType > getTpetraDomainVector(int i) const
void initializeGhostedContainer(int, LinearObjContainer &loc) const
virtual void ghostToGlobalContainer(const LinearObjContainer &ghostContainer, LinearObjContainer &container, int) const
Teuchos::RCP< Thyra::VectorBase< ScalarT > > getThyraDomainVector() const
Get a domain vector.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
std::vector< Teuchos::RCP< const GlobalIndexer > > gidProviders_
Teuchos::RCP< Thyra::VectorBase< ScalarT > > getGhostedThyraDomainVector() const
Get a domain vector.
T_To & dyn_cast(T_From &from)
Tpetra::Import< LocalOrdinalT, GlobalOrdinalT, NodeT > ImportType
Teuchos::RCP< VectorType > getGhostedTpetraRangeVector(int i) const
virtual Teuchos::RCP< LinearObjContainer > buildLinearObjContainer() const
Teuchos::RCP< const panzer::BlockedDOFManager > getGlobalIndexer() const
Teuchos::RCP< Thyra::VectorBase< ScalarT > > getGhostedThyraRangeVector() const
Get a range vector.
void globalToGhostThyraVector(const Teuchos::RCP< const Thyra::VectorBase< ScalarT > > &in, const Teuchos::RCP< Thyra::VectorBase< ScalarT > > &out) const
virtual void applyDirichletBCs(const LinearObjContainer &counter, LinearObjContainer &result) const
virtual Teuchos::RCP< const ImportType > getGhostedImport(int i) const
get importer for converting an overalapped object to a "normal" object
Teuchos::RCP< const Thyra::VectorSpaceBase< ScalarT > > getThyraRangeSpace() const
Get the range vector space (f)
Tpetra::CrsGraph< LocalOrdinalT, GlobalOrdinalT, NodeT > CrsGraphType
This class encapsulates the needs of a gather operation to do a halo exchange for blocked vectors...
Teuchos::RCP< const Thyra::VectorSpaceBase< ScalarT > > getGhostedThyraDomainSpace() const
Get the domain vector space (x and dxdt)
void ghostToGlobalTpetraMatrix(int blockRow, const CrsMatrixType &in, CrsMatrixType &out) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Tpetra::Export< LocalOrdinalT, GlobalOrdinalT, NodeT > ExportType
virtual Teuchos::RCP< const MapType > buildTpetraMap(int i) const
void globalToGhostTpetraVector(int i, const VectorType &in, VectorType &out) const
virtual Teuchos::RCP< const MapType > buildTpetraGhostedMap(int i) const
BlockedTpetraLinearObjFactory(const Teuchos::RCP< const Teuchos::MpiComm< int > > &comm, const Teuchos::RCP< const BlockedDOFManager > &gidProvider)
void setRequiresDirichletAdjustment(bool b)
void ghostToGlobalThyraMatrix(const Thyra::LinearOpBase< ScalarT > &in, Thyra::LinearOpBase< ScalarT > &out) const
virtual Teuchos::RCP< LinearObjContainer > buildGhostedLinearObjContainer() const
Teuchos::RCP< Thyra::BlockedLinearOpBase< ScalarT > > getGhostedThyraMatrix() const
Get a Thyra operator.
int getBlockColCount() const
how many block columns
void makeRoomForBlocks(std::size_t blockCnt)
Allocate the space in the std::vector objects so we can fill with appropriate Tpetra data...
virtual Teuchos::RCP< const MapType > getGhostedMap(int i) const
get the ghosted map from the matrix
Teuchos::RCP< VectorType > getGhostedTpetraDomainVector(int i) const
Tpetra::Vector< ScalarT, LocalOrdinalT, GlobalOrdinalT, NodeT > VectorType
This class provides a boundary exchange communication mechanism for vectors.
Teuchos::RCP< VectorType > getTpetraRangeVector(int i) const
void ghostToGlobalThyraVector(const Teuchos::RCP< const Thyra::VectorBase< ScalarT > > &in, const Teuchos::RCP< Thyra::VectorBase< ScalarT > > &out) const
virtual Teuchos::RCP< const MapType > getMap(int i) const
get the map from the matrix
Tpetra::CrsMatrix< ScalarT, LocalOrdinalT, GlobalOrdinalT, NodeT > CrsMatrixType
virtual void endFill(LinearObjContainer &loc) const
void addExcludedPairs(const std::vector< std::pair< int, int > > &exPairs)
exclude a vector of pairs from the matrix
Teuchos::RCP< const Thyra::VectorSpaceBase< ScalarT > > getGhostedThyraRangeSpace() const
Get the range vector space (f)
virtual Teuchos::RCP< const CrsGraphType > getGraph(int i, int j) const
get the graph of the crs matrix
virtual Teuchos::RCP< const CrsGraphType > getGhostedGraph(int i, int j) const
get the ghosted graph of the crs matrix
void addExcludedPair(int rowBlock, int colBlock)
exclude a block pair from the matrix
Teuchos::MpiComm< int > getComm() const
virtual Teuchos::RCP< const CrsGraphType > buildTpetraGraph(int i, int j) const
virtual void beginFill(LinearObjContainer &loc) const
void set_x(const Teuchos::RCP< VectorType > &in)
virtual Teuchos::RCP< const CrsGraphType > buildTpetraGhostedGraph(int i, int j) const
virtual void globalToGhostContainer(const LinearObjContainer &container, LinearObjContainer &ghostContainer, int) const
Teuchos::RCP< VectorType > get_f() const
int getBlockRowCount() const
how many block rows
Teuchos::RCP< CrsMatrixType > getGhostedTpetraMatrix(int i, int j) const
virtual void getElementGIDs(panzer::LocalOrdinal localElmtId, std::vector< panzer::GlobalOrdinal > &gids, const std::string &blockIdHint="") const =0
Get the global IDs for a particular element. This function overwrites the gids variable.
void ghostToGlobalTpetraVector(int i, const VectorType &in, VectorType &out) const
void buildGatherScatterEvaluators(const BuilderT &builder)
Teuchos::RCP< Thyra::VectorBase< ScalarT > > getThyraRangeVector() const
Get a range vector.
#define TEUCHOS_ASSERT(assertion_test)
Teuchos::RCP< CrsMatrixType > get_A() const
void set_f(const Teuchos::RCP< VectorType > &in)
Tpetra::Map< LocalOrdinalT, GlobalOrdinalT, NodeT > MapType
Teuchos::RCP< const Thyra::VectorSpaceBase< ScalarT > > getThyraDomainSpace() const
Get the domain vector space (x and dxdt)
Teuchos::RCP< Thyra::LinearOpBase< ScalarT > > getThyraMatrix() const
Get a Thyra operator.
void set_A(const Teuchos::RCP< CrsMatrixType > &in)