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  Copyright (C) 2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "processorFaMeshes.H"
30 #include "Time.H"
31 #include "OSspecific.H"
32 
33 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
34 
35 void Foam::processorFaMeshes::read()
36 {
37  forAll(fvMeshes_, proci)
38  {
39  meshes_.set(proci, new faMesh(fvMeshes_[proci]));
40 
41  // Read the addressing information
42 
43  IOobject ioAddr
44  (
45  "procAddressing",
46  "constant", // Placeholder
48  meshes_[proci].thisDb(),
51  );
52 
53  const auto& runTime = meshes_[proci].thisDb().time();
54  const auto& meshDir = meshes_[proci].meshDir();
55 
56  // pointProcAddressing (faMesh)
57  ioAddr.rename("pointProcAddressing");
58  ioAddr.instance() = runTime.findInstance(meshDir, ioAddr.name());
59  pointProcAddressing_.set(proci, new labelIOList(ioAddr));
60 
61  // edgeProcAddressing (faMesh)
62  ioAddr.rename("edgeProcAddressing");
63  ioAddr.instance() = runTime.findInstance(meshDir, ioAddr.name());
64  edgeProcAddressing_.set(proci, new labelIOList(ioAddr));
65 
66  // faceProcAddressing (faMesh)
67  ioAddr.rename("faceProcAddressing");
68  ioAddr.instance() = runTime.findInstance(meshDir, ioAddr.name());
69  faceProcAddressing_.set(proci, new labelIOList(ioAddr));
70 
71  // boundaryProcAddressing (faMesh)
72  ioAddr.rename("boundaryProcAddressing");
73  ioAddr.instance() = runTime.findInstance(meshDir, ioAddr.name());
74  boundaryProcAddressing_.set(proci, new labelIOList(ioAddr));
75  }
76 }
77 
78 
79 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
80 
81 Foam::processorFaMeshes::processorFaMeshes
82 (
83  const UPtrList<fvMesh>& procFvMeshes
84 )
85 :
86  fvMeshes_(procFvMeshes),
87  meshes_(procFvMeshes.size()),
88  pointProcAddressing_(meshes_.size()),
89  edgeProcAddressing_(meshes_.size()),
90  faceProcAddressing_(meshes_.size()),
91  boundaryProcAddressing_(meshes_.size())
92 {
93  read();
94 }
95 
96 
97 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
98 
100 {
101  IOobject io
102  (
103  "procAddressing",
106  mesh.thisDb()
107  );
108 
109  // procAddressing
110  fileHandler().rm(fileHandler().filePath(io.objectPath()));
111 
112  // pointProcAddressing
113  io.rename("pointProcAddressing");
114  fileHandler().rm(fileHandler().filePath(io.objectPath()));
115 
116  // edgeProcAddressing
117  io.rename("edgeProcAddressing");
118  fileHandler().rm(fileHandler().filePath(io.objectPath()));
119 
120  // faceProcAddressing
121  io.rename("faceProcAddressing");
122  fileHandler().rm(fileHandler().filePath(io.objectPath()));
123 
124  // boundaryProcAddressing
125  io.rename("boundaryProcAddressing");
126  fileHandler().rm(fileHandler().filePath(io.objectPath()));
127 }
128 
129 
130 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:88
const fileName & facesInstance() const
Return the current instance directory for faces.
Definition: polyMesh.C:853
virtual void rename(const word &newName)
Rename the object.
Definition: IOobject.H:626
engineTime & runTime
autoPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler.
Ignore writing from objectRegistry::writeObject()
fileName objectPath() const
The complete path + object name.
Definition: IOobjectI.H:239
bool read(const char *buf, int32_t &val)
Same as readInt32.
Definition: int32.H:125
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
Definition: fvMesh.H:377
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:413
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
dynamicFvMesh & mesh
static void removeFiles(const faMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
static word meshSubDir
The mesh sub-directory name (usually "faMesh")
Definition: faMesh.H:698
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:166
IOList< label > labelIOList
Label container classes.
Definition: labelIOList.H:38