1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 A storage mechanism which allows setting of the fixed value and
29 consequently recovering the equation for a single row of the matrix as
30 well as the b. The equation is taken out of the matrix using a
31 variant of compact matrix storage mechanism.
34 Hrvoje Jasak, Wikki Ltd. All rights reserved.
39 \*---------------------------------------------------------------------------*/
41 #ifndef BlockConstraint_H
42 #define BlockConstraint_H
44 #include "BlockCoeff.H"
45 #include "coeffFields.H"
46 #include "blockLduMatrices.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 class BlockConstraint;
57 Ostream& operator<<(Ostream&, const BlockConstraint<Type>&);
60 /*---------------------------------------------------------------------------*\
61 Class BlockConstraint Declaration
62 \*---------------------------------------------------------------------------*/
69 typedef CoeffField<Type> TypeCoeffField;
70 typedef Field<Type> TypeField;
80 //- Fixed components (0-1) 1 = fixed, 0 = free
81 Type fixedComponents_;
83 //- Are matrix coefficients set?
84 bool matrixCoeffsSet_;
86 //- Diagonal coefficient
87 BlockCoeff<Type> diagCoeff_;
92 //- Upper coefficients, owner side
93 TypeCoeffField* upperCoeffsOwnerPtr_;
95 //- Upper coefficients, neighbour side
96 TypeCoeffField* upperCoeffsNeighbourPtr_;
98 //- Lower coefficients, owner side
99 TypeCoeffField* lowerCoeffsOwnerPtr_;
101 //- Lower coefficients, neighbour side
102 TypeCoeffField* lowerCoeffsNeighbourPtr_;
110 //- Construct from components
115 const Type& fixedCmpts = pTraits<Type>::one
118 //- Construct as copy
119 BlockConstraint(const BlockConstraint&);
121 //- Construct from Istream
122 BlockConstraint(Istream&);
132 //- Return matrix row ID
138 //- Return fixed value
144 //- Return map of fixed components
145 const Type& fixedComponents() const
147 return fixedComponents_;
150 //- Return diagonal coefficient
151 const BlockCoeff<Type>& diagCoeff() const;
153 //- Return right-hand side
154 const Type& b() const;
156 //- Return off-diagonal coefficients
157 const TypeCoeffField& upperCoeffsOwner() const;
159 const TypeCoeffField& upperCoeffsNeighbour() const;
161 const TypeCoeffField& lowerCoeffsOwner() const;
163 const TypeCoeffField& lowerCoeffsNeighbour() const;
165 //- Combine with existing equation
166 void combine(const BlockConstraint<Type>&);
168 //- Set matrix coefficients
171 const BlockLduMatrix<Type>& matrix,
177 //- Eliminate equation
178 void eliminateEquation
180 BlockLduMatrix<Type>& matrix,
184 //- Set x, b and diagonal in eliminated equation
187 BlockLduMatrix<Type>&,
193 //- Reconstruct matrix coefficients
194 void reconstructMatrix(BlockLduMatrix<Type>&) const;
196 //- Clear matrix coefficients
202 void operator=(const BlockConstraint<Type>&);
207 friend Ostream& operator<< <Type>
210 const BlockConstraint<Type>&
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 } // End namespace Foam
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 # include "BlockConstraint.C"
223 # include "BlockConstraintTools.C"
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 // ************************************************************************* //