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 | Copyright (C) 2011-2015 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_ = NULL;
44  return *orPtr_;
45 }
46 
47 
48 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
49 
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  {
121  const processorLduInterface& pi = refCast
122  <
123  const processorLduInterface
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 // ************************************************************************* //
Foam::lduAddressing
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Definition: lduAddressing.H:111
Foam::InfoProxy
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:45
Foam::labelList
List< label > labelList
A List of labels.
Definition: labelList.H:56
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::processorLduInterface
An abstract base class for processor coupled interfaces.
Definition: processorLduInterface.H:50
objectRegistry.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::lduAddressing::size
label size() const
Return number of equations.
Definition: lduAddressing.H:168
Foam::lduAddressing::upperAddr
virtual const labelUList & upperAddr() const =0
Return upper addressing.
processorLduInterface.H
Foam::lduMesh::interfaces
virtual lduInterfacePtrsList interfaces() const =0
Return a list of pointers for each patch.
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::lduMesh::thisDb
virtual const objectRegistry & thisDb() const
Return the object registry.
Definition: lduMesh.C:40
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:365
Foam::label
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
Foam::InfoProxy::t_
const T & t_
Definition: InfoProxy.H:53
Foam::UPtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: UPtrList.H:53
Foam::operator<<
Ostream & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:130
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::refCast
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:106
Foam::lduAddressing::lowerAddr
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
Foam::UPtrList::set
bool set(const label) const
Is element set.
Foam::UList
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
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::constant::mathematical::pi
const scalar pi(M_PI)
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::labelUList
UList< label > labelUList
Definition: UList.H:63
Foam::UList::size
label size() const
Return the number of elements in the UList.
Definition: UListI.H:299
lduMesh.H
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
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:51
Foam::UPtrList::size
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:31