lduMesh.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-2016 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 "lduMesh.H"
29 #include "objectRegistry.H"
30 #include "processorLduInterface.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
37 }
38 
39 
40 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
41 
43 {
45  return NullObjectRef<objectRegistry>();
46 }
47 
48 
49 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
50 
51 Foam::Ostream& Foam::operator<<
52 (
53  Ostream& os,
54  const InfoProxy<lduMesh>& iproxy
55 )
56 {
57  const auto& ldum = *iproxy;
58  const lduAddressing& addr = ldum.lduAddr();
59  const lduInterfacePtrsList interfaces = ldum.interfaces();
60 
61  os << "lduMesh :"
62  << " size:" << addr.size()
63  << " l:" << addr.lowerAddr().size()
64  << " u:" << addr.upperAddr().size()
65  << " interfaces:" << interfaces.size()
66  << " comm:" << ldum.comm()
67  << endl;
68 
69  label nCouples = 0;
70  forAll(interfaces, i)
71  {
72  if (interfaces.set(i))
73  {
74  const labelUList& faceCells = addr.patchAddr(i);
75  nCouples += faceCells.size();
76 
77  if (isA<processorLduInterface>(interfaces[i]))
78  {
79  const processorLduInterface& pi = refCast
80  <
81  const processorLduInterface
82  >(interfaces[i]);
83 
84  os << " patch:" << i
85  << " type:" << interfaces[i].type()
86  << " size:" << faceCells.size()
87  << " myProcNo:" << pi.myProcNo()
88  << " neighbProcNo:" << pi.neighbProcNo()
89  << " comm:" << pi.comm()
90  << endl;
91  }
92  else
93  {
94  os << " patch:" << i
95  << " type:" << interfaces[i].type()
96  << " size:" << faceCells.size()
97  << endl;
98  }
99  }
100  }
101  os << " Interface faces/cells:" << scalar(nCouples)/addr.size()
102  << endl;
103 
104 
105  // Print actual contents
106  if (lduMesh::debug)
107  {
108  const labelList& l = addr.lowerAddr();
109  const labelList& u = addr.upperAddr();
110  forAll(l, facei)
111  {
112  os << " face:" << facei << " l:" << l[facei]
113  << " u:" << u[facei] << endl;
114  }
115  forAll(interfaces, i)
116  {
117  if (interfaces.set(i))
118  {
119  const labelUList& faceCells = addr.patchAddr(i);
120  if (faceCells.size())
121  {
122  os << " patch:" << i
123  << " type:" << interfaces[i].type() << endl;
124 
125  if (isA<processorLduInterface>(interfaces[i]))
126  {
127  const processorLduInterface& pi = refCast
128  <
129  const processorLduInterface
130  >(interfaces[i]);
131 
132  os << " myProcNo:" << pi.myProcNo()
133  << " neighbProcNo:" << pi.neighbProcNo()
134  << " comm:" << pi.comm()
135  << endl;
136  }
137 
138  forAll(faceCells, i)
139  {
140  os << " " << i << " own:" << faceCells[i]
141  << endl;
142  }
143  }
144  }
145  }
146  }
147 
149 
150  return os;
151 }
152 
153 
154 // ************************************************************************* //
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:45
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Definition: typeInfo.H:172
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
Definition: lduMesh.H:53
UList< label > labelUList
A UList of labels.
Definition: UList.H:78
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
constexpr scalar pi(M_PI)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
#define FUNCTION_NAME
defineTypeNameAndDebug(combustionModel, 0)
virtual const objectRegistry & thisDb() const
Return the object registry.
Definition: lduMesh.C:35
List< label > labelList
A List of labels.
Definition: List.H:62
Registry of regIOobjects.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:696
Namespace for OpenFOAM.