11#ifndef __Panzer_BlockedEpetraLinearObjFactory_impl_hpp__
12#define __Panzer_BlockedEpetraLinearObjFactory_impl_hpp__
16#include "Epetra_CrsMatrix.h"
17#include "Epetra_MpiComm.h"
18#include "Epetra_MultiVector.h"
19#include "Epetra_Vector.h"
35#include "Thyra_DefaultBlockedLinearOp.hpp"
36#include "Thyra_DefaultProductVector.hpp"
37#include "Thyra_DefaultProductVectorSpace.hpp"
38#include "Thyra_EpetraLinearOp.hpp"
39#include "Thyra_EpetraThyraWrappers.hpp"
40#include "Thyra_get_Epetra_Operator.hpp"
41#include "Thyra_SpmdVectorBase.hpp"
42#include "Thyra_VectorStdOps.hpp"
52template <
typename Traits,
typename LocalOrdinalT>
55 const Teuchos::RCP<const GlobalIndexer> & gidProvider,
56 bool useDiscreteAdjoint)
57 : useColGidProviders_(false), eComm_(
Teuchos::null)
58 , rawMpiComm_(comm->getRawMpiComm())
59 , useDiscreteAdjoint_(useDiscreteAdjoint)
75template <
typename Traits,
typename LocalOrdinalT>
78 const Teuchos::RCP<const GlobalIndexer> & gidProvider,
79 const Teuchos::RCP<const GlobalIndexer> & colGidProvider,
80 bool useDiscreteAdjoint)
82 , rawMpiComm_(comm->getRawMpiComm())
83 , useDiscreteAdjoint_(useDiscreteAdjoint)
101template <
typename Traits,
typename LocalOrdinalT>
108template <
typename Traits,
typename LocalOrdinalT>
114 using Teuchos::rcp_dynamic_cast;
115 using Teuchos::dyn_cast;
121 RCP<Thyra::VectorBase<double> > vec;
133 TEUCHOS_ASSERT(
false);
137 int blockRows = this->getBlockRowCount();
138 RCP<ProductVectorBase<double> > b_vec = Thyra::nonconstProductVectorBase(vec);
141 for(
int i=0;i<blockRows;i++) {
142 RCP<Thyra::VectorBase<double> > x = b_vec->getNonconstVectorBlock(i);
143 RCP<Epetra_Vector> ex = Thyra::get_Epetra_Vector(*getMap(i),x);
146 std::stringstream ss;
147 ss << identifier <<
"-" << i <<
".mm";
158template <
typename Traits,
typename LocalOrdinalT>
164 using Teuchos::rcp_dynamic_cast;
165 using Teuchos::dyn_cast;
171 RCP<const Thyra::VectorBase<double> > vec;
183 TEUCHOS_ASSERT(
false);
187 int blockRows = this->getBlockRowCount();
188 RCP<const ProductVectorBase<double> > b_vec = Thyra::productVectorBase(vec);
191 for(
int i=0;i<blockRows;i++) {
192 RCP<const Thyra::VectorBase<double> > x = b_vec->getVectorBlock(i);
193 RCP<const Epetra_Vector> ex = Thyra::get_Epetra_Vector(*getMap(i),x);
196 std::stringstream ss;
197 ss << identifier <<
"-" << i <<
".mm";
204template <
typename Traits,
typename LocalOrdinalT>
208 if(!rowDOFManagerContainer_->containsBlockedDOFManager() && !colDOFManagerContainer_->containsBlockedDOFManager()) {
209 Teuchos::RCP<EpetraLinearObjContainer> container = Teuchos::rcp(
new EpetraLinearObjContainer(getColMap(0),getMap(0)));
214 std::vector<Teuchos::RCP<const Epetra_Map> > blockMaps;
215 std::size_t blockDim = getBlockRowCount();
216 for(std::size_t i=0;i<blockDim;i++)
217 blockMaps.push_back(getMap(i));
220 container->setMapsForBlocks(blockMaps);
225template <
typename Traits,
typename LocalOrdinalT>
229 if(!rowDOFManagerContainer_->containsBlockedDOFManager() && !colDOFManagerContainer_->containsBlockedDOFManager()) {
230 Teuchos::RCP<EpetraLinearObjContainer> container = Teuchos::rcp(
new EpetraLinearObjContainer(getGhostedColMap(0),getGhostedMap(0)));
235 std::vector<Teuchos::RCP<const Epetra_Map> > blockMaps;
236 std::size_t blockDim = getBlockRowCount();
237 for(std::size_t i=0;i<blockDim;i++)
238 blockMaps.push_back(getGhostedMap(i));
241 container->setMapsForBlocks(blockMaps);
246template <
typename Traits,
typename LocalOrdinalT>
250 using Teuchos::is_null;
255 if( !rowDOFManagerContainer_->containsBlockedDOFManager()
256 && !colDOFManagerContainer_->containsBlockedDOFManager()) {
262 if ( !is_null(e_in.
get_x()) && !is_null(e_out.
get_x()) && ((mem & LOC::X)==LOC::X))
263 globalToGhostEpetraVector(0,*e_in.
get_x(),*e_out.
get_x(),
true);
265 if ( !is_null(e_in.
get_dxdt()) && !is_null(e_out.
get_dxdt()) && ((mem & LOC::DxDt)==LOC::DxDt))
268 if ( !is_null(e_in.
get_f()) && !is_null(e_out.
get_f()) && ((mem & LOC::F)==LOC::F))
269 globalToGhostEpetraVector(0,*e_in.
get_f(),*e_out.
get_f(),
false);
272 const BLOC & b_in = Teuchos::dyn_cast<const BLOC>(in);
273 BLOC & b_out = Teuchos::dyn_cast<BLOC>(out);
277 if ( !is_null(b_in.get_x()) && !is_null(b_out.get_x()) && ((mem & LOC::X)==LOC::X))
278 globalToGhostThyraVector(b_in.get_x(),b_out.get_x(),
true);
280 if ( !is_null(b_in.get_dxdt()) && !is_null(b_out.get_dxdt()) && ((mem & LOC::DxDt)==LOC::DxDt))
281 globalToGhostThyraVector(b_in.get_dxdt(),b_out.get_dxdt(),
true);
283 if ( !is_null(b_in.get_f()) && !is_null(b_out.get_f()) && ((mem & LOC::F)==LOC::F))
284 globalToGhostThyraVector(b_in.get_f(),b_out.get_f(),
false);
288template <
typename Traits,
typename LocalOrdinalT>
292 using Teuchos::is_null;
297 if( !rowDOFManagerContainer_->containsBlockedDOFManager()
298 && !colDOFManagerContainer_->containsBlockedDOFManager()) {
304 if ( !is_null(e_in.
get_x()) && !is_null(e_out.
get_x()) && ((mem & LOC::X)==LOC::X))
305 ghostToGlobalEpetraVector(0,*e_in.
get_x(),*e_out.
get_x(),
true);
307 if ( !is_null(e_in.
get_f()) && !is_null(e_out.
get_f()) && ((mem & LOC::F)==LOC::F))
308 ghostToGlobalEpetraVector(0,*e_in.
get_f(),*e_out.
get_f(),
false);
310 if ( !is_null(e_in.
get_A()) && !is_null(e_out.
get_A()) && ((mem & LOC::Mat)==LOC::Mat))
311 ghostToGlobalEpetraMatrix(0,*e_in.
get_A(),*e_out.
get_A());
314 const BLOC & b_in = Teuchos::dyn_cast<const BLOC>(in);
315 BLOC & b_out = Teuchos::dyn_cast<BLOC>(out);
319 if ( !is_null(b_in.get_x()) && !is_null(b_out.get_x()) && ((mem & LOC::X)==LOC::X))
320 ghostToGlobalThyraVector(b_in.get_x(),b_out.get_x(),
true);
322 if ( !is_null(b_in.get_f()) && !is_null(b_out.get_f()) && ((mem & LOC::F)==LOC::F))
323 ghostToGlobalThyraVector(b_in.get_f(),b_out.get_f(),
false);
325 if ( !is_null(b_in.get_A()) && !is_null(b_out.get_A()) && ((mem & LOC::Mat)==LOC::Mat))
326 ghostToGlobalThyraMatrix(*b_in.get_A(),*b_out.get_A());
330template <
typename Traits,
typename LocalOrdinalT>
335 bool zeroVectorRows,
bool adjustX)
const
340 using Teuchos::rcp_dynamic_cast;
342 using Thyra::PhysicallyBlockedLinearOpBase;
345 using Thyra::get_Epetra_Vector;
346 using Thyra::get_Epetra_Operator;
348 int rBlockDim = getBlockRowCount();
349 int cBlockDim = getBlockColCount();
352 const TOC & b_localBCRows = Teuchos::dyn_cast<const TOC>(localBCRows);
353 const TOC & b_globalBCRows = Teuchos::dyn_cast<const TOC>(globalBCRows);
354 TOC & b_ghosted = Teuchos::dyn_cast<TOC>(ghostedObjs);
356 TEUCHOS_ASSERT(b_localBCRows.get_f_th()!=Teuchos::null);
357 TEUCHOS_ASSERT(b_globalBCRows.get_f_th()!=Teuchos::null);
360 RCP<PhysicallyBlockedLinearOpBase<double> > A = rcp_dynamic_cast<PhysicallyBlockedLinearOpBase<double> >(b_ghosted.get_A_th());
361 if(A==Teuchos::null && b_ghosted.get_A_th()!=Teuchos::null) {
363 A = rcp_dynamic_cast<PhysicallyBlockedLinearOpBase<double> >(Thyra::nonconstBlock1x1(b_ghosted.get_A_th()));
366 RCP<ProductVectorBase<double> > f = b_ghosted.get_f_th()==Teuchos::null
368 : Thyra::castOrCreateNonconstProductVectorBase(b_ghosted.get_f_th());
369 RCP<ProductVectorBase<double> > local_bcs = b_localBCRows.get_f_th()==Teuchos::null
371 : Thyra::castOrCreateNonconstProductVectorBase(b_localBCRows.get_f_th());
372 RCP<ProductVectorBase<double> > global_bcs = b_globalBCRows.get_f_th()==Teuchos::null
374 : Thyra::castOrCreateNonconstProductVectorBase(b_globalBCRows.get_f_th());
376 if(adjustX) f = Thyra::castOrCreateNonconstProductVectorBase(b_ghosted.get_x_th());
379 if(A!=Teuchos::null) TEUCHOS_ASSERT(A->productRange()->numBlocks()==rBlockDim);
380 if(A!=Teuchos::null) TEUCHOS_ASSERT(A->productDomain()->numBlocks()==cBlockDim);
381 if(f!=Teuchos::null) TEUCHOS_ASSERT(f->productSpace()->numBlocks()==rBlockDim);
382 TEUCHOS_ASSERT(local_bcs->productSpace()->numBlocks()==rBlockDim);
383 TEUCHOS_ASSERT(global_bcs->productSpace()->numBlocks()==rBlockDim);
385 for(
int i=0;i<rBlockDim;i++) {
387 RCP<const Epetra_Vector> e_local_bcs = get_Epetra_Vector(*getGhostedMap(i),local_bcs->getVectorBlock(i));
388 RCP<const Epetra_Vector> e_global_bcs = get_Epetra_Vector(*getGhostedMap(i),global_bcs->getVectorBlock(i));
391 RCP<VectorBase<double> > th_f = (f==Teuchos::null) ? Teuchos::null : f->getNonconstVectorBlock(i);
392 RCP<Epetra_Vector> e_f;
393 if(th_f==Teuchos::null)
396 e_f = get_Epetra_Vector(*getGhostedMap(i),th_f);
398 for(
int j=0;j<cBlockDim;j++) {
401 RCP<LinearOpBase<double> > th_A = (A== Teuchos::null)? Teuchos::null : A->getNonconstBlock(i,j);
404 RCP<Epetra_CrsMatrix> e_A;
405 if(th_A==Teuchos::null)
408 e_A = rcp_dynamic_cast<Epetra_CrsMatrix>(get_Epetra_Operator(*th_A),
true);
411 adjustForDirichletConditions(*e_local_bcs,*e_global_bcs,e_f.ptr(),e_A.ptr(),zeroVectorRows);
418template <
typename Traits,
typename LocalOrdinalT>
422 const Teuchos::Ptr<Epetra_Vector> & f,
423 const Teuchos::Ptr<Epetra_CrsMatrix> & A,
424 bool zeroVectorRows)
const
426 if(f==Teuchos::null && A==Teuchos::null)
430 for(
int i=0;i<local_bcs.
MyLength();i++) {
431 if(global_bcs[i]==0.0)
438 if(local_bcs[i]==0.0 || zeroVectorRows) {
442 if(!Teuchos::is_null(f))
444 if(!Teuchos::is_null(A)) {
445 A->ExtractMyRowView(i,numEntries,values,indices);
446 for(
int c=0;c<numEntries;c++)
453 double scaleFactor = global_bcs[i];
456 if(!Teuchos::is_null(f))
457 (*f)[i] /= scaleFactor;
458 if(!Teuchos::is_null(A)) {
459 A->ExtractMyRowView(i,numEntries,values,indices);
460 for(
int c=0;c<numEntries;c++)
461 values[c] /= scaleFactor;
467template <
typename Traits,
typename LocalOrdinalT>
473 using Teuchos::rcp_dynamic_cast;
474 using Teuchos::dyn_cast;
481 RCP<const PVector> count = Thyra::castOrCreateProductVectorBase(th_counter.
get_f_th().getConst());
482 RCP<const PVector> f_in = Thyra::castOrCreateProductVectorBase(th_counter.
get_f_th().getConst());
483 RCP<PVector> f_out = Thyra::castOrCreateNonconstProductVectorBase(th_result.get_f_th());
485 int rBlockDim = getBlockRowCount();
486 for(
int i=0;i<rBlockDim;i++) {
488 Teuchos::ArrayRCP<const double> count_array,f_in_array;
489 Teuchos::ArrayRCP<double> f_out_array;
491 rcp_dynamic_cast<const Thyra::SpmdVectorBase<double> >(count->getVectorBlock(i),
true)->getLocalData(Teuchos::ptrFromRef(count_array));
492 rcp_dynamic_cast<const Thyra::SpmdVectorBase<double> >(f_in->getVectorBlock(i),
true)->getLocalData(Teuchos::ptrFromRef(f_in_array));
493 rcp_dynamic_cast<Thyra::SpmdVectorBase<double> >(f_out->getNonconstVectorBlock(i),
true)->getNonconstLocalData(Teuchos::ptrFromRef(f_out_array));
495 TEUCHOS_ASSERT(count_array.size()==f_in_array.size());
496 TEUCHOS_ASSERT(count_array.size()==f_out_array.size());
498 for(Teuchos::ArrayRCP<double>::size_type j=0;j<count_array.size();++j) {
499 if(count_array[j]!=0.0)
500 f_out_array[j] = f_in_array[j];
510template<
typename Traits,
typename LocalOrdinalT>
511Teuchos::RCP<ReadOnlyVector_GlobalEvaluationData>
524 if (not colDOFManagerContainer_->containsBlockedDOFManager())
526 auto ged = rcp(
new EVROGED);
527 ged->initialize(getGhostedColImport2(0), getGhostedColMap2(0),
533 vector<RCP<ROVGED>> gedBlocks;
534 for (
int i(0); i < getBlockColCount(); ++i)
536 auto vecGed = rcp(
new EVROGED);
537 vecGed->initialize(getGhostedColImport2(i), getGhostedColMap2(i),
539 gedBlocks.push_back(vecGed);
541 auto ged = rcp(
new BVROGED);
542 ged->initialize(getGhostedThyraDomainSpace2(), getThyraDomainSpace(),
552template<
typename Traits,
typename LocalOrdinalT>
553Teuchos::RCP<WriteVector_GlobalEvaluationData>
566 if (not colDOFManagerContainer_->containsBlockedDOFManager())
568 auto ged = rcp(
new EVWGED);
569 ged->initialize(getGhostedColExport2(0), getGhostedColMap2(0),
575 vector<RCP<WVGED>> gedBlocks;
576 for (
int i(0); i < getBlockColCount(); ++i)
578 auto vecGed = rcp(
new EVWGED);
579 vecGed->initialize(getGhostedColExport2(i), getGhostedColMap2(i),
581 gedBlocks.push_back(vecGed);
583 auto ged = rcp(
new BVWGED);
584 ged->initialize(getGhostedThyraDomainSpace2(), getThyraDomainSpace(),
589template <
typename Traits,
typename LocalOrdinalT>
596template <
typename Traits,
typename LocalOrdinalT>
602 TOC & toc = Teuchos::dyn_cast<TOC>(loc);
603 initializeContainer_internal(mem,toc);
606template <
typename Traits,
typename LocalOrdinalT>
613 TOC & toc = Teuchos::dyn_cast<TOC>(loc);
614 initializeGhostedContainer_internal(mem,toc);
616 if(rowDOFManagerContainer_->containsBlockedDOFManager()) {
619 BLOC & bloc = Teuchos::dyn_cast<BLOC>(loc);
621 if((mem & LOC::F) == LOC::F)
622 bloc.setRequiresDirichletAdjustment(
true);
624 if((mem & LOC::Mat) == LOC::Mat)
625 bloc.setRequiresDirichletAdjustment(
true);
630 if((mem & LOC::F) == LOC::F)
633 if((mem & LOC::Mat) == LOC::Mat)
641template <
typename Traits,
typename LocalOrdinalT>
649 if((mem & LOC::X) == LOC::X)
650 loc.
set_x_th(getThyraDomainVector());
652 if((mem & LOC::DxDt) == LOC::DxDt)
655 if((mem & LOC::F) == LOC::F)
656 loc.
set_f_th(getThyraRangeVector());
658 if((mem & LOC::Mat) == LOC::Mat)
662template <
typename Traits,
typename LocalOrdinalT>
670 if((mem & LOC::X) == LOC::X)
671 loc.
set_x_th(getGhostedThyraDomainVector());
673 if((mem & LOC::DxDt) == LOC::DxDt)
676 if((mem & LOC::F) == LOC::F)
677 loc.
set_f_th(getGhostedThyraRangeVector());
679 if((mem & LOC::Mat) == LOC::Mat)
680 loc.
set_A_th(getGhostedThyraMatrix());
683template <
typename Traits,
typename LocalOrdinalT>
687 excludedPairs_.insert(std::make_pair(rowBlock,colBlock));
690template <
typename Traits,
typename LocalOrdinalT>
694 for(std::size_t i=0;i<exPairs.size();i++)
695 excludedPairs_.insert(exPairs[i]);
698template <
typename Traits,
typename LocalOrdinalT>
702 return rowDOFManagerContainer_->getFieldDOFManagers()[i];
705template <
typename Traits,
typename LocalOrdinalT>
709 return colDOFManagerContainer_->getFieldDOFManagers()[i];
717template<
typename Traits,
typename LocalOrdinalT>
721 std::size_t blockCnt,
722 std::size_t colBlockCnt)
724 maps_.resize(blockCnt);
725 ghostedMaps_.resize(blockCnt);
726 ghostedMaps2_.resize(blockCnt);
727 importers_.resize(blockCnt);
728 importers2_.resize(blockCnt);
729 exporters_.resize(blockCnt);
732 colMaps_.resize(colBlockCnt);
733 colGhostedMaps_.resize(colBlockCnt);
734 colGhostedMaps2_.resize(colBlockCnt);
735 colImporters_.resize(colBlockCnt);
736 colImporters2_.resize(colBlockCnt);
737 colExporters_.resize(colBlockCnt);
744template <
typename Traits,
typename LocalOrdinalT>
748 if(domainSpace_==Teuchos::null) {
749 if(colDOFManagerContainer_->containsBlockedDOFManager()) {
751 std::vector<Teuchos::RCP<const Thyra::VectorSpaceBase<double> > > vsArray;
752 for(
int i=0;i<getBlockColCount();i++)
753 vsArray.push_back(Thyra::create_VectorSpace(getColMap(i)));
755 domainSpace_ = Thyra::productVectorSpace<double>(vsArray);
760 domainSpace_ = Thyra::create_VectorSpace(getColMap(0));
767template <
typename Traits,
typename LocalOrdinalT>
771 if(rangeSpace_==Teuchos::null) {
772 if(rowDOFManagerContainer_->containsBlockedDOFManager()) {
774 std::vector<Teuchos::RCP<const Thyra::VectorSpaceBase<double> > > vsArray;
775 for(
int i=0;i<getBlockRowCount();i++)
776 vsArray.push_back(Thyra::create_VectorSpace(getMap(i)));
778 rangeSpace_ = Thyra::productVectorSpace<double>(vsArray);
783 rangeSpace_ = Thyra::create_VectorSpace(getMap(0));
790template <
typename Traits,
typename LocalOrdinalT>
794 Teuchos::RCP<Thyra::VectorBase<double> > vec =
795 Thyra::createMember<double>(*getThyraDomainSpace());
796 Thyra::assign(vec.ptr(),0.0);
801template <
typename Traits,
typename LocalOrdinalT>
805 Teuchos::RCP<Thyra::VectorBase<double> > vec =
806 Thyra::createMember<double>(*getThyraRangeSpace());
807 Thyra::assign(vec.ptr(),0.0);
812template <
typename Traits,
typename LocalOrdinalT>
817 if(!rowDOFManagerContainer_->containsBlockedDOFManager() &&
818 !colDOFManagerContainer_->containsBlockedDOFManager()) {
819 return Thyra::nonconstEpetraLinearOp(getEpetraMatrix(0,0));
822 Teuchos::RCP<Thyra::PhysicallyBlockedLinearOpBase<double> > blockedOp = Thyra::defaultBlockedLinearOp<double>();
825 std::size_t rBlockDim = getBlockRowCount();
826 std::size_t cBlockDim = getBlockColCount();
829 blockedOp->beginBlockFill(rBlockDim,cBlockDim);
832 for(std::size_t i=0;i<rBlockDim;i++) {
833 for(std::size_t j=0;j<cBlockDim;j++) {
834 if(excludedPairs_.find(std::make_pair(i,j))==excludedPairs_.end()) {
836 Teuchos::RCP<Thyra::LinearOpBase<double> > block = Thyra::nonconstEpetraLinearOp(getEpetraMatrix(i,j));
837 blockedOp->setNonconstBlock(i,j,block);
843 blockedOp->endBlockFill();
853template<
typename Traits,
typename LocalOrdinalT>
854Teuchos::RCP<const Thyra::VectorSpaceBase<double>>
860 using Thyra::create_VectorSpace;
861 using Thyra::productVectorSpace;
863 if (ghostedDomainSpace_.is_null())
865 if (colDOFManagerContainer_->containsBlockedDOFManager())
868 vector<RCP<const VectorSpaceBase<double>>> vsArray;
869 for (
int i(0); i < getBlockColCount(); ++i)
870 vsArray.push_back(create_VectorSpace(getGhostedColMap(i)));
871 ghostedDomainSpace_ = productVectorSpace<double>(vsArray);
877 ghostedDomainSpace_ = create_VectorSpace(getGhostedColMap(0));
880 return ghostedDomainSpace_;
888template<
typename Traits,
typename LocalOrdinalT>
889Teuchos::RCP<const Thyra::VectorSpaceBase<double>>
895 using Thyra::create_VectorSpace;
896 using Thyra::productVectorSpace;
898 if (ghostedDomainSpace_.is_null())
900 if (colDOFManagerContainer_->containsBlockedDOFManager())
903 vector<RCP<const VectorSpaceBase<double>>> vsArray;
904 for (
int i(0); i < getBlockColCount(); ++i)
905 vsArray.push_back(create_VectorSpace(getGhostedColMap2(i)));
906 ghostedDomainSpace_ = productVectorSpace<double>(vsArray);
912 ghostedDomainSpace_ = create_VectorSpace(getGhostedColMap2(0));
915 return ghostedDomainSpace_;
918template <
typename Traits,
typename LocalOrdinalT>
922 if(ghostedRangeSpace_==Teuchos::null) {
923 if(rowDOFManagerContainer_->containsBlockedDOFManager()) {
925 std::vector<Teuchos::RCP<const Thyra::VectorSpaceBase<double> > > vsArray;
926 for(
int i=0;i<getBlockRowCount();i++)
927 vsArray.push_back(Thyra::create_VectorSpace(getGhostedMap(i)));
929 ghostedRangeSpace_ = Thyra::productVectorSpace<double>(vsArray);
934 ghostedRangeSpace_ = Thyra::create_VectorSpace(getGhostedMap(0));
938 return ghostedRangeSpace_;
941template <
typename Traits,
typename LocalOrdinalT>
945 Teuchos::RCP<Thyra::VectorBase<double> > vec =
946 Thyra::createMember<double>(*getGhostedThyraDomainSpace());
947 Thyra::assign(vec.ptr(),0.0);
952template <
typename Traits,
typename LocalOrdinalT>
956 Teuchos::RCP<Thyra::VectorBase<double> > vec =
957 Thyra::createMember<double>(*getGhostedThyraRangeSpace());
958 Thyra::assign(vec.ptr(),0.0);
963template <
typename Traits,
typename LocalOrdinalT>
968 if(!rowDOFManagerContainer_->containsBlockedDOFManager() &&
969 !colDOFManagerContainer_->containsBlockedDOFManager()) {
970 return Thyra::nonconstEpetraLinearOp(getGhostedEpetraMatrix(0,0));
973 Teuchos::RCP<Thyra::PhysicallyBlockedLinearOpBase<double> > blockedOp = Thyra::defaultBlockedLinearOp<double>();
976 std::size_t rBlockDim = getBlockRowCount();
977 std::size_t cBlockDim = getBlockColCount();
980 blockedOp->beginBlockFill(rBlockDim,cBlockDim);
983 for(std::size_t i=0;i<rBlockDim;i++) {
984 for(std::size_t j=0;j<cBlockDim;j++) {
985 if(excludedPairs_.find(std::make_pair(i,j))==excludedPairs_.end()) {
987 Teuchos::RCP<Thyra::LinearOpBase<double> > block = Thyra::nonconstEpetraLinearOp(getGhostedEpetraMatrix(i,j));
988 blockedOp->setNonconstBlock(i,j,block);
994 blockedOp->endBlockFill();
999template <
typename Traits,
typename LocalOrdinalT>
1005 using Teuchos::rcp_dynamic_cast;
1007 using Thyra::get_Epetra_Vector;
1009 std::size_t blockDim = col ? getBlockColCount() : getBlockRowCount();
1012 RCP<const ProductVectorBase<double> > prod_in = Thyra::castOrCreateProductVectorBase(in);
1013 RCP<ProductVectorBase<double> > prod_out = Thyra::castOrCreateNonconstProductVectorBase(out);
1015 TEUCHOS_ASSERT(prod_in->productSpace()->numBlocks()==(
int) blockDim);
1016 TEUCHOS_ASSERT(prod_out->productSpace()->numBlocks()==(
int) blockDim);
1018 for(std::size_t i=0;i<blockDim;i++) {
1020 RCP<const Epetra_Vector> ep_in;
1021 RCP<Epetra_Vector> ep_out;
1024 ep_in = get_Epetra_Vector(*getGhostedMap(i),prod_in->getVectorBlock(i));
1025 ep_out = get_Epetra_Vector(*getMap(i),prod_out->getNonconstVectorBlock(i));
1027 ep_in = get_Epetra_Vector(*getGhostedColMap(i),prod_in->getVectorBlock(i));
1028 ep_out = get_Epetra_Vector(*getColMap(i),prod_out->getNonconstVectorBlock(i));
1032 ghostToGlobalEpetraVector(i,*ep_in,*ep_out,col);
1036template <
typename Traits,
typename LocalOrdinalT>
1041 using Teuchos::rcp_dynamic_cast;
1042 using Teuchos::dyn_cast;
1044 using Thyra::PhysicallyBlockedLinearOpBase;
1045 using Thyra::get_Epetra_Operator;
1048 std::size_t rBlockDim = getBlockRowCount();
1049 std::size_t cBlockDim = getBlockColCount();
1052 const PhysicallyBlockedLinearOpBase<double> & prod_in = dyn_cast<const PhysicallyBlockedLinearOpBase<double> >(in);
1053 PhysicallyBlockedLinearOpBase<double> & prod_out = dyn_cast<PhysicallyBlockedLinearOpBase<double> >(out);
1055 TEUCHOS_ASSERT(prod_in.productRange()->numBlocks()==(
int) rBlockDim);
1056 TEUCHOS_ASSERT(prod_in.productDomain()->numBlocks()==(
int) cBlockDim);
1057 TEUCHOS_ASSERT(prod_out.productRange()->numBlocks()==(
int) rBlockDim);
1058 TEUCHOS_ASSERT(prod_out.productDomain()->numBlocks()==(
int) cBlockDim);
1060 for(std::size_t i=0;i<rBlockDim;i++) {
1061 for(std::size_t j=0;j<cBlockDim;j++) {
1062 if(excludedPairs_.find(std::make_pair(i,j))==excludedPairs_.end()) {
1064 RCP<const LinearOpBase<double> > th_in = prod_in.getBlock(i,j);
1065 RCP<LinearOpBase<double> > th_out = prod_out.getNonconstBlock(i,j);
1068 TEUCHOS_ASSERT(th_in!=Teuchos::null);
1069 TEUCHOS_ASSERT(th_out!=Teuchos::null);
1072 RCP<const Epetra_CrsMatrix> ep_in = rcp_dynamic_cast<const Epetra_CrsMatrix>(get_Epetra_Operator(*th_in),
true);
1073 RCP<Epetra_CrsMatrix> ep_out = rcp_dynamic_cast<Epetra_CrsMatrix>(get_Epetra_Operator(*th_out),
true);
1076 ghostToGlobalEpetraMatrix(i,*ep_in,*ep_out);
1082template <
typename Traits,
typename LocalOrdinalT>
1088 using Teuchos::rcp_dynamic_cast;
1090 using Thyra::get_Epetra_Vector;
1092 std::size_t blockDim = col ? getBlockColCount() : getBlockRowCount();
1095 RCP<const ProductVectorBase<double> > prod_in = Thyra::castOrCreateProductVectorBase(in);
1096 RCP<ProductVectorBase<double> > prod_out = Thyra::castOrCreateNonconstProductVectorBase(out);
1098 TEUCHOS_ASSERT(prod_in->productSpace()->numBlocks()==(
int) blockDim);
1099 TEUCHOS_ASSERT(prod_out->productSpace()->numBlocks()==(
int) blockDim);
1101 for(std::size_t i=0;i<blockDim;i++) {
1103 RCP<const Epetra_Vector> ep_in;
1104 RCP<Epetra_Vector> ep_out;
1107 ep_in = get_Epetra_Vector(*getMap(i),prod_in->getVectorBlock(i));
1108 ep_out = get_Epetra_Vector(*getGhostedMap(i),prod_out->getNonconstVectorBlock(i));
1111 ep_in = get_Epetra_Vector(*getColMap(i),prod_in->getVectorBlock(i));
1112 ep_out = get_Epetra_Vector(*getGhostedColMap(i),prod_out->getNonconstVectorBlock(i));
1116 globalToGhostEpetraVector(i,*ep_in,*ep_out,col);
1123template <
typename Traits,
typename LocalOrdinalT>
1130 RCP<Epetra_Export> exporter = col ? getGhostedColExport(i) : getGhostedExport(i);
1133 TEUCHOS_ASSERT_EQUALITY(err,0);
1136template <
typename Traits,
typename LocalOrdinalT>
1143 RCP<Epetra_Export> exporter = getGhostedExport(blockRow);
1146 TEUCHOS_ASSERT_EQUALITY(err,0);
1149template <
typename Traits,
typename LocalOrdinalT>
1156 RCP<Epetra_Import> importer = col ? getGhostedColImport(i) : getGhostedImport(i);
1159 TEUCHOS_ASSERT_EQUALITY(err,0);
1163template <
typename Traits,
typename LocalOrdinalT>
1167 if(maps_[i]==Teuchos::null)
1168 maps_[i] = buildMap(i);
1174template <
typename Traits,
typename LocalOrdinalT>
1178 if(not useColGidProviders_)
1181 if(colMaps_[i]==Teuchos::null)
1182 colMaps_[i] = buildColMap(i);
1192template<
typename Traits,
typename LocalOrdinalT>
1193const Teuchos::RCP<Epetra_Map>
1198 if (ghostedMaps_[i].is_null())
1199 ghostedMaps_[i] = buildGhostedMap(i);
1200 return ghostedMaps_[i];
1208template<
typename Traits,
typename LocalOrdinalT>
1209const Teuchos::RCP<Epetra_Map>
1214 if (ghostedMaps2_[i].is_null())
1215 ghostedMaps2_[i] = buildGhostedMap2(i);
1216 return ghostedMaps2_[i];
1224template<
typename Traits,
typename LocalOrdinalT>
1225const Teuchos::RCP<Epetra_Map>
1230 if (not useColGidProviders_)
1231 return getGhostedMap(i);
1232 if (colGhostedMaps_[i].is_null())
1233 colGhostedMaps_[i] = buildColGhostedMap(i);
1234 return colGhostedMaps_[i];
1242template<
typename Traits,
typename LocalOrdinalT>
1243const Teuchos::RCP<Epetra_Map>
1248 if (not useColGidProviders_)
1249 return getGhostedMap2(i);
1250 if (colGhostedMaps2_[i].is_null())
1251 colGhostedMaps2_[i] = buildColGhostedMap2(i);
1252 return colGhostedMaps2_[i];
1256template <
typename Traits,
typename LocalOrdinalT>
1260 typedef std::unordered_map<std::pair<int,int>,Teuchos::RCP<Epetra_CrsGraph>,
panzer::pair_hash> GraphMap;
1262 GraphMap::const_iterator itr = graphs_.find(std::make_pair(i,j));
1263 Teuchos::RCP<Epetra_CrsGraph> graph;
1264 if(itr==graphs_.end()) {
1265 graph = buildGraph(i,j);
1266 graphs_[std::make_pair(i,j)] = graph;
1269 graph = itr->second;
1271 TEUCHOS_ASSERT(graph!=Teuchos::null);
1275template <
typename Traits,
typename LocalOrdinalT>
1279 typedef std::unordered_map<std::pair<int,int>,Teuchos::RCP<Epetra_CrsGraph>,
panzer::pair_hash> GraphMap;
1281 GraphMap::const_iterator itr = ghostedGraphs_.find(std::make_pair(i,j));
1282 Teuchos::RCP<Epetra_CrsGraph> ghostedGraph;
1283 if(itr==ghostedGraphs_.end()) {
1284 ghostedGraph = buildGhostedGraph(i,j,
true);
1285 ghostedGraphs_[std::make_pair(i,j)] = ghostedGraph;
1288 ghostedGraph = itr->second;
1290 TEUCHOS_ASSERT(ghostedGraph!=Teuchos::null);
1291 return ghostedGraph;
1299template<
typename Traits,
typename LocalOrdinalT>
1300const Teuchos::RCP<Epetra_Import>
1306 if (importers_[i].is_null())
1307 importers_[i] = rcp(
new Epetra_Import(*getGhostedMap(i), *getMap(i)));
1308 return importers_[i];
1316template<
typename Traits,
typename LocalOrdinalT>
1317const Teuchos::RCP<Epetra_Import>
1323 if (importers2_[i].is_null())
1324 importers2_[i] = rcp(
new Epetra_Import(*getGhostedMap2(i), *getMap(i)));
1325 return importers2_[i];
1333template<
typename Traits,
typename LocalOrdinalT>
1334const Teuchos::RCP<Epetra_Import>
1340 if (not useColGidProviders_)
1341 return getGhostedImport(i);
1342 if (colImporters_[i].is_null())
1344 rcp(
new Epetra_Import(*getGhostedColMap(i), *getColMap(i)));
1345 return colImporters_[i];
1353template<
typename Traits,
typename LocalOrdinalT>
1354const Teuchos::RCP<Epetra_Import>
1360 if (not useColGidProviders_)
1361 return getGhostedImport2(i);
1362 if (colImporters2_[i].is_null())
1364 rcp(
new Epetra_Import(*getGhostedColMap2(i), *getColMap(i)));
1365 return colImporters2_[i];
1373template<
typename Traits,
typename LocalOrdinalT>
1374const Teuchos::RCP<Epetra_Export>
1380 if (exporters_[i].is_null())
1381 exporters_[i] = rcp(
new Epetra_Export(*getGhostedMap(i), *getMap(i)));
1382 return exporters_[i];
1390template<
typename Traits,
typename LocalOrdinalT>
1391const Teuchos::RCP<Epetra_Export>
1397 if (exporters_[i].is_null())
1398 exporters_[i] = rcp(
new Epetra_Export(*getGhostedMap2(i), *getMap(i)));
1399 return exporters_[i];
1407template<
typename Traits,
typename LocalOrdinalT>
1408const Teuchos::RCP<Epetra_Export>
1414 if (not useColGidProviders_)
1415 return getGhostedExport(i);
1416 if (colExporters_[i].is_null())
1417 colExporters_[i] = rcp(
new Epetra_Export(*getGhostedColMap(i),
1419 return colExporters_[i];
1427template<
typename Traits,
typename LocalOrdinalT>
1428const Teuchos::RCP<Epetra_Export>
1434 if (not useColGidProviders_)
1435 return getGhostedExport2(i);
1436 if (colExporters_[i].is_null())
1437 colExporters_[i] = rcp(
new Epetra_Export(*getGhostedColMap2(i),
1439 return colExporters_[i];
1442template <
typename Traits,
typename LocalOrdinalT>
1446 std::vector<int> indices;
1449 getGlobalIndexer(i)->getOwnedIndicesAsInt(indices);
1451 return Teuchos::rcp(
new Epetra_Map(-1,indices.size(),&indices[0],0,*eComm_));
1454template <
typename Traits,
typename LocalOrdinalT>
1458 if(not useColGidProviders_)
1461 std::vector<int> indices;
1464 getColGlobalIndexer(i)->getOwnedIndicesAsInt(indices);
1466 return Teuchos::rcp(
new Epetra_Map(-1,indices.size(),&indices[0],0,*eComm_));
1474template<
typename Traits,
typename LocalOrdinalT>
1475const Teuchos::RCP<Epetra_Map>
1482 vector<int> indices;
1483 getGlobalIndexer(i)->getOwnedAndGhostedIndicesAsInt(indices);
1484 return rcp(
new Epetra_Map(-1, indices.size(), &indices[0], 0, *eComm_));
1492template<
typename Traits,
typename LocalOrdinalT>
1493const Teuchos::RCP<Epetra_Map>
1500 vector<int> indices;
1501 getGlobalIndexer(i)->getGhostedIndicesAsInt(indices);
1502 return rcp(
new Epetra_Map(-1, indices.size(), &indices[0], 0, *eComm_));
1510template<
typename Traits,
typename LocalOrdinalT>
1511const Teuchos::RCP<Epetra_Map>
1518 if (not useColGidProviders_)
1519 return buildGhostedMap(i);
1520 vector<int> indices;
1521 getColGlobalIndexer(i)->getOwnedAndGhostedIndicesAsInt(indices);
1522 return rcp(
new Epetra_Map(-1, indices.size(), &indices[0], 0, *eComm_));
1530template<
typename Traits,
typename LocalOrdinalT>
1531const Teuchos::RCP<Epetra_Map>
1538 if (not useColGidProviders_)
1539 return buildGhostedMap2(i);
1540 vector<int> indices;
1541 getColGlobalIndexer(i)->getGhostedIndicesAsInt(indices);
1542 return rcp(
new Epetra_Map(-1, indices.size(), &indices[0], 0, *eComm_));
1546template <
typename Traits,
typename LocalOrdinalT>
1555 RCP<Epetra_Map> map_i = getMap(i);
1556 RCP<Epetra_Map> map_j = getColMap(j);
1558 TEUCHOS_ASSERT(map_i!=Teuchos::null);
1559 TEUCHOS_ASSERT(map_j!=Teuchos::null);
1562 RCP<Epetra_CrsGraph> oGraph = buildFilteredGhostedGraph(i,j);
1567 RCP<Epetra_Export> exporter = getGhostedExport(i);
1568 int err = graph->Export( *oGraph, *exporter,
Insert );
1569 TEUCHOS_ASSERT_EQUALITY(err,0);
1570 graph->FillComplete(*map_j,*map_i);
1571 graph->OptimizeStorage();
1576template <
typename Traits,
typename LocalOrdinalT>
1581 Teuchos::RCP<Epetra_Map> rowMap = getGhostedMap(i);
1582 Teuchos::RCP<Epetra_Map> colMap = getGhostedColMap(j);
1583 Teuchos::RCP<Epetra_CrsGraph> graph = Teuchos::rcp(
new Epetra_CrsGraph(
Copy,*rowMap,*colMap,0));
1585 std::vector<std::string> elementBlockIds;
1587 Teuchos::RCP<const GlobalIndexer> rowProvider, colProvider;
1589 rowProvider = getGlobalIndexer(i);
1590 colProvider = getColGlobalIndexer(j);
1592 rowProvider->getElementBlockIds(elementBlockIds);
1595 const Teuchos::RCP<const ConnManager> conn_mgr = colProvider->getConnManager();
1596 const bool han = conn_mgr.is_null() ? false : conn_mgr->hasAssociatedNeighbors();
1599 std::vector<std::string>::const_iterator blockItr;
1600 for(blockItr=elementBlockIds.begin();blockItr!=elementBlockIds.end();++blockItr) {
1601 std::string blockId = *blockItr;
1604 const std::vector<LocalOrdinalT> & elements = rowProvider->getElementBlock(blockId);
1608 std::vector<int> row_gids;
1609 std::vector<int> col_gids;
1612 for(std::size_t elmt=0;elmt<elements.size();elmt++) {
1613 rowProvider->getElementGIDsAsInt(elements[elmt],row_gids);
1614 colProvider->getElementGIDsAsInt(elements[elmt],col_gids);
1617 const std::vector<LocalOrdinalT>& aes = conn_mgr->getAssociatedNeighbors(elements[elmt]);
1618 for (
typename std::vector<LocalOrdinalT>::const_iterator eit = aes.begin();
1619 eit != aes.end(); ++eit) {
1620 std::vector<int> other_col_gids;
1621 colProvider->getElementGIDsAsInt(*eit, other_col_gids);
1622 col_gids.insert(col_gids.end(), other_col_gids.begin(), other_col_gids.end());
1626 for(std::size_t row=0;row<row_gids.size();row++)
1627 graph->InsertGlobalIndices(row_gids[row],col_gids.size(),&col_gids[0]);
1633 graph->FillComplete(*colMap,*rowMap);
1635 graph->OptimizeStorage();
1640template <
typename Traits,
typename LocalOrdinalT>
1646 using Teuchos::rcp_dynamic_cast;
1649 RCP<const Filtered_GlobalIndexer> filtered_ugi
1650 = rcp_dynamic_cast<const Filtered_GlobalIndexer>(getColGlobalIndexer(j));
1653 if(filtered_ugi==Teuchos::null)
1654 return buildGhostedGraph(i,j,
true);
1657 std::vector<int> ghostedActive;
1658 filtered_ugi->getOwnedAndGhostedNotFilteredIndicator(ghostedActive);
1661 Teuchos::RCP<Epetra_CrsGraph> filteredGraph = buildGhostedGraph(i,j,
false);
1665 for(
int k=0;k<filteredGraph->NumMyRows();++k) {
1666 std::vector<int> removedIndices;
1669 TEUCHOS_ASSERT(filteredGraph->ExtractMyRowView(k,numIndices,indices)==0);
1671 for(
int m=0;m<numIndices;++m) {
1672 if(ghostedActive[indices[m]]==0)
1673 removedIndices.push_back(indices[m]);
1676 TEUCHOS_ASSERT(filteredGraph->RemoveMyIndices(k,Teuchos::as<int>(removedIndices.size()),&removedIndices[0])==0);
1680 Teuchos::RCP<Epetra_Map> rowMap = getGhostedMap(i);
1681 Teuchos::RCP<Epetra_Map> colMap = getGhostedColMap(j);
1683 TEUCHOS_ASSERT(filteredGraph->FillComplete(*colMap,*rowMap)==0);
1684 TEUCHOS_ASSERT(filteredGraph->OptimizeStorage()==0);
1686 return filteredGraph;
1689template <
typename Traits,
typename LocalOrdinalT>
1693 Teuchos::RCP<Epetra_CrsGraph> eGraph = getGraph(i,j);
1695 TEUCHOS_ASSERT(mat->Filled());
1699template <
typename Traits,
typename LocalOrdinalT>
1703 Teuchos::RCP<Epetra_CrsGraph> eGraph = getGhostedGraph(i,j);
1705 TEUCHOS_ASSERT(mat->Filled());
1709template <
typename Traits,
typename LocalOrdinalT>
1716template <
typename Traits,
typename LocalOrdinalT>
1720 return rowDOFManagerContainer_->getFieldBlocks();
1723template <
typename Traits,
typename LocalOrdinalT>
1727 return colDOFManagerContainer_->getFieldBlocks();
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.
int PutScalar(double ScalarConstant)
int Import(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
int Export(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
int PutScalar(double ScalarConstant)
Teuchos::RCP< VectorType > get_f() const
Teuchos::RCP< VectorType > get_dxdt() const
Teuchos::RCP< VectorType > get_x() const
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
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
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.
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 DOFManagerContainer > rowDOFManagerContainer_
int getBlockColCount() const
how many block columns
Teuchos::RCP< Thyra::VectorBase< double > > getThyraRangeVector() const
Get a range vector.
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.
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.
virtual ~BlockedEpetraLinearObjFactory()
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
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...
virtual void adjustForDirichletConditions(const LinearObjContainer &localBCRows, const LinearObjContainer &globalBCRows, LinearObjContainer &ghostedObjs, bool zeroVectorRows=false, bool adjustX=false) const
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
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
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_
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.
virtual Teuchos::RCP< LinearObjContainer > buildLinearObjContainer() 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
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< const Thyra::VectorSpaceBase< double > > getGhostedThyraDomainSpace() const
Get the domain vector space (x and dxdt)
This class encapsulates the needs of a gather operation to do a halo exchange for blocked vectors.
This class encapsulates the needs of a gather operation to do a // halo exchange for blocked vectors....
const Teuchos::RCP< Epetra_CrsMatrix > get_A() const
const Teuchos::RCP< Epetra_Vector > get_dxdt() const
const Teuchos::RCP< Epetra_Vector > get_f() const
const Teuchos::RCP< Epetra_Vector > get_x() const
This class provides a boundary exchange communication mechanism for vectors.
This class provides a boundary exchange communication mechanism for vectors.
void setRequiresDirichletAdjustment(bool b)
void buildGatherScatterEvaluators(const BuilderT &builder)
virtual void set_f_th(const Teuchos::RCP< Thyra::VectorBase< ScalarT > > &in)=0
virtual void set_A_th(const Teuchos::RCP< Thyra::LinearOpBase< ScalarT > > &in)=0
virtual Teuchos::RCP< Thyra::VectorBase< ScalarT > > get_f_th() const =0
virtual void set_dxdt_th(const Teuchos::RCP< Thyra::VectorBase< ScalarT > > &in)=0
virtual void set_x_th(const Teuchos::RCP< Thyra::VectorBase< ScalarT > > &in)=0
int MatrixMarketFileToVector(const char *filename, const Epetra_BlockMap &map, Epetra_Vector *&A)
int VectorToMatrixMarketFile(const char *filename, const Epetra_Vector &A, const char *matrixName=0, const char *matrixDescription=0, bool writeHeader=true)