00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _VECTORTRANSFORMATION_H_
00012 #define _VECTORTRANSFORMATION_H_
00013
00014 #include "IntVect.H"
00015 #include "RealVect.H"
00016 #include "Tuple.H"
00017 #include "FArrayBox.H"
00018
00019 #include "NamespaceHeader.H"
00020
00021
00022
00023 class VectorTransformation
00024 {
00025
00026 friend class VectorAvgTransformation;
00027
00028 public:
00029
00030
00031 VectorTransformation()
00032 { }
00033
00034
00035 void setComponent(int a_dirDst,
00036 int a_dirSrc,
00037 Real a_val)
00038 { m_coeffs[matrixIndex(a_dirDst, a_dirSrc)] = a_val; }
00039
00040
00041 RealVect transform(const RealVect& a_vec) const;
00042
00043
00044 void addTransformFab(FArrayBox& a_dstFab,
00045 const FArrayBox& a_srcFab,
00046 const Box& a_bx,
00047 Real a_weight = 1.) const;
00048
00049
00050 void addTransformFabAvg(FArrayBox& a_dstFab,
00051 const FArrayBox& a_srcFab,
00052 const FArrayBox& a_gradFab,
00053 const Vector<VectorTransformation>& a_vecTransformGrad,
00054 const Box& a_bx,
00055 Real a_weight = 1.) const;
00056
00057
00058
00059
00060 VectorTransformation inverse() const;
00061
00062
00063
00064
00065
00066
00067 VectorTransformation compose(const VectorTransformation& a_next) const;
00068
00069 VectorTransformation& operator+= (const VectorTransformation& p);
00070
00071 friend VectorTransformation operator+ (const VectorTransformation& s,
00072 const VectorTransformation& p);
00073
00074 VectorTransformation& operator-= (const VectorTransformation& p);
00075
00076 friend VectorTransformation operator- (const VectorTransformation& s,
00077 const VectorTransformation& p);
00078
00079 VectorTransformation& operator*= (Real s);
00080
00081 VectorTransformation operator* (Real s) const;
00082
00083 friend VectorTransformation operator* (Real s,
00084 const VectorTransformation& p);
00085
00086 VectorTransformation& operator/= (Real s);
00087
00088 VectorTransformation operator/ (Real s) const;
00089
00090 friend VectorTransformation operator/ (Real s,
00091 const VectorTransformation& p);
00092
00093
00094
00095
00096
00097 static const VectorTransformation Identity;
00098
00099
00100
00101
00102 static int InitStatics();
00103
00104 protected:
00105
00106 const static int s_ncoeffs = SpaceDim*SpaceDim;
00107
00108
00109
00110
00111 Real m_coeffs[s_ncoeffs];
00112
00113
00114
00115
00116
00117
00118 static inline int matrixIndex(int a_dirDst, int a_dirSrc)
00119 {
00120 return (SpaceDim*a_dirDst + a_dirSrc);
00121 }
00122
00123 Vector< Vector<Real> > vecvec(const Real* a_coeffs) const;
00124
00125 Real determinant(const Real* a_matrix) const;
00126
00127 Real determinant(const Vector< Vector<Real> >& a_matrix) const;
00128
00129 Real matrixMinor(const Vector< Vector<Real> >& a_matrix,
00130 int a_row,
00131 int a_col) const;
00132 };
00133
00134
00135
00136
00137
00138
00139
00140
00141 static int s_dummyForVectorTransformationH = VectorTransformation::InitStatics();
00142
00143 #include "NamespaceFooter.H"
00144
00145 #endif // include guard