00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef constraint_H
00040 #define constraint_H
00041
00042 #include "labelList.H"
00043 #include "scalarField.H"
00044
00045
00046
00047 namespace Foam
00048 {
00049
00050 template<class Type>
00051 class constraint;
00052
00053 template<class Type>
00054 Ostream& operator<<(Ostream&, const constraint<Type>&);
00055
00056
00057
00058
00059
00060
00061 template<class Type>
00062 class constraint
00063 {
00064
00065
00066
00067 label rowID_;
00068
00069
00070 Type value_;
00071
00072
00073 Type fixedComponents_;
00074
00075
00076 bool matrixCoeffsSet_;
00077
00078
00079 scalar diagCoeff_;
00080
00081
00082 Type source_;
00083
00084
00085 scalarField* upperCoeffsOwnerPtr_;
00086
00087 scalarField* upperCoeffsNeighbourPtr_;
00088
00089
00090 scalarField* lowerCoeffsOwnerPtr_;
00091
00092 scalarField* lowerCoeffsNeighbourPtr_;
00093
00094
00095
00096
00097 scalar componentOfValue(const Type&, const direction) const;
00098
00099
00100 public:
00101
00102
00103
00104
00105
00106 constraint
00107 (
00108 const label row,
00109 const Type value,
00110 const Type& fixedCmpts = pTraits<Type>::one
00111 );
00112
00113
00114 template<template<class> class Matrix>
00115 constraint
00116 (
00117 const Matrix<Type>&,
00118 const label row,
00119 const Type value,
00120 const Type& fixedCmpts = pTraits<Type>::one
00121 );
00122
00123
00124 constraint(const constraint&);
00125
00126
00127 constraint(Istream&);
00128
00129
00130
00131
00132 ~constraint();
00133
00134
00135
00136
00137
00138 label rowID() const
00139 {
00140 return rowID_;
00141 }
00142
00143
00144 Type value() const
00145 {
00146 return value_;
00147 }
00148
00149
00150 const Type& fixedComponents() const
00151 {
00152 return fixedComponents_;
00153 }
00154
00155
00156 scalar diagCoeff() const;
00157
00158
00159 Type source() const;
00160
00161
00162 const scalarField& upperCoeffsOwner() const;
00163
00164 const scalarField& upperCoeffsNeighbour() const;
00165
00166 const scalarField& lowerCoeffsOwner() const;
00167
00168 const scalarField& lowerCoeffsNeighbour() const;
00169
00170
00171 void combine(const constraint&);
00172
00173
00174 template<template<class> class Matrix>
00175 void setMatrix(const Matrix<Type>&);
00176
00177
00178
00179 template<template<class> class Matrix>
00180 static void eliminateEquation(Matrix<Type>&, const label, const Type&);
00181
00182
00183 template<template<class> class Matrix>
00184 void eliminateEquation(Matrix<Type>&) const;
00185
00186
00187
00188 template<template<class> class Matrix>
00189 void eliminateEquation
00190 (
00191 Matrix<Type>&,
00192 const direction,
00193 scalarField&
00194 ) const;
00195
00196
00197
00198 template<template<class> class Matrix>
00199 static void setSource(Matrix<Type>&, const label, const Type&);
00200
00201
00202 template<template<class> class Matrix>
00203 void setSource(Matrix<Type>&) const;
00204
00205
00206 template<template<class> class Matrix>
00207 void setSourceDiag
00208 (
00209 Matrix<Type>&,
00210 const direction,
00211 scalarField& psiCmpt,
00212 scalarField& sourceCmpt
00213 ) const;
00214
00215
00216
00217 template<template<class> class Matrix>
00218 void reconstructMatrix(Matrix<Type>&) const;
00219
00220
00221 void clearMatrix();
00222
00223
00224
00225
00226 void operator=(const constraint<Type>&);
00227
00228
00229
00230
00231 friend Ostream& operator<< <Type>
00232 (
00233 Ostream&,
00234 const constraint<Type>&
00235 );
00236 };
00237
00238
00239
00240
00241 }
00242
00243
00244
00245 #ifdef NoRepository
00246 # include "constraint.C"
00247 # include "constraintTools.C"
00248 #endif
00249
00250
00251
00252 #include "scalarConstraint.H"
00253
00254
00255
00256 #endif
00257
00258