initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / OpenFOAM / meshes / polyMesh / mapPolyMesh / mapDistribute / mapDistributeLagrangian.H
blob5782308d196e59cdabcae247fcc6922a5d8721ec
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
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     Foam::mapDistributeLagrangian
28 Description
29     Class containing mesh-to-mesh mapping information for particles
31 SourceFiles
32     mapDistributeLagrangian.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef mapDistributeLagrangian_H
37 #define mapDistributeLagrangian_H
39 #include "mapDistribute.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 namespace Foam
46 class mapPolyMesh;
48 /*---------------------------------------------------------------------------*\
49                            Class mapDistributeLagrangian Declaration
50 \*---------------------------------------------------------------------------*/
52 class mapDistributeLagrangian
54     // Private data
56         //- Map to distribute particles
57         const mapDistribute particleMap_;
59         //- Per element in subsetted mesh the cell label
60         const labelListList constructCellLabels_;
63 public:
65     // Constructors
67         //- Construct from components
68         mapDistributeLagrangian
69         (
70             const label nNewParticles,
71             const labelListList& subParticleMap,
72             const labelListList& constructParticleMap,
73             const labelListList& constructCellLabels
74         )
75         :
76             particleMap_(nNewParticles, subParticleMap, constructParticleMap),
77             constructCellLabels_(constructCellLabels)
78         {}
80         //- Construct from components and steal storage
81         mapDistributeLagrangian
82         (
83             const label nNewParticles,
84             labelListList& subParticleMap,
85             labelListList& constructParticleMap,
86             labelListList& constructCellLabels,
87             const bool reUse
88         )
89         :
90             particleMap_
91             (
92                 nNewParticles,
93                 subParticleMap,
94                 constructParticleMap,
95                 reUse
96             ),
97             constructCellLabels_(constructCellLabels, reUse)
98         {}
101     // Member Functions
103         // Access
105             //- Distribution map
106             const mapDistribute& particleMap() const
107             {
108                 return particleMap_;
109             }
111             //- Per received particle the destination cell label
112             const labelListList& constructCellLabels() const
113             {
114                 return constructCellLabels_;
115             }
118         // Edit
120             //- distribute list of lagrangian data
121             template<class T>
122             void distributeLagrangianData(List<T>& lst) const
123             {
124                 particleMap_.distribute(lst);
125             }
127             //- Correct for topo change.
128             void updateMesh(const mapPolyMesh&)
129             {
130                 notImplemented
131                 (
132                     "mapDistributeLagrangian::updateMesh(const mapPolyMesh&)"
133                 );
134             }
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 } // End namespace Foam
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 #endif
146 // ************************************************************************* //