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-------------------------------------------------------------------------------
11License
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
35void 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
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 ioAddr
102 (
103 "procAddressing",
106 mesh.thisDb(),
109 false // not registered
110 );
111
112 // procAddressing
113 rm(ioAddr.objectPath());
114
115 // pointProcAddressing
116 ioAddr.rename("pointProcAddressing");
117 rm(ioAddr.objectPath());
118
119 // edgeProcAddressing
120 ioAddr.rename("edgeProcAddressing");
121 rm(ioAddr.objectPath());
122
123 // faceProcAddressing
124 ioAddr.rename("faceProcAddressing");
125 rm(ioAddr.objectPath());
126
127 // boundaryProcAddressing
128 ioAddr.rename("boundaryProcAddressing");
129 rm(ioAddr.objectPath());
130}
131
132
133// ************************************************************************* //
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
virtual void rename(const word &newName)
Rename the object.
Definition: IOobject.H:497
fileName objectPath() const
The complete path + object name.
Definition: IOobjectI.H:214
word findInstance(const fileName &dir, const word &name=word::null, const IOobject::readOption rOpt=IOobject::MUST_READ, const word &stopInstance=word::null) const
Definition: Time.C:797
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: UPtrList.H:71
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:100
void removeFiles() const
Remove all files from mesh instance()
Definition: faMesh.C:718
static word meshSubDir
The mesh sub-directory name (usually "faMesh")
Definition: faMesh.H:504
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
Definition: fvMesh.H:302
const fileName & facesInstance() const
Return the current instance directory for faces.
Definition: polyMesh.C:866
Container for finite-area processor mesh addressing.
dynamicFvMesh & mesh
engineTime & runTime
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
Definition: MSwindows.C:1012
IOList< label > labelIOList
Label container classes.
Definition: labelIOList.H:44
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333