SymmetricTensor.h
1 //##################################################################################################
2 //
3 // Ceetron Desktop Components
4 // Component: Core
5 //
6 // --------------------------------------------------------------------------------------------
7 // Copyright (C) 2014, Ceetron AS
8 // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Ceetron AS. The contents of this file may
9 // not be disclosed to third parties, copied or duplicated in any form, in whole or in part,
10 // without the prior written permission of Ceetron AS.
11 //##################################################################################################
12 
13 #pragma once
14 
15 #include "CeeCore/Base.h"
16 #include "CeeCore/Vec3d.h"
17 
18 
19 namespace cee {
20 
21 //==================================================================================================
22 //
23 // A symmetric 3x3 tensor represented by 6 values: xx, yy, zz, xy, yz, zx
24 //
25 //==================================================================================================
26 class CEE_CORE_EXPORT SymmetricTensor
27 {
28 public:
30  SymmetricTensor(const SymmetricTensor& other);
31  SymmetricTensor(double xx, double yy, double zz, double xy, double yz, double zx);
32  ~SymmetricTensor();
33 
35  bool operator==(const SymmetricTensor& rhs) const;
36  bool operator!=(const SymmetricTensor& rhs) const;
37 
38  const SymmetricTensor operator+(const SymmetricTensor& rhs) const;
39  const SymmetricTensor operator-(const SymmetricTensor& rhs) const;
40 
41  SymmetricTensor& operator+=(const SymmetricTensor& rhs);
42  SymmetricTensor& operator-=(const SymmetricTensor& rhs);
43 
44  const Vec3d operator*(const Vec3d& v) const;
45 
46  const SymmetricTensor operator*(double scalar) const;
47  const SymmetricTensor operator/(double scalar) const;
48  SymmetricTensor& operator*=(double scalar);
49  SymmetricTensor& operator/=(double scalar);
50 
51  friend SymmetricTensor operator*(double scalar, const SymmetricTensor& t) { return t*scalar; }
52 
53  const double& xx() const;
54  const double& yy() const;
55  const double& zz() const;
56  const double& xy() const;
57  const double& yz() const;
58  const double& zx() const;
59 
60  double& xx();
61  double& yy();
62  double& zz();
63  double& xy();
64  double& yz();
65  double& zx();
66 
67  void set(double xx, double yy, double zz, double xy, double yz, double zx);
68 
69  const double* rawPointer() const;
70 
71  double trace() const;
72  SymmetricTensor deviator() const;
73  static SymmetricTensor identity();
74 
75  double vonMises() const;
76  double firstPrincipalValue() const;
77  double secondPrincipalValue() const;
78  double thirdPrincipalValue() const;
79 
80  Vec3d firstPrincipalVector() const;
81  Vec3d secondPrincipalVector() const;
82  Vec3d thirdPrincipalVector() const;
83 
84 protected:
85  SymmetricTensor(double* values);
86 
87 private:
88  CEE_PRIVATE_IMPL(SymmetricTensor);
89  CEE_BASE_F(SharedMemorySymmetricTensor);
90 };
91 
92 //==================================================================================================
93 //
94 // A symmetric 3x3 tensor represented by 6 values: xx, yy, zz, xy, yz, zx
95 //
96 //==================================================================================================
97 class CEE_CORE_EXPORT SharedMemorySymmetricTensor : public SymmetricTensor
98 {
99 public:
100  SharedMemorySymmetricTensor(double* data);
101  void setSharedData(double* data);
102 };
103 
104 } // namespace cee
cee::Str operator+(const char *str1, const cee::Str &str2)
Global operator to allow a const char + a cee::Str.
Definition: Str.cpp:817
Namespace cee contains all functionality and structures under the Core component. ...
Definition: AppComponent.cpp:26
A symmetric 3x3 tensor represented by 6 values: xx, yy, zz, xy, yz, zx.
Definition: SymmetricTensor.h:97
bool operator!=(const PtrRef< T1 > &a, const PtrRef< T2 > &b)
Returns true if the internal pointers of refs a and b are different.
Definition: PtrRef.h:58
bool operator==(const PtrRef< T1 > &a, const PtrRef< T2 > &b)
Returns true if the internal pointers of refs a and b are equal.
Definition: PtrRef.h:57
A symmetric 3x3 tensor represented by 6 values: xx, yy, zz, xy, yz, zx.
Definition: SymmetricTensor.h:26
Vector class for a 3D double vector.
Definition: Vec3d.h:26