54 #include <lifev/core/LifeV.hpp> 56 #include <lifev/core/array/MatrixElemental.hpp> 57 #include <lifev/core/array/VectorElemental.hpp> 58 #include <lifev/core/array/MatrixEpetra.hpp> 59 #include <lifev/core/array/VectorEpetra.hpp> 61 #include <lifev/core/fem/CurrentFE.hpp> 62 #include <lifev/core/fem/DOFLocalPattern.hpp> 75 template <
typename DofType>
86 assembleVector (globalVector, elementID, localVector, currentFE
.nbFEDof(), dof, block, offset);
94 template <
typename DofType>
97 const UInt& elementID,
109 for (
UInt i (0) ; i < feNbDof ; ++i )
111 iGlobalID = dof.localToGlobalMap ( elementID, i ) + offset;
112 globalVector.sumIntoGlobalValues ( iGlobalID, localView ( i ) );
121 template <
typename DofType>
124 const UInt& elementID,
137 assembleMatrix ( globalMatrix,
144 dof, iOffset, jOffset);
152 template <
typename DofType>
164 return assembleMatrix ( globalMatrix, localMatrix, currentFE, currentFE, dof, dof,
165 iblock, jblock, iOffset, jOffset);
173 template <
typename DofType1,
typename DofType2,
typename LocalMatrixType>
176 UInt const& elementID1,
177 UInt const& elementID2,
178 LocalMatrixType& localMatrix,
181 const DofType1& dof1,
182 const DofType2& dof2,
187 assembleMatrix (globalMatrix, elementID1, elementID2, localMatrix, currentFE1
.nbFEDof(), currentFE2
.nbFEDof(),
188 dof1, dof2, iOffset, jOffset);
197 template <
typename DofType1,
typename DofType2,
typename LocalMatrixType>
200 UInt const& elementID1,
201 UInt const& elementID2,
202 LocalMatrixType& localMatrix,
203 const UInt& fe1NbDof,
204 const UInt& fe2NbDof,
205 const DofType1& dof1,
206 const DofType2& dof2,
212 std::vector<Int> iList (fe1NbDof);
213 std::vector<Int> jList (fe2NbDof);
216 std::vector<Real*> matPtr (fe2NbDof);
219 for (
UInt k1 (0) ; k1 < fe1NbDof ; k1++ )
221 iList[k1] = dof1.localToGlobalMap ( elementID1, k1 ) + iOffset ;
224 for (
UInt k2 (0) ; k2 < fe2NbDof ; k2++ )
226 jList[k2] = dof2.localToGlobalMap ( elementID2, k2 ) + jOffset ;
227 matPtr[k2] = & (localMatrix (
static_cast<UInt> (0), k2) );
230 assert (localMatrix.indexij (
Int (1),
Int (0) ) == 1);
232 globalMatrix.addToCoefficients ( fe1NbDof, fe2NbDof, iList, jList, &matPtr[0], Epetra_FECrsMatrix::COLUMN_MAJOR );
240 template <
typename DofType1,
typename DofType2>
246 const DofType1& dof1,
247 const DofType2& dof2,
259 assembleMatrix ( globalMatrix, elementID1, elementID2, localView,
260 currentFE1, currentFE2, dof1, dof2, iOffset, jOffset );
273 template <
typename DofType1,
typename DofType2>
280 const DofType1& dof1,
281 const DofType2& dof2,
289 localView *= coefficient;
297 std::vector<Int> ilist (currentFE1.nbFEDof() );
298 std::vector<Int> jlist (currentFE2.nbFEDof() );
300 std::vector<Real*> matPtr (currentFE1.nbFEDof() );
302 for ( k1 = 0 ; k1 < currentFE1
.nbFEDof() ; k1++ )
305 ilist[k1] = dof1.localToGlobalMap ( elementID1, i ) + iOffset ;
306 matPtr[k1] = & (localView (0, i) );
309 for ( k2 = 0 ; k2 < currentFE2
.nbFEDof() ; k2++ )
312 jlist[k2] = dof2.localToGlobalMap ( elementID2, j ) + jOffset ;
315 assert (localView.indexij ( Int (1), Int (0) ) == 1);
317 globalMatrix.addToCoefficients ( currentFE1.nbFEDof(), currentFE2.nbFEDof(),
318 ilist, jlist, &matPtr[0], Epetra_FECrsMatrix::ROW_MAJOR );
322 template <
typename DOF,
typename VectorElemental>
325 VectorElemental& elvec,
329 const UInt elvecBlock )
331 typename VectorElemental::vector_view vec = elvec.block ( elvecBlock );
335 const UInt ig = dof.localToGlobalMap ( feId, i );
336 vec ( i ) = V
[ ig ];
VectorEpetra - The Epetra Vector format Wrapper.
void importFromHDF5(std::string const &fileName, std::string const &matrixName="matrix")
Read a matrix from a HDF5 (.h5) file.
int32_type Int
Generic integer data.
const data_type & operator[](const UInt row) const
Access operators.
void updateInverseJacobian(const UInt &iQuadPt)
DOFLocalPattern - A class to store the "couplings" between the basis functions.
double Real
Generic real data.
CurrentFE - A primordial class for the assembly of the local matrices/vectors retaining the values on...
UInt nbFEDof() const
Getter for the number of nodes.
const UInt & nbLocalDof() const
Return the number of local degrees of freedom.
UInt currentLocalId() const
Getter for the local ID of the current cell.
uint32_type UInt
generic unsigned integer (used mainly for addressing)