FEDEM Solver  R8.0
Source code of the dynamics solver
FFaTensor1.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
8 #ifndef FFA_TENSOR1_H
9 #define FFA_TENSOR1_H
10 
11 #include <iostream>
12 
13 class FFaTensor2;
14 class FFaTensor3;
15 
16 
24 {
25  double myT;
26 
27 public:
28 
29  // Constructors
30 
31  FFaTensor1(double d = 0.0) { myT = d; }
32  FFaTensor1(const FFaTensor1& t) { myT = t.myT; }
33  FFaTensor1(const FFaTensor2& t);
34  FFaTensor1(const FFaTensor3& t);
35 
36  // Local operators
37 
38  FFaTensor1& operator= (const FFaTensor1& t);
39  FFaTensor1& operator= (const FFaTensor2& t);
40  FFaTensor1& operator= (const FFaTensor3& t);
41 
43  {
44  myT += t.myT;
45  return *this;
46  }
47 
49  {
50  myT -= t.myT;
51  return *this;
52  }
53 
55  {
56  myT *= d;
57  return *this;
58  }
59 
61  {
62  myT /= d;
63  return *this;
64  }
65 
66  operator double() const { return myT; }
67 
68  // Global operators
69 
70  friend FFaTensor1 operator- (const FFaTensor1&);
71  friend FFaTensor1 operator+ (const FFaTensor1&, const FFaTensor1&);
72  friend FFaTensor1 operator- (const FFaTensor1&, const FFaTensor1&);
73  // Scaling by scalar
74  friend FFaTensor1 operator* (const FFaTensor1&, double);
75  friend FFaTensor1 operator* (double, const FFaTensor1&);
76  friend FFaTensor1 operator/ (const FFaTensor1&, double);
77  // Equality
78  friend bool operator== (const FFaTensor1&, const FFaTensor1&);
79  friend bool operator!= (const FFaTensor1&, const FFaTensor1&);
80  // Writing and reading
81  friend std::ostream& operator<< (std::ostream&, const FFaTensor1&);
82  friend std::istream& operator>> (std::istream&, FFaTensor1&);
83 };
84 
85 #endif
Definition: FFaTensor1.H:24
double myT
Definition: FFaTensor1.H:25
friend std::istream & operator>>(std::istream &, FFaTensor1 &)
Definition: FFaTensor1.C:106
friend bool operator!=(const FFaTensor1 &, const FFaTensor1 &)
Definition: FFaTensor1.C:94
friend FFaTensor1 operator+(const FFaTensor1 &, const FFaTensor1 &)
Definition: FFaTensor1.C:57
FFaTensor1 & operator*=(double d)
Definition: FFaTensor1.H:54
FFaTensor1 & operator/=(double d)
Definition: FFaTensor1.H:60
FFaTensor1 & operator+=(const FFaTensor1 &t)
Definition: FFaTensor1.H:42
FFaTensor1 & operator-=(const FFaTensor1 &t)
Definition: FFaTensor1.H:48
friend std::ostream & operator<<(std::ostream &, const FFaTensor1 &)
Definition: FFaTensor1.C:100
friend FFaTensor1 operator-(const FFaTensor1 &)
Definition: FFaTensor1.C:51
friend FFaTensor1 operator*(const FFaTensor1 &, double)
Definition: FFaTensor1.C:69
FFaTensor1(double d=0.0)
Definition: FFaTensor1.H:31
friend FFaTensor1 operator/(const FFaTensor1 &, double)
Definition: FFaTensor1.C:80
FFaTensor1 & operator=(const FFaTensor1 &t)
Definition: FFaTensor1.C:27
FFaTensor1(const FFaTensor1 &t)
Definition: FFaTensor1.H:32
friend bool operator==(const FFaTensor1 &, const FFaTensor1 &)
Definition: FFaTensor1.C:89
Definition: FFaTensor2.H:27
Definition: FFaTensor3.H:27