BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / OpenFOAM / meshes / polyMesh / polyPatches / constraint / processorCyclic / processorCyclicPolyPatch.H
blob77eea65d6c6448a193bd640e65cb52c87ac0ac12
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::processorCyclicPolyPatch
27 Description
28     Neighbour processor patch.
30     Note: morph patch face ordering is geometric.
32 SourceFiles
33     processorCyclicPolyPatch.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef processorCyclicPolyPatch_H
38 #define processorCyclicPolyPatch_H
40 #include "processorPolyPatch.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                            Class processorCyclicPolyPatch Declaration
49 \*---------------------------------------------------------------------------*/
51 class processorCyclicPolyPatch
53     public processorPolyPatch
55     // Private data
57         //- Message tag to use for communication
58         const int tag_;
60         //- Name of originating patch
61         const word referPatchName_;
63         //- Index of originating patch
64         mutable label referPatchID_;
66     // Private member functions
69 protected:
71     // Protected Member functions
73         //- Initialise the calculation of the patch geometry
74         void initGeometry(PstreamBuffers&);
76         //- Calculate the patch geometry
77         void calcGeometry(PstreamBuffers&);
79         //- Calculate the patch geometry with externally
80         //  provided geometry
81         virtual void calcGeometry
82         (
83             const primitivePatch& referPatch,
84             const pointField& thisCtrs,
85             const vectorField& thisAreas,
86             const pointField& thisCc,
87             const pointField& nbrCtrs,
88             const vectorField& nbrAreas,
89             const pointField& nbrCc
90         )
91         {
92             notImplemented("processorCyclicPolyPatch::calcGeometry(..)");
93         }
95         //- Initialise the patches for moving points
96         void initMovePoints(PstreamBuffers&, const pointField&);
98         //- Correct patches after moving points
99         void movePoints(PstreamBuffers&, const pointField&);
101         //- Initialise the update of the patch topology
102         virtual void initUpdateMesh(PstreamBuffers&);
104         //- Update of the patch topology
105         virtual void updateMesh(PstreamBuffers&);
108 public:
110     //- Runtime type information
111     TypeName("processorCyclic");
114     // Constructors
116         //- Construct from components
117         processorCyclicPolyPatch
118         (
119             const word& name,
120             const label size,
121             const label start,
122             const label index,
123             const polyBoundaryMesh& bm,
124             const int myProcNo,
125             const int neighbProcNo,
126             const word& referPatchName
127         );
129         //- Construct from dictionary
130         processorCyclicPolyPatch
131         (
132             const word& name,
133             const dictionary& dict,
134             const label index,
135             const polyBoundaryMesh&
136         );
138         //- Construct as copy, resetting the boundary mesh
139         processorCyclicPolyPatch
140         (
141             const processorCyclicPolyPatch&,
142             const polyBoundaryMesh&
143         );
145         //- Construct as given the original patch and resetting the
146         //  face list and boundary mesh information
147         processorCyclicPolyPatch
148         (
149             const processorCyclicPolyPatch& pp,
150             const polyBoundaryMesh& bm,
151             const label index,
152             const label newSize,
153             const label newStart,
154             const word& referPatchName
155         );
157         //- Construct given the original patch and a map
158         processorCyclicPolyPatch
159         (
160             const processorCyclicPolyPatch& pp,
161             const polyBoundaryMesh& bm,
162             const label index,
163             const labelUList& mapAddressing,
164             const label newStart
165         );
168         //- Construct and return a clone, resetting the boundary mesh
169         virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
170         {
171             return autoPtr<polyPatch>(new processorCyclicPolyPatch(*this, bm));
172         }
174         //- Construct and return a clone, resetting the face list
175         //  and boundary mesh
176         virtual autoPtr<polyPatch> clone
177         (
178             const polyBoundaryMesh& bm,
179             const label index,
180             const label newSize,
181             const label newStart,
182             const word& referPatchName
183         ) const
184         {
185             return autoPtr<polyPatch>
186             (
187                 new processorCyclicPolyPatch
188                 (
189                     *this,
190                     bm,
191                     index,
192                     newSize,
193                     newStart,
194                     referPatchName
195                 )
196             );
197         }
199         //- Construct and return a clone, resetting the face list
200         //  and boundary mesh
201         virtual autoPtr<polyPatch> clone
202         (
203             const polyBoundaryMesh& bm,
204             const label index,
205             const labelUList& mapAddressing,
206             const label newStart
207         ) const
208         {
209             return autoPtr<polyPatch>
210             (
211                 new processorCyclicPolyPatch
212                 (
213                     *this,
214                     bm,
215                     index,
216                     mapAddressing,
217                     newStart
218                 )
219             );
220         }
223     // Destructor
225         virtual ~processorCyclicPolyPatch();
228     // Member functions
230         const word& referPatchName() const
231         {
232             return referPatchName_;
233         }
235         //- Referring patchID.
236         label referPatchID() const
237         {
238             if (referPatchID_ == -1)
239             {
240                 referPatchID_ = this->boundaryMesh().findPatchID
241                 (
242                     referPatchName_
243                 );
244                 if (referPatchID_ == -1)
245                 {
246                     FatalErrorIn
247                     (
248                         "processorCyclicPolyPatch::referPatchID() const"
249                     )   << "Illegal referPatch name " << referPatchName_
250                         << endl << "Valid patch names are "
251                         << this->boundaryMesh().names()
252                         << exit(FatalError);
253                 }
254             }
255             return referPatchID_;
256         }
258         const coupledPolyPatch& referPatch() const
259         {
260             const polyPatch& pp = this->boundaryMesh()[referPatchID()];
261             return refCast<const coupledPolyPatch>(pp);
262         }
264         //- Return message tag to use for communication
265         virtual int tag() const
266         {
267             return tag_;
268         }
270         //- Does this side own the patch ?
271         virtual bool owner() const
272         {
273             return referPatch().owner();
274         }
276         //- Transform a patch-based position from other side to this side
277         virtual void transformPosition(pointField& l) const
278         {
279             referPatch().transformPosition(l);
280         }
282         //- Transform a patch-based position from other side to this side
283         virtual void transformPosition(point& l, const label facei) const
284         {
285             referPatch().transformPosition(l, facei);
286         }
288         //- Are the planes separated.
289         virtual bool separated() const
290         {
291             return referPatch().separated();
292         }
294         //- If the planes are separated the separation vector.
295         virtual const vectorField& separation() const
296         {
297             return referPatch().separation();
298         }
300         //- Are the cyclic planes parallel.
301         virtual bool parallel() const
302         {
303             return referPatch().parallel();
304         }
306         //- Return face transformation tensor.
307         virtual const tensorField& forwardT() const
308         {
309             return referPatch().forwardT();
310         }
312         //- Return neighbour-cell transformation tensor.
313         virtual const tensorField& reverseT() const
314         {
315             return referPatch().reverseT();
316         }
318         //- Are faces collocated. Either size 0,1 or length of patch
319         virtual const boolList& collocated() const
320         {
321             return referPatch().collocated();
322         }
325         //- Initialize ordering for primitivePatch. Does not
326         //  refer to *this (except for name() and type() etc.)
327         virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;
329         //- Return new ordering for primitivePatch.
330         //  Ordering is -faceMap: for every face
331         //  index of the new face -rotation:for every new face the clockwise
332         //  shift of the original face. Return false if nothing changes
333         //  (faceMap is identity, rotation is 0), true otherwise.
334         virtual bool order
335         (
336             PstreamBuffers&,
337             const primitivePatch&,
338             labelList& faceMap,
339             labelList& rotation
340         ) const;
343         //- Write the polyPatch data as a dictionary
344         virtual void write(Ostream&) const;
348 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
350 } // End namespace Foam
352 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
354 #endif
356 // ************************************************************************* //