1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::coupledPolyPatch
29 The coupledPolyPatch is an abstract base class for patches that couple
30 regions of the computational domain e.g. cyclic and processor-processor
35 coupledPolyPatchMorph.C
37 \*---------------------------------------------------------------------------*/
39 #ifndef coupledPolyPatch_H
40 #define coupledPolyPatch_H
42 #include "polyPatch.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Class coupledPolyPatch Declaration
51 \*---------------------------------------------------------------------------*/
53 class coupledPolyPatch
59 //- offset (distance) vector from one side of the couple to the other
60 mutable vectorField separation_;
62 //- Face transformation tensor
63 mutable tensorField forwardT_;
65 //- Neighbour-cell transformation tensor
66 mutable tensorField reverseT_;
70 // Static data members
72 //- Relative tolerance (for geometric matching).
73 static scalar matchTol;
78 // Protected Member Functions
80 //- Calculate the transformation tensors
81 // smallDist : matching distance per face
82 // absTol : absolute error in normal
83 void calcTransformTensors
85 const vectorField& Cf,
86 const vectorField& Cr,
87 const vectorField& nf,
88 const vectorField& nr,
89 const scalarField& smallDist,
90 const scalar absTol = matchTol
93 //- Initialise the calculation of the patch geometry
94 virtual void initGeometry() = 0;
96 //- Calculate the patch geometry
97 virtual void calcGeometry() = 0;
99 //- Initialise the patches for moving points
100 virtual void initMovePoints(const pointField&) = 0;
102 //- Correct patches after moving points
103 virtual void movePoints(const pointField&) = 0;
105 //- Initialise the update of the patch topology
106 virtual void initUpdateMesh() = 0;
108 //- Update of the patch topology
109 virtual void updateMesh() = 0;
112 //- Write point in OBJ format
113 static void writeOBJ(Ostream& os, const point& pt);
115 //- Write selected points in OBJ format
116 static void writeOBJ(Ostream&, const pointField&, const labelList&);
126 //- Write edge in OBJ format
135 //- Calculate face centres
136 static pointField calcFaceCentres
142 //- Get f[0] for all faces
143 static pointField getAnchorPoints
149 //- Is face (in old face labels) in current patch?
152 const labelList& oldToNew,
156 //- Given list of starts of patches and a face label determine
158 static label whichPatch
160 const labelList& patchStarts,
164 //- Calculate typical tolerance per face. Is currently max distance
165 // from face centre to any of the face vertices.
166 static scalarField calcFaceTol
168 const UList<face>& faces,
169 const pointField& points,
170 const pointField& faceCentres
173 //- Get the number of vertices face f needs to be rotated such that
174 // its f[0] point aligns with given anchor (within tol).
175 static label getRotation
177 const pointField& points,
186 //- Runtime type information
192 //- Construct from components
199 const polyBoundaryMesh& bm
202 //- Construct from dictionary
206 const dictionary& dict,
208 const polyBoundaryMesh& bm
211 //- Construct as copy, resetting the boundary mesh
212 coupledPolyPatch(const coupledPolyPatch&, const polyBoundaryMesh&);
214 //- Construct given the original patch and resetting the
215 // face list and boundary mesh information
218 const coupledPolyPatch& pp,
219 const polyBoundaryMesh& bm,
228 virtual ~coupledPolyPatch();
235 //- Return true because this patch is coupled
236 virtual bool coupled() const
242 //- Are the coupled planes separated
243 bool separated() const
245 return separation_.size();
248 //- Return the offset (distance) vector from one side of the couple
250 const vectorField& separation() const
256 //- Are the cyclic planes parallel
257 bool parallel() const
259 return forwardT_.size() == 0;
262 //- Return face transformation tensor
263 const tensorField& forwardT() const
268 //- Return neighbour-cell transformation tensor
269 const tensorField& reverseT() const
275 //- Initialize ordering for primitivePatch. Does not
276 // refer to *this (except for name() and type() etc.)
277 virtual void initOrder(const primitivePatch&) const = 0;
279 //- Return new ordering for primitivePatch.
280 // Ordering is -faceMap: for every face
281 // index of the new face -rotation:for every new face the clockwise
282 // shift of the original face. Return false if nothing changes
283 // (faceMap is identity, rotation is 0), true otherwise.
286 const primitivePatch&,
293 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
295 } // End namespace Foam
297 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
301 // ************************************************************************* //