diff --git a/src/OpenFOAM/meshes/lduMesh/lduMesh.C b/src/OpenFOAM/meshes/lduMesh/lduMesh.C index 2ab4cfe04650c6a2989aba9f33450eaa966d44e5..bd7c6aacd51c55ee216e72a292f19f4bcad9ea1d 100644 --- a/src/OpenFOAM/meshes/lduMesh/lduMesh.C +++ b/src/OpenFOAM/meshes/lduMesh/lduMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- 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; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/lduMesh/lduMesh.H b/src/OpenFOAM/meshes/lduMesh/lduMesh.H index 0c3314452ad08ee8523e6d84c2508cab15d8b01f..aa96663e49ba83cdebee329992821c00945ed3a0 100644 --- a/src/OpenFOAM/meshes/lduMesh/lduMesh.H +++ b/src/OpenFOAM/meshes/lduMesh/lduMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,6 +36,7 @@ Description #include "lduAddressing.H" #include "lduInterfacePtrsList.H" #include "typeInfo.H" +#include "InfoProxy.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -77,6 +78,19 @@ public: //- Return a list of pointers for each patch // with only those pointing to interfaces being set 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>&); };