~ubuntu-branches/ubuntu/maverick/openturns/maverick

« back to all changes in this revision

Viewing changes to lib/src/Base/Type/NumericalPoint.hxx

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2010-05-10 17:27:55 UTC
  • mfrom: (1.1.4 upstream) (5.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100510172755-cb5ynskknqqi5rhp
Tags: 0.13.2-2ubuntu1
* Merge with Debian testing. No changes left.
* ubuntu_fix-python-2.6.patch: fix detection of python 2.6 libs, to not use
  LOCALMODLIBS. This pulls a dependency on SSL and makes the package FTBFS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *  @file  NumericalPoint.hxx
4
4
 *  @brief NumericalPoint implements the classical mathematical point
5
5
 *
6
 
 *  (C) Copyright 2005-2007 EDF-EADS-Phimeca
 
6
 *  (C) Copyright 2005-2010 EDF-EADS-Phimeca
7
7
 *
8
8
 *  This library is free software; you can redistribute it and/or
9
9
 *  modify it under the terms of the GNU Lesser General Public
20
20
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21
21
 *
22
22
 *  @author: $LastChangedBy: dutka $
23
 
 *  @date:   $LastChangedDate: 2009-05-28 14:47:53 +0200 (jeu. 28 mai 2009) $
24
 
 *  Id:      $Id: NumericalPoint.hxx 1262 2009-05-28 12:47:53Z dutka $
 
23
 *  @date:   $LastChangedDate: 2010-02-04 16:44:49 +0100 (jeu. 04 févr. 2010) $
 
24
 *  Id:      $Id: NumericalPoint.hxx 1473 2010-02-04 15:44:49Z dutka $
25
25
 */
26
26
#ifndef OPENTURNS_NUMERICALPOINT_HXX
27
27
#define OPENTURNS_NUMERICALPOINT_HXX
28
28
 
29
 
#include "TypedCollectionInterfaceObject.hxx"
30
 
#include "NumericalPointImplementation.hxx"
 
29
#include <vector>
 
30
#include "PersistentCollection.hxx"
 
31
#include "Description.hxx"
 
32
#include "Exception.hxx"
31
33
 
32
34
namespace OpenTURNS
33
35
{
44
46
       * NumericalPoint implements the classical mathematical point
45
47
       */
46
48
 
47
 
      class NumericalPoint :
48
 
        public Common::TypedCollectionInterfaceObject<NumericalPointImplementation>
 
49
      class NumericalPoint
 
50
        : public PersistentCollection<NumericalScalar>
49
51
      {
50
52
        CLASSNAME;
51
53
 
52
54
      public:
53
55
 
54
 
        typedef Common::InvalidArgumentException                        InvalidArgumentException;
55
 
        typedef NumericalPointImplementation::NumericalScalarCollection NumericalScalarCollection;
 
56
        typedef Type::PersistentCollection<NumericalScalar> InternalType;
 
57
        typedef Type::Collection<NumericalScalar>           NumericalScalarCollection;
 
58
        typedef InternalType::iterator                      iterator;
 
59
        typedef InternalType::const_iterator                const_iterator;
 
60
        typedef InternalType::reverse_iterator              reverse_iterator;
 
61
        typedef InternalType::const_reverse_iterator        const_reverse_iterator;
 
62
        typedef Common::InvalidArgumentException            InvalidArgumentException;
 
63
        typedef Common::StorageManager                      StorageManager;
 
64
        typedef Common::PersistentObject                    PersistentObject;
 
65
        typedef NumericalPoint                              ImplementationType;
56
66
 
57
67
        /** Default constructor */
58
68
        NumericalPoint();
61
71
        NumericalPoint(const UnsignedLong size,
62
72
                       const NumericalScalar value = 0.0);
63
73
 
64
 
        /** Constructor from implementation */
65
 
        NumericalPoint(const NumericalPointImplementation & implementation);
66
 
 
67
 
//      /** Description Accessor */
68
 
//      void setDescription(const Description & description);
69
 
//      Description getDescription() const;
 
74
        /** Constructor from a collection */
 
75
        NumericalPoint(const Type::Collection<NumericalScalar> & coll);
 
76
 
 
77
        /** Virtual constructor */
 
78
        virtual NumericalPoint * clone() const;
 
79
 
 
80
        /** Destructor */
 
81
        virtual ~NumericalPoint() throw();
 
82
 
 
83
        /** Description Accessor */
 
84
        virtual void setDescription(const Description & description) {}
 
85
        virtual Description getDescription() const { return Description( getDimension() ); }
 
86
 
 
87
        /** String converter */
 
88
        String __repr__() const;
 
89
        String __str__() const;
 
90
 
 
91
        /** Dimension accessor */
 
92
        inline UnsignedLong getDimension() const { return PersistentCollection<NumericalScalar>::getSize(); }
 
93
        inline UnsignedLong getSize() const { return PersistentCollection<NumericalScalar>::getSize(); }
70
94
 
71
95
        /** Collection accessor */
72
 
        const NumericalScalarCollection & getCollection() const;
73
 
 
74
 
        /** String converter */
75
 
        virtual String __repr__() const;
76
 
        virtual String __str__() const;
77
 
 
78
 
        /* Method __eq__() is for Python */
79
 
        Bool __eq__(const NumericalPoint & rhs) const;
80
 
 
81
 
        /* Method __ne__() is for Python */
82
 
        Bool __ne__(const NumericalPoint & rhs) const;
 
96
        inline const NumericalScalarCollection & getCollection() const { return *this; }
 
97
 
 
98
#ifndef SWIG
 
99
        /** Coordinate accessor */
 
100
        NumericalScalar & operator[](const UnsignedLong index);
 
101
        const NumericalScalar & operator[](const UnsignedLong index) const;
 
102
 
 
103
        /** Erase the elements between first and last */
 
104
        iterator erase(iterator first, iterator last);
 
105
      
 
106
        /** Erase the element pointed by position */
 
107
        iterator erase(iterator position);
 
108
 
 
109
        /** Erase the element pointed by position */
 
110
        iterator erase(UnsignedLong position);
 
111
#endif
83
112
 
84
113
        /** Addition operator */
85
114
        NumericalPoint operator +(const NumericalPoint & rhs) const
86
 
          throw (InvalidArgumentException);
 
115
          /* throw (InvalidArgumentException) */;
87
116
 
88
117
        /** Substraction operator */
89
118
        NumericalPoint operator -(const NumericalPoint & rhs) const
90
 
          throw (InvalidArgumentException);
 
119
          /* throw (InvalidArgumentException) */;
91
120
 
92
121
        /** In-place addition operator */
93
 
        NumericalPoint & operator +=(const NumericalPoint & other) throw (InvalidArgumentException);
 
122
        NumericalPoint & operator +=(const NumericalPoint & other) /* throw (InvalidArgumentException) */;
94
123
        
95
124
        /** In-place substraction operator */
96
 
        NumericalPoint & operator -=(const NumericalPoint & other) throw (InvalidArgumentException);
 
125
        NumericalPoint & operator -=(const NumericalPoint & other) /* throw (InvalidArgumentException) */;
97
126
 
98
127
        /** Product operator */
99
128
        NumericalPoint operator *(const NumericalScalar scalar) const;
110
139
        /** Dot product operator */
111
140
        static NumericalScalar dot(const NumericalPoint & lhs,
112
141
                                   const NumericalPoint & rhs)
113
 
          throw (InvalidArgumentException);
114
 
 
115
 
      protected:
116
 
 
117
 
        // This class is intented to be used only by derived class that want to usethe constructor from implementation pointer
118
 
        class Derived {};
119
 
 
120
 
        /** Constructor from implementation */
121
 
        NumericalPoint(NumericalPointImplementation * p_implementation, Derived);
122
 
 
 
142
          /* throw (InvalidArgumentException) */;
 
143
 
 
144
        /** Method save() stores the object through the StorageManager */
 
145
        virtual void save(StorageManager::Advocate & adv) const;
 
146
 
 
147
        /** Method load() reloads the object from the StorageManager */
 
148
        virtual void load(StorageManager::Advocate & adv);      
 
149
 
 
150
      private:
 
151
 
 
152
        //      /** The description of all components */
 
153
        //      Description:: p_description_;
123
154
 
124
155
      }; /* class NumericalPoint */
125
156