From 8cabfbb7d185bbbeeb07088123127ff517da3d04 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 13 Oct 2010 16:56:18 +0100 Subject: [PATCH] ENH: cyclicPolyPatch : moved debug .obj file dumping --- .../constraint/cyclic/cyclicPolyPatch.C | 89 ++++++++----------- 1 file changed, 39 insertions(+), 50 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index 330b912fb9..aafabecbb2 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -91,44 +91,58 @@ void Foam::cyclicPolyPatch::calcTransforms() // Half0 const cyclicPolyPatch& half0 = *this; - - const pointField& half0Ctrs = half0.faceCentres(); - - if (debug) - { - fileName casePath(boundaryMesh().mesh().time().path()); - - fileName nm0(casePath/name()+"_faces.obj"); - Pout<< "cyclicPolyPatch::calcTransforms : Writing " << name() - << " faces to OBJ file " << nm0 << endl; - writeOBJ(nm0, half0, half0.points()); - } - vectorField half0Areas(half0.size()); - forAll(half0, facei) { half0Areas[facei] = half0[facei].normal(half0.points()); } - - // Half1 - const cyclicPolyPatch& half1 = neighbPatch(); - - const pointField& half1Ctrs = half1.faceCentres(); - - // Dump halves - if (debug) + vectorField half1Areas(half1.size()); + forAll(half1, facei) { - fileName casePath(boundaryMesh().mesh().time().path()); + half1Areas[facei] = half1[facei].normal(half1.points()); + } + calcTransforms + ( + half0, + half0.faceCentres(), + half0Areas, + half1.faceCentres(), + half1Areas + ); + } +} + + +void Foam::cyclicPolyPatch::calcTransforms +( + const primitivePatch& half0, + const UList& half0Ctrs, + const UList& half0Areas, + const UList& half1Ctrs, + const UList& half1Areas +) +{ + if (debug) + { + fileName casePath(boundaryMesh().mesh().time().path()); + { + fileName nm0(casePath/name()+"_faces.obj"); + Pout<< "cyclicPolyPatch::calcTransforms : Writing " << name() + << " faces to OBJ file " << nm0 << endl; + writeOBJ(nm0, half0, half0.points()); + } + const cyclicPolyPatch& half1 = neighbPatch(); + { fileName nm1(casePath/half1.name()+"_faces.obj"); Pout<< "cyclicPolyPatch::calcTransforms : Writing " << half1.name() << " faces to OBJ file " << nm1 << endl; writeOBJ(nm1, half1, half1.points()); - + } + { OFstream str(casePath/name()+"_to_" + half1.name() + ".obj"); label vertI = 0; Pout<< "cyclicPolyPatch::calcTransforms :" @@ -145,35 +159,10 @@ void Foam::cyclicPolyPatch::calcTransforms() str << "l " << vertI-1 << ' ' << vertI << nl; } } - - vectorField half1Areas(half1.size()); - - forAll(half1, facei) - { - half1Areas[facei] = half1[facei].normal(half1.points()); - } - - calcTransforms - ( - half0, - half0Ctrs, - half0Areas, - half1Ctrs, - half1Areas - ); } -} -void Foam::cyclicPolyPatch::calcTransforms -( - const primitivePatch& half0, - const UList& half0Ctrs, - const UList& half0Areas, - const UList& half1Ctrs, - const UList& half1Areas -) -{ + if (half0Ctrs.size() != half1Ctrs.size()) { FatalErrorIn