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  Copyright (C) 2024 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "procLduMatrix.H"
30 #include "procLduInterface.H"
31 #include "lduMatrix.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
36 (
37  const lduMatrix& ldum,
38  const FieldField<Field, scalar>& interfaceCoeffs,
39  const lduInterfaceFieldPtrsList& interfaces
40 )
41 :
42  upperAddr_(ldum.lduAddr().upperAddr()),
43  lowerAddr_(ldum.lduAddr().lowerAddr()),
44  diag_(ldum.diag()),
45  upper_(ldum.upper()),
46  lower_(ldum.lower()),
47  interfaces_(interfaces.count_nonnull())
48 {
49  label nInterfaces = 0;
50 
51  forAll(interfaces, i)
52  {
53  if (interfaces.test(i))
54  {
55  interfaces_.set
56  (
57  nInterfaces++,
59  (
60  interfaces[i],
61  interfaceCoeffs[i]
62  )
63  );
64  }
65  }
66 }
67 
68 
70 {
71  read(is);
72 }
73 
74 
75 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
76 
77 // void Foam::procLduMatrix::clear()
78 // {
79 // upperAddr_.clear();
80 // lowerAddr_.clear();
81 // diag_.clear();
82 // upper_.clear();
83 // lower_.clear();
84 // interfaces_.clear();
85 // }
86 
87 
89 {
90  is >> upperAddr_ >> lowerAddr_ >> diag_ >> upper_ >> lower_ >> interfaces_;
91 }
92 
93 
95 {
96  os << upperAddr_ << lowerAddr_ << diag_ << upper_ << lower_ << interfaces_;
97 }
98 
99 
100 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
101 
103 {
104  mat.read(is);
105  return is;
106 }
107 
108 
109 Foam::Ostream& Foam::operator<<(Ostream& os, const procLduMatrix& mat)
110 {
111  mat.write(os);
112  return os;
113 }
114 
115 
116 // ************************************************************************* //
IO interface for processorLduInterface.
const T * test(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
Definition: UPtrListI.H:127
procLduMatrix()=default
Default construct.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
Definition: stringOps.C:1187
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:51
bool read(const char *buf, int32_t &val)
Same as readInt32.
Definition: int32.H:127
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
void write(Ostream &os) const
Definition: procLduMatrix.C:87
Istream & operator>>(Istream &, directionInfo &)
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
Definition: lduMatrix.H:80
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
Definition: stringOps.C:1171
void read(Istream &is)
Definition: procLduMatrix.C:81
I/O for lduMatrix and interface values.
Definition: procLduMatrix.H:58