Forward compatibility: flex
[foam-extend-3.2.git] / applications / utilities / parallelProcessing / reconstructParMesh / processorFaMeshes.C
bloba860aef6f47904186f403d8e2193b2d068113a3a
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "processorFaMeshes.H"
27 #include "foamTime.H"
29 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
31 void Foam::processorFaMeshes::read()
33     forAll (fvMeshes_, procI)
34     {
35         meshes_.set
36         (
37             procI,
38             new faMesh(fvMeshes_[procI])
39         );
41         pointProcAddressing_.set
42         (
43             procI,
44             new labelIOList
45             (
46                 IOobject
47                 (
48                     "pointProcAddressing",
49                     meshes_[procI].time().findInstance
50                     (
51                         meshes_[procI].meshDir(),
52                         "pointProcAddressing"
53                     ),
54                     meshes_[procI].meshSubDir,
55                     fvMeshes_[procI],
56                     IOobject::MUST_READ,
57                     IOobject::NO_WRITE
58                 )
59             )
60         );
62         edgeProcAddressing_.set
63         (
64             procI,
65             new labelIOList
66             (
67                 IOobject
68                 (
69                     "edgeProcAddressing",
70                     meshes_[procI].time().findInstance
71                     (
72                         meshes_[procI].meshDir(),
73                         "edgeProcAddressing"
74                     ),
75                     meshes_[procI].meshSubDir,
76                     fvMeshes_[procI],
77                     IOobject::MUST_READ,
78                     IOobject::NO_WRITE
79                 )
80             )
81         );
83         faceProcAddressing_.set
84         (
85             procI,
86             new labelIOList
87             (
88                 IOobject
89                 (
90                     "faceProcAddressing",
91                     meshes_[procI].time().findInstance
92                     (
93                         meshes_[procI].meshDir(),
94                         "faceProcAddressing"
95                     ),
96                     meshes_[procI].meshSubDir,
97                     fvMeshes_[procI],
98                     IOobject::MUST_READ,
99                     IOobject::NO_WRITE
100                 )
101             )
102         );
104         boundaryProcAddressing_.set
105         (
106             procI,
107             new labelIOList
108             (
109                 IOobject
110                 (
111                     "boundaryProcAddressing",
112                     meshes_[procI].time().findInstance
113                     (
114                         meshes_[procI].meshDir(),
115                         "faceProcAddressing"
116                     ),
117                     meshes_[procI].meshSubDir,
118                     fvMeshes_[procI],
119                     IOobject::MUST_READ,
120                     IOobject::NO_WRITE
121                 )
122             )
123         );
124     }
128 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
130 Foam::processorFaMeshes::processorFaMeshes
132     const PtrList<fvMesh>& processorFvMeshes
135     fvMeshes_(processorFvMeshes),
136     meshes_(processorFvMeshes.size()),
137     pointProcAddressing_(processorFvMeshes.size()),
138     edgeProcAddressing_(processorFvMeshes.size()),
139     faceProcAddressing_(processorFvMeshes.size()),
140     boundaryProcAddressing_(processorFvMeshes.size())
142     read();
146 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
148 // Foam::fvMesh::readUpdateState Foam::processorFaMeshes::readUpdate()
149 // {
150 //     fvMesh::readUpdateState stat = fvMesh::UNCHANGED;
152 //     forAll (databases_, procI)
153 //     {
154 //         // Check if any new meshes need to be read.
155 //         fvMesh::readUpdateState procStat = meshes_[procI].readUpdate();
157 //         /*
158 //         if (procStat != fvMesh::UNCHANGED)
159 //         {
160 //             Info<< "Processor " << procI
161 //                 << " at time " << databases_[procI].timeName()
162 //                 << " detected mesh change " << procStat
163 //                 << endl;
164 //         }
165 //         */
167 //         // Combine into overall mesh change status
168 //         if (stat == fvMesh::UNCHANGED)
169 //         {
170 //             stat = procStat;
171 //         }
172 //         else
173 //         {
174 //             if (stat != procStat)
175 //             {
176 //                 FatalErrorIn("processorFaMeshes::readUpdate()")
177 //                     << "Processor " << procI
178 //                     << " has a different polyMesh at time "
179 //                     << databases_[procI].timeName()
180 //                     << " compared to any previous processors." << nl
181 //                     << "Please check time " << databases_[procI].timeName()
182 //                     << " directories on all processors for consistent"
183 //                     << " mesh files."
184 //                     << exit(FatalError);
185 //             }
186 //         }
187 //     }
189 //     if
190 //     (
191 //         stat == fvMesh::TOPO_CHANGE
192 //      || stat == fvMesh::TOPO_PATCH_CHANGE
193 //     )
194 //     {
195 //         // Reread all meshes and addresssing
196 //         read();
197 //     }
198 //     return stat;
199 // }
202 // void Foam::processorFaMeshes::reconstructPoints(fvMesh& mesh)
203 // {
204 //     // Read the field for all the processors
205 //     PtrList<pointIOField> procsPoints(meshes_.size());
207 //     forAll (meshes_, procI)
208 //     {
209 //         procsPoints.set
210 //         (
211 //             procI,
212 //             new pointIOField
213 //             (
214 //                 IOobject
215 //                 (
216 //                     "points",
217 //                     meshes_[procI].time().timeName(),
218 //                     polyMesh::meshSubDir,
219 //                     meshes_[procI],
220 //                     IOobject::MUST_READ,
221 //                     IOobject::NO_WRITE
222 //                 )
223 //             )
224 //         );
225 //     }
227 //     // Create the new points
228 //     vectorField newPoints(mesh.nPoints());
230 //     forAll (meshes_, procI)
231 //     {
232 //         const vectorField& procPoints = procsPoints[procI];
234 //         // Set the cell values in the reconstructed field
236 //         const labelList& pointProcAddressingI = pointProcAddressing_[procI];
238 //         if (pointProcAddressingI.size() != procPoints.size())
239 //         {
240 //             FatalErrorIn("processorFaMeshes")
241 //                 << "problem :"
242 //                 << " pointProcAddressingI:" << pointProcAddressingI.size()
243 //                 << " procPoints:" << procPoints.size()
244 //                 << abort(FatalError);
245 //         }
247 //         forAll(pointProcAddressingI, pointI)
248 //         {
249 //             newPoints[pointProcAddressingI[pointI]] = procPoints[pointI];
250 //         }
251 //     }
253 //     mesh.movePoints(newPoints);
254 //     mesh.write();
255 // }
258 // ************************************************************************* //