lduMesh.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "lduMesh.H"
27 #include "objectRegistry.H"
28 #include "processorLduInterface.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 defineTypeNameAndDebug(lduMesh, 0);
35 }
36 
37 
38 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
39 
41 {
43  const objectRegistry* orPtr_ = nullptr;
44  return *orPtr_;
45 }
46 
47 
48 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
49 
50 Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy<lduMesh>& ip)
51 {
52  const lduMesh& ldum = ip.t_;
53  const lduAddressing& addr = ldum.lduAddr();
54  const lduInterfacePtrsList interfaces = ldum.interfaces();
55 
56  os << "lduMesh :"
57  << " size:" << addr.size()
58  << " l:" << addr.lowerAddr().size()
59  << " u:" << addr.upperAddr().size()
60  << " interfaces:" << interfaces.size()
61  << " comm:" << ldum.comm()
62  << endl;
63  label nCouples = 0;
64  forAll(interfaces, i)
65  {
66  if (interfaces.set(i))
67  {
68  const labelUList& faceCells = addr.patchAddr(i);
69  nCouples += faceCells.size();
70 
71  if (isA<processorLduInterface>(interfaces[i]))
72  {
74  <
76  >(interfaces[i]);
77 
78  os << " patch:" << i
79  << " type:" << interfaces[i].type()
80  << " size:" << faceCells.size()
81  << " myProcNo:" << pi.myProcNo()
82  << " neighbProcNo:" << pi.neighbProcNo()
83  << " comm:" << pi.comm()
84  << endl;
85  }
86  else
87  {
88  os << " patch:" << i
89  << " type:" << interfaces[i].type()
90  << " size:" << faceCells.size()
91  << endl;
92  }
93  }
94  }
95  os << " Interface faces/cells:" << scalar(nCouples)/addr.size()
96  << endl;
97 
98 
99  // Print actual contents
100  if (lduMesh::debug)
101  {
102  const labelList& l = addr.lowerAddr();
103  const labelList& u = addr.upperAddr();
104  forAll(l, facei)
105  {
106  os << " face:" << facei << " l:" << l[facei]
107  << " u:" << u[facei] << endl;
108  }
109  forAll(interfaces, i)
110  {
111  if (interfaces.set(i))
112  {
113  const labelUList& faceCells = addr.patchAddr(i);
114  if (faceCells.size())
115  {
116  os << " patch:" << i
117  << " type:" << interfaces[i].type() << endl;
118 
119  if (isA<processorLduInterface>(interfaces[i]))
120  {
122  <
124  >(interfaces[i]);
125 
126  os << " myProcNo:" << pi.myProcNo()
127  << " neighbProcNo:" << pi.neighbProcNo()
128  << " comm:" << pi.comm()
129  << endl;
130  }
131 
132  forAll(faceCells, i)
133  {
134  os << " " << i << " own:" << faceCells[i]
135  << endl;
136  }
137  }
138  }
139  }
140  }
141 
142  os.check("Ostream& operator<<(Ostream&, const lduMesh&");
143 
144  return os;
145 }
146 
147 
148 // ************************************************************************* //
virtual lduInterfacePtrsList interfaces() const =0
Return a list of pointers for each patch.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:106
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
Definition: lduMesh.H:59
virtual label comm() const =0
Return communicator used for parallel communication.
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
virtual const labelUList & upperAddr() const =0
Return upper addressing.
virtual const labelUList & patchAddr(const label patchNo) const =0
Return patch to internal addressing given patch number.
virtual const lduAddressing & lduAddr() const =0
Return ldu addressing.
virtual label comm() const =0
Return communicator used for parallel communication.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
bool set(const label) const
Is element set.
Definition: UPtrListI.H:78
An abstract base class for processor coupled interfaces.
defineTypeNameAndDebug(combustionModel, 0)
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:29
virtual const objectRegistry & thisDb() const
Return the object registry.
Definition: lduMesh.C:40
virtual int neighbProcNo() const =0
Return neighbour processor number (rank in communicator)
The class contains the addressing required by the lduMatrix: upper, lower and losort.
virtual int myProcNo() const =0
Return processor number (rank in communicator)
Registry of regIOobjects.
label size() const
Return the number of elements in the UList.
Definition: UListI.H:311
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:370
Namespace for OpenFOAM.
label size() const
Return number of equations.