本文整理汇总了C++中vector_type::mapType方法的典型用法代码示例。如果您正苦于以下问题:C++ vector_type::mapType方法的具体用法?C++ vector_type::mapType怎么用?C++ vector_type::mapType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector_type
的用法示例。
在下文中一共展示了vector_type::mapType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nbElements
void
ADRAssembler< mesh_type, matrix_type, vector_type>::
addMassRhs (vector_type& rhs, const vector_type& f)
{
// f has to be repeated!
if (f.mapType() == Unique)
{
addMassRhs (rhs, vector_type (f, Repeated) );
return;
}
// Check that the fespace is set
ASSERT (M_fespace != 0, "No FE space for assembling the right hand side (mass)!");
M_massRhsAssemblyChrono.start();
// Some constants
const UInt nbElements (M_fespace->mesh()->numElements() );
const UInt fieldDim (M_fespace->fieldDim() );
const UInt nbFEDof (M_massRhsCFE->nbFEDof() );
const UInt nbQuadPt (M_massRhsCFE->nbQuadPt() );
const UInt nbTotalDof (M_fespace->dof().numTotalDof() );
// Temporaries
Real localValue (0.0);
std::vector<Real> fValues (nbQuadPt, 0.0);
// Loop over the elements
for (UInt iterElement (0); iterElement < nbElements; ++iterElement)
{
// Update the diffusion current FE
M_massRhsCFE->update ( M_fespace->mesh()->element (iterElement), UPDATE_PHI | UPDATE_WDET );
// Clean the local matrix
M_localMassRhs->zero();
// Assemble the local diffusion
for (UInt iterFDim (0); iterFDim < fieldDim; ++iterFDim)
{
localVector_type::vector_view localView = M_localMassRhs->block (iterFDim);
// Compute the value of f in the quadrature nodes
for (UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
{
fValues[iQuadPt] = 0.0;
for (UInt iDof (0); iDof < nbFEDof ; ++iDof)
{
fValues[iQuadPt] +=
f[ M_fespace->dof().localToGlobalMap (iterElement, iDof) + iterFDim * nbTotalDof]
* M_massRhsCFE->phi (iDof, iQuadPt);
}
}
// Loop over the basis functions
for (UInt iDof (0); iDof < nbFEDof ; ++iDof)
{
localValue = 0.0;
//Loop on the quadrature nodes
for (UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
{
localValue += fValues[iQuadPt]
* M_massRhsCFE->phi (iDof, iQuadPt)
* M_massRhsCFE->wDetJacobian (iQuadPt);
}
// Add on the local matrix
localView (iDof) = localValue;
}
}
// Here add in the global rhs
for (UInt iterFDim (0); iterFDim < fieldDim; ++iterFDim)
{
assembleVector ( rhs,
iterElement,
*M_localMassRhs,
nbFEDof,
M_fespace->dof(),
iterFDim,
iterFDim * M_fespace->dof().numTotalDof() );
}
}
M_massRhsAssemblyChrono.stop();
}