]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Ad an input operator for Point objects.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 5 Apr 2005 19:49:41 +0000 (19:49 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 5 Apr 2005 19:49:41 +0000 (19:49 +0000)
git-svn-id: https://svn.dealii.org/trunk@10359 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/point.h

index 49139601fd73a1354efc259c697156eb0049713d..fda71c498a746cc045adac046ac80618bbc7d003 100644 (file)
@@ -377,7 +377,8 @@ Point<dim> operator * (const double factor, const Point<dim> &p)
  */
 template <int dim>
 inline
-std::ostream & operator << (std::ostream &out, const Point<dim> &p)
+std::ostream & operator << (std::ostream     &out,
+                           const Point<dim> &p)
 {
   for (unsigned int i=0; i<dim-1; ++i)
     out << p[i] << ' ';
@@ -388,6 +389,23 @@ std::ostream & operator << (std::ostream &out, const Point<dim> &p)
 
 
 
+/**
+ * Output operator for points. Print the elements consecutively,
+ * with a space in between.
+ */
+template <int dim>
+inline
+std::istream & operator >> (std::istream &in,
+                           Point<dim>   &p)
+{
+  for (unsigned int i=0; i<dim; ++i)
+    in >> p[i];
+
+  return in;
+}
+
+
+
 /** 
  * Output operator for points of dimension 1. This is implemented
  * specialized from the general template in order to avoid a compiler

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.