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  const objectRegistry* orPtr_ = nullptr;
46  return *orPtr_;
47 }
48 
49 
50 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
51 
52 Foam::Ostream& Foam::operator<<
53 (
54  Ostream& os,
55  const InfoProxy<lduMesh>& iproxy
56 )
57 {
58  const auto& ldum = *iproxy;
59  const lduAddressing& addr = ldum.lduAddr();
60  const lduInterfacePtrsList interfaces = ldum.interfaces();
61 
62  os << "lduMesh :"
63  << " size:" << addr.size()
64  << " l:" << addr.lowerAddr().size()
65  << " u:" << addr.upperAddr().size()
66  << " interfaces:" << interfaces.size()
67  << " comm:" << ldum.comm()
68  << endl;
69 
70  label nCouples = 0;
71  forAll(interfaces, i)
72  {
73  if (interfaces.set(i))
74  {
75  const labelUList& faceCells = addr.patchAddr(i);
76  nCouples += faceCells.size();
77 
78  if (isA<processorLduInterface>(interfaces[i]))
79  {
80  const processorLduInterface& pi = refCast
81  <
82  const processorLduInterface
83  >(interfaces[i]);
84 
85  os << " patch:" << i
86  << " type:" << interfaces[i].type()
87  << " size:" << faceCells.size()
88  << " myProcNo:" << pi.myProcNo()
89  << " neighbProcNo:" << pi.neighbProcNo()
90  << " comm:" << pi.comm()
91  << endl;
92  }
93  else
94  {
95  os << " patch:" << i
96  << " type:" << interfaces[i].type()
97  << " size:" << faceCells.size()
98  << endl;
99  }
100  }
101  }
102  os << " Interface faces/cells:" << scalar(nCouples)/addr.size()
103  << endl;
104 
105 
106  // Print actual contents
107  if (lduMesh::debug)
108  {
109  const labelList& l = addr.lowerAddr();
110  const labelList& u = addr.upperAddr();
111  forAll(l, facei)
112  {
113  os << " face:" << facei << " l:" << l[facei]
114  << " u:" << u[facei] << endl;
115  }
116  forAll(interfaces, i)
117  {
118  if (interfaces.set(i))
119  {
120  const labelUList& faceCells = addr.patchAddr(i);
121  if (faceCells.size())
122  {
123  os << " patch:" << i
124  << " type:" << interfaces[i].type() << endl;
125 
126  if (isA<processorLduInterface>(interfaces[i]))
127  {
128  const processorLduInterface& pi = refCast
129  <
130  const processorLduInterface
131  >(interfaces[i]);
132 
133  os << " myProcNo:" << pi.myProcNo()
134  << " neighbProcNo:" << pi.neighbProcNo()
135  << " comm:" << pi.comm()
136  << endl;
137  }
138 
139  forAll(faceCells, i)
140  {
141  os << " " << i << " own:" << faceCells[i]
142  << endl;
143  }
144  }
145  }
146  }
147  }
148 
150 
151  return os;
152 }
153 
154 
155 // ************************************************************************* //
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). Generates a FatalError on failed casts and uses the virtual type() m...
Definition: typeInfo.H:159
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:686
Namespace for OpenFOAM.