fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / tetDecompositionFiniteElement / tetPolyMeshCellDecomp / tetPolyPatches / constraint / processor / processorTetPolyPatchCellDecomp.H
blob862c9c41fdcfcd73ba860f41e67c66df6a99dc27
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
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 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
19     for more details.
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
25 Class
26     processorTetPolyPatchCellDecomp
28 Description
29     Processor patch boundary needs to be such that the ordering of
30     points in the patch is the same on both sides. Looking at the
31     creation of the faces on both sides of the processor patch they
32     need to be identical on both sides with the normals pointing in
33     opposite directions.  This is achieved by calling the reverseFace
34     function in the decomposition.  It is therefore possible to
35     re-create the ordering of patch points on the slave side by
36     reversing all the patch faces of the owner.  Warning: this will
37     work only with the FOAM parallel decomposition tools - enforce the
38     same in all other decomposition tools.
40 SourceFiles
41     processorTetPolyPatchCellDecomp.C
42     calcProcessorTetPolyPatchCellDecompAddr.C
43     calcProcessorTetPolyPatchCellDecompPointAddr.C
45 \*---------------------------------------------------------------------------*/
47 #ifndef processorTetPolyPatchCellDecomp_H
48 #define processorTetPolyPatchCellDecomp_H
50 #include "coupledFaceTetPolyPatchCellDecomp.H"
51 #include "processorPolyPatch.H"
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 namespace Foam
58 /*---------------------------------------------------------------------------*\
59                 Class processorTetPolyPatchCellDecomp Declaration
60 \*---------------------------------------------------------------------------*/
62 class processorTetPolyPatchCellDecomp
64     public coupledFaceTetPolyPatchCellDecomp
66     // Private data
68         const processorPolyPatch& procPolyPatch_;
71     // Demand driven private data
73         //- Local edge indices
74         mutable labelList* localEdgeIndicesPtr_;
76         //- Cut edges indices, i.e. the ones originating from the
77         //  points on the patch but connected to points which are
78         //  internal (not on the patch)
79         mutable labelList* cutEdgeIndicesPtr_;
81         // Edge addressing for cut edges.
82         // Edges are separated into two lists, one where the patch point
83         // is the owner and one for the neighbour.  The edges are ordered
84         // such that the first n add a contribution to the vertex zero and
85         // so on; the breaks in the list are stored in the "start"
86         // mechanism, described in lduAddressing.  This will be used to
87         // calculate the cross-processor contribution of the vector-matrix
88         // multiply.  HJ, 13/Nov/2001
90             //- Cut edges owner list
91             mutable labelList* cutEdgeOwnerIndicesPtr_;
93             //- Cut edge owner starts
94             mutable labelList* cutEdgeOwnerStartPtr_;
96             //- Cut edges neighbour list
97             mutable labelList* cutEdgeNeighbourIndicesPtr_;
99             //- Cut edge neighbour starts
100             mutable labelList* cutEdgeNeighbourStartPtr_;
103             //- Doubly cut edge indices
104             mutable labelList* doubleCutEdgeIndicesPtr_;
106             //- Doubly cut edge owner addressing
107             mutable labelList* doubleCutOwnerPtr_;
109             //- Doubly cut edge neighbour addressing
110             mutable labelList* doubleCutNeighbourPtr_;
112             //- Owner-neighbour-double cut multiplication mask
113             mutable scalarField* ownNeiDoubleMaskPtr_;
116     // Private Member Functions
118         //- Disallow default construct as copy
119         processorTetPolyPatchCellDecomp
120         (
121             const processorTetPolyPatchCellDecomp&
122         );
124         //- Disallow default assignment
125         void operator=(const processorTetPolyPatchCellDecomp&);
128         // Construction of demand-driven data
130             //- Calculate mesh points
131             virtual void calcMeshPoints() const;
133             //- Calculate local edge indices
134             template<template<class> class FaceList>
135             labelList calcProcLocalEdgesIndices
136             (
137                 const PrimitivePatch<face, FaceList, const pointField&>& p
138             ) const;
140             //- Calculate cut edge indices
141             void calcCutEdgeIndices() const;
143             //- Calculate cut edge addressing
144             void calcCutEdgeAddressing() const;
146             //- Calculate local multiplication mask
147             void calcOwnNeiDoubleMask() const;
149             //- Clear cut edge addressing
150             void clearCutEdgeAddressing() const;
153 public:
155     typedef coupledFaceTetPolyPatchCellDecomp CoupledPointPatch;
156     typedef tetPolyBoundaryMeshCellDecomp BoundaryMesh;
159     //- Runtime type information
160     TypeName(processorPolyPatch::typeName_());
162     // Constructors
164         //- Construct from components
165         processorTetPolyPatchCellDecomp
166         (
167             const polyPatch& patch,
168             const tetPolyBoundaryMeshCellDecomp& bm
169         );
172     // Destructor
174         virtual ~processorTetPolyPatchCellDecomp();
177     // Member functions
179         //- Return processor number
180         int myProcNo() const
181         {
182             return procPolyPatch_.myProcNo();
183         }
185         //- Return neigbour processor number
186         int neighbProcNo() const
187         {
188             return procPolyPatch_.neighbProcNo();
189         }
191         //- Is this a master patch
192         bool isMaster() const
193         {
194             return myProcNo() < neighbProcNo();
195         }
197         //- Is this a slave patch
198         bool isSlave() const
199         {
200             return !isMaster();
201         }
203         //- Return the underlying processorPolyPatch
204         const processorPolyPatch& procPolyPatch() const
205         {
206             return procPolyPatch_;
207         }
210         // Access functions for demand driven data
212             //- Return pointField of points in patch.  Not implemented.
213             virtual const pointField& localPoints() const;
215             //- Return point unit normals.  Not implemented.
216             virtual const vectorField& pointNormals() const;
218             //- Return list of edge indices for edges local to the patch
219             //  (i.e. connecting points within the patch)
220             virtual const labelList& localEdgeIndices() const;
222             //- Return list of edge indices for cut edges
223             //  (i.e. connecting points within the patch ot points outside it)
224             virtual const labelList& cutEdgeIndices() const;
227             // Cut edge addressing
229                //- Return cut edge owner edge indices
230                const labelList& cutEdgeOwnerIndices() const;
232                //- Return cut edge owner edge starts
233                const labelList& cutEdgeOwnerStart() const;
235                //- Return cut edge neighbour edge indices
236                const labelList& cutEdgeNeighbourIndices() const;
238                //- Return cut edge neighbour edge starts
239                const labelList& cutEdgeNeighbourStart() const;
241               // There exists a possibility of having an internal edge for a
242               // point on the processor patch which is in fact connected to
243               // another point of the same patch.  This particular nastiness
244               // introduces a deformation in the solution because the edge is
245               // either multiplied twice or not at all.  For this purpose, the
246               // offending edges need to be separated out and multiplied
247               // appropriately.  This will only happen for cell tetrahedral
248               // decomposition and is generally nasty.  HJ, 4/Dec/2001
250                   //- Return doubly cut edge indices
251                   const labelList& doubleCutEdgeIndices() const;
253                   //- Return doubly cut edge owner addressing
254                   //  into current patch
255                   const labelList& doubleCutOwner() const;
257                   //- Return doubly cut edge neighbour addressing
258                   //  into current patch
259                   const labelList& doubleCutNeighbour() const;
261               //- Return cut edge multiplication mask
262               const scalarField& ownNeiDoubleMask() const;
265         // Dummy functionality for new lduInteface base class
266         // To be removed.  HJ, 2/Nov/2007
268         // Access
270             //- Return faceCell addressing
271             virtual const unallocLabelList& faceCells() const
272             {
273                 return labelList::null();
274             }
277         // Interface transfer functions
279             //- Return the values of the given internal data adjacent to
280             //  the interface as a field
281             virtual tmp<labelField> interfaceInternalField
282             (
283                 const unallocLabelList& internalData
284             ) const
285             {
286                 return tmp<labelField>(NULL);
287             }
289             //- Initialise interface data transfer
290             virtual void initTransfer
291             (
292                 const Pstream::commsTypes commsType,
293                 const unallocLabelList& interfaceData
294             ) const
295             {}
297             //- Transfer and return neighbour field
298             virtual tmp<labelField> transfer
299             (
300                 const Pstream::commsTypes commsType,
301                 const unallocLabelList& interfaceData
302             ) const
303             {
304                 return tmp<labelField>(NULL);
305             }
307             //- Initialise transfer of internal field adjacent to the interface
308             virtual void initInternalFieldTransfer
309             (
310                 const Pstream::commsTypes commsType,
311                 const unallocLabelList& iF
312             ) const
313             {}
315             //- Transfer and return internal field adjacent to the interface
316             virtual tmp<labelField> internalFieldTransfer
317             (
318                 const Pstream::commsTypes commsType,
319                 const unallocLabelList& iF
320             ) const
321             {
322                 return tmp<labelField>(NULL);
323             }
327 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
329 } // End namespace Foam
331 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
333 #ifdef NoRepository
334 #   include "processorTetPolyPatchCellDecomp.C"
335 #endif
337 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
339 #endif
341 // ************************************************************************* //