Exemple #1
0
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;
}
Exemple #2
0
void getAllShapesets(const Space<BasisFunctionType>& space,
        std::vector<const Fiber::Shapeset<BasisFunctionType>*>& shapesets)
{
    std::auto_ptr<GridView> view = space.grid()->leafView();
    const Mapper& mapper = view->elementMapper();
    const int elementCount = view->entityCount(0);

    shapesets.resize(elementCount);

    std::auto_ptr<EntityIterator<0> > it = view->entityIterator<0>();
    while (!it->finished()) {
        const Entity<0>& e = it->entity();
        shapesets[mapper.entityIndex(e)] = &space.shapeset(e);
        it->next();
    }
}
Exemple #3
0
Matrix<ValueType> evaluateLocalBasis(const Space<double>& space, const Entity<0>& element, 
        const Matrix<double>& local, const Vector<ValueType>& localCoefficients)
{


  if (local.rows() != space.grid()->dim())
    throw std::invalid_argument("evaluate(): points in 'local' have an "
                                "invalid number of coordinates");

  const int nComponents = space.codomainDimension();
  Matrix<ValueType> values(nComponents, local.cols());
  values.setZero();

  // Find out which basis data need to be calculated
  size_t basisDeps = 0, geomDeps = 0;
  // Find out which geometrical data need to be calculated,
  const Fiber::CollectionOfShapesetTransformations<double>
      &transformations = space.basisFunctionValue();
  transformations.addDependencies(basisDeps, geomDeps);

  // Get basis data
  const Fiber::Shapeset<double> &shapeset =
      space.shapeset(element);
  Fiber::BasisData<double> basisData;
  shapeset.evaluate(basisDeps, local, ALL_DOFS, basisData);
  // Get geometrical data
  Fiber::GeometricalData<double> geomData;
  element.geometry().getData(geomDeps, local, geomData);
  // Get shape function values
  Fiber::CollectionOf3dArrays<double> functionValues;
  transformations.evaluate(basisData, geomData, functionValues);

  // Calculate grid function values
  for (size_t p = 0; p < functionValues[0].extent(2); ++p)
    for (size_t f = 0; f < functionValues[0].extent(1); ++f)
      for (size_t dim = 0; dim < functionValues[0].extent(0); ++dim)
        values(dim, p) += functionValues[0](dim, f, p) * localCoefficients(f);

  return values;
}