Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
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
89{
90 is >> upperAddr_ >> lowerAddr_ >> diag_ >> upper_ >> lower_ >> interfaces_;
91}
92
93
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
109Foam::Ostream& Foam::operator<<(Ostream& os, const procLduMatrix& mat)
110{
111 mat.write(os);
112 return os;
113}
114
115
116// ************************************************************************* //
A field of fields is a PtrList of fields with reference counting.
Definition FieldField.H:77
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
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
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Definition lduMatrix.H:81
IO interface for processorLduInterface.
I/O for lduMatrix and interface values.
procLduMatrix()=default
Default construct.
void write(Ostream &os) const
void read(Istream &is)
OBJstream os(runTime.globalPath()/outputName)
bool read(const char *buf, int32_t &val)
Same as readInt32.
Definition int32.H:127
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Istream & operator>>(Istream &, directionInfo &)
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
UPtrList< const lduInterfaceField > lduInterfaceFieldPtrsList
List of coupled interface fields to be used in coupling.
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299