1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-6 H. Jasak All rights reserved
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM 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 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Matrix wrapper class containing ldu addressing, matrix, coupling interfaces
30 coupling interface fields and coupling coefficients
33 Hrvoje Jasak, Wikki Ltd. All rights reserved
40 \*---------------------------------------------------------------------------*/
45 #include "lduPrimitiveMesh.H"
46 #include "demandDrivenData.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 /*---------------------------------------------------------------------------*\
54 Class amgMatrix Declaration
55 \*---------------------------------------------------------------------------*/
61 //- Matrix addressing object
62 lduPrimitiveMesh* addrPtr_;
64 //- Coupling interfaces fields
65 lduInterfacePtrsList* interfacesPtr_;
68 lduMatrix* matrixPtr_;
70 //- Coupling interface fields
71 lduInterfaceFieldPtrsList* interfaceFieldsPtr_;
73 //- Coupling coefficients, upper
74 FieldField<Field, scalar>* coupleBouCoeffsPtr_;
76 //- Coupling coefficients, lower
77 FieldField<Field, scalar>* coupleIntCoeffsPtr_;
80 // Private Member Functions
82 //- Disallow default bitwise copy construct
83 amgMatrix(const amgMatrix&);
85 //- Disallow default bitwise assignment
86 void operator=(const amgMatrix&);
91 // Static data members
96 //- Construct from components
99 lduPrimitiveMesh* addrPtr,
100 lduInterfacePtrsList* interfacesPtr,
101 lduMatrix* matrixPtr,
102 FieldField<Field, scalar>* coupleBouCoeffsPtr,
103 FieldField<Field, scalar>* coupleIntCoeffsPtr,
104 lduInterfaceFieldPtrsList* interfaceFieldsPtr
108 interfacesPtr_(interfacesPtr),
109 matrixPtr_(matrixPtr),
110 interfaceFieldsPtr_(interfaceFieldsPtr),
111 coupleBouCoeffsPtr_(coupleBouCoeffsPtr),
112 coupleIntCoeffsPtr_(coupleIntCoeffsPtr)
120 deleteDemandDrivenData(addrPtr_);
122 // Clear the interface storage by hand. It is a list of ptrs
123 // not a PtrList for consistency of the interface
126 lduInterfacePtrsList& curLevel = *interfacesPtr_;
137 deleteDemandDrivenData(interfacesPtr_);
139 deleteDemandDrivenData(matrixPtr_);
141 // Clear the interface field storage by hand. It is a list of ptrs
142 // not a PtrList for consistency of the interface
143 if (interfaceFieldsPtr_)
145 lduInterfaceFieldPtrsList& curLevelField = *interfaceFieldsPtr_;
147 forAll (curLevelField, i)
149 if (curLevelField.set(i))
151 delete curLevelField(i);
156 deleteDemandDrivenData(interfaceFieldsPtr_);
157 deleteDemandDrivenData(coupleBouCoeffsPtr_);
158 deleteDemandDrivenData(coupleIntCoeffsPtr_);
167 return addrPtr_->size();
171 const lduMatrix& matrix() const
176 //- Return coupling interfaces
177 const lduInterfacePtrsList& interfaces() const
179 return *interfacesPtr_;
182 //- Return coupling interfaceFields
183 const lduInterfaceFieldPtrsList& interfaceFields() const
185 return *interfaceFieldsPtr_;
188 //- Return boundary coefficients
189 const FieldField<Field, scalar>& coupleBouCoeffs() const
191 return *coupleBouCoeffsPtr_;
194 //- Return internal coefficients
195 const FieldField<Field, scalar>& coupleIntCoeffs() const
197 return *coupleIntCoeffsPtr_;
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 } // End namespace Foam
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 // ************************************************************************* //