procLduMatrix.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "procLduMatrix.H"
29 #include "procLduInterface.H"
30 #include "lduMatrix.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 Foam::procLduMatrix::procLduMatrix
35 (
36  const lduMatrix& ldum,
37  const FieldField<Field, scalar>& interfaceCoeffs,
38  const lduInterfaceFieldPtrsList& interfaces
39 )
40 :
41  upperAddr_(ldum.lduAddr().upperAddr()),
42  lowerAddr_(ldum.lduAddr().lowerAddr()),
43  diag_(ldum.diag()),
44  upper_(ldum.upper()),
45  lower_(ldum.lower())
46 {
47  label nInterfaces = 0;
48 
49  forAll(interfaces, i)
50  {
51  if (interfaces.set(i))
52  {
53  nInterfaces++;
54  }
55  }
56 
57  interfaces_.setSize(nInterfaces);
58 
59  nInterfaces = 0;
60 
61  forAll(interfaces, i)
62  {
63  if (interfaces.set(i))
64  {
65  interfaces_.set
66  (
67  nInterfaces++,
69  (
70  interfaces[i],
71  interfaceCoeffs[i]
72  )
73  );
74  }
75  }
76 
77 }
78 
79 
80 Foam::procLduMatrix::procLduMatrix(Istream& is)
81 :
82  upperAddr_(is),
83  lowerAddr_(is),
84  diag_(is),
85  upper_(is),
86  lower_(is),
87  interfaces_(is)
88 {}
89 
90 
91 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
92 
94 {
95  os << cldum.upperAddr_
96  << cldum.lowerAddr_
97  << cldum.diag_
98  << cldum.upper_
99  << cldum.lower_
100  << cldum.interfaces_;
101 
102  return os;
103 }
104 
105 
106 // ************************************************************************* //
Foam::lduMatrix::lduAddr
const lduAddressing & lduAddr() const
Return the LDU addressing.
Definition: lduMatrix.H:572
Foam::FieldField
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:53
Foam::lduMatrix::upper
scalarField & upper()
Definition: lduMatrix.C:203
Foam::lduMatrix
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Definition: lduMatrix.H:83
lduMatrix.H
Foam::lduAddressing::upperAddr
virtual const labelUList & upperAddr() const =0
Return upper addressing.
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::procLduMatrix
I/O for lduMatrix and interface values.
Definition: procLduMatrix.H:63
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::UPtrList< const lduInterfaceField >
Foam::procLduInterface
IO interface for processorLduInterface.
Definition: procLduInterface.H:61
Foam::lduMatrix::diag
scalarField & diag()
Definition: lduMatrix.C:192
procLduInterface.H
Foam::UPtrList::set
const T * set(const label i) const
Return const pointer to element (can be nullptr),.
Definition: UPtrList.H:170
Foam::lduAddressing::lowerAddr
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
procLduMatrix.H
Foam::lduMatrix::lower
scalarField & lower()
Definition: lduMatrix.C:174