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 Matrix wrapper class containing ldu addressing, matrix, coupling interfaces
29 coupling interface fields and coupling coefficients
32 Hrvoje Jasak, Wikki Ltd. All rights reserved
39 \*---------------------------------------------------------------------------*/
44 #include "lduPrimitiveMesh.H"
45 #include "demandDrivenData.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 /*---------------------------------------------------------------------------*\
53 Class amgMatrix Declaration
54 \*---------------------------------------------------------------------------*/
60 //- Matrix addressing object
61 lduPrimitiveMesh* addrPtr_;
63 //- Coupling interfaces fields
64 lduInterfacePtrsList* interfacesPtr_;
67 lduMatrix* matrixPtr_;
69 //- Coupling interface fields
70 lduInterfaceFieldPtrsList* interfaceFieldsPtr_;
72 //- Coupling coefficients, upper
73 FieldField<Field, scalar>* coupleBouCoeffsPtr_;
75 //- Coupling coefficients, lower
76 FieldField<Field, scalar>* coupleIntCoeffsPtr_;
79 // Private Member Functions
81 //- Disallow default bitwise copy construct
82 amgMatrix(const amgMatrix&);
84 //- Disallow default bitwise assignment
85 void operator=(const amgMatrix&);
90 // Static data members
95 //- Construct from components
98 lduPrimitiveMesh* addrPtr,
99 lduInterfacePtrsList* interfacesPtr,
100 lduMatrix* matrixPtr,
101 FieldField<Field, scalar>* coupleBouCoeffsPtr,
102 FieldField<Field, scalar>* coupleIntCoeffsPtr,
103 lduInterfaceFieldPtrsList* interfaceFieldsPtr
107 interfacesPtr_(interfacesPtr),
108 matrixPtr_(matrixPtr),
109 interfaceFieldsPtr_(interfaceFieldsPtr),
110 coupleBouCoeffsPtr_(coupleBouCoeffsPtr),
111 coupleIntCoeffsPtr_(coupleIntCoeffsPtr)
119 deleteDemandDrivenData(addrPtr_);
121 // Clear the interface storage by hand. It is a list of ptrs
122 // not a PtrList for consistency of the interface
125 lduInterfacePtrsList& curLevel = *interfacesPtr_;
136 deleteDemandDrivenData(interfacesPtr_);
138 deleteDemandDrivenData(matrixPtr_);
140 // Clear the interface field storage by hand. It is a list of ptrs
141 // not a PtrList for consistency of the interface
142 if (interfaceFieldsPtr_)
144 lduInterfaceFieldPtrsList& curLevelField = *interfaceFieldsPtr_;
146 forAll (curLevelField, i)
148 if (curLevelField.set(i))
150 delete curLevelField(i);
155 deleteDemandDrivenData(interfaceFieldsPtr_);
156 deleteDemandDrivenData(coupleBouCoeffsPtr_);
157 deleteDemandDrivenData(coupleIntCoeffsPtr_);
166 return addrPtr_->size();
170 const lduMatrix& matrix() const
175 //- Return coupling interfaces
176 const lduInterfacePtrsList& interfaces() const
178 return *interfacesPtr_;
181 //- Return coupling interfaceFields
182 const lduInterfaceFieldPtrsList& interfaceFields() const
184 return *interfaceFieldsPtr_;
187 //- Return boundary coefficients
188 const FieldField<Field, scalar>& coupleBouCoeffs() const
190 return *coupleBouCoeffsPtr_;
193 //- Return internal coefficients
194 const FieldField<Field, scalar>& coupleIntCoeffs() const
196 return *coupleIntCoeffsPtr_;
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 } // End namespace Foam
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 // ************************************************************************* //