00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef ELEMENTARYMATRIXSET_HPP
00021 #define ELEMENTARYMATRIXSET_HPP
00022
00023 #include <TinyMatrix.hpp>
00024 #include <TinyVector.hpp>
00025 #include <PDEOperator.hpp>
00026
00027 #include <ErrorHandler.hpp>
00028
00029 class Problem;
00030 template <typename ElementaryMatrixType>
00031 class ElementaryMatrixSet
00032 {
00033 private:
00034 bool __divMuGrad;
00035 bool __massOperator;
00036 bool __secondOrderOperator;
00037 bool __firstOrderOperator;
00038
00039 TinyMatrix<3,3, bool> __secondOrderOperatorList;
00040 TinyVector<3, bool> __firstOrderUdxVList;
00041 TinyVector<3, bool> __firstOrderDxUVList;
00042
00043 ElementaryMatrixType __divMuGradMatrix;
00044 ElementaryMatrixType __massOperatorMatrix;
00045 TinyVector<3,ElementaryMatrixType > __firstOrderUdxVMatrix;
00046 TinyVector<3,ElementaryMatrixType > __firstOrderDxUVMatrix;
00047 TinyMatrix<3,3, ElementaryMatrixType > __secondOrderOperatorMatrix;
00048
00049 public:
00050
00051 const ElementaryMatrixType& operator()(const PDEOperator::Type& type) const
00052 {
00053 switch (type) {
00054 case (PDEOperator::massop): {
00055 return __massOperatorMatrix;
00056 }
00057 case (PDEOperator::divmugrad): {
00058 return __divMuGradMatrix;
00059 }
00060 default: {
00061 throw ErrorHandler(__FILE__,__LINE__,
00062 "unknown PDE operator",
00063 ErrorHandler::unexpected);
00064 }
00065 }
00066 }
00067
00068 const bool& isDivMuGrad() const
00069 {
00070 return __divMuGrad;
00071 }
00072
00073 const ElementaryMatrixType& divMuGrad() const
00074 {
00075 ASSERT(__divMuGrad);
00076 return __divMuGradMatrix;
00077 }
00078
00079 ElementaryMatrixType& divMuGrad()
00080 {
00081 ASSERT(__divMuGrad);
00082 return __divMuGradMatrix;
00083 }
00084
00085 const bool& isMassOperator() const
00086 {
00087 return __massOperator;
00088 }
00089
00090 const ElementaryMatrixType& massOperator() const
00091 {
00092 ASSERT(__massOperator);
00093 return __massOperatorMatrix;
00094 }
00095
00096 ElementaryMatrixType& massOperator()
00097 {
00098 ASSERT(__massOperator);
00099 return __massOperatorMatrix;
00100 }
00101
00102 const bool& isSecondOrderOperator() const
00103 {
00104 return __secondOrderOperator;
00105 }
00106
00107 const bool& isSecondOrderOperator(const size_t i, const size_t j) const
00108 {
00109 return __secondOrderOperatorList(i,j);
00110 }
00111
00112 const ElementaryMatrixType& secondOrderOperator(const size_t i, const size_t j) const
00113 {
00114 ASSERT(__secondOrderOperatorList(i,j));
00115 return __secondOrderOperatorMatrix(i,j);
00116 }
00117
00118 ElementaryMatrixType& secondOrderOperator(const size_t i, const size_t j)
00119 {
00120 ASSERT(__secondOrderOperatorList(i,j));
00121 return __secondOrderOperatorMatrix(i,j);
00122 }
00123
00124 const bool& isFirstOrderOperator() const
00125 {
00126 return __firstOrderOperator;
00127 }
00128
00129 const bool& isFirstOrderUdxV(const size_t i) const
00130 {
00131 return __firstOrderUdxVList[i];
00132 }
00133
00134 const ElementaryMatrixType& firstOrderOperatorUdxV(const size_t i) const
00135 {
00136 ASSERT(__firstOrderUdxVList[i]);
00137 return __firstOrderUdxVMatrix[i];
00138 }
00139
00140 ElementaryMatrixType& firstOrderOperatorUdxV(const size_t i)
00141 {
00142 ASSERT(__firstOrderUdxVList[i]);
00143 return __firstOrderUdxVMatrix[i];
00144 }
00145
00146 const bool& isFirstOrderDxUV(const size_t i) const
00147 {
00148 return __firstOrderDxUVList[i];
00149 }
00150
00151 const ElementaryMatrixType& firstOrderOperatorDxUV(const size_t i) const
00152 {
00153 ASSERT(__firstOrderDxUVList[i]);
00154 return __firstOrderDxUVMatrix[i];
00155 }
00156
00157 ElementaryMatrixType& firstOrderOperatorDxUV(const size_t i)
00158 {
00159 ASSERT(__firstOrderDxUVList[i]);
00160 return __firstOrderDxUVMatrix[i];
00161 }
00162
00167 ElementaryMatrixSet(const Problem& problem);
00168 };
00169
00170 #endif
00171