1 /*---------------------------------------------------------------------------*\
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 -------------------------------------------------------------------------------
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 "processorMeshes.H"
28 #include "primitiveMesh.H"
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 void Foam::processorMeshes::readMeshes()
34 forAll (databases_, procI)
44 databases_[procI].timeName(),
53 void Foam::processorMeshes::readAddressing()
55 forAll (databases_, procI)
57 pointProcAddressing_.set
64 "pointProcAddressing",
65 meshes_[procI].facesInstance(),
66 meshes_[procI].meshSubDir,
74 faceProcAddressing_.set
82 meshes_[procI].facesInstance(),
83 meshes_[procI].meshSubDir,
91 cellProcAddressing_.set
99 meshes_[procI].facesInstance(),
100 meshes_[procI].meshSubDir,
108 boundaryProcAddressing_.set
115 "boundaryProcAddressing",
116 meshes_[procI].facesInstance(),
117 meshes_[procI].meshSubDir,
128 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
130 Foam::processorMeshes::processorMeshes
132 PtrList<Time>& databases,
136 databases_(databases),
138 meshes_(databases.size()),
139 pointProcAddressing_(databases.size()),
140 faceProcAddressing_(databases.size()),
141 cellProcAddressing_(databases.size()),
142 boundaryProcAddressing_(databases.size())
149 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
151 Foam::polyMesh::readUpdateState Foam::processorMeshes::readUpdate()
153 polyMesh::readUpdateState stat = polyMesh::UNCHANGED;
155 forAll (databases_, procI)
157 // Check if any new meshes need to be read.
158 polyMesh::readUpdateState procStat = meshes_[procI].readUpdate();
160 // Combine into overall mesh change status
161 if (stat == polyMesh::UNCHANGED)
167 if (stat != procStat)
169 FatalErrorIn("processorMeshes::readUpdate()")
170 << "Processor " << procI
171 << " has a different polyMesh at time "
172 << databases_[procI].timeName()
173 << " compared to any previous processors." << nl
174 << "Please check time " << databases_[procI].timeName()
175 << " directories on all processors for consistent"
182 // Reading of meshes removed: readUpdate will do this
185 stat == polyMesh::TOPO_CHANGE
186 || stat == polyMesh::TOPO_PATCH_CHANGE
189 // Reread addressing; meshes are already updated with readUpdate.
197 void Foam::processorMeshes::reconstructPoints(fvMesh& mesh)
199 // Create the new points
200 vectorField newPoints(mesh.nPoints());
202 forAll (meshes_, procI)
204 const vectorField& procPoints = meshes_[procI].allPoints();
206 // Set the cell values in the reconstructed field
208 const labelList& pointProcAddressingI = pointProcAddressing_[procI];
210 if (pointProcAddressingI.size() != procPoints.size())
212 FatalErrorIn("processorMeshes")
214 << " pointProcAddressingI:" << pointProcAddressingI.size()
215 << " procPoints:" << procPoints.size()
216 << abort(FatalError);
219 // Only live points carry reconstruction data. Reconsider
221 for (label pointI = 0; pointI < meshes_[procI].nPoints(); pointI++)
222 // forAll(pointProcAddressingI, pointI)
224 newPoints[pointProcAddressingI[pointI]] = procPoints[pointI];
228 mesh.movePoints(newPoints);
233 // ************************************************************************* //