3
* @file NumericalPointImplementation.hxx
4
* @brief NumericalPointImplementation implements the classical mathematical point
6
* (C) Copyright 2005-2007 EDF-EADS-Phimeca
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.
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.
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
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 $
26
#ifndef OPENTURNS_NUMERICALPOINTIMPLEMENTATION_HXX
27
#define OPENTURNS_NUMERICALPOINTIMPLEMENTATION_HXX
30
#include "PersistentCollection.hxx"
31
#include "Description.hxx"
32
#include "Exception.hxx"
44
* @class NumericalPointImplementation
46
* NumericalPointImplementation implements the classical mathematical point
49
class NumericalPointImplementation
50
: public PersistentCollection<NumericalScalar>
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;
66
/** Default constructor */
67
NumericalPointImplementation();
69
/** Constructor with size */
70
NumericalPointImplementation(const UnsignedLong size,
71
const NumericalScalar value = 0.0);
73
/** Constructor from a collection */
74
NumericalPointImplementation(const Type::Collection<NumericalScalar> & coll);
76
/** Virtual constructor */
77
virtual NumericalPointImplementation * clone() const;
79
/** Description Accessor */
80
virtual void setDescription(const Description & description) {}
81
virtual Description getDescription() const { return Description( getDimension() ); }
83
/** String converter */
84
String __repr__() const;
85
String __str__() const;
87
/** Dimension accessor */
88
inline UnsignedLong getDimension() const { return PersistentCollection<NumericalScalar>::getSize(); }
89
inline UnsignedLong getSize() const { return PersistentCollection<NumericalScalar>::getSize(); }
91
/** Collection accessor */
92
inline const NumericalScalarCollection & getCollection() const { return *this; }
95
/** Coordinate accessor */
96
NumericalScalar & operator[](const UnsignedLong index);
97
const NumericalScalar & operator[](const UnsignedLong index) const;
100
/** Addition operator */
101
NumericalPointImplementation operator +(const NumericalPointImplementation & rhs) const
102
throw (InvalidArgumentException);
104
/** Substraction operator */
105
NumericalPointImplementation operator -(const NumericalPointImplementation & rhs) const
106
throw (InvalidArgumentException);
108
/** In-place addition operator */
109
NumericalPointImplementation & operator +=(const NumericalPointImplementation & other) throw (InvalidArgumentException);
111
/** In-place substraction operator */
112
NumericalPointImplementation & operator -=(const NumericalPointImplementation & other) throw (InvalidArgumentException);
114
/** Product operator */
115
NumericalPointImplementation operator *(const NumericalScalar scalar) const;
117
/** In-place product operator */
118
NumericalPointImplementation & operator *=(const NumericalScalar scalar);
121
NumericalScalar norm() const;
124
NumericalScalar norm2() const;
126
/** Dot product operator */
127
static NumericalScalar dot(const NumericalPointImplementation & lhs,
128
const NumericalPointImplementation & rhs)
129
throw (InvalidArgumentException);
131
/** Method save() stores the object through the StorageManager */
132
virtual void save(const StorageManager::Advocate & adv) const;
134
/** Method load() reloads the object from the StorageManager */
135
virtual void load(const StorageManager::Advocate & adv);
139
// /** The description of all components */
140
// Description::Implementation p_description_;
142
}; /* class NumericalPointImplementation */
146
/** Comparison operator */
147
Bool operator ==(const NumericalPointImplementation & lhs,
148
const NumericalPointImplementation & rhs);
150
/** Ordering operator */
151
Bool operator <(const NumericalPointImplementation & lhs,
152
const NumericalPointImplementation & rhs);
154
/** Product operator */
155
NumericalPointImplementation operator *(const NumericalScalar scalar,
156
const NumericalPointImplementation & point);
160
} /* namespace Common */
161
} /* namespace Base */
162
} /* namespace OpenTURNS */
164
#endif /* OPENTURNS_NUMERICALPOINTIMPLEMENTATION_HXX */