本文整理汇总了C++中Space::gridView方法的典型用法代码示例。如果您正苦于以下问题:C++ Space::gridView方法的具体用法?C++ Space::gridView怎么用?C++ Space::gridView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Space
的用法示例。
在下文中一共展示了Space::gridView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reallyCalculateProjections
Vector<ResultType> reallyCalculateProjections(
const Space<BasisFunctionType> &dualSpace,
Fiber::LocalAssemblerForGridFunctions<ResultType> &assembler,
const AssemblyOptions &options) {
// TODO: parallelise using TBB (the parameter options will then start be used)
// Get the grid's leaf view so that we can iterate over elements
const GridView &view = dualSpace.gridView();
const size_t elementCount = view.entityCount(0);
// Global DOF indices corresponding to local DOFs on elements
std::vector<std::vector<GlobalDofIndex>> testGlobalDofs(elementCount);
std::vector<std::vector<BasisFunctionType>> testLocalDofWeights(elementCount);
// Gather global DOF lists
const Mapper &mapper = view.elementMapper();
std::unique_ptr<EntityIterator<0>> it = view.entityIterator<0>();
while (!it->finished()) {
const Entity<0> &element = it->entity();
const int elementIndex = mapper.entityIndex(element);
dualSpace.getGlobalDofs(element, testGlobalDofs[elementIndex],
testLocalDofWeights[elementIndex]);
it->next();
}
// Make a vector of all element indices
std::vector<int> testIndices(elementCount);
for (size_t i = 0; i < elementCount; ++i)
testIndices[i] = i;
// Create the weak form's column vector
Vector<ResultType> result(dualSpace.globalDofCount());
result.setZero();
std::vector<Vector<ResultType>> localResult;
// Evaluate local weak forms
assembler.evaluateLocalWeakForms(testIndices, localResult);
// Loop over test indices
for (size_t testIndex = 0; testIndex < elementCount; ++testIndex)
// Add the integrals to appropriate entries in the global weak form
for (size_t testDof = 0; testDof < testGlobalDofs[testIndex].size();
++testDof) {
int testGlobalDof = testGlobalDofs[testIndex][testDof];
if (testGlobalDof >= 0) // if it's negative, it means that this
// local dof is constrained (not used)
result(testGlobalDof) +=
conj(testLocalDofWeights[testIndex][testDof]) *
localResult[testIndex](testDof);
}
// Return the vector of projections <phi_i, f>
return result;
}
示例2: collectGridData
static void collectGridData(
const Space<BasisFunctionType>& space,
shared_ptr<Fiber::RawGridGeometry<CoordinateType> >& rawGeometry,
shared_ptr<GeometryFactory>& geometryFactory) {
typedef Fiber::RawGridGeometry<CoordinateType> RawGridGeometry;
rawGeometry = boost::make_shared<RawGridGeometry>(space.gridDimension(),
space.worldDimension());
const GridView& view = space.gridView();
view.getRawElementData(
rawGeometry->vertices(), rawGeometry->elementCornerIndices(),
rawGeometry->auxData(), rawGeometry->domainIndices());
geometryFactory = space.elementGeometryFactory();
}
示例3: maximumShapesetOrder
int maximumShapesetOrder(const Space<BasisFunctionType>& space)
{
const GridView& view = space.gridView();
int maxOrder = 0;
std::auto_ptr<EntityIterator<0> > it = view.entityIterator<0>();
while (!it->finished()) {
const Entity<0>& e = it->entity();
maxOrder = std::max(maxOrder, space.shapeset(e).order());
it->next();
}
return maxOrder;
}