From b7be6bce24b5edbfbfdff602e6dd09bb10e4581a Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 14 Jul 2008 11:34:47 +0100 Subject: [PATCH] updated --- .../manipulation/createPatch/createPatch.C | 435 +++++++++++++----- .../manipulation/createPatch/createPatchDict | 6 + 2 files changed, 338 insertions(+), 103 deletions(-) diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index e1e4284712..f9cc4cce30 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,8 +26,15 @@ Description Utility to create patches out of selected boundary faces. Faces come either from existing patches or from a faceSet. + More specifically it: + - creates new patches (from selected boundary faces). Synchronise faces + on coupled patches. + - synchronises points on coupled boundaries + - remove patches with 0 faces in them + \*---------------------------------------------------------------------------*/ +#include "syncTools.H" #include "argList.H" #include "polyMesh.H" #include "Time.H" @@ -48,6 +55,23 @@ namespace Foam defineTemplateTypeNameAndDebug(IOPtrList, 0); } +// Combine operator to synchronise points. We choose point nearest to origin so +// we can use e.g. great,great,great as null value. +class nearestEqOp +{ + +public: + + void operator()(vector& x, const vector& y) const + { + if (magSqr(y) < magSqr(x)) + { + x = y; + } + } +}; + + label getPatch(const polyBoundaryMesh& patches, const word& patchName) { @@ -55,7 +79,7 @@ label getPatch(const polyBoundaryMesh& patches, const word& patchName) if (patchI == -1) { - FatalErrorIn("createPatch") + FatalErrorIn("createPatch(const polyBoundaryMesh&, const word&)") << "Cannot find source patch " << patchName << endl << "Valid patch names are " << patches.names() << exit(FatalError); @@ -105,47 +129,174 @@ void changePatchID // Filter out the empty patches. void filterPatches(polyMesh& mesh) { - Info<< "Filtering empty patches." << endl; - const polyBoundaryMesh& patches = mesh.boundaryMesh(); - // Old patches. + // Patches to keep DynamicList allPatches(patches.size()); - labelList compactPatchMap(patches.size()); + label nOldPatches = returnReduce(patches.size(), sumOp