Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "TSFEpetraGhostView.hpp"
00028 #include "Epetra_Import.h"
00029
00030
00031 using namespace Teuchos;
00032 using namespace TSFExtended;
00033
00034 const double& EpetraGhostView::getElement(OrdType globalIndex) const
00035 {
00036 const Epetra_BlockMap& myMap = ghostView_->Map();
00037 return (*ghostView_)[myMap.LID(globalIndex)];
00038 }
00039
00040 void EpetraGhostView::getElements(const OrdType* globalIndices, int numElems,
00041 Array<double>& elems) const
00042 {
00043 elems.resize(numElems);
00044 const Epetra_BlockMap& myMap = ghostView_->Map();
00045
00046 for (int i=0; i<numElems; i++)
00047 {
00048 elems[i] = (*ghostView_)[myMap.LID(globalIndices[i])];
00049 }
00050 }
00051
00052 void EpetraGhostView::import(const Epetra_Import& importer,
00053 const Epetra_Vector& srcObject)
00054 {
00055
00056
00057 if (ghostView_.get()==0)
00058 {
00059 ghostView_ = rcp(new Epetra_Vector(importer.TargetMap()));
00060 }
00061
00062
00063 int ierr = ghostView_->Import(srcObject, importer, Insert);
00064 TEST_FOR_EXCEPTION(ierr < 0, std::runtime_error, "ierr=" << ierr << " in EpetraGhostView::import()");
00065 }
00066
00067 void EpetraGhostView::print(std::ostream& os) const
00068 {
00069 if (ghostView_.get()==0)
00070 {
00071 os << "[null Epetra ghost view]" << std::endl;
00072 }
00073 else
00074 {
00075 ghostView_->Print(os);
00076 }
00077 }