Subversion Repositories gelsvn

Rev

Rev 561 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 561 Rev 595
Line -... Line 1...
-
 
1
/* ----------------------------------------------------------------------- *
-
 
2
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
-
 
3
 * Copyright (C) the authors and DTU Informatics
-
 
4
 * For license and list of authors, see ../../doc/intro.pdf
-
 
5
 * @brief Abstract vector class
-
 
6
 * ----------------------------------------------------------------------- */
-
 
7
 
-
 
8
/** @file ArithVec.h
-
 
9
 * @brief Abstract vector class
-
 
10
 */
-
 
11
 
1
#ifndef __CGLA_ARITHVEC_H__
12
#ifndef __CGLA_ARITHVEC_H__
2
#define __CGLA_ARITHVEC_H__
13
#define __CGLA_ARITHVEC_H__
3
 
14
 
4
#include <iostream>
15
#include <iostream>
5
#include "CGLA.h"
16
#include "CGLA.h"
Line 393... Line 404...
393
    inline std::istream& operator>>(std::istream&is, ArithVec<T,V,N>& v)
404
    inline std::istream& operator>>(std::istream&is, ArithVec<T,V,N>& v)
394
    {
405
    {
395
        is >> std::ws;
406
        is >> std::ws;
396
        if (is.peek() == '[')
407
        if (is.peek() == '[')
397
            is.ignore();
408
            is.ignore();
398
        else
-
 
399
        {
-
 
400
            is.setstate(std::ios::badbit);
-
 
401
            return is;
-
 
402
        }
-
 
403
        is >> std::ws;
409
        is >> std::ws;
404
        for (int c=0; c<N; ++c)
410
        for (int c=0; c<N; ++c)
405
        {
411
        {
406
            is >> v(c) >> std::ws;
412
            is >> v(c) >> std::ws;
407
        }
413
        }
408
        if (is.peek() == ']')
414
        if (is.peek() == ']')
409
            is.ignore();
415
            is.ignore();
410
        else
-
 
411
        {
-
 
412
            is.setstate(std::ios::badbit);
-
 
413
            return is;
416
        return is;
414
        }
417
    }
415
        return is;
-
 
416
 
-
 
417
        //OLD VERSION
-
 
418
        //for(unsigned int i=0;i<N;i++) is>>v[i];
-
 
419
        //    return is;
-
 
420
    }
-
 
421
 
418
 
422
 
419
 
423
  /** Dot product for two vectors. The `*' operator is 
420
  /** Dot product for two vectors. The `*' operator is 
424
      reserved for coordinatewise	multiplication of vectors. */
421
      reserved for coordinatewise	multiplication of vectors. */
425
  template <class T,class V, unsigned int N>
422
  template <class T,class V, unsigned int N>