1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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::processorPolyPatch
29 Neighbour processor patch.
31 Note: morph patch face ordering comes geometric or topological.
32 Geometric: no cyclics allowed (assumes faces coincident)
33 Topological: needs unmodified faces on both sides to correspond. Also
34 needs at least one per connected patch area (so all patch faces can be
35 visited from an unmodified face)
39 processorPolyPatchMorph.C
41 \*---------------------------------------------------------------------------*/
43 #ifndef processorPolyPatch_H
44 #define processorPolyPatch_H
46 #include "coupledPolyPatch.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 /*---------------------------------------------------------------------------*\
54 Class processorPolyPatch Declaration
55 \*---------------------------------------------------------------------------*/
57 class processorPolyPatch
59 public coupledPolyPatch
66 //- Processor-neighbbour patch face centres
67 vectorField neighbFaceCentres_;
69 //- Processor-neighbbour patch face areas
70 vectorField neighbFaceAreas_;
72 //- Processor-neighbbour patch neighbour cell centres
73 vectorField neighbFaceCellCentres_;
75 //- Corresponding neighbouring local point label for every local point
76 // (so localPoints()[i] == neighb.localPoints()[neighbPoints_[i]])
77 mutable labelList* neighbPointsPtr_;
79 //- Corresponding neighbouring local edge label for every local edge
80 // (so edges()[i] == neighb.edges()[neighbEdges_[i]])
81 mutable labelList* neighbEdgesPtr_;
85 // Private static data
87 //- Whether to use geometric or topological matching
88 static bool geometricMatch_;
90 //- Relative tolerance (for geometric matching only). Is factor of
91 // maximum edge length per face.
92 static scalar matchTol_;
97 // Protected Member functions
99 //- Initialise the calculation of the patch geometry
102 //- Calculate the patch geometry
105 //- Initialise the patches for moving points
106 void initMovePoints(const pointField&);
108 //- Correct patches after moving points
109 void movePoints(const pointField&);
111 //- Initialise the update of the patch topology
112 virtual void initUpdateMesh();
114 //- Update of the patch topology
115 virtual void updateMesh();
120 //- Runtime type information
121 TypeName("processor");
126 //- Construct from components
133 const polyBoundaryMesh& bm,
135 const int neighbProcNo
138 //- Construct from dictionary
142 const dictionary& dict,
144 const polyBoundaryMesh&
147 //- Construct as copy, resetting the boundary mesh
148 processorPolyPatch(const processorPolyPatch&, const polyBoundaryMesh&);
150 //- Construct as given the original patch and resetting the
151 // face list and boundary mesh information
154 const processorPolyPatch& pp,
155 const polyBoundaryMesh& bm,
161 //- Construct and return a clone, resetting the boundary mesh
162 virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
164 return autoPtr<polyPatch>(new processorPolyPatch(*this, bm));
167 //- Construct and return a clone, resetting the face list
169 virtual autoPtr<polyPatch> clone
171 const polyBoundaryMesh& bm,
177 return autoPtr<polyPatch>
179 new processorPolyPatch
181 refCast<const processorPolyPatch>(*this),
193 virtual ~processorPolyPatch();
198 //- Return processor number
204 //- Return neigbour processor number
205 int neighbProcNo() const
207 return neighbProcNo_;
210 //- Does the processor own the patch ?
213 return (myProcNo_ < neighbProcNo_);
216 //- Is the processor the patch neighbour ?
217 bool neighbour() const
222 //- Return processor-neighbbour patch face centres
223 const vectorField& neighbFaceCentres() const
225 return neighbFaceCentres_;
228 //- Return processor-neighbbour patch face areas
229 const vectorField& neighbFaceAreas() const
231 return neighbFaceAreas_;
234 //- Return processor-neighbbour patch neighbour cell centres
235 const vectorField& neighbFaceCellCentres() const
237 return neighbFaceCellCentres_;
240 //- Return neighbour point labels. This is for my local point (-1 or)
241 // the corresponding local point on the other side. It is -1 if
242 // there are multiple corresponding points on this or the other side
243 // (can happen for cyclics being converted into proc patches)
244 const labelList& neighbPoints() const;
246 //- Return neighbour edge labels. This is for my local edge (-1 or) the
247 // corresponding local edge on the other side. See above for -1 cause.
248 const labelList& neighbEdges() const;
251 //- Initialize ordering for primitivePatch. Does not
252 // refer to *this (except for name() and type() etc.)
253 virtual void initOrder(const primitivePatch&) const;
255 //- Return new ordering for primitivePatch.
256 // Ordering is -faceMap: for every face
257 // index of the new face -rotation:for every new face the clockwise
258 // shift of the original face. Return false if nothing changes
259 // (faceMap is identity, rotation is 0), true otherwise.
262 const primitivePatch&,
268 //- Write the polyPatch data as a dictionary
269 virtual void write(Ostream&) const;
273 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 } // End namespace Foam
277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 // ************************************************************************* //