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 "processorMeshesReconstructor.H"
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 void Foam::processorMeshesReconstructor::readMeshes()
32 forAll (databases_, procI)
34 Info<< "Reading mesh for processor " << procI << endl;
43 databases_[procI].timeName(),
50 // Clear reconstruction maps: new mesh
55 void Foam::processorMeshesReconstructor::clearMaps()
57 pointProcAddressing_.clear();
58 faceProcAddressing_.clear();
59 cellProcAddressing_.clear();
60 boundaryProcAddressing_.clear();
64 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
67 Foam::processorMeshesReconstructor::processorMeshesReconstructor
69 PtrList<Time>& databases,
73 databases_(databases),
75 meshes_(databases.size()),
76 pointProcAddressing_(),
77 faceProcAddressing_(),
78 cellProcAddressing_(),
79 boundaryProcAddressing_()
85 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
87 Foam::polyMesh::readUpdateState
88 Foam::processorMeshesReconstructor::readUpdate()
90 polyMesh::readUpdateState stat = polyMesh::UNCHANGED;
92 forAll (databases_, procI)
94 // Check if any new meshes need to be read.
95 polyMesh::readUpdateState procStat = meshes_[procI].readUpdate();
97 // Combine into overall mesh change status
98 if (stat == polyMesh::UNCHANGED)
104 if (stat != procStat)
106 FatalErrorIn("processorMeshesReconstructor::readUpdate()")
107 << "Processor " << procI
108 << " has a different polyMesh at time "
109 << databases_[procI].timeName()
110 << " compared to any previous processors." << nl
111 << "Please check time " << databases_[procI].timeName()
112 << " directories on all processors for consistent"
121 stat == polyMesh::TOPO_CHANGE
122 || stat == polyMesh::TOPO_PATCH_CHANGE
125 // Reconstruction maps have changed: clear
126 Info<< "Mesh changed: clear reconstruction maps" << endl;
134 const Foam::PtrList<Foam::labelIOList>&
135 Foam::processorMeshesReconstructor::pointProcAddressing() const
137 if (pointProcAddressing_.empty())
141 "const PtrList<labelIOList>& "
142 "processorMeshesReconstructor::pointProcAddressing() const"
143 ) << "Mesh is not reconstructed"
144 << abort(FatalError);
147 return pointProcAddressing_;
151 const Foam::PtrList<Foam::labelIOList>&
152 Foam::processorMeshesReconstructor::faceProcAddressing() const
154 if (faceProcAddressing_.empty())
158 "const PtrList<labelIOList>& "
159 "processorMeshesReconstructor::faceProcAddressing() const"
160 ) << "Mesh is not reconstructed"
161 << abort(FatalError);
164 return faceProcAddressing_;
168 const Foam::PtrList<Foam::labelIOList>&
169 Foam::processorMeshesReconstructor::cellProcAddressing() const
171 if (cellProcAddressing_.empty())
175 "const PtrList<labelIOList>& "
176 "processorMeshesReconstructor::cellProcAddressing() const"
177 ) << "Mesh is not reconstructed"
178 << abort(FatalError);
181 return cellProcAddressing_;
185 const Foam::PtrList<Foam::labelIOList>&
186 Foam::processorMeshesReconstructor::boundaryProcAddressing() const
188 if (boundaryProcAddressing_.empty())
192 "const PtrList<labelIOList>& "
193 "processorMeshesReconstructor::boundaryProcAddressing() const"
194 ) << "Mesh is not reconstructed"
195 << abort(FatalError);
198 return boundaryProcAddressing_;
202 // ************************************************************************* //