ENH: lduMesh: added printing

This commit is contained in:
mattijs
2013-05-02 13:58:47 +01:00
parent a0fc2bc0f2
commit e6155d8ce5
2 changed files with 116 additions and 2 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -44,4 +44,104 @@ const Foam::objectRegistry& Foam::lduMesh::thisDb() const
} }
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy<lduMesh>& ip)
{
const lduMesh& ldum = ip.t_;
const lduAddressing& addr = ldum.lduAddr();
const lduInterfacePtrsList interfaces = ldum.interfaces();
os << "lduMesh :"
<< " size:" << addr.size()
<< " l:" << addr.lowerAddr().size()
<< " u:" << addr.upperAddr().size()
<< " interfaces:" << interfaces.size()
<< " comm:" << ldum.comm()
<< endl;
label nCouples = 0;
forAll(interfaces, i)
{
if (interfaces.set(i))
{
const labelUList& faceCells = addr.patchAddr(i);
nCouples += faceCells.size();
if (isA<processorLduInterface>(interfaces[i]))
{
const processorLduInterface& pi = refCast
<
const processorLduInterface
>(interfaces[i]);
os << " patch:" << i
<< " type:" << interfaces[i].type()
<< " size:" << faceCells.size()
<< " myProcNo:" << pi.myProcNo()
<< " neighbProcNo:" << pi.neighbProcNo()
<< " comm:" << pi.comm()
<< endl;
}
else
{
os << " patch:" << i
<< " type:" << interfaces[i].type()
<< " size:" << faceCells.size()
<< endl;
}
}
}
os << " Interface faces/cells:" << scalar(nCouples)/addr.size()
<< endl;
// Print actual contents
if (lduMesh::debug)
{
const labelList& l = addr.lowerAddr();
const labelList& u = addr.upperAddr();
forAll(l, faceI)
{
os << " face:" << faceI << " l:" << l[faceI]
<< " u:" << u[faceI] << endl;
}
forAll(interfaces, i)
{
if (interfaces.set(i))
{
const labelUList& faceCells = addr.patchAddr(i);
if (faceCells.size())
{
os << " patch:" << i
<< " type:" << interfaces[i].type() << endl;
if (isA<processorLduInterface>(interfaces[i]))
{
const processorLduInterface& pi = refCast
<
const processorLduInterface
>(interfaces[i]);
os << " myProcNo:" << pi.myProcNo()
<< " neighbProcNo:" << pi.neighbProcNo()
<< " comm:" << pi.comm()
<< endl;
}
forAll(faceCells, i)
{
os << " " << i << " own:" << faceCells[i]
<< endl;
}
}
}
}
}
os.check("Ostream& operator<<(Ostream&, const lduMesh&");
return os;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -36,6 +36,7 @@ Description
#include "lduAddressing.H" #include "lduAddressing.H"
#include "lduInterfacePtrsList.H" #include "lduInterfacePtrsList.H"
#include "typeInfo.H" #include "typeInfo.H"
#include "InfoProxy.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -77,6 +78,19 @@ public:
//- Return a list of pointers for each patch //- Return a list of pointers for each patch
// with only those pointing to interfaces being set // with only those pointing to interfaces being set
virtual lduInterfacePtrsList interfaces() const = 0; virtual lduInterfacePtrsList interfaces() const = 0;
// Info
//- Return info proxy.
// Used to print mesh information to a stream
InfoProxy<lduMesh> info() const
{
return *this;
}
// Ostream operator
friend Ostream& operator<<(Ostream&, const InfoProxy<lduMesh>&);
}; };