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::directMappedPatchBase
29 Determines a mapping between patch face centres and mesh cell or face
30 centres and processors they're on.
33 Storage is not optimal. It temporary collects all (patch)face centres
34 on all processors to keep the addressing calculation simple.
37 directMappedPatchBase.C
39 \*---------------------------------------------------------------------------*/
41 #ifndef directMappedPatchBase_H
42 #define directMappedPatchBase_H
44 #include "pointField.H"
46 #include "pointIndexHit.H"
47 #include "mapDistribute.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 /*---------------------------------------------------------------------------*\
59 Class directMappedPatchBase Declaration
60 \*---------------------------------------------------------------------------*/
62 class directMappedPatchBase
67 //- Mesh items to sample
79 static const NamedEnum<sampleMode, 3> sampleModeNames_;
82 const polyPatch& patch_;
85 const word sampleRegion_;
88 const sampleMode mode_;
90 //- Patch (only if NEARESTPATCHFACE)
91 const word samplePatch_;
93 //- For backwards compatibility : reading/writing of uniform offset.
94 const bool uniformOffset_;
96 //- Offset vector (uniform)
100 const vectorField offsets_;
103 const bool sameRegion_;
106 // Derived information
108 //- Communication schedule:
109 // - Cells/faces to sample per processor
110 // - Patch faces to receive per processor
112 mutable autoPtr<mapDistribute> mapPtr_;
115 // Private Member Functions
117 //- Collect single list of samples and originating processor+face.
121 labelList& patchFaceProcs,
122 labelList& patchFaces,
126 //- Find cells/faces containing samples
130 labelList& sampleProcs, // processor containing sample
131 labelList& sampleIndices, // local index of cell/face
132 pointField& sampleLocations // actual representative location
135 //- Calculate matching
136 void calcMapping() const;
141 //- Runtime type information
142 TypeName("directMappedPatchBase");
147 //- Construct from patch
148 directMappedPatchBase(const polyPatch&);
150 //- Construct from components
151 directMappedPatchBase
154 const word& sampleRegion,
155 const sampleMode sampleMode,
156 const word& samplePatch,
157 const vectorField& offset
160 //- Construct from components
161 directMappedPatchBase
164 const word& sampleRegion,
165 const sampleMode sampleMode,
166 const word& samplePatch,
170 //- Construct from dictionary
171 directMappedPatchBase(const polyPatch&, const dictionary&);
173 //- Construct as copy, resetting patch
174 directMappedPatchBase(const polyPatch&, const directMappedPatchBase&);
178 virtual ~directMappedPatchBase();
186 const sampleMode& mode() const
192 const word& sampleRegion() const
194 return sampleRegion_;
197 //- Patch (only if NEARESTBOUNDARY)
198 const word& samplePatch() const
203 //- Offset vector (from patch faces to destination mesh objects)
204 const vectorField& offsets() const
209 //- Return reference to the parallel distribution map
210 const mapDistribute& map() const
219 //- Cached sampleRegion != mesh.name()
220 bool sameRegion() const
225 //- Get the region mesh
226 const polyMesh& sampleMesh() const;
228 //- Get the patch on the region
229 const polyPatch& samplePolyPatch() const;
231 //- Write as a dictionary
232 virtual void write(Ostream&) const;
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 } // End namespace Foam
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 // ************************************************************************* //