Simpatico  v1.10
setToZero.h
1 #ifndef UTIL_SET_TO_ZERO_H
2 #define UTIL_SET_TO_ZERO_H
3 
4 /*
5 * Util Package - C++ Utilities for Scientific Computation
6 *
7 * Copyright 2010 - 2017, The Regents of the University of Minnesota
8 * Distributed under the terms of the GNU General Public License.
9 */
10 
11 #include <util/space/Vector.h>
12 #include <util/space/Tensor.h>
13 #include <complex>
14 
15 using std::complex;
16 
17 namespace Util
18 {
19 
25  inline void setToZero(int& value)
26  { value = 0; }
27 
33  inline void setToZero(float& value)
34  { value = 0.0; }
35 
41  inline void setToZero(double& value)
42  { value = 0.0; }
43 
49  inline void setToZero(Vector& value)
50  { value.zero(); }
51 
57  inline void setToZero(Tensor& value)
58  { value.zero(); }
59 
65  inline void setToZero(complex<float>& value)
66  { value = complex<float>(0.0, 0.0); }
67 
73  inline void setToZero(complex<double>& value)
74  { value = complex<double>(0.0, 0.0); }
75 
76 }
77 #endif
Vector & zero()
Set all elements of a 3D vector to zero.
Definition: Vector.h:514
A Vector is a Cartesian vector.
Definition: Vector.h:75
Tensor & zero()
Set all elements of this tensor to zero.
Definition: Tensor.h:441
A Tensor represents a Cartesian tensor.
Definition: Tensor.h:32
void setToZero(int &value)
Set an int variable to zero.
Definition: setToZero.h:25
Utility classes for scientific computation.
Definition: accumulators.mod:1