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 {
36 defineTypeNameAndDebug(lduMesh, 0);
37 }
38 
39 
40 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
41 
43 {
45  const objectRegistry* orPtr_ = nullptr;
46  return *orPtr_;
47 }
48 
49 
50 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
51 
53 {
54  const lduMesh& ldum = ip.t_;
55  const lduAddressing& addr = ldum.lduAddr();
56  const lduInterfacePtrsList interfaces = ldum.interfaces();
57 
58  os << "lduMesh :"
59  << " size:" << addr.size()
60  << " l:" << addr.lowerAddr().size()
61  << " u:" << addr.upperAddr().size()
62  << " interfaces:" << interfaces.size()
63  << " comm:" << ldum.comm()
64  << endl;
65  label nCouples = 0;
66  forAll(interfaces, i)
67  {
68  if (interfaces.set(i))
69  {
70  const labelUList& faceCells = addr.patchAddr(i);
71  nCouples += faceCells.size();
72 
73  if (isA<processorLduInterface>(interfaces[i]))
74  {
76  <
78  >(interfaces[i]);
79 
80  os << " patch:" << i
81  << " type:" << interfaces[i].type()
82  << " size:" << faceCells.size()
83  << " myProcNo:" << pi.myProcNo()
84  << " neighbProcNo:" << pi.neighbProcNo()
85  << " comm:" << pi.comm()
86  << endl;
87  }
88  else
89  {
90  os << " patch:" << i
91  << " type:" << interfaces[i].type()
92  << " size:" << faceCells.size()
93  << endl;
94  }
95  }
96  }
97  os << " Interface faces/cells:" << scalar(nCouples)/addr.size()
98  << endl;
99 
100 
101  // Print actual contents
102  if (lduMesh::debug)
103  {
104  const labelList& l = addr.lowerAddr();
105  const labelList& u = addr.upperAddr();
106  forAll(l, facei)
107  {
108  os << " face:" << facei << " l:" << l[facei]
109  << " u:" << u[facei] << endl;
110  }
111  forAll(interfaces, i)
112  {
113  if (interfaces.set(i))
114  {
115  const labelUList& faceCells = addr.patchAddr(i);
116  if (faceCells.size())
117  {
118  os << " patch:" << i
119  << " type:" << interfaces[i].type() << endl;
120 
121  if (isA<processorLduInterface>(interfaces[i]))
122  {
124  <
126  >(interfaces[i]);
127 
128  os << " myProcNo:" << pi.myProcNo()
129  << " neighbProcNo:" << pi.neighbProcNo()
130  << " comm:" << pi.comm()
131  << endl;
132  }
133 
134  forAll(faceCells, i)
135  {
136  os << " " << i << " own:" << faceCells[i]
137  << endl;
138  }
139  }
140  }
141  }
142  }
143 
145 
146  return os;
147 }
148 
149 
150 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::lduAddressing
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Definition: lduAddressing.H:114
Foam::UPtrList::size
label size() const noexcept
The number of elements in the list.
Definition: UPtrListI.H:106
Foam::InfoProxy
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:47
Foam::processorLduInterface
An abstract base class for processor coupled interfaces.
Definition: processorLduInterface.H:53
objectRegistry.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::lduAddressing::size
label size() const
Return number of equations.
Definition: lduAddressing.H:171
Foam::lduAddressing::upperAddr
virtual const labelUList & upperAddr() const =0
Return upper addressing.
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
processorLduInterface.H
Foam::lduMesh::interfaces
virtual lduInterfacePtrsList interfaces() const =0
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::lduMesh::thisDb
virtual const objectRegistry & thisDb() const
Return the object registry.
Definition: lduMesh.C:42
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::InfoProxy::t_
const T & t_
Definition: InfoProxy.H:55
Foam::UPtrList< const lduInterface >
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:58
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::refCast
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:131
Foam::UPtrList::set
const T * set(const label i) const
Definition: UPtrList.H:176
Foam::constant::mathematical::pi
constexpr scalar pi(M_PI)
Foam::lduAddressing::lowerAddr
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
Foam::List< label >
Foam::UList< label >
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:295
Foam::lduAddressing::patchAddr
virtual const labelUList & patchAddr(const label patchNo) const =0
Return patch to internal addressing given patch number.
Foam::lduMesh::comm
virtual label comm() const =0
Return communicator used for parallel communication.
Foam::UList::size
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
lduMesh.H
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56
Foam::lduMesh::lduAddr
virtual const lduAddressing & lduAddr() const =0
Return ldu addressing.
Foam::lduMesh
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
Definition: lduMesh.H:62