Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Annotation of /trunk/gadget/doublevector.h
[mareframe] / trunk / gadget / doublevector.h Repository:
ViewVC logotype

Annotation of /trunk/gadget/doublevector.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 1 #ifndef doublevector_h
2 :     #define doublevector_h
3 :    
4 :     #include "mathfunc.h"
5 :     #include "gadget.h"
6 :    
7 :     /**
8 :     * \class DoubleVector
9 :     * \brief This class implements a dynamic vector of double values
10 :     */
11 :     class DoubleVector {
12 :     public:
13 :     /**
14 :     * \brief This is the default DoubleVector constructor
15 :     */
16 :     DoubleVector() { size = 0; v = 0; };
17 :     /**
18 :     * \brief This is the DoubleVector constructor for a specified size
19 :     * \param sz is the size of the vector to be created
20 :     * \note The elements of the vector will all be created, and set to zero
21 :     */
22 :     DoubleVector(int sz);
23 :     /**
24 :     * \brief This is the DoubleVector constructor for a specified size with an initial value
25 :     * \param sz is the size of the vector to be created
26 :     * \param initial is the initial value for all the entries of the vector
27 :     */
28 :     DoubleVector(int sz, double initial);
29 :     /**
30 :     * \brief This is the DoubleVector constructor that creates a copy of an existing DoubleVector
31 :     * \param initial is the DoubleVector to copy
32 :     */
33 :     DoubleVector(const DoubleVector& initial);
34 :     /**
35 :     * \brief This is the DoubleVector destructor
36 :     * \note This will free all the memory allocated to all the elements of the vector
37 :     */
38 :     ~DoubleVector();
39 :     /**
40 :     * \brief This will add new entries to the vector
41 :     * \param addsize is the number of new entries to the vector
42 :     * \param value is the value that will be entered for the new entries
43 :     */
44 :     void resize(int addsize, double value);
45 :     /**
46 :     * \brief This will delete an entry from the vector
47 :     * \param pos is the element of the vector to be deleted
48 :     * \note This will free the memory allocated to the deleted element of the vector
49 :     */
50 :     void Delete(int pos);
51 :     /**
52 :     * \brief This will return the size of the vector
53 :     * \return the size of the vector
54 :     */
55 :     int Size() const { return size; };
56 :     /**
57 :     * \brief This will return the value of an element of the vector
58 :     * \param pos is the element of the vector to be returned
59 :     * \return the value of the specified element
60 :     */
61 :     double& operator [] (int pos) { return v[pos]; };
62 :     /**
63 :     * \brief This will return the value of an element of the vector
64 :     * \param pos is the element of the vector to be returned
65 :     * \return the value of the specified element
66 :     */
67 :     const double& operator [] (int pos) const { return v[pos]; };
68 :     /**
69 :     * \brief This will reset the vector
70 :     * \note This will delete every entry from the vector and set the size to zero
71 :     */
72 :     void Reset();
73 :     /**
74 :     * \brief This function will set all of the entries of the vector to zero
75 :     */
76 :     void setToZero();
77 :     /**
78 :     * \brief This operator will calculate the dot product of the vector and an existing DoubleVector
79 :     * \param d is the DoubleVector to copy
80 :     * \return the dot product of the two vectors
81 :     */
82 :     double operator * (const DoubleVector& d) const;
83 :     /**
84 :     * \brief This operator will set the vector equal to an existing DoubleVector
85 :     * \param d is the DoubleVector to copy
86 :     */
87 :     DoubleVector& operator = (const DoubleVector& d);
88 :     protected:
89 :     /**
90 :     * \brief This is the vector of double values
91 :     */
92 :     double* v;
93 :     /**
94 :     * \brief This is the size of the vector
95 :     */
96 :     int size;
97 :     };
98 :    
99 :     #endif

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge