Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #include "MOR_EpetraMVDenseMatrixView.hpp"
00008
00009 #include "Epetra_MultiVector.h"
00010
00011 #include "Epetra_SerialDenseMatrix.h"
00012 #include "Epetra_SerialSymDenseMatrix.h"
00013
00014 #include "Epetra_Comm.h"
00015
00016 #include "Teuchos_TestForException.hpp"
00017
00018 namespace MOR {
00019
00020 namespace {
00021
00022 bool any(const Epetra_Comm &comm, bool localCondition) {
00023 int localValue = static_cast<int>(localCondition);
00024 int result;
00025 comm.MaxAll(&localValue, &result, 1);
00026 return result;
00027 }
00028
00029 bool all(const Epetra_Comm &comm, bool localCondition) {
00030 int localValue = static_cast<int>(localCondition);
00031 int result;
00032 comm.MinAll(&localValue, &result, 1);
00033 return result;
00034 }
00035
00036 }
00037
00038 Epetra_SerialDenseMatrix localDenseMatrixView(Epetra_MultiVector &mv) {
00039 double *values;
00040 int localLeadDim;
00041 mv.ExtractView(&values, &localLeadDim);
00042 return Epetra_SerialDenseMatrix(View, values, localLeadDim, mv.MyLength(), mv.NumVectors());
00043 }
00044
00045 Epetra_SerialSymDenseMatrix localSymDenseMatrixView(Epetra_MultiVector &mv) {
00046 const int matrixSize = mv.NumVectors();
00047 TEUCHOS_TEST_FOR_EXCEPT(any(mv.Comm(), matrixSize != mv.MyLength()));
00048 double *values;
00049 int localLeadDim;
00050 mv.ExtractView(&values, &localLeadDim);
00051 return Epetra_SerialSymDenseMatrix(View, values, localLeadDim, matrixSize);
00052 }
00053
00054 }