processorFaMeshes.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016-2017 Wikki Ltd
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "processorFaMeshes.H"
29 #include "Time.H"
30 
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 
33 void Foam::processorFaMeshes::read()
34 {
35  forAll(fvMeshes_, procI)
36  {
37  meshes_.set
38  (
39  procI,
40  new faMesh(fvMeshes_[procI])
41  );
42 
43  pointProcAddressing_.set
44  (
45  procI,
46  new labelIOList
47  (
48  IOobject
49  (
50  "pointProcAddressing",
51  meshes_[procI].time().findInstance
52  (
53  meshes_[procI].meshDir(),
54  "pointProcAddressing"
55  ),
56  meshes_[procI].meshSubDir,
57  fvMeshes_[procI],
60  )
61  )
62  );
63 
64  edgeProcAddressing_.set
65  (
66  procI,
67  new labelIOList
68  (
69  IOobject
70  (
71  "edgeProcAddressing",
72  meshes_[procI].time().findInstance
73  (
74  meshes_[procI].meshDir(),
75  "edgeProcAddressing"
76  ),
77  meshes_[procI].meshSubDir,
78  fvMeshes_[procI],
81  )
82  )
83  );
84 
85  faceProcAddressing_.set
86  (
87  procI,
88  new labelIOList
89  (
90  IOobject
91  (
92  "faceProcAddressing",
93  meshes_[procI].time().findInstance
94  (
95  meshes_[procI].meshDir(),
96  "faceProcAddressing"
97  ),
98  meshes_[procI].meshSubDir,
99  fvMeshes_[procI],
102  )
103  )
104  );
105 
106  boundaryProcAddressing_.set
107  (
108  procI,
109  new labelIOList
110  (
111  IOobject
112  (
113  "boundaryProcAddressing",
114  meshes_[procI].time().findInstance
115  (
116  meshes_[procI].meshDir(),
117  "faceProcAddressing"
118  ),
119  meshes_[procI].meshSubDir,
120  fvMeshes_[procI],
123  )
124  )
125  );
126  }
127 }
128 
129 
130 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
131 
132 Foam::processorFaMeshes::processorFaMeshes
133 (
134  const PtrList<fvMesh>& processorFvMeshes
135 )
136 :
137  fvMeshes_(processorFvMeshes),
138  meshes_(processorFvMeshes.size()),
139  pointProcAddressing_(processorFvMeshes.size()),
140  edgeProcAddressing_(processorFvMeshes.size()),
141  faceProcAddressing_(processorFvMeshes.size()),
142  boundaryProcAddressing_(processorFvMeshes.size())
143 {
144  read();
145 }
146 
147 
148 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
149 
150 // Foam::fvMesh::readUpdateState Foam::processorFaMeshes::readUpdate()
151 // {
152 // fvMesh::readUpdateState stat = fvMesh::UNCHANGED;
153 
154 // forAll(databases_, procI)
155 // {
156 // // Check if any new meshes need to be read.
157 // fvMesh::readUpdateState procStat = meshes_[procI].readUpdate();
158 
159 // /*
160 // if (procStat != fvMesh::UNCHANGED)
161 // {
162 // Info<< "Processor " << procI
163 // << " at time " << databases_[procI].timeName()
164 // << " detected mesh change " << procStat
165 // << endl;
166 // }
167 // */
168 
169 // // Combine into overall mesh change status
170 // if (stat == fvMesh::UNCHANGED)
171 // {
172 // stat = procStat;
173 // }
174 // else
175 // {
176 // if (stat != procStat)
177 // {
178 // FatalErrorIn("processorFaMeshes::readUpdate()")
179 // << "Processor " << procI
180 // << " has a different polyMesh at time "
181 // << databases_[procI].timeName()
182 // << " compared to any previous processors." << nl
183 // << "Please check time " << databases_[procI].timeName()
184 // << " directories on all processors for consistent"
185 // << " mesh files."
186 // << exit(FatalError);
187 // }
188 // }
189 // }
190 
191 // if
192 // (
193 // stat == fvMesh::TOPO_CHANGE
194 // || stat == fvMesh::TOPO_PATCH_CHANGE
195 // )
196 // {
197 // // Reread all meshes and addressing
198 // read();
199 // }
200 // return stat;
201 // }
202 
203 
204 // void Foam::processorFaMeshes::reconstructPoints(fvMesh& mesh)
205 // {
206 // // Read the field for all the processors
207 // PtrList<pointIOField> procsPoints(meshes_.size());
208 
209 // forAll(meshes_, procI)
210 // {
211 // procsPoints.set
212 // (
213 // procI,
214 // new pointIOField
215 // (
216 // IOobject
217 // (
218 // "points",
219 // meshes_[procI].time().timeName(),
220 // polyMesh::meshSubDir,
221 // meshes_[procI],
222 // IOobject::MUST_READ,
223 // IOobject::NO_WRITE
224 // )
225 // )
226 // );
227 // }
228 
229 // // Create the new points
230 // vectorField newPoints(mesh.nPoints());
231 
232 // forAll(meshes_, procI)
233 // {
234 // const vectorField& procPoints = procsPoints[procI];
235 
236 // // Set the cell values in the reconstructed field
237 
238 // const labelList& pointProcAddressingI = pointProcAddressing_[procI];
239 
240 // if (pointProcAddressingI.size() != procPoints.size())
241 // {
242 // FatalErrorIn("processorFaMeshes")
243 // << "problem :"
244 // << " pointProcAddressingI:" << pointProcAddressingI.size()
245 // << " procPoints:" << procPoints.size()
246 // << abort(FatalError);
247 // }
248 
249 // forAll(pointProcAddressingI, pointI)
250 // {
251 // newPoints[pointProcAddressingI[pointI]] = procPoints[pointI];
252 // }
253 // }
254 
255 // mesh.movePoints(newPoints);
256 // mesh.write();
257 // }
258 
259 
260 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
processorFaMeshes.H
Foam::read
bool read(const char *buf, int32_t &val)
Same as readInt32.
Definition: int32.H:107
Foam::labelIOList
IOList< label > labelIOList
Label container classes.
Definition: labelIOList.H:44
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Time.H
Foam::IOobject::MUST_READ
Definition: IOobject.H:120