From 31afe2d5d3be26c5611cb5d9b414ffa69dfdfc8d Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 8 Oct 2012 09:44:08 +0100 Subject: [PATCH 1/2] ENH: symbolic units: test app --- .../dimensionedType/Test-dimensionedType.C | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/applications/test/dimensionedType/Test-dimensionedType.C b/applications/test/dimensionedType/Test-dimensionedType.C index 5c826d256f..ccf56fff6b 100644 --- a/applications/test/dimensionedType/Test-dimensionedType.C +++ b/applications/test/dimensionedType/Test-dimensionedType.C @@ -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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,6 +41,45 @@ int main(int argc, char *argv[]) Info<< ds*dt << " " << dt*ds << endl; + + // dimensionSet + { + Pout<< "dimensionSet construct from is:" + << dimensionSet(IStringStream("[Pa m^2 s^-2]")()) + << endl; + + IStringStream is("[Pa m^2 s^-2]"); + dimensionSet dset(dimless); + is >> dset; + Pout<< "dimensionSet read:" << dset << endl; + } + // dimensionedType + { + Pout<< "construct from is:" + << dimensionedScalar(IStringStream("bla [Pa mm^2 s^-2] 3.0")()) + << endl; + Pout<< "construct from name,is:" + << dimensionedScalar + ( + "ABC", + IStringStream("[Pa mm^2 s^-2] 3.0")() + ) << endl; + Pout<< "construct from name,dimensionSet,is:" + << dimensionedScalar + ( + "ABC", + dimLength, + IStringStream("bla [mm] 3.0")() + ) << endl; + { + IStringStream is("bla [mm] 3.0"); + dimensionedScalar ds; + is >> ds; + Pout<< "read:" << ds << endl; + } + } + + Info<< "End\n" << endl; return 0; From eca5475f04fe34dd3a34742226e88ac994594c13 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 8 Oct 2012 14:56:05 +0100 Subject: [PATCH 2/2] ENH: splitMeshRegions: optionally add regionName to all patches --- .../splitMeshRegions/splitMeshRegions.C | 65 ++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index d129efde6d..4abdc6c607 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -55,6 +55,8 @@ Description this if you don't mind having disconnected domains in a single region. This option requires all cells to be in one (and one only) cellZone. + - prefixRegion prefixes all normal patches with region name (interface + (patches already have region name prefix) - Should work in parallel. cellZones can differ on either side of processor boundaries in which case @@ -389,6 +391,40 @@ void reorderPatches } +// Prepend prefix to selected patches. +void renamePatches +( + fvMesh& mesh, + const word& prefix, + const labelList& patchesToRename +) +{ + polyBoundaryMesh& polyPatches = + const_cast(mesh.boundaryMesh()); + forAll(patchesToRename, i) + { + label patchI = patchesToRename[i]; + polyPatch& pp = polyPatches[patchI]; + + if (isA(pp)) + { + WarningIn + ( + "renamePatches(fvMesh&, const word&, const labelList&" + ) << "Encountered coupled patch " << pp.name() + << ". Will only rename the patch itself," + << " not any referred patches." + << " This might have to be done by hand." + << endl; + } + + pp.name() = prefix + '_' + pp.name(); + } + // Recalculate any demand driven data (e.g. group to name lookup) + polyPatches.updateMesh(); +} + + template void subsetVolFields ( @@ -987,6 +1023,7 @@ void createAndWriteRegion const fvMesh& mesh, const labelList& cellRegion, const wordList& regionNames, + const bool prefixRegion, const labelList& faceToInterface, const labelList& interfacePatches, const label regionI, @@ -1017,6 +1054,7 @@ void createAndWriteRegion addedPatches.insert(interfacePatches[interfaceI]+1); } + Info<< "Mapping fields" << endl; // Map existing fields @@ -1109,6 +1147,7 @@ void createAndWriteRegion // Create reordering list to move patches-to-be-deleted to end labelList oldToNew(newPatches.size(), -1); + DynamicList