Add a ufc::coordinate_mapping class (was ufc::domain)

Issue #83 resolved
Martin Sandve Alnæs created an issue

I'm working on implementing a ufc class for coordinate mappings, initially under the ufc::domain classname but now I'm changing to ufc::coordinate_mapping because that matches better what's needed at this level. Below is the current iteration of the interface right now:

  /// A representation of a coordinate mapping parameterized by a local finite element basis on each cell
  class coordinate_mapping
  {
  public:
    virtual ~coordinate_mapping() {}

    /// Return coordinate_mapping signature string
    virtual const char * signature() const = 0;

    /// Create object of the same type
    virtual coordinate_mapping * create() const = 0;

    /// Return geometric dimension of the coordinate_mapping
    virtual std::size_t geometric_dimension() const = 0;

    /// Return topological dimension of the coordinate_mapping
    virtual std::size_t topological_dimension() const = 0;

    /// Return cell shape of the coordinate_mapping
    virtual shape cell_shape() const = 0;

    /// Create finite_element object representing the coordinate parameterization
    virtual finite_element * create_coordinate_finite_element() const = 0;

    /// Create dofmap object representing the coordinate parameterization
    virtual dofmap * create_coordinate_dofmap() const = 0;

    /// Compute physical coordinates x from reference coordinates X, the inverse of compute_reference_coordinates
    virtual void compute_physical_coordinates(
        double * x, std::size_t num_points,
        const double * X,
        const double * coordinate_dofs, int cell_orientation) const = 0;

    /// Compute reference coordinates X from physical coordinates x, the inverse of compute_physical_coordinates
    virtual void compute_reference_coordinates(
        double * X, std::size_t num_points,
        const double * x,
        const double * coordinate_dofs, int cell_orientation) const = 0;

    /// Compute Jacobian of coordinate mapping J = dx/dX at reference coordinates X
    virtual void compute_jacobians(
        double * J, std::size_t num_points,
        const double * X,
        const double * coordinate_dofs, int cell_orientation) const = 0;

    /// Compute determinants of (pseudo-)Jacobians J
    virtual void compute_jacobian_determinants(
        double * detJ, std::size_t num_points,
        const double * J) const = 0;

    /// Compute (pseudo-)inverses K of (pseudo-)Jacobians J
    virtual void compute_jacobian_inverses(
        double * K, std::size_t num_points,
        const double * J, const double * detJ) const = 0;

    /// Combined (for convenience) computation of x, J, detJ, K from X and coordinate_dofs on a cell
    virtual void compute_geometry(
        double * x, double * J, double * detJ, double * K, std::size_t num_points,
        const double * X,
        const double * coordinate_dofs, int cell_orientation) const = 0;

  };

  class form
  {
  ...
    /// Create a new coordinate mapping
    virtual coordinate_mapping * create_coordinate_mapping() const = 0;
  ...
  };

Note: The form currently has only one coordinate mapping but that can be extended when needed.

Note: I've already added create_coordinate_finite_element and create_coordinate_dofmap to ufc::form as a first step and these are called by dolfin but not used much. The coordinate_mapping will later replace those.

Note: I've also removed the finite_element::map_to|from_reference_cell because they're not implemented and belongs with the coordinate_mapping and not the finite_element.

Note: I'm also working on changing the finite_element evaluation to work with reference cell evaluation and mapping given precomputed jacobian and jacobian inverse, to avoid duplication of effort of mapping coordinates back and forth (there should be one way to do it), and to avoid reference cell based finite elements depending on the coordinate mapping.

Comments (9)

  1. Martin Sandve Alnæs reporter
    • removed responsible

    This is now implemented. Some testing would be a good idea though.

  2. Log in to comment