]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add Point assignment operator
authorDaniel Garcia-Sanchez <daniel.garcia-sanchez@insp.upmc.fr>
Wed, 24 Jul 2019 18:47:54 +0000 (20:47 +0200)
committerDaniel Garcia-Sanchez <daniel.garcia-sanchez@insp.upmc.fr>
Wed, 24 Jul 2019 18:47:54 +0000 (20:47 +0200)
Assignment operator from a Tensor<1, dim, Number> with different underlying
scalar type.

include/deal.II/base/point.h

index 3afb0fa3196dadd1c964ad2d3b730ce2d35ce089..f2836107ec8a66d6fd8838d0c5b33a82132d88d1 100644 (file)
@@ -195,6 +195,15 @@ public:
   DEAL_II_CUDA_HOST_DEV Number &
                         operator()(const unsigned int index);
 
+  /**
+   * Assignment operator from Tensor<1, dim, Number> with different underlying
+   * scalar type. This obviously requires that the @p OtherNumber type is
+   * convertible to @p Number.
+   */
+  template <typename OtherNumber>
+  Point<dim, Number> &
+  operator=(const Tensor<1, dim, OtherNumber> &p);
+
   /**
    * @name Addition and subtraction of points.
    * @{
@@ -481,6 +490,17 @@ Point<dim, Number>::operator()(const unsigned int index)
 
 
 
+template <int dim, typename Number>
+template <typename OtherNumber>
+inline DEAL_II_ALWAYS_INLINE Point<dim, Number> &
+Point<dim, Number>::operator=(const Tensor<1, dim, OtherNumber> &p)
+{
+  Tensor<1, dim, Number>::operator=(p);
+  return *this;
+}
+
+
+
 template <int dim, typename Number>
 inline DEAL_II_CUDA_HOST_DEV Point<dim, Number>
 Point<dim, Number>::operator+(const Tensor<1, dim, Number> &p) const

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.