Computational Physics - Department of Physics

(Axel Boer) #1

3.3 Classes in C++ 79


/**
*@brief Constructor. Creates a vector initializing its elements to zero
*@param int_length. The number of entries in the array.
**/
// Default constructor
Vector();

/**
*@brief Constructor. Creates a vector initializing its elements to zero
*@param int length. The number of entries in the array.
**/
// Constructor
Vector(int_length);

/**
*Constructor. Creates a vector to hold a given array.
*@param int_length. Number of entreis in the array.
*@param const double*a. Constant pointer to a double array.
**/
// Constructor
Vector(int_length,const double*array);
/**
*Copy constructor.
*
**/
// copy constructor
Vector(constVector&);
/**
*Destructor.
**/
// Destructor
~Vector();
/**Get the number of elements in an array.
*@return the length of the array.
**/
// Get the length of the array.
intgetLength()const;
// Return pointers to the data: Useful for sending data
// to Fortran and C
const double*getPtr()const;
double*getPtr();
doubleinner(constVector&)const;
//Normalize a vector, i.e., create an unit vector
// Normalize a vector
voidnormalize();
voidprint(std::ostream&)const;
/**
*Change the length of a vector
**/
Free download pdf