Пример #1
0
  BemppGridGeometry(
      const GeometryType &type,
      const std::vector<FieldVector<double, coorddimension>> &coordinates) {

    if (!(type == this->type()))
      DUNE_THROW(Exception, "Only lines are supported by this Geometry type.");

    if (coordinates.size() != vertexcount)
      DUNE_THROW(RangeError, "Expected coordinates to have three elements.");

    for (int i = 0; i < vertexcount; ++i)
      for (int j = 0; j < coorddimension; ++j)
        m_vertices[j][i] = coordinates[i][j];

    m_transformation = m_vertices.rightmultiplyany(m_coeffsToVertex);
  }
Пример #2
0
  /** \brief Create a structured simplex grid

      \note Simplices are not supported in YaspGrid, so this functions
            unconditionally throws a GridError.
  */
  static std::unique_ptr<GridType>
  createSimplexGrid(const FieldVector<ctype, dimworld> &lowerLeft,
                    const FieldVector<ctype, dimworld> &upperRight,
                    const array<int, dim> &elements) {
    DUNE_THROW(GridError,
               className<BemppStructuredGridFactory>()
                   << "::createSimplexGrid(): Simplices are not supported "
                      "by YaspGrid.");
  }
Пример #3
0
  unsigned int subEntities(int codim) {

    switch (codim) {
    case 0:
      return 1;
    case 1:
      return 3;
    case 2:
      return 3;
    default:
      DUNE_THROW(RangeError, "codim must be between 0 and 2");
    }
  }
Пример #4
0
  /** \brief Create a structured cube grid

      \param lowerLeft  Lower left corner of the grid
      \param upperRight Upper right corner of the grid
      \param elements   Number of elements in each coordinate direction

      \note YaspGrid only supports lowerLeft at the origin.  This
            function throws a GridError if this requirement is not met.
  */
  static std::unique_ptr<GridType>
  createCubeGrid(const FieldVector<ctype, dimworld> &lowerLeft,
                 const FieldVector<ctype, dimworld> &upperRight,
                 const array<int, dim> &elements) {
    for (int d = 0; d < dimworld; ++d)
      if (std::abs(lowerLeft[d]) > std::abs(upperRight[d]) * 1e-10)
        DUNE_THROW(GridError,
                   className<BemppStructuredGridFactory>()
                       << "::createCubeGrid(): The lower coordinates "
                          "must be at the origin for YaspGrid.");

    FieldVector<int, dim> elements_;
    std::copy(elements.begin(), elements.end(), elements_.begin());

    return std::unique_ptr<GridType>(
        new GridType(upperRight, elements_, FieldVector<bool, dim>(false), 0));
  }
Пример #5
0
	    IndexType subIndex(const cpgrid::Entity<codim>& /* e */, int /* i */, unsigned int /* cc */) const
	    {
	      DUNE_THROW(NotImplemented, "subIndex not implemented for codim"
			 << codim << "entities.");
	    }
Пример #6
0
	    IndexType subIndex(const cpgrid::Entity<codim>& e, int i, unsigned int cc) const
	    {
	      DUNE_THROW(NotImplemented, "subIndex not implemented for codim"
			 << codim << "entities.");
	    }