8 #include <lifev/core/linear_algebra/BlockEpetra_MultiVector.hpp> 45 ASSERT_PRE(iblock < M_nBlocks,
"Asking a block out of range!");
47 double ** arrayOfPointers;
48 ExtractView(&arrayOfPointers);
49 double ** arrayOfShiftedPointers =
new double*[NumVectors()];
51 for(Int iVect(0); iVect < NumVectors(); ++iVect)
52 arrayOfShiftedPointers[iVect] = arrayOfPointers[iVect] + M_myLocalOffsets[iblock];
54 M_blocks[iblock]->ResetView(arrayOfShiftedPointers);
56 delete[] arrayOfShiftedPointers;
58 return *(M_blocks[iblock]);
63 ASSERT_PRE(iblock < M_nBlocks,
"Asking a block out of range!");
65 double ** arrayOfPointers;
66 ExtractView(&arrayOfPointers);
67 double ** arrayOfShiftedPointers =
new double*[NumVectors()];
69 for(Int iVect(0); iVect < NumVectors(); ++iVect)
70 arrayOfShiftedPointers[iVect] = arrayOfPointers[iVect] + M_myLocalOffsets[iblock];
72 M_blocks[iblock]->ResetView(arrayOfShiftedPointers);
74 delete[] arrayOfShiftedPointers;
76 return *(M_blocks[iblock]);
87 double ** arrayOfPointers;
88 ExtractView(&arrayOfPointers);
89 double ** arrayOfShiftedPointers =
new double*[NumVectors()];
92 for(Int iVect(0); iVect < NumVectors(); ++iVect)
93 arrayOfShiftedPointers[iVect] = arrayOfPointers[iVect] + M_myLocalOffsets[iblock];
94 M_blocks[iblock].reset(
95 new Epetra_MultiVector(View, *(M_blockMap.blockMap(iblock)), arrayOfShiftedPointers, NumVectors())
98 delete[] arrayOfShiftedPointers;
106 const UInt nBlocks(vectors.size());
107 const UInt numVectors(vectors[0]->NumVectors());
109 for(
UInt i(0); i<nBlocks; ++i)
110 ASSERT_PRE( numVectors ==
static_cast<UInt>(vectors[i]->NumVectors()),
"error in BlockEpetra_MultiVector * stride\n");
116 for(UInt i(0); i < nBlocks; ++i)
117 mapPtrContainer[i].reset( blockMap2Map(&(vectors[i]->Map())) );
125 stridedVector->PutScalar(404.3142713);
128 for(UInt i(0); i < nBlocks; ++i)
129 stridedVector->block(i) = *(vectors[i]);
132 return stridedVector;
139 std::vector<
const BlockEpetra_MultiVector::vector_Type *> vectors(2);
142 return stride(vectors);
150 std::vector<
const BlockEpetra_MultiVector::vector_Type *> vectors(3);
154 return stride(vectors);
163 std::vector<
const BlockEpetra_MultiVector::vector_Type *> vectors(4);
168 return stride(vectors);
175 bMV =
new BlockEpetra_MultiVector(View, source, map);
This class handles block access to parallel monolithic Vectors with an underling block structure...
Epetra_MultiVector vector_Type
BlockEpetra_MultiVector * createBlockView(const BlockEpetra_MultiVector::vector_Type &source, const BlockEpetra_Map &map)
Generate a BlockEpetra_MultiVector from a Epetra_MultiVector and a BlockEpetra_Map.
void setUp(const mapPtrContainer_Type &mapPtrContainer)
general setup for arbitrary number of blocks. The maps of the block to stride are collected in a mapP...
Epetra_MultiVector & block(UInt iblock)
Return a Epetra_MultiVector (view) object for block iblock.
BlockEpetra_MultiVector(const BlockEpetra_Map &map, int numVectors, bool zeroOut=true)
Generate a BlockEpetra_MultiVector from a BlockEpetra_Map.
const BlockEpetra_Map & blockEpetraMap() const
retrieve the BlockEpetra_Map
BlockEpetra_MultiVector * stride(const BlockEpetra_MultiVector::vector_Type &v1, const BlockEpetra_MultiVector::vector_Type &v2, const BlockEpetra_MultiVector::vector_Type &v3, const BlockEpetra_MultiVector::vector_Type &v4)
Generate a BlockEpetra_MultiVector from three Epetra_MultiVectors.
void updateInverseJacobian(const UInt &iQuadPt)
std::vector< mapPtr_Type > mapPtrContainer_Type
BlockEpetra_MultiVector(const BlockEpetra_MultiVector &Source)
Copy Constructor.
BlockEpetra_MultiVector(Epetra_DataAccess CV, const vector_Type &source, const BlockEpetra_Map &map)
Overlay a block structure to a source.
A derived class from Epetra_MultiVector specialized to handle parallel block structured Vectors...
BlockEpetra_MultiVector * stride(const BlockEpetra_MultiVector::vector_Type &v1, const BlockEpetra_MultiVector::vector_Type &v2)
Generate a BlockEpetra_MultiVector from two Epetra_MultiVectors.
UInt nBlocks() const
get the number of blocks
const Epetra_MultiVector & block(UInt iblock) const
const version
vectorPtrContainer_Type M_blocks
BlockEpetra_MultiVector * stride(const BlockEpetra_MultiVector::vector_Type &v1, const BlockEpetra_MultiVector::vector_Type &v2, const BlockEpetra_MultiVector::vector_Type &v3)
Generate a BlockEpetra_MultiVector from three Epetra_MultiVectors.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
BlockEpetra_MultiVector * stride(std::vector< const BlockEpetra_MultiVector::vector_Type *> vectors)
Generate a BlockEpetra_MultiVector from a list of Epetra_MultiVector.