本文整理汇总了C++中Basis::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Basis::size方法的具体用法?C++ Basis::size怎么用?C++ Basis::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Basis
的用法示例。
在下文中一共展示了Basis::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setSchreyerMultipliers
void setSchreyerMultipliers(const Basis& basis) {
MonoVector schreyer(monoid());
for (size_t gen = 0; gen < basis.size(); ++gen)
schreyer.push_back(basis.getPoly(gen)->getLeadMonomial());
setSchreyerMultipliers(std::move(schreyer));
}
示例2: geometry
void NumericalTestTrialIntegrator<BasisFunctionType, ResultType, GeometryFactory>::integrate(
const std::vector<int>& elementIndices,
const Basis<BasisFunctionType>& testBasis,
const Basis<BasisFunctionType>& trialBasis,
arma::Cube<ResultType>& result) const
{
const size_t pointCount = m_localQuadPoints.n_cols;
const size_t elementCount = elementIndices.size();
if (pointCount == 0 || elementCount == 0)
return;
// TODO: in the (pathological) case that pointCount == 0 but
// elementCount != 0, set elements of result to 0.
// Evaluate constants
const int componentCount = m_testTransformations.resultDimension(0);
const int testDofCount = testBasis.size();
const int trialDofCount = trialBasis.size();
// if (m_trialTransformations.codomainDimension() != componentCount)
// throw std::runtime_error("NumericalTestTrialIntegrator::integrate(): "
// "test and trial functions "
// "must have the same number of components");
BasisData<BasisFunctionType> testBasisData, trialBasisData;
GeometricalData<CoordinateType> geomData;
size_t testBasisDeps = 0, trialBasisDeps = 0;
size_t geomDeps = INTEGRATION_ELEMENTS;
m_testTransformations.addDependencies(testBasisDeps, geomDeps);
m_trialTransformations.addDependencies(trialBasisDeps, geomDeps);
typedef typename GeometryFactory::Geometry Geometry;
std::auto_ptr<Geometry> geometry(m_geometryFactory.make());
CollectionOf3dArrays<BasisFunctionType> testValues, trialValues;
result.set_size(testDofCount, trialDofCount, elementCount);
testBasis.evaluate(testBasisDeps, m_localQuadPoints, ALL_DOFS, testBasisData);
trialBasis.evaluate(trialBasisDeps, m_localQuadPoints, ALL_DOFS, trialBasisData);
// Iterate over the elements
for (size_t e = 0; e < elementCount; ++e)
{
m_rawGeometry.setupGeometry(elementIndices[e], *geometry);
geometry->getData(geomDeps, m_localQuadPoints, geomData);
m_testTransformations.evaluate(testBasisData, geomData, testValues);
m_trialTransformations.evaluate(trialBasisData, geomData, trialValues);
for (int trialDof = 0; trialDof < trialDofCount; ++trialDof)
for (int testDof = 0; testDof < testDofCount; ++testDof)
{
ResultType sum = 0.;
for (size_t point = 0; point < pointCount; ++point)
for (int dim = 0; dim < componentCount; ++dim)
sum += m_quadWeights[point] *
geomData.integrationElements(point) *
conjugate(testValues[0](dim, testDof, point)) *
trialValues[0](dim, trialDof, point);
result(testDof, trialDof, e) = sum;
}
}
}