当前位置: 首页>>代码示例>>C++>>正文


C++ Space::gridView方法代码示例

本文整理汇总了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;
}
开发者ID:evantwout,项目名称:bempp,代码行数:54,代码来源:function_projector.hpp

示例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();
    }
开发者ID:huidong80,项目名称:bempp,代码行数:14,代码来源:local_assembler_construction_helper.hpp

示例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;
}
开发者ID:huidong80,项目名称:bempp,代码行数:14,代码来源:space.cpp


注:本文中的Space::gridView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。