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

« back to all changes in this revision

Viewing changes to lib/src/Base/Type/NumericalPointImplementation.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:
1
 
//                                               -*- C++ -*-
2
 
/**
3
 
 *  @file  NumericalPointImplementation.hxx
4
 
 *  @brief NumericalPointImplementation implements the classical mathematical point
5
 
 *
6
 
 *  (C) Copyright 2005-2007 EDF-EADS-Phimeca
7
 
 *
8
 
 *  This library is free software; you can redistribute it and/or
9
 
 *  modify it under the terms of the GNU Lesser General Public
10
 
 *  License as published by the Free Software Foundation; either
11
 
 *  version 2.1 of the License.
12
 
 *
13
 
 *  This library is distributed in the hope that it will be useful
14
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 
 *  Lesser General Public License for more details.
17
 
 *
18
 
 *  You should have received a copy of the GNU Lesser General Public
19
 
 *  License along with this library; if not, write to the Free Software
20
 
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21
 
 *
22
 
 *  @author: $LastChangedBy: dutka $
23
 
 *  @date:   $LastChangedDate: 2009-05-28 14:47:53 +0200 (jeu. 28 mai 2009) $
24
 
 *  Id:      $Id: NumericalPointImplementation.hxx 1262 2009-05-28 12:47:53Z dutka $
25
 
 */
26
 
#ifndef OPENTURNS_NUMERICALPOINTIMPLEMENTATION_HXX
27
 
#define OPENTURNS_NUMERICALPOINTIMPLEMENTATION_HXX
28
 
 
29
 
#include <vector>
30
 
#include "PersistentCollection.hxx"
31
 
#include "Description.hxx"
32
 
#include "Exception.hxx"
33
 
 
34
 
namespace OpenTURNS
35
 
{
36
 
 
37
 
  namespace Base
38
 
  {
39
 
 
40
 
    namespace Type
41
 
    {
42
 
 
43
 
      /**
44
 
       * @class NumericalPointImplementation
45
 
       *
46
 
       * NumericalPointImplementation implements the classical mathematical point
47
 
       */
48
 
 
49
 
      class NumericalPointImplementation
50
 
        : public PersistentCollection<NumericalScalar>
51
 
      {
52
 
        CLASSNAME;
53
 
 
54
 
      public:
55
 
 
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
 
 
66
 
        /** Default constructor */
67
 
        NumericalPointImplementation();
68
 
 
69
 
        /** Constructor with size */
70
 
        NumericalPointImplementation(const UnsignedLong size,
71
 
                                     const NumericalScalar value = 0.0);
72
 
 
73
 
        /** Constructor from a collection */
74
 
        NumericalPointImplementation(const Type::Collection<NumericalScalar> & coll);
75
 
 
76
 
        /** Virtual constructor */
77
 
        virtual NumericalPointImplementation * clone() const;
78
 
 
79
 
        /** Description Accessor */
80
 
        virtual void setDescription(const Description & description) {}
81
 
        virtual Description getDescription() const { return Description( getDimension() ); }
82
 
 
83
 
        /** String converter */
84
 
        String __repr__() const;
85
 
        String __str__() const;
86
 
 
87
 
        /** Dimension accessor */
88
 
        inline UnsignedLong getDimension() const { return PersistentCollection<NumericalScalar>::getSize(); }
89
 
        inline UnsignedLong getSize() const { return PersistentCollection<NumericalScalar>::getSize(); }
90
 
 
91
 
        /** Collection accessor */
92
 
        inline const NumericalScalarCollection & getCollection() const { return *this; }
93
 
 
94
 
#ifndef SWIG
95
 
        /** Coordinate accessor */
96
 
        NumericalScalar & operator[](const UnsignedLong index);
97
 
        const NumericalScalar & operator[](const UnsignedLong index) const;
98
 
#endif
99
 
 
100
 
        /** Addition operator */
101
 
        NumericalPointImplementation operator +(const NumericalPointImplementation & rhs) const
102
 
          throw (InvalidArgumentException);
103
 
 
104
 
        /** Substraction operator */
105
 
        NumericalPointImplementation operator -(const NumericalPointImplementation & rhs) const
106
 
          throw (InvalidArgumentException);
107
 
 
108
 
        /** In-place addition operator */
109
 
        NumericalPointImplementation & operator +=(const NumericalPointImplementation & other) throw (InvalidArgumentException);
110
 
        
111
 
        /** In-place substraction operator */
112
 
        NumericalPointImplementation & operator -=(const NumericalPointImplementation & other) throw (InvalidArgumentException);
113
 
 
114
 
        /** Product operator */
115
 
        NumericalPointImplementation operator *(const NumericalScalar scalar) const;
116
 
 
117
 
        /**  In-place product operator */
118
 
        NumericalPointImplementation & operator *=(const NumericalScalar scalar);
119
 
        
120
 
        /**  Norm */
121
 
        NumericalScalar norm() const;
122
 
        
123
 
        /**  Norm^2 */
124
 
        NumericalScalar norm2() const;
125
 
        
126
 
        /** Dot product operator */
127
 
        static NumericalScalar dot(const NumericalPointImplementation & lhs,
128
 
                                   const NumericalPointImplementation & rhs)
129
 
          throw (InvalidArgumentException);
130
 
 
131
 
        /** Method save() stores the object through the StorageManager */
132
 
        virtual void save(const StorageManager::Advocate & adv) const;
133
 
 
134
 
        /** Method load() reloads the object from the StorageManager */
135
 
        virtual void load(const StorageManager::Advocate & adv);        
136
 
 
137
 
      private:
138
 
 
139
 
//      /** The description of all components */
140
 
//      Description::Implementation p_description_;
141
 
 
142
 
      }; /* class NumericalPointImplementation */
143
 
 
144
 
 
145
 
#ifndef SWIG
146
 
      /** Comparison operator */
147
 
      Bool operator ==(const NumericalPointImplementation & lhs,
148
 
                       const NumericalPointImplementation & rhs);
149
 
      
150
 
      /** Ordering operator */
151
 
      Bool operator <(const NumericalPointImplementation & lhs,
152
 
                      const NumericalPointImplementation & rhs);
153
 
      
154
 
      /** Product operator */
155
 
      NumericalPointImplementation operator *(const NumericalScalar scalar,
156
 
                                              const NumericalPointImplementation & point);
157
 
#endif
158
 
      
159
 
 
160
 
    } /* namespace Common */
161
 
  } /* namespace Base */
162
 
} /* namespace OpenTURNS */
163
 
 
164
 
#endif /* OPENTURNS_NUMERICALPOINTIMPLEMENTATION_HXX */