*/
PolarManifold(const Point<spacedim> center = Point<spacedim>());
+ /**
+ * Make a clone of this Manifold object.
+ */
+ virtual std::unique_ptr<Manifold<dim,spacedim> > clone() const override;
+
/**
* Pull back the given point from the Euclidean space. Will return the polar
* coordinates associated with the point @p space_point. Only used when
* spacedim = 2.
*/
virtual Point<spacedim>
- pull_back(const Point<spacedim> &space_point) const;
+ pull_back(const Point<spacedim> &space_point) const override;
/**
* Given a point in the spherical coordinate system, this method returns the
* Only used when spacedim = 3.
*/
virtual Point<spacedim>
- push_forward(const Point<spacedim> &chart_point) const;
+ push_forward(const Point<spacedim> &chart_point) const override;
/**
* Given a point in the spacedim dimensional Euclidean space, this
*/
virtual
DerivativeForm<1,spacedim,spacedim>
- push_forward_gradient(const Point<spacedim> &chart_point) const;
+ push_forward_gradient(const Point<spacedim> &chart_point) const override;
/**
* The center of the spherical coordinate system.
*/
SphericalManifold(const Point<spacedim> center = Point<spacedim>());
+ /**
+ * Make a clone of this Manifold object.
+ */
+ virtual std::unique_ptr<Manifold<dim,spacedim> > clone() const override;
+
/**
* Given any two points in space, first project them on the surface
* of a sphere with unit radius, then connect them with a geodesic
const Point<spacedim> &point_on_axis,
const double tolerance = 1e-10);
+ /**
+ * Make a clone of this Manifold object.
+ */
+ virtual std::unique_ptr<Manifold<dim,spacedim> > clone() const override;
+
/**
* Compute the Cartesian coordinates for a point given in cylindrical
* coordinates.
*/
~FunctionManifold();
+ /**
+ * Make a clone of this Manifold object.
+ */
+ virtual std::unique_ptr<Manifold<dim,spacedim> > clone() const override;
+
/**
* Given a point in the @p chartdim coordinate system, uses the
* push_forward_function to compute the push_forward of points in @p
* chartdim space dimensions to @p spacedim space dimensions.
*/
virtual Point<spacedim>
- push_forward(const Point<chartdim> &chart_point) const;
+ push_forward(const Point<chartdim> &chart_point) const override;
/**
* Given a point in the chartdim dimensional Euclidean space, this
*/
virtual
DerivativeForm<1,chartdim,spacedim>
- push_forward_gradient(const Point<chartdim> &chart_point) const;
+ push_forward_gradient(const Point<chartdim> &chart_point) const override;
/**
* Given a point in the spacedim coordinate system, uses the
* space dimensions to @p chartdim space dimensions.
*/
virtual Point<chartdim>
- pull_back(const Point<spacedim> &space_point) const;
+ pull_back(const Point<spacedim> &space_point) const override;
private:
/**
* pointers.
*/
const bool owns_pointers;
+
+ /**
+ * The expresssion used to construct the push_forward function.
+ */
+ const std::string push_forward_expression;
+
+ /**
+ * The expresssion used to construct the pull_back function.
+ */
+ const std::string pull_back_expression;
+
+ /**
+ * Variable names in the chart domain.
+ */
+ const std::string chart_vars;
+
+ /**
+ * Variable names in the space domain.
+ */
+ const std::string space_vars;
+
+ /**
+ * The finite difference step to use internally.
+ */
+ const double finite_difference_step;
};
+
/**
* Manifold description for the surface of a Torus in three dimensions. The
* Torus is assumed to be in the x-z plane. The reference coordinate system
*/
TorusManifold (const double R, const double r);
+ /**
+ * Make a clone of this Manifold object.
+ */
+ virtual std::unique_ptr<Manifold<dim, 3> > clone() const override;
+
/**
* Pull back operation.
*/
virtual Point<3>
- pull_back(const Point<3> &p) const;
+ pull_back(const Point<3> &p) const override;
/**
* Push forward operation.
*/
virtual Point<3>
- push_forward(const Point<3> &chart_point) const;
+ push_forward(const Point<3> &chart_point) const override;
/**
* Gradient.
*/
virtual
DerivativeForm<1,3,3>
- push_forward_gradient(const Point<3> &chart_point) const;
+ push_forward_gradient(const Point<3> &chart_point) const override;
private:
double r, R;
*/
TransfiniteInterpolationManifold();
+ /**
+ * Make a clone of this Manifold object.
+ */
+ virtual std::unique_ptr<Manifold<dim,spacedim> > clone() const override;
+
/**
* Initializes the manifold with a coarse mesh. The prerequisite for using
* this class is that the input triangulation is uniformly refined and the
+template<int dim, int spacedim>
+std::unique_ptr<Manifold<dim, spacedim> >
+PolarManifold<dim,spacedim>::clone() const
+{
+ return std::unique_ptr<Manifold<dim,spacedim> >(new PolarManifold<dim,spacedim>(center));
+}
+
+
+
template <int dim, int spacedim>
Tensor<1,spacedim>
PolarManifold<dim,spacedim>::get_periodicity()
+template<int dim, int spacedim>
+std::unique_ptr<Manifold<dim, spacedim> >
+SphericalManifold<dim,spacedim>::clone() const
+{
+ return std::unique_ptr<Manifold<dim,spacedim> >(new SphericalManifold<dim,spacedim>(center));
+}
+
+
+
template <int dim, int spacedim>
Point<spacedim>
SphericalManifold<dim,spacedim>::
+template<int dim, int spacedim>
+std::unique_ptr<Manifold<dim, spacedim> >
+CylindricalManifold<dim,spacedim>::clone() const
+{
+ return std::unique_ptr<Manifold<dim,spacedim> >
+ (new CylindricalManifold<dim,spacedim>(direction, point_on_axis, tolerance));
+}
+
+
+
template <int dim, int spacedim>
Point<spacedim>
CylindricalManifold<dim,spacedim>::
push_forward_function(&push_forward_function),
pull_back_function(&pull_back_function),
tolerance(tolerance),
- owns_pointers(false)
+ owns_pointers(false),
+ finite_difference_step(0)
{
AssertDimension(push_forward_function.n_components, spacedim);
AssertDimension(pull_back_function.n_components, chartdim);
ChartManifold<dim,spacedim,chartdim>(periodicity),
const_map(const_map),
tolerance(tolerance),
- owns_pointers(true)
+ owns_pointers(true),
+ push_forward_expression(push_forward_expression),
+ pull_back_expression(pull_back_expression),
+ chart_vars(chart_vars),
+ space_vars(space_vars),
+ finite_difference_step(h)
{
FunctionParser<chartdim> *pf = new FunctionParser<chartdim>(spacedim, 0.0, h);
FunctionParser<spacedim> *pb = new FunctionParser<spacedim>(chartdim, 0.0, h);
+template<int dim, int spacedim, int chartdim>
+std::unique_ptr<Manifold<dim, spacedim> >
+FunctionManifold<dim,spacedim,chartdim>::clone() const
+{
+ if (owns_pointers == true)
+ {
+ return std::unique_ptr<Manifold<dim,spacedim> >
+ (new FunctionManifold<dim,spacedim,chartdim>(push_forward_expression,
+ pull_back_expression,
+ this->get_periodicity(),
+ const_map,
+ chart_vars,
+ space_vars,
+ tolerance,
+ finite_difference_step));
+ }
+ else
+ return std::unique_ptr<Manifold<dim,spacedim> >
+ (new FunctionManifold<dim,spacedim,chartdim>(*push_forward_function,
+ *pull_back_function,
+ this->get_periodicity(),
+ tolerance));
+}
+
+
+
template <int dim, int spacedim, int chartdim>
Point<spacedim>
FunctionManifold<dim,spacedim,chartdim>::push_forward(const Point<chartdim> &chart_point) const
+template<int dim>
+std::unique_ptr<Manifold<dim, 3> >
+TorusManifold<dim>::clone() const
+{
+ return std::unique_ptr<Manifold<dim,3> >(new TorusManifold<dim>(R,r));
+}
+
+
+
template <int dim>
DerivativeForm<1,3,3>
TorusManifold<dim>::push_forward_gradient(const Point<3> &chart_point) const
+template<int dim, int spacedim>
+std::unique_ptr<Manifold<dim, spacedim> >
+TransfiniteInterpolationManifold<dim,spacedim>::clone() const
+{
+ auto ptr = new TransfiniteInterpolationManifold<dim,spacedim>();
+ if (triangulation)
+ ptr->initialize(*triangulation);
+ return std::unique_ptr<Manifold<dim,spacedim> >(ptr);
+}
+
+
+
template <int dim, int spacedim>
void
TransfiniteInterpolationManifold<dim,spacedim>