From 3ad9f0cb628817b4016509ceef6952c7c0e80990 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 13 Aug 2014 17:16:21 +0100 Subject: [PATCH] ENH: patchSummary: support point fields --- .../miscellaneous/patchSummary/patchSummary.C | 89 +++++++++++++------ .../patchSummary/patchSummaryTemplates.C | 27 +++--- .../patchSummary/patchSummaryTemplates.H | 16 ++-- 3 files changed, 85 insertions(+), 47 deletions(-) diff --git a/applications/utilities/miscellaneous/patchSummary/patchSummary.C b/applications/utilities/miscellaneous/patchSummary/patchSummary.C index e26fc109..01b2137f 100644 --- a/applications/utilities/miscellaneous/patchSummary/patchSummary.C +++ b/applications/utilities/miscellaneous/patchSummary/patchSummary.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,6 +37,7 @@ Description #include "fvCFD.H" #include "volFields.H" +#include "pointFields.H" #include "IOobjectList.H" #include "patchSummaryTemplates.H" @@ -87,6 +88,12 @@ int main(int argc, char *argv[]) PtrList vsytf(objNames.size()); PtrList vtf(objNames.size()); + PtrList psf(objNames.size()); + PtrList pvf(objNames.size()); + PtrList psptf(objNames.size()); + PtrList psytf(objNames.size()); + PtrList ptf(objNames.size()); + Info<< "Valid fields:" << endl; forAll(objNames, objI) @@ -101,11 +108,17 @@ int main(int argc, char *argv[]) if (obj.headerOk()) { - addToFieldList(vsf, obj, objI, mesh); - addToFieldList(vvf, obj, objI, mesh); - addToFieldList(vsptf, obj, objI, mesh); - addToFieldList(vsytf, obj, objI, mesh); - addToFieldList(vtf, obj, objI, mesh); + addToFieldList(vsf, obj, objI, mesh); + addToFieldList(vvf, obj, objI, mesh); + addToFieldList(vsptf, obj, objI, mesh); + addToFieldList(vsytf, obj, objI, mesh); + addToFieldList(vtf, obj, objI, mesh); + + addToFieldList(psf, obj, objI, pointMesh::New(mesh)); + addToFieldList(pvf, obj, objI, pointMesh::New(mesh)); + addToFieldList(psptf, obj, objI, pointMesh::New(mesh)); + addToFieldList(psytf, obj, objI, pointMesh::New(mesh)); + addToFieldList(ptf, obj, objI, pointMesh::New(mesh)); } } @@ -119,11 +132,17 @@ int main(int argc, char *argv[]) forAll(bm, patchI) { Info<< bm[patchI].type() << "\t: " << bm[patchI].name() << nl; - outputFieldList(vsf, patchI); - outputFieldList(vvf, patchI); - outputFieldList(vsptf, patchI); - outputFieldList(vsytf, patchI); - outputFieldList(vtf, patchI); + outputFieldList(vsf, patchI); + outputFieldList(vvf, patchI); + outputFieldList(vsptf, patchI); + outputFieldList(vsytf, patchI); + outputFieldList(vtf, patchI); + + outputFieldList(psf, patchI); + outputFieldList(pvf, patchI); + outputFieldList(psptf, patchI); + outputFieldList(psytf, patchI); + outputFieldList(ptf, patchI); Info<< endl; } } @@ -139,11 +158,17 @@ int main(int argc, char *argv[]) forAll(bm, patchI) { HashTable fieldToType; - collectFieldList(vsf, patchI, fieldToType); - collectFieldList(vvf, patchI, fieldToType); - collectFieldList(vsptf, patchI, fieldToType); - collectFieldList(vsytf, patchI, fieldToType); - collectFieldList(vtf, patchI, fieldToType); + collectFieldList(vsf, patchI, fieldToType); + collectFieldList(vvf, patchI, fieldToType); + collectFieldList(vsptf, patchI, fieldToType); + collectFieldList(vsytf, patchI, fieldToType); + collectFieldList(vtf, patchI, fieldToType); + + collectFieldList(psf, patchI, fieldToType); + collectFieldList(pvf, patchI, fieldToType); + collectFieldList(psptf, patchI, fieldToType); + collectFieldList(psytf, patchI, fieldToType); + collectFieldList(ptf, patchI, fieldToType); label groupI = findIndex(fieldToTypes, fieldToType); if (groupI == -1) @@ -184,11 +209,17 @@ int main(int argc, char *argv[]) Info<< "group\t: " << groups[i] << nl; } } - outputFieldList(vsf, patchIDs[0]); - outputFieldList(vvf, patchIDs[0]); - outputFieldList(vsptf, patchIDs[0]); - outputFieldList(vsytf, patchIDs[0]); - outputFieldList(vtf, patchIDs[0]); + outputFieldList(vsf, patchIDs[0]); + outputFieldList(vvf, patchIDs[0]); + outputFieldList(vsptf, patchIDs[0]); + outputFieldList(vsytf, patchIDs[0]); + outputFieldList(vtf, patchIDs[0]); + + outputFieldList(psf, patchIDs[0]); + outputFieldList(pvf, patchIDs[0]); + outputFieldList(psptf, patchIDs[0]); + outputFieldList(psytf, patchIDs[0]); + outputFieldList(ptf, patchIDs[0]); Info<< endl; } else @@ -199,11 +230,17 @@ int main(int argc, char *argv[]) label patchI = patchIDs[i]; Info<< bm[patchI].type() << "\t: " << bm[patchI].name() << nl; - outputFieldList(vsf, patchI); - outputFieldList(vvf, patchI); - outputFieldList(vsptf, patchI); - outputFieldList(vsytf, patchI); - outputFieldList(vtf, patchI); + outputFieldList(vsf, patchI); + outputFieldList(vvf, patchI); + outputFieldList(vsptf, patchI); + outputFieldList(vsytf, patchI); + outputFieldList(vtf, patchI); + + outputFieldList(psf, patchI); + outputFieldList(pvf, patchI); + outputFieldList(psptf, patchI); + outputFieldList(psytf, patchI); + outputFieldList(ptf, patchI); Info<< endl; } } diff --git a/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.C b/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.C index bc0eee1e..4f130eed 100644 --- a/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.C +++ b/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,33 +28,33 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template +template void Foam::addToFieldList ( - PtrList >& fieldList, + PtrList& fieldList, const IOobject& obj, const label fieldI, - const fvMesh& mesh + const typename GeoField::Mesh& mesh ) { - typedef GeometricField fieldType; + typedef GeoField fieldType; - if (obj.headerClassName() == fieldType::typeName) + if (obj.headerClassName() == GeoField::typeName) { fieldList.set ( fieldI, - new fieldType(obj, mesh) + new GeoField(obj, mesh) ); - Info<< " " << fieldType::typeName << tab << obj.name() << endl; + Info<< " " << GeoField::typeName << tab << obj.name() << endl; } } -template +template void Foam::outputFieldList ( - const PtrList >& fieldList, + const PtrList& fieldList, const label patchI ) { @@ -62,7 +62,8 @@ void Foam::outputFieldList { if (fieldList.set(fieldI)) { - Info<< " " << pTraits::typeName << tab << tab + Info<< " " << pTraits::typeName + << tab << tab << fieldList[fieldI].name() << tab << tab << fieldList[fieldI].boundaryField()[patchI].type() << nl; } @@ -70,10 +71,10 @@ void Foam::outputFieldList } -template +template void Foam::collectFieldList ( - const PtrList >& fieldList, + const PtrList& fieldList, const label patchI, HashTable& fieldToType ) diff --git a/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.H b/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.H index d61a416a..8689ed84 100644 --- a/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.H +++ b/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.H @@ -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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,26 +33,26 @@ License namespace Foam { - template + template void addToFieldList ( - PtrList >& fieldList, + PtrList& fieldList, const IOobject& obj, const label fieldI, - const fvMesh& mesh + const typename GeoField::Mesh& mesh ); - template + template void outputFieldList ( - const PtrList >& fieldList, + const PtrList& fieldList, const label patchI ); - template + template void collectFieldList ( - const PtrList >& fieldList, + const PtrList& fieldList, const label patchI, HashTable& fieldToType );