zeroDimensionalFvMesh.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "zeroDimensionalFvMesh.H"
27 #include "emptyPolyPatch.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
32 {
33  pointField points(8);
34  points[0] = vector(-0.5, -0.5, -0.5);
35  points[1] = vector( 0.5, -0.5, -0.5);
36  points[2] = vector( 0.5, 0.5, -0.5);
37  points[3] = vector(-0.5, 0.5, -0.5);
38  points[4] = vector(-0.5, -0.5, 0.5);
39  points[5] = vector( 0.5, -0.5, 0.5);
40  points[6] = vector( 0.5, 0.5, 0.5);
41  points[7] = vector(-0.5, 0.5, 0.5);
42 
43  faceList faces = cellModeller::lookup("hex")->modelFaces();
44 
45  labelList owner(6, label(0));
46  labelList neighbour(0);
47 
48  fvMesh mesh
49  (
50  IOobject
51  (
52  fvMesh::defaultRegion,
53  db.time().name(),
54  db,
55  IOobject::READ_IF_PRESENT
56  ),
57  move(points),
58  move(faces),
59  move(owner),
60  move(neighbour)
61  );
62 
64  (
65  1,
66  new emptyPolyPatch
67  (
68  "boundary",
69  6,
70  0,
71  0,
72  mesh.boundaryMesh(),
73  emptyPolyPatch::typeName
74  )
75  );
76 
77  mesh.addFvPatches(patches);
78 
79  return mesh;
80 }
81 
82 // ************************************************************************* //
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
const word & name() const
Return const reference to name.
Empty front and back plane patch. Used for 2-D geometries.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
void addFvPatches(const List< polyPatch * > &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
Definition: fvMesh.C:725
Registry of regIOobjects.
const Time & time() const
Return time.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:403
const pointField & points
const fvPatchList & patches
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
fvMesh zeroDimensionalFvMesh(const objectRegistry &db)
Construct a zero-dimensional unit-cube FV mesh.