43 #ifndef __Panzer_BlockedEpetraLinearObjFactory_impl_hpp__ 44 #define __Panzer_BlockedEpetraLinearObjFactory_impl_hpp__ 48 #include "Epetra_CrsMatrix.h" 49 #include "Epetra_MpiComm.h" 50 #include "Epetra_MultiVector.h" 51 #include "Epetra_Vector.h" 54 #include "EpetraExt_VectorIn.h" 55 #include "EpetraExt_VectorOut.h" 67 #include "Thyra_DefaultBlockedLinearOp.hpp" 68 #include "Thyra_DefaultProductVector.hpp" 69 #include "Thyra_DefaultProductVectorSpace.hpp" 70 #include "Thyra_EpetraLinearOp.hpp" 71 #include "Thyra_EpetraThyraWrappers.hpp" 72 #include "Thyra_get_Epetra_Operator.hpp" 73 #include "Thyra_SpmdVectorBase.hpp" 74 #include "Thyra_VectorStdOps.hpp" 84 template <
typename Traits,
typename LocalOrdinalT>
87 const Teuchos::RCP<const UniqueGlobalIndexerBase> & gidProvider,
88 bool useDiscreteAdjoint)
89 : useColGidProviders_(false), eComm_(
Teuchos::null)
90 , rawMpiComm_(comm->getRawMpiComm())
91 , useDiscreteAdjoint_(useDiscreteAdjoint)
107 template <
typename Traits,
typename LocalOrdinalT>
110 const Teuchos::RCP<const UniqueGlobalIndexerBase> & gidProvider,
111 const Teuchos::RCP<const UniqueGlobalIndexerBase> & colGidProvider,
112 bool useDiscreteAdjoint)
114 , rawMpiComm_(comm->getRawMpiComm())
115 , useDiscreteAdjoint_(useDiscreteAdjoint)
133 template <
typename Traits,
typename LocalOrdinalT>
140 template <
typename Traits,
typename LocalOrdinalT>
146 using Teuchos::rcp_dynamic_cast;
147 using Teuchos::dyn_cast;
153 RCP<Thyra::VectorBase<double> > vec;
165 TEUCHOS_ASSERT(
false);
169 int blockRows = this->getBlockRowCount();
170 RCP<ProductVectorBase<double> > b_vec = Thyra::nonconstProductVectorBase(vec);
173 for(
int i=0;i<blockRows;i++) {
174 RCP<Thyra::VectorBase<double> > x = b_vec->getNonconstVectorBlock(i);
175 RCP<Epetra_Vector> ex = Thyra::get_Epetra_Vector(*getMap(i),x);
178 std::stringstream ss;
179 ss << identifier <<
"-" << i <<
".mm";
182 Epetra_Vector * ptr_ex = 0;
183 TEUCHOS_ASSERT(0==EpetraExt::MatrixMarketFileToVector(ss.str().c_str(),*getMap(i),ptr_ex));
190 template <
typename Traits,
typename LocalOrdinalT>
196 using Teuchos::rcp_dynamic_cast;
197 using Teuchos::dyn_cast;
203 RCP<const Thyra::VectorBase<double> > vec;
215 TEUCHOS_ASSERT(
false);
219 int blockRows = this->getBlockRowCount();
220 RCP<const ProductVectorBase<double> > b_vec = Thyra::productVectorBase(vec);
223 for(
int i=0;i<blockRows;i++) {
224 RCP<const Thyra::VectorBase<double> > x = b_vec->getVectorBlock(i);
225 RCP<const Epetra_Vector> ex = Thyra::get_Epetra_Vector(*getMap(i),x);
228 std::stringstream ss;
229 ss << identifier <<
"-" << i <<
".mm";
232 TEUCHOS_ASSERT(0==EpetraExt::VectorToMatrixMarketFile(ss.str().c_str(),*ex));
236 template <
typename Traits,
typename LocalOrdinalT>
240 if(!rowDOFManagerContainer_->containsBlockedDOFManager() && !colDOFManagerContainer_->containsBlockedDOFManager()) {
241 Teuchos::RCP<EpetraLinearObjContainer> container = Teuchos::rcp(
new EpetraLinearObjContainer(getColMap(0),getMap(0)));
246 std::vector<Teuchos::RCP<const Epetra_Map> > blockMaps;
247 std::size_t blockDim = getBlockRowCount();
248 for(std::size_t i=0;i<blockDim;i++)
249 blockMaps.push_back(getMap(i));
252 container->setMapsForBlocks(blockMaps);
257 template <
typename Traits,
typename LocalOrdinalT>
261 if(!rowDOFManagerContainer_->containsBlockedDOFManager() && !colDOFManagerContainer_->containsBlockedDOFManager()) {
262 Teuchos::RCP<EpetraLinearObjContainer> container = Teuchos::rcp(
new EpetraLinearObjContainer(getGhostedColMap(0),getGhostedMap(0)));
267 std::vector<Teuchos::RCP<const Epetra_Map> > blockMaps;
268 std::size_t blockDim = getBlockRowCount();
269 for(std::size_t i=0;i<blockDim;i++)
270 blockMaps.push_back(getGhostedMap(i));
273 container->setMapsForBlocks(blockMaps);
278 template <
typename Traits,
typename LocalOrdinalT>
282 using Teuchos::is_null;
287 if( !rowDOFManagerContainer_->containsBlockedDOFManager()
288 && !colDOFManagerContainer_->containsBlockedDOFManager()) {
294 if ( !is_null(e_in.
get_x()) && !is_null(e_out.get_x()) && ((mem & LOC::X)==LOC::X))
295 globalToGhostEpetraVector(0,*e_in.
get_x(),*e_out.get_x(),
true);
297 if ( !is_null(e_in.
get_dxdt()) && !is_null(e_out.get_dxdt()) && ((mem & LOC::DxDt)==LOC::DxDt))
298 globalToGhostEpetraVector(0,*e_in.
get_dxdt(),*e_out.get_dxdt(),
true);
300 if ( !is_null(e_in.
get_f()) && !is_null(e_out.get_f()) && ((mem & LOC::F)==LOC::F))
301 globalToGhostEpetraVector(0,*e_in.
get_f(),*e_out.get_f(),
false);
304 const BLOC & b_in = Teuchos::dyn_cast<
const BLOC>(in);
305 BLOC & b_out = Teuchos::dyn_cast<BLOC>(out);
309 if ( !is_null(b_in.get_x()) && !is_null(b_out.get_x()) && ((mem & LOC::X)==LOC::X))
310 globalToGhostThyraVector(b_in.get_x(),b_out.get_x(),
true);
312 if ( !is_null(b_in.get_dxdt()) && !is_null(b_out.get_dxdt()) && ((mem & LOC::DxDt)==LOC::DxDt))
313 globalToGhostThyraVector(b_in.get_dxdt(),b_out.get_dxdt(),
true);
315 if ( !is_null(b_in.get_f()) && !is_null(b_out.get_f()) && ((mem & LOC::F)==LOC::F))
316 globalToGhostThyraVector(b_in.get_f(),b_out.get_f(),
false);
320 template <
typename Traits,
typename LocalOrdinalT>
324 using Teuchos::is_null;
329 if( !rowDOFManagerContainer_->containsBlockedDOFManager()
330 && !colDOFManagerContainer_->containsBlockedDOFManager()) {
336 if ( !is_null(e_in.
get_x()) && !is_null(e_out.get_x()) && ((mem & LOC::X)==LOC::X))
337 ghostToGlobalEpetraVector(0,*e_in.
get_x(),*e_out.get_x(),
true);
339 if ( !is_null(e_in.
get_f()) && !is_null(e_out.get_f()) && ((mem & LOC::F)==LOC::F))
340 ghostToGlobalEpetraVector(0,*e_in.
get_f(),*e_out.get_f(),
false);
342 if ( !is_null(e_in.
get_A()) && !is_null(e_out.get_A()) && ((mem & LOC::Mat)==LOC::Mat))
343 ghostToGlobalEpetraMatrix(0,*e_in.
get_A(),*e_out.get_A());
346 const BLOC & b_in = Teuchos::dyn_cast<
const BLOC>(in);
347 BLOC & b_out = Teuchos::dyn_cast<BLOC>(out);
351 if ( !is_null(b_in.get_x()) && !is_null(b_out.get_x()) && ((mem & LOC::X)==LOC::X))
352 ghostToGlobalThyraVector(b_in.get_x(),b_out.get_x(),
true);
354 if ( !is_null(b_in.get_f()) && !is_null(b_out.get_f()) && ((mem & LOC::F)==LOC::F))
355 ghostToGlobalThyraVector(b_in.get_f(),b_out.get_f(),
false);
357 if ( !is_null(b_in.get_A()) && !is_null(b_out.get_A()) && ((mem & LOC::Mat)==LOC::Mat))
358 ghostToGlobalThyraMatrix(*b_in.get_A(),*b_out.get_A());
362 template <
typename Traits,
typename LocalOrdinalT>
367 bool zeroVectorRows,
bool adjustX)
const 372 using Teuchos::rcp_dynamic_cast;
374 using Thyra::PhysicallyBlockedLinearOpBase;
377 using Thyra::get_Epetra_Vector;
378 using Thyra::get_Epetra_Operator;
380 int rBlockDim = getBlockRowCount();
381 int cBlockDim = getBlockColCount();
384 const TOC & b_localBCRows = Teuchos::dyn_cast<
const TOC>(localBCRows);
385 const TOC & b_globalBCRows = Teuchos::dyn_cast<
const TOC>(globalBCRows);
386 TOC & b_ghosted = Teuchos::dyn_cast<TOC>(ghostedObjs);
388 TEUCHOS_ASSERT(b_localBCRows.get_f_th()!=Teuchos::null);
389 TEUCHOS_ASSERT(b_globalBCRows.get_f_th()!=Teuchos::null);
392 RCP<PhysicallyBlockedLinearOpBase<double> > A = rcp_dynamic_cast<PhysicallyBlockedLinearOpBase<double> >(b_ghosted.get_A_th());
393 if(A==Teuchos::null && b_ghosted.get_A_th()!=Teuchos::null) {
395 A = rcp_dynamic_cast<PhysicallyBlockedLinearOpBase<double> >(Thyra::nonconstBlock1x1(b_ghosted.get_A_th()));
398 RCP<ProductVectorBase<double> > f = b_ghosted.get_f_th()==Teuchos::null
400 : Thyra::castOrCreateNonconstProductVectorBase(b_ghosted.get_f_th());
401 RCP<ProductVectorBase<double> > local_bcs = b_localBCRows.get_f_th()==Teuchos::null
403 : Thyra::castOrCreateNonconstProductVectorBase(b_localBCRows.get_f_th());
404 RCP<ProductVectorBase<double> > global_bcs = b_globalBCRows.get_f_th()==Teuchos::null
406 : Thyra::castOrCreateNonconstProductVectorBase(b_globalBCRows.get_f_th());
408 if(adjustX) f = Thyra::castOrCreateNonconstProductVectorBase(b_ghosted.get_x_th());
411 if(A!=Teuchos::null) TEUCHOS_ASSERT(A->productRange()->numBlocks()==rBlockDim);
412 if(A!=Teuchos::null) TEUCHOS_ASSERT(A->productDomain()->numBlocks()==cBlockDim);
413 if(f!=Teuchos::null) TEUCHOS_ASSERT(f->productSpace()->numBlocks()==rBlockDim);
414 TEUCHOS_ASSERT(local_bcs->productSpace()->numBlocks()==rBlockDim);
415 TEUCHOS_ASSERT(global_bcs->productSpace()->numBlocks()==rBlockDim);
417 for(
int i=0;i<rBlockDim;i++) {
419 RCP<const Epetra_Vector> e_local_bcs = get_Epetra_Vector(*getGhostedMap(i),local_bcs->getVectorBlock(i));
420 RCP<const Epetra_Vector> e_global_bcs = get_Epetra_Vector(*getGhostedMap(i),global_bcs->getVectorBlock(i));
423 RCP<VectorBase<double> > th_f = (f==Teuchos::null) ? Teuchos::null : f->getNonconstVectorBlock(i);
424 RCP<Epetra_Vector> e_f;
425 if(th_f==Teuchos::null)
428 e_f = get_Epetra_Vector(*getGhostedMap(i),th_f);
430 for(
int j=0;j<cBlockDim;j++) {
433 RCP<LinearOpBase<double> > th_A = (A== Teuchos::null)? Teuchos::null : A->getNonconstBlock(i,j);
436 RCP<Epetra_CrsMatrix> e_A;
437 if(th_A==Teuchos::null)
440 e_A = rcp_dynamic_cast<Epetra_CrsMatrix>(get_Epetra_Operator(*th_A),
true);
443 adjustForDirichletConditions(*e_local_bcs,*e_global_bcs,e_f.ptr(),e_A.ptr(),zeroVectorRows);
450 template <
typename Traits,
typename LocalOrdinalT>
453 const Epetra_Vector & global_bcs,
454 const Teuchos::Ptr<Epetra_Vector> & f,
455 const Teuchos::Ptr<Epetra_CrsMatrix> & A,
456 bool zeroVectorRows)
const 458 if(f==Teuchos::null && A==Teuchos::null)
461 TEUCHOS_ASSERT(local_bcs.MyLength()==global_bcs.MyLength());
462 for(
int i=0;i<local_bcs.MyLength();i++) {
463 if(global_bcs[i]==0.0)
470 if(local_bcs[i]==0.0 || zeroVectorRows) {
474 if(!Teuchos::is_null(f))
476 if(!Teuchos::is_null(A)) {
477 A->ExtractMyRowView(i,numEntries,values,indices);
478 for(
int c=0;c<numEntries;c++)
485 double scaleFactor = global_bcs[i];
488 if(!Teuchos::is_null(f))
489 (*f)[i] /= scaleFactor;
490 if(!Teuchos::is_null(A)) {
491 A->ExtractMyRowView(i,numEntries,values,indices);
492 for(
int c=0;c<numEntries;c++)
493 values[c] /= scaleFactor;
499 template <
typename Traits,
typename LocalOrdinalT>
505 using Teuchos::rcp_dynamic_cast;
506 using Teuchos::dyn_cast;
513 RCP<const PVector> count = Thyra::castOrCreateProductVectorBase(th_counter.
get_f_th().getConst());
514 RCP<const PVector> f_in = Thyra::castOrCreateProductVectorBase(th_counter.
get_f_th().getConst());
515 RCP<PVector> f_out = Thyra::castOrCreateNonconstProductVectorBase(th_result.get_f_th());
517 int rBlockDim = getBlockRowCount();
518 for(
int i=0;i<rBlockDim;i++) {
520 Teuchos::ArrayRCP<const double> count_array,f_in_array;
521 Teuchos::ArrayRCP<double> f_out_array;
523 rcp_dynamic_cast<
const Thyra::SpmdVectorBase<double> >(count->getVectorBlock(i),
true)->getLocalData(Teuchos::ptrFromRef(count_array));
524 rcp_dynamic_cast<
const Thyra::SpmdVectorBase<double> >(f_in->getVectorBlock(i),
true)->getLocalData(Teuchos::ptrFromRef(f_in_array));
525 rcp_dynamic_cast<Thyra::SpmdVectorBase<double> >(f_out->getNonconstVectorBlock(i),
true)->getNonconstLocalData(Teuchos::ptrFromRef(f_out_array));
527 TEUCHOS_ASSERT(count_array.size()==f_in_array.size());
528 TEUCHOS_ASSERT(count_array.size()==f_out_array.size());
530 for(Teuchos::ArrayRCP<double>::size_type i=0;i<count_array.size();i++) {
531 if(count_array[i]!=0.0)
532 f_out_array[i] = f_in_array[i];
542 template<
typename Traits,
typename LocalOrdinalT>
543 Teuchos::RCP<ReadOnlyVector_GlobalEvaluationData>
556 if (not colDOFManagerContainer_->containsBlockedDOFManager())
558 auto ged = rcp(
new EVROGED);
559 ged->initialize(getGhostedColImport2(0), getGhostedColMap2(0),
565 vector<RCP<ROVGED>> gedBlocks;
566 for (
int i(0); i < getBlockColCount(); ++i)
568 auto vecGed = rcp(
new EVROGED);
569 vecGed->initialize(getGhostedColImport2(i), getGhostedColMap2(i),
571 gedBlocks.push_back(vecGed);
573 auto ged = rcp(
new BVROGED);
574 ged->initialize(getGhostedThyraDomainSpace2(), getThyraDomainSpace(),
584 template<
typename Traits,
typename LocalOrdinalT>
585 Teuchos::RCP<WriteVector_GlobalEvaluationData>
598 if (not colDOFManagerContainer_->containsBlockedDOFManager())
600 auto ged = rcp(
new EVWGED);
601 ged->initialize(getGhostedColExport2(0), getGhostedColMap2(0),
607 vector<RCP<WVGED>> gedBlocks;
608 for (
int i(0); i < getBlockColCount(); ++i)
610 auto vecGed = rcp(
new EVWGED);
611 vecGed->initialize(getGhostedColExport2(i), getGhostedColMap2(i),
613 gedBlocks.push_back(vecGed);
615 auto ged = rcp(
new BVWGED);
616 ged->initialize(getGhostedThyraDomainSpace2(), getThyraDomainSpace(),
621 template <
typename Traits,
typename LocalOrdinalT>
628 template <
typename Traits,
typename LocalOrdinalT>
634 TOC & toc = Teuchos::dyn_cast<TOC>(loc);
635 initializeContainer_internal(mem,toc);
638 template <
typename Traits,
typename LocalOrdinalT>
645 TOC & toc = Teuchos::dyn_cast<TOC>(loc);
646 initializeGhostedContainer_internal(mem,toc);
648 if(rowDOFManagerContainer_->containsBlockedDOFManager()) {
651 BLOC & bloc = Teuchos::dyn_cast<BLOC>(loc);
653 if((mem & LOC::F) == LOC::F)
656 if((mem & LOC::Mat) == LOC::Mat)
657 bloc.setRequiresDirichletAdjustment(
true);
662 if((mem & LOC::F) == LOC::F)
665 if((mem & LOC::Mat) == LOC::Mat)
673 template <
typename Traits,
typename LocalOrdinalT>
681 if((mem & LOC::X) == LOC::X)
682 loc.
set_x_th(getThyraDomainVector());
684 if((mem & LOC::DxDt) == LOC::DxDt)
687 if((mem & LOC::F) == LOC::F)
688 loc.
set_f_th(getThyraRangeVector());
690 if((mem & LOC::Mat) == LOC::Mat)
694 template <
typename Traits,
typename LocalOrdinalT>
702 if((mem & LOC::X) == LOC::X)
703 loc.
set_x_th(getGhostedThyraDomainVector());
705 if((mem & LOC::DxDt) == LOC::DxDt)
708 if((mem & LOC::F) == LOC::F)
709 loc.
set_f_th(getGhostedThyraRangeVector());
711 if((mem & LOC::Mat) == LOC::Mat)
712 loc.
set_A_th(getGhostedThyraMatrix());
715 template <
typename Traits,
typename LocalOrdinalT>
719 excludedPairs_.insert(std::make_pair(rowBlock,colBlock));
722 template <
typename Traits,
typename LocalOrdinalT>
726 for(std::size_t i=0;i<exPairs.size();i++)
727 excludedPairs_.insert(exPairs[i]);
730 template <
typename Traits,
typename LocalOrdinalT>
734 return rowDOFManagerContainer_->getFieldDOFManagers()[i];
737 template <
typename Traits,
typename LocalOrdinalT>
741 return colDOFManagerContainer_->getFieldDOFManagers()[i];
749 template<
typename Traits,
typename LocalOrdinalT>
753 std::size_t blockCnt,
754 std::size_t colBlockCnt)
756 maps_.resize(blockCnt);
757 ghostedMaps_.resize(blockCnt);
758 ghostedMaps2_.resize(blockCnt);
759 importers_.resize(blockCnt);
760 importers2_.resize(blockCnt);
761 exporters_.resize(blockCnt);
764 colMaps_.resize(colBlockCnt);
765 colGhostedMaps_.resize(colBlockCnt);
766 colGhostedMaps2_.resize(colBlockCnt);
767 colImporters_.resize(colBlockCnt);
768 colImporters2_.resize(colBlockCnt);
769 colExporters_.resize(colBlockCnt);
776 template <
typename Traits,
typename LocalOrdinalT>
780 if(domainSpace_==Teuchos::null) {
781 if(colDOFManagerContainer_->containsBlockedDOFManager()) {
783 std::vector<Teuchos::RCP<const Thyra::VectorSpaceBase<double> > > vsArray;
784 for(
int i=0;i<getBlockColCount();i++)
785 vsArray.push_back(Thyra::create_VectorSpace(getColMap(i)));
787 domainSpace_ = Thyra::productVectorSpace<double>(vsArray);
792 domainSpace_ = Thyra::create_VectorSpace(getColMap(0));
799 template <
typename Traits,
typename LocalOrdinalT>
803 if(rangeSpace_==Teuchos::null) {
804 if(rowDOFManagerContainer_->containsBlockedDOFManager()) {
806 std::vector<Teuchos::RCP<const Thyra::VectorSpaceBase<double> > > vsArray;
807 for(
int i=0;i<getBlockRowCount();i++)
808 vsArray.push_back(Thyra::create_VectorSpace(getMap(i)));
810 rangeSpace_ = Thyra::productVectorSpace<double>(vsArray);
815 rangeSpace_ = Thyra::create_VectorSpace(getMap(0));
822 template <
typename Traits,
typename LocalOrdinalT>
826 Teuchos::RCP<Thyra::VectorBase<double> > vec =
827 Thyra::createMember<double>(*getThyraDomainSpace());
828 Thyra::assign(vec.ptr(),0.0);
833 template <
typename Traits,
typename LocalOrdinalT>
837 Teuchos::RCP<Thyra::VectorBase<double> > vec =
838 Thyra::createMember<double>(*getThyraRangeSpace());
839 Thyra::assign(vec.ptr(),0.0);
844 template <
typename Traits,
typename LocalOrdinalT>
849 if(!rowDOFManagerContainer_->containsBlockedDOFManager() &&
850 !colDOFManagerContainer_->containsBlockedDOFManager()) {
851 return Thyra::nonconstEpetraLinearOp(getEpetraMatrix(0,0));
854 Teuchos::RCP<Thyra::PhysicallyBlockedLinearOpBase<double> > blockedOp = Thyra::defaultBlockedLinearOp<double>();
857 std::size_t rBlockDim = getBlockRowCount();
858 std::size_t cBlockDim = getBlockColCount();
861 blockedOp->beginBlockFill(rBlockDim,cBlockDim);
864 for(std::size_t i=0;i<rBlockDim;i++) {
865 for(std::size_t j=0;j<cBlockDim;j++) {
866 if(excludedPairs_.find(std::make_pair(i,j))==excludedPairs_.end()) {
868 Teuchos::RCP<Thyra::LinearOpBase<double> > block = Thyra::nonconstEpetraLinearOp(getEpetraMatrix(i,j));
869 blockedOp->setNonconstBlock(i,j,block);
875 blockedOp->endBlockFill();
885 template<
typename Traits,
typename LocalOrdinalT>
886 Teuchos::RCP<const Thyra::VectorSpaceBase<double>>
892 using Thyra::create_VectorSpace;
893 using Thyra::productVectorSpace;
895 if (ghostedDomainSpace_.is_null())
897 if (colDOFManagerContainer_->containsBlockedDOFManager())
900 vector<RCP<const VectorSpaceBase<double>>> vsArray;
901 for (
int i(0); i < getBlockColCount(); ++i)
902 vsArray.push_back(create_VectorSpace(getGhostedColMap(i)));
903 ghostedDomainSpace_ = productVectorSpace<double>(vsArray);
909 ghostedDomainSpace_ = create_VectorSpace(getGhostedColMap(0));
912 return ghostedDomainSpace_;
920 template<
typename Traits,
typename LocalOrdinalT>
921 Teuchos::RCP<const Thyra::VectorSpaceBase<double>>
927 using Thyra::create_VectorSpace;
928 using Thyra::productVectorSpace;
930 if (ghostedDomainSpace_.is_null())
932 if (colDOFManagerContainer_->containsBlockedDOFManager())
935 vector<RCP<const VectorSpaceBase<double>>> vsArray;
936 for (
int i(0); i < getBlockColCount(); ++i)
937 vsArray.push_back(create_VectorSpace(getGhostedColMap2(i)));
938 ghostedDomainSpace_ = productVectorSpace<double>(vsArray);
944 ghostedDomainSpace_ = create_VectorSpace(getGhostedColMap2(0));
947 return ghostedDomainSpace_;
950 template <
typename Traits,
typename LocalOrdinalT>
954 if(ghostedRangeSpace_==Teuchos::null) {
955 if(rowDOFManagerContainer_->containsBlockedDOFManager()) {
957 std::vector<Teuchos::RCP<const Thyra::VectorSpaceBase<double> > > vsArray;
958 for(
int i=0;i<getBlockRowCount();i++)
959 vsArray.push_back(Thyra::create_VectorSpace(getGhostedMap(i)));
961 ghostedRangeSpace_ = Thyra::productVectorSpace<double>(vsArray);
966 ghostedRangeSpace_ = Thyra::create_VectorSpace(getGhostedMap(0));
970 return ghostedRangeSpace_;
973 template <
typename Traits,
typename LocalOrdinalT>
977 Teuchos::RCP<Thyra::VectorBase<double> > vec =
978 Thyra::createMember<double>(*getGhostedThyraDomainSpace());
979 Thyra::assign(vec.ptr(),0.0);
984 template <
typename Traits,
typename LocalOrdinalT>
988 Teuchos::RCP<Thyra::VectorBase<double> > vec =
989 Thyra::createMember<double>(*getGhostedThyraRangeSpace());
990 Thyra::assign(vec.ptr(),0.0);
995 template <
typename Traits,
typename LocalOrdinalT>
1000 if(!rowDOFManagerContainer_->containsBlockedDOFManager() &&
1001 !colDOFManagerContainer_->containsBlockedDOFManager()) {
1002 return Thyra::nonconstEpetraLinearOp(getGhostedEpetraMatrix(0,0));
1005 Teuchos::RCP<Thyra::PhysicallyBlockedLinearOpBase<double> > blockedOp = Thyra::defaultBlockedLinearOp<double>();
1008 std::size_t rBlockDim = getBlockRowCount();
1009 std::size_t cBlockDim = getBlockColCount();
1012 blockedOp->beginBlockFill(rBlockDim,cBlockDim);
1015 for(std::size_t i=0;i<rBlockDim;i++) {
1016 for(std::size_t j=0;j<cBlockDim;j++) {
1017 if(excludedPairs_.find(std::make_pair(i,j))==excludedPairs_.end()) {
1019 Teuchos::RCP<Thyra::LinearOpBase<double> > block = Thyra::nonconstEpetraLinearOp(getGhostedEpetraMatrix(i,j));
1020 blockedOp->setNonconstBlock(i,j,block);
1026 blockedOp->endBlockFill();
1031 template <
typename Traits,
typename LocalOrdinalT>
1037 using Teuchos::rcp_dynamic_cast;
1039 using Thyra::get_Epetra_Vector;
1041 std::size_t blockDim = col ? getBlockColCount() : getBlockRowCount();
1044 RCP<const ProductVectorBase<double> > prod_in = Thyra::castOrCreateProductVectorBase(in);
1045 RCP<ProductVectorBase<double> > prod_out = Thyra::castOrCreateNonconstProductVectorBase(out);
1047 TEUCHOS_ASSERT(prod_in->productSpace()->numBlocks()==(int) blockDim);
1048 TEUCHOS_ASSERT(prod_out->productSpace()->numBlocks()==(int) blockDim);
1050 for(std::size_t i=0;i<blockDim;i++) {
1052 RCP<const Epetra_Vector> ep_in;
1053 RCP<Epetra_Vector> ep_out;
1056 ep_in = get_Epetra_Vector(*getGhostedMap(i),prod_in->getVectorBlock(i));
1057 ep_out = get_Epetra_Vector(*getMap(i),prod_out->getNonconstVectorBlock(i));
1059 ep_in = get_Epetra_Vector(*getGhostedColMap(i),prod_in->getVectorBlock(i));
1060 ep_out = get_Epetra_Vector(*getColMap(i),prod_out->getNonconstVectorBlock(i));
1064 ghostToGlobalEpetraVector(i,*ep_in,*ep_out,col);
1068 template <
typename Traits,
typename LocalOrdinalT>
1073 using Teuchos::rcp_dynamic_cast;
1074 using Teuchos::dyn_cast;
1076 using Thyra::PhysicallyBlockedLinearOpBase;
1077 using Thyra::get_Epetra_Operator;
1080 std::size_t rBlockDim = getBlockRowCount();
1081 std::size_t cBlockDim = getBlockColCount();
1084 const PhysicallyBlockedLinearOpBase<double> & prod_in = dyn_cast<
const PhysicallyBlockedLinearOpBase<double> >(in);
1085 PhysicallyBlockedLinearOpBase<double> & prod_out = dyn_cast<PhysicallyBlockedLinearOpBase<double> >(out);
1087 TEUCHOS_ASSERT(prod_in.productRange()->numBlocks()==(int) rBlockDim);
1088 TEUCHOS_ASSERT(prod_in.productDomain()->numBlocks()==(int) cBlockDim);
1089 TEUCHOS_ASSERT(prod_out.productRange()->numBlocks()==(int) rBlockDim);
1090 TEUCHOS_ASSERT(prod_out.productDomain()->numBlocks()==(int) cBlockDim);
1092 for(std::size_t i=0;i<rBlockDim;i++) {
1093 for(std::size_t j=0;j<cBlockDim;j++) {
1094 if(excludedPairs_.find(std::make_pair(i,j))==excludedPairs_.end()) {
1096 RCP<const LinearOpBase<double> > th_in = prod_in.getBlock(i,j);
1097 RCP<LinearOpBase<double> > th_out = prod_out.getNonconstBlock(i,j);
1100 TEUCHOS_ASSERT(th_in!=Teuchos::null);
1101 TEUCHOS_ASSERT(th_out!=Teuchos::null);
1104 RCP<const Epetra_CrsMatrix> ep_in = rcp_dynamic_cast<
const Epetra_CrsMatrix>(get_Epetra_Operator(*th_in),
true);
1105 RCP<Epetra_CrsMatrix> ep_out = rcp_dynamic_cast<Epetra_CrsMatrix>(get_Epetra_Operator(*th_out),
true);
1108 ghostToGlobalEpetraMatrix(i,*ep_in,*ep_out);
1114 template <
typename Traits,
typename LocalOrdinalT>
1120 using Teuchos::rcp_dynamic_cast;
1122 using Thyra::get_Epetra_Vector;
1124 std::size_t blockDim = col ? getBlockColCount() : getBlockRowCount();
1127 RCP<const ProductVectorBase<double> > prod_in = Thyra::castOrCreateProductVectorBase(in);
1128 RCP<ProductVectorBase<double> > prod_out = Thyra::castOrCreateNonconstProductVectorBase(out);
1130 TEUCHOS_ASSERT(prod_in->productSpace()->numBlocks()==(int) blockDim);
1131 TEUCHOS_ASSERT(prod_out->productSpace()->numBlocks()==(int) blockDim);
1133 for(std::size_t i=0;i<blockDim;i++) {
1135 RCP<const Epetra_Vector> ep_in;
1136 RCP<Epetra_Vector> ep_out;
1139 ep_in = get_Epetra_Vector(*getMap(i),prod_in->getVectorBlock(i));
1140 ep_out = get_Epetra_Vector(*getGhostedMap(i),prod_out->getNonconstVectorBlock(i));
1143 ep_in = get_Epetra_Vector(*getColMap(i),prod_in->getVectorBlock(i));
1144 ep_out = get_Epetra_Vector(*getGhostedColMap(i),prod_out->getNonconstVectorBlock(i));
1148 globalToGhostEpetraVector(i,*ep_in,*ep_out,col);
1155 template <
typename Traits,
typename LocalOrdinalT>
1162 RCP<Epetra_Export> exporter = col ? getGhostedColExport(i) : getGhostedExport(i);
1164 int err = out.Export(in,*exporter,Add);
1165 TEUCHOS_ASSERT_EQUALITY(err,0);
1168 template <
typename Traits,
typename LocalOrdinalT>
1175 RCP<Epetra_Export> exporter = getGhostedExport(blockRow);
1177 int err = out.Export(in,*exporter,Add);
1178 TEUCHOS_ASSERT_EQUALITY(err,0);
1181 template <
typename Traits,
typename LocalOrdinalT>
1188 RCP<Epetra_Import> importer = col ? getGhostedColImport(i) : getGhostedImport(i);
1190 int err = out.Import(in,*importer,Insert);
1191 TEUCHOS_ASSERT_EQUALITY(err,0);
1195 template <
typename Traits,
typename LocalOrdinalT>
1199 if(maps_[i]==Teuchos::null)
1200 maps_[i] = buildMap(i);
1206 template <
typename Traits,
typename LocalOrdinalT>
1210 if(not useColGidProviders_)
1213 if(colMaps_[i]==Teuchos::null)
1214 colMaps_[i] = buildColMap(i);
1224 template<
typename Traits,
typename LocalOrdinalT>
1225 const Teuchos::RCP<Epetra_Map>
1230 if (ghostedMaps_[i].is_null())
1231 ghostedMaps_[i] = buildGhostedMap(i);
1232 return ghostedMaps_[i];
1240 template<
typename Traits,
typename LocalOrdinalT>
1241 const Teuchos::RCP<Epetra_Map>
1246 if (ghostedMaps2_[i].is_null())
1247 ghostedMaps2_[i] = buildGhostedMap2(i);
1248 return ghostedMaps2_[i];
1256 template<
typename Traits,
typename LocalOrdinalT>
1257 const Teuchos::RCP<Epetra_Map>
1262 if (not useColGidProviders_)
1263 return getGhostedMap(i);
1264 if (colGhostedMaps_[i].is_null())
1265 colGhostedMaps_[i] = buildColGhostedMap(i);
1266 return colGhostedMaps_[i];
1274 template<
typename Traits,
typename LocalOrdinalT>
1275 const Teuchos::RCP<Epetra_Map>
1280 if (not useColGidProviders_)
1281 return getGhostedMap2(i);
1282 if (colGhostedMaps2_[i].is_null())
1283 colGhostedMaps2_[i] = buildColGhostedMap2(i);
1284 return colGhostedMaps2_[i];
1288 template <
typename Traits,
typename LocalOrdinalT>
1292 typedef std::unordered_map<std::pair<int,int>,Teuchos::RCP<Epetra_CrsGraph>,
panzer::pair_hash> GraphMap;
1294 GraphMap::const_iterator itr = graphs_.find(std::make_pair(i,j));
1295 Teuchos::RCP<Epetra_CrsGraph> graph;
1296 if(itr==graphs_.end()) {
1297 graph = buildGraph(i,j);
1298 graphs_[std::make_pair(i,j)] = graph;
1301 graph = itr->second;
1303 TEUCHOS_ASSERT(graph!=Teuchos::null);
1307 template <
typename Traits,
typename LocalOrdinalT>
1311 typedef std::unordered_map<std::pair<int,int>,Teuchos::RCP<Epetra_CrsGraph>,
panzer::pair_hash> GraphMap;
1313 GraphMap::const_iterator itr = ghostedGraphs_.find(std::make_pair(i,j));
1314 Teuchos::RCP<Epetra_CrsGraph> ghostedGraph;
1315 if(itr==ghostedGraphs_.end()) {
1316 ghostedGraph = buildGhostedGraph(i,j,
true);
1317 ghostedGraphs_[std::make_pair(i,j)] = ghostedGraph;
1320 ghostedGraph = itr->second;
1322 TEUCHOS_ASSERT(ghostedGraph!=Teuchos::null);
1323 return ghostedGraph;
1331 template<
typename Traits,
typename LocalOrdinalT>
1332 const Teuchos::RCP<Epetra_Import>
1338 if (importers_[i].is_null())
1339 importers_[i] = rcp(
new Epetra_Import(*getGhostedMap(i), *getMap(i)));
1340 return importers_[i];
1348 template<
typename Traits,
typename LocalOrdinalT>
1349 const Teuchos::RCP<Epetra_Import>
1355 if (importers2_[i].is_null())
1356 importers2_[i] = rcp(
new Epetra_Import(*getGhostedMap2(i), *getMap(i)));
1357 return importers2_[i];
1365 template<
typename Traits,
typename LocalOrdinalT>
1366 const Teuchos::RCP<Epetra_Import>
1372 if (not useColGidProviders_)
1373 return getGhostedImport(i);
1374 if (colImporters_[i].is_null())
1376 rcp(
new Epetra_Import(*getGhostedColMap(i), *getColMap(i)));
1377 return colImporters_[i];
1385 template<
typename Traits,
typename LocalOrdinalT>
1386 const Teuchos::RCP<Epetra_Import>
1392 if (not useColGidProviders_)
1393 return getGhostedImport2(i);
1394 if (colImporters2_[i].is_null())
1396 rcp(
new Epetra_Import(*getGhostedColMap2(i), *getColMap(i)));
1397 return colImporters2_[i];
1405 template<
typename Traits,
typename LocalOrdinalT>
1406 const Teuchos::RCP<Epetra_Export>
1412 if (exporters_[i].is_null())
1413 exporters_[i] = rcp(
new Epetra_Export(*getGhostedMap(i), *getMap(i)));
1414 return exporters_[i];
1422 template<
typename Traits,
typename LocalOrdinalT>
1423 const Teuchos::RCP<Epetra_Export>
1429 if (exporters_[i].is_null())
1430 exporters_[i] = rcp(
new Epetra_Export(*getGhostedMap2(i), *getMap(i)));
1431 return exporters_[i];
1439 template<
typename Traits,
typename LocalOrdinalT>
1440 const Teuchos::RCP<Epetra_Export>
1446 if (not useColGidProviders_)
1447 return getGhostedExport(i);
1448 if (colExporters_[i].is_null())
1449 colExporters_[i] = rcp(
new Epetra_Export(*getGhostedColMap(i),
1451 return colExporters_[i];
1459 template<
typename Traits,
typename LocalOrdinalT>
1460 const Teuchos::RCP<Epetra_Export>
1466 if (not useColGidProviders_)
1467 return getGhostedExport2(i);
1468 if (colExporters_[i].is_null())
1469 colExporters_[i] = rcp(
new Epetra_Export(*getGhostedColMap2(i),
1471 return colExporters_[i];
1474 template <
typename Traits,
typename LocalOrdinalT>
1478 std::vector<int> indices;
1481 getGlobalIndexer(i)->getOwnedIndices(indices);
1483 return Teuchos::rcp(
new Epetra_Map(-1,indices.size(),&indices[0],0,*eComm_));
1486 template <
typename Traits,
typename LocalOrdinalT>
1490 if(not useColGidProviders_)
1493 std::vector<int> indices;
1496 getColGlobalIndexer(i)->getOwnedIndices(indices);
1498 return Teuchos::rcp(
new Epetra_Map(-1,indices.size(),&indices[0],0,*eComm_));
1506 template<
typename Traits,
typename LocalOrdinalT>
1507 const Teuchos::RCP<Epetra_Map>
1514 vector<int> indices;
1515 getGlobalIndexer(i)->getOwnedAndGhostedIndices(indices);
1516 return rcp(
new Epetra_Map(-1, indices.size(), &indices[0], 0, *eComm_));
1524 template<
typename Traits,
typename LocalOrdinalT>
1525 const Teuchos::RCP<Epetra_Map>
1532 vector<int> indices;
1533 getGlobalIndexer(i)->getGhostedIndices(indices);
1534 return rcp(
new Epetra_Map(-1, indices.size(), &indices[0], 0, *eComm_));
1542 template<
typename Traits,
typename LocalOrdinalT>
1543 const Teuchos::RCP<Epetra_Map>
1550 if (not useColGidProviders_)
1551 return buildGhostedMap(i);
1552 vector<int> indices;
1553 getColGlobalIndexer(i)->getOwnedAndGhostedIndices(indices);
1554 return rcp(
new Epetra_Map(-1, indices.size(), &indices[0], 0, *eComm_));
1562 template<
typename Traits,
typename LocalOrdinalT>
1563 const Teuchos::RCP<Epetra_Map>
1570 if (not useColGidProviders_)
1571 return buildGhostedMap2(i);
1572 vector<int> indices;
1573 getColGlobalIndexer(i)->getGhostedIndices(indices);
1574 return rcp(
new Epetra_Map(-1, indices.size(), &indices[0], 0, *eComm_));
1578 template <
typename Traits,
typename LocalOrdinalT>
1587 RCP<Epetra_Map> map_i = getMap(i);
1588 RCP<Epetra_Map> map_j = getColMap(j);
1590 TEUCHOS_ASSERT(map_i!=Teuchos::null);
1591 TEUCHOS_ASSERT(map_j!=Teuchos::null);
1593 RCP<Epetra_CrsGraph> graph = rcp(
new Epetra_CrsGraph(
Copy,*map_i,0));
1594 RCP<Epetra_CrsGraph> oGraph = buildFilteredGhostedGraph(i,j);
1599 RCP<Epetra_Export> exporter = getGhostedExport(i);
1600 int err = graph->Export( *oGraph, *exporter, Insert );
1601 TEUCHOS_ASSERT_EQUALITY(err,0);
1602 graph->FillComplete(*map_j,*map_i);
1603 graph->OptimizeStorage();
1608 template <
typename Traits,
typename LocalOrdinalT>
1613 Teuchos::RCP<Epetra_Map> rowMap = getGhostedMap(i);
1614 Teuchos::RCP<Epetra_Map> colMap = getGhostedColMap(j);
1615 Teuchos::RCP<Epetra_CrsGraph> graph = Teuchos::rcp(
new Epetra_CrsGraph(
Copy,*rowMap,*colMap,0));
1617 std::vector<std::string> elementBlockIds;
1619 Teuchos::RCP<const UniqueGlobalIndexer<LocalOrdinalT,int> > rowProvider, colProvider;
1621 rowProvider = getGlobalIndexer(i);
1622 colProvider = getColGlobalIndexer(j);
1624 rowProvider->getElementBlockIds(elementBlockIds);
1627 const Teuchos::RCP<const ConnManagerBase<LocalOrdinalT> > conn_mgr = colProvider->getConnManagerBase();
1628 const bool han = conn_mgr.is_null() ? false : conn_mgr->hasAssociatedNeighbors();
1631 std::vector<std::string>::const_iterator blockItr;
1632 for(blockItr=elementBlockIds.begin();blockItr!=elementBlockIds.end();++blockItr) {
1633 std::string blockId = *blockItr;
1636 const std::vector<LocalOrdinalT> & elements = rowProvider->getElementBlock(blockId);
1640 std::vector<int> row_gids;
1641 std::vector<int> col_gids;
1644 for(std::size_t elmt=0;elmt<elements.size();elmt++) {
1645 rowProvider->getElementGIDs(elements[elmt],row_gids);
1646 colProvider->getElementGIDs(elements[elmt],col_gids);
1649 const std::vector<LocalOrdinalT>& aes = conn_mgr->getAssociatedNeighbors(elements[elmt]);
1650 for (
typename std::vector<LocalOrdinalT>::const_iterator eit = aes.begin();
1651 eit != aes.end(); ++eit) {
1652 std::vector<int> other_col_gids;
1653 colProvider->getElementGIDs(*eit, other_col_gids);
1654 col_gids.insert(col_gids.end(), other_col_gids.begin(), other_col_gids.end());
1658 for(std::size_t row=0;row<row_gids.size();row++)
1659 graph->InsertGlobalIndices(row_gids[row],col_gids.size(),&col_gids[0]);
1665 graph->FillComplete(*colMap,*rowMap);
1667 graph->OptimizeStorage();
1672 template <
typename Traits,
typename LocalOrdinalT>
1678 using Teuchos::rcp_dynamic_cast;
1681 RCP<const Filtered_UniqueGlobalIndexer<LocalOrdinalT,int> > filtered_ugi
1685 if(filtered_ugi==Teuchos::null)
1686 return buildGhostedGraph(i,j,
true);
1689 std::vector<int> ghostedActive;
1690 filtered_ugi->getOwnedAndGhostedNotFilteredIndicator(ghostedActive);
1693 Teuchos::RCP<Epetra_CrsGraph> filteredGraph = buildGhostedGraph(i,j,
false);
1697 for(
int i=0;i<filteredGraph->NumMyRows();i++) {
1698 std::vector<int> removedIndices;
1701 TEUCHOS_ASSERT(filteredGraph->ExtractMyRowView(i,numIndices,indices)==0);
1703 for(
int j=0;j<numIndices;j++) {
1704 if(ghostedActive[indices[j]]==0)
1705 removedIndices.push_back(indices[j]);
1708 TEUCHOS_ASSERT(filteredGraph->RemoveMyIndices(i,Teuchos::as<int>(removedIndices.size()),&removedIndices[0])==0);
1712 Teuchos::RCP<Epetra_Map> rowMap = getGhostedMap(i);
1713 Teuchos::RCP<Epetra_Map> colMap = getGhostedColMap(j);
1715 TEUCHOS_ASSERT(filteredGraph->FillComplete(*colMap,*rowMap)==0);
1716 TEUCHOS_ASSERT(filteredGraph->OptimizeStorage()==0);
1718 return filteredGraph;
1721 template <
typename Traits,
typename LocalOrdinalT>
1725 Teuchos::RCP<Epetra_CrsGraph> eGraph = getGraph(i,j);
1726 Teuchos::RCP<Epetra_CrsMatrix> mat = Teuchos::rcp(
new Epetra_CrsMatrix(
Copy, *eGraph));
1727 TEUCHOS_ASSERT(mat->Filled());
1731 template <
typename Traits,
typename LocalOrdinalT>
1735 Teuchos::RCP<Epetra_CrsGraph> eGraph = getGhostedGraph(i,j);
1736 Teuchos::RCP<Epetra_CrsMatrix> mat = Teuchos::rcp(
new Epetra_CrsMatrix(
Copy, *eGraph));
1737 TEUCHOS_ASSERT(mat->Filled());
1741 template <
typename Traits,
typename LocalOrdinalT>
1748 template <
typename Traits,
typename LocalOrdinalT>
1752 return rowDOFManagerContainer_->getFieldBlocks();
1755 template <
typename Traits,
typename LocalOrdinalT>
1759 return colDOFManagerContainer_->getFieldBlocks();
1764 #endif // __Panzer_BlockedEpetraLinearObjFactory_impl_hpp__ 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...
virtual Teuchos::RCP< LinearObjContainer > buildGhostedLinearObjContainer() const
Teuchos::RCP< Thyra::VectorBase< double > > getGhostedThyraRangeVector() const
Get a range vector.
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 ghostToGlobalEpetraVector(int i, const Epetra_Vector &in, Epetra_Vector &out, bool col) const
virtual void readVector(const std::string &identifier, LinearObjContainer &loc, int id) const
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.
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
const Teuchos::RCP< Epetra_CrsMatrix > get_A() const
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...
virtual void writeVector(const std::string &identifier, const LinearObjContainer &loc, int id) const
Teuchos::RCP< const Epetra_Comm > eComm_
virtual Teuchos::RCP< ReadOnlyVector_GlobalEvaluationData > buildReadOnlyDomainContainer() const
Teuchos::RCP< Thyra::VectorBase< double > > getThyraDomainVector() 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...
void globalToGhostEpetraVector(int i, const Epetra_Vector &in, Epetra_Vector &out, bool col) const
void globalToGhostThyraVector(const Teuchos::RCP< const Thyra::VectorBase< double > > &in, const Teuchos::RCP< Thyra::VectorBase< double > > &out, bool col) const
Teuchos::RCP< const UniqueGlobalIndexer< LocalOrdinalT, int > > getColGlobalIndexer(int i) const
int getBlockColCount() const
how many block columns
virtual void set_x_th(const Teuchos::RCP< Thyra::VectorBase< ScalarT > > &in)=0
virtual const Teuchos::RCP< Epetra_CrsGraph > buildGhostedGraph(int i, int j, bool optimizeStorage) const
virtual void adjustForDirichletConditions(const LinearObjContainer &localBCRows, const LinearObjContainer &globalBCRows, LinearObjContainer &ghostedObjs, bool zeroVectorRows=false, bool adjustX=false) const
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getGhostedThyraRangeSpace() const
Get the range vector space (f)
virtual Teuchos::RCP< Thyra::VectorBase< ScalarT > > get_f_th() const =0
virtual void set_dxdt_th(const Teuchos::RCP< Thyra::VectorBase< ScalarT > > &in)=0
void initializeGhostedContainer(int, LinearObjContainer &loc) const
virtual Teuchos::RCP< WriteVector_GlobalEvaluationData > buildWriteDomainContainer() const
virtual const Teuchos::RCP< Epetra_Map > getMap(int i) const
get the map from the matrix
Teuchos::RCP< Thyra::VectorBase< double > > getThyraRangeVector() const
Get a range vector.
void ghostToGlobalEpetraMatrix(int blockRow, const Epetra_CrsMatrix &in, Epetra_CrsMatrix &out) const
This class encapsulates the needs of a gather operation to do a // halo exchange for blocked vector...
virtual const Teuchos::RCP< Epetra_Import > getGhostedImport(int i) const
get importer for converting an overalapped object to a "normal" object
void ghostToGlobalThyraVector(const Teuchos::RCP< const Thyra::VectorBase< double > > &in, const Teuchos::RCP< Thyra::VectorBase< double > > &out, bool col) const
virtual const Teuchos::RCP< Epetra_Map > getGhostedColMap2(int i) const
Get or create the i-th ghosted column map.
void ghostToGlobalThyraMatrix(const Thyra::LinearOpBase< double > &in, Thyra::LinearOpBase< double > &out) const
virtual const Teuchos::RCP< Epetra_CrsGraph > getGhostedGraph(int i, int j) const
get the ghosted graph of the crs matrix
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.
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 ~BlockedEpetraLinearObjFactory()
This class encapsulates the needs of a gather operation to do a halo exchange for blocked vectors...
Teuchos::RCP< const DOFManagerContainer > colDOFManagerContainer_
Teuchos::RCP< const Teuchos::OpaqueWrapper< MPI_Comm > > rawMpiComm_
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.
void addExcludedPairs(const std::vector< std::pair< int, int > > &exPairs)
exclude a vector of pairs from the matrix
const Teuchos::RCP< Epetra_Vector > get_x() const
virtual void set_f_th(const Teuchos::RCP< Thyra::VectorBase< ScalarT > > &in)=0
void setRequiresDirichletAdjustment(bool b)
Teuchos::RCP< Thyra::LinearOpBase< double > > getThyraMatrix() const
Get a Thyra operator.
This class provides a boundary exchange communication mechanism for vectors.
Teuchos::RCP< Thyra::VectorBase< double > > getGhostedThyraDomainVector() const
Get a domain vector.
virtual void ghostToGlobalContainer(const LinearObjContainer &ghostContainer, LinearObjContainer &container, int) const
virtual Teuchos::MpiComm< int > getComm() const
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 applyDirichletBCs(const LinearObjContainer &counter, LinearObjContainer &result) const
void addExcludedPair(int rowBlock, int colBlock)
exclude a block pair from the matrix
Teuchos::RCP< VectorType > get_dxdt() const
void initializeContainer(int, LinearObjContainer &loc) const
This class provides a boundary exchange communication mechanism for vectors.
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...
virtual void globalToGhostContainer(const LinearObjContainer &container, LinearObjContainer &ghostContainer, int) const
virtual const Teuchos::RCP< Epetra_Map > getGhostedMap2(int i) const
Get or create the i-th ghosted map.
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< VectorType > get_f() const
virtual const Teuchos::RCP< Epetra_CrsGraph > buildGraph(int i, int j) const
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getThyraDomainSpace() const
Get the domain vector space (x and dxdt)
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 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 initializeGhostedContainer_internal(int mem, ThyraObjContainer< double > &loc) const
virtual void set_A_th(const Teuchos::RCP< Thyra::LinearOpBase< ScalarT > > &in)=0
Teuchos::RCP< VectorType > get_x() 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 > getGraph(int i, int j) const
get the graph of the crs matrix
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getGhostedThyraDomainSpace2() const
Get or create the ghosted Thyra domain space.
Teuchos::RCP< Thyra::LinearOpBase< double > > getGhostedThyraMatrix() const
Get a Thyra operator.
virtual const Teuchos::RCP< const Epetra_Comm > getEpetraComm() const
get exporter for converting an overalapped object to a "normal" object
virtual const Teuchos::RCP< Epetra_Map > getGhostedColMap(int i) const
get the ghosted map from the matrix
Teuchos::RCP< const panzer::BlockedDOFManager< int, int > > getGlobalIndexer() const
void buildGatherScatterEvaluators(const BuilderT &builder)
void initializeContainer_internal(int mem, ThyraObjContainer< double > &loc) const
int getBlockRowCount() const
how many block rows
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getThyraRangeSpace() const
Get the range vector space (f)
const Teuchos::RCP< Epetra_Vector > get_f() const
Teuchos::RCP< Teuchos::MpiComm< int > > tComm_
Teuchos::RCP< const DOFManagerContainer > rowDOFManagerContainer_
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.
virtual const Teuchos::RCP< Epetra_Export > getGhostedColExport(int j) const
get exporter for converting an overalapped object to a "normal" object
const Teuchos::RCP< Epetra_Vector > get_dxdt() const
BlockedEpetraLinearObjFactory(const Teuchos::RCP< const Teuchos::MpiComm< int > > &comm, const Teuchos::RCP< const UniqueGlobalIndexerBase > &gidProvider, bool useDiscreteAdjoint=false)
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getGhostedThyraDomainSpace() const
Get the domain vector space (x and dxdt)
virtual Teuchos::RCP< LinearObjContainer > buildLinearObjContainer() const