本文整理汇总了C++中MESH::elementsEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ MESH::elementsEnd方法的具体用法?C++ MESH::elementsEnd怎么用?C++ MESH::elementsEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MESH
的用法示例。
在下文中一共展示了MESH::elementsEnd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_pair
std::pair<double,double> probe( const MESH& mesh, const DISP& displacement,
const PRESS& pressure )
{
// pick an element
const std::size_t numElements = std::distance( mesh.elementsBegin(), mesh.elementsEnd() );
const std::size_t elemNum = (numElements +
static_cast<std::size_t>(std::sqrt(numElements)) ) / 2;
// geometry
const typename MESH::Element* geomEp = mesh.elementPtr( elemNum );
const typename base::Vector<MESH::Element::dim>::Type xi =
base::constantVector<MESH::Element::dim>( 0. );
const typename base::Geometry<typename MESH::Element>::result_type x =
base::Geometry<typename MESH::Element>()( geomEp, xi );
// displacement
const typename DISP::Element* dispEp = displacement.elementPtr( elemNum );
const typename base::Vector<DISP::DegreeOfFreedom::size>::Type uh =
base::post::evaluateField( geomEp, dispEp, xi );
// pressure
const typename PRESS::Element* pressEp = pressure.elementPtr( elemNum );
const typename base::Vector<PRESS::DegreeOfFreedom::size>::Type ph =
base::post::evaluateField( geomEp, pressEp, xi );
return std::make_pair( uh[1], ph[0] );
}
示例2: errorComputation
double errorComputation( const QUADRATURE& quadrature,
const MESH& mesh,
const FIELD& field,
const typename
base::post::ErrorNorm<
typename MESH::Element,
typename FIELD::Element,
ORDER>::Reference& refSol )
{
typedef ErrorNorm<typename MESH::Element,typename FIELD::Element,
ORDER> Error;
Error error( refSol );
// compute for every element the error
typename MESH::ElementPtrConstIter elemIter = mesh.elementsBegin();
typename MESH::ElementPtrConstIter elemLast = mesh.elementsEnd();
double errorSquared = 0.;
for ( ; elemIter != elemLast; ++elemIter ) {
// work around to get the ID of the field elements
const std::size_t fieldElemID = detail_::getID( *elemIter );
// get corresponding field element
typename FIELD::Element* fieldElem =
field.elementPtr( fieldElemID );
// Construct a field element pointer tuple
base::asmb::FieldElementPointerTuple<
typename MESH::Element*,
typename FIELD::Element*> fept( *elemIter, fieldElem );
// apply quadrature
quadrature.apply( error, fept, errorSquared );
}
// return the square root of the sum of the squares
return std::sqrt( errorSquared );
}