DelaunayMeshI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2012-2015 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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
27 
28 template<class Triangulation>
30 {
31  return runTime_;
32 }
33 
34 
35 template<class Triangulation>
37 (
38  const string& description,
39  const bool check
40 ) const
41 {
42  if (check)
43  {
44  Info<< nl << "--- [ cpuTime "
45  << time().elapsedCpuTime() << " s, "
46  << "delta " << time().cpuTimeIncrement()<< " s";
47 
48  if (description != word::null)
49  {
50  Info<< ", " << description << " ";
51  }
52  else
53  {
54  Info<< " ";
55  }
56 
57  Info<< "] --- " << endl;
58  }
59 }
60 
61 
62 template<class Triangulation>
64 {
65  label id = cellCount_++;
66 
67  if (id == labelMax)
68  {
69  WarningIn
70  (
71  "Foam::DelaunayMesh<Triangulation>::getNewCellIndex() const"
72  ) << "Cell counter has overflowed." << endl;
73  }
74 
75  return id;
76 }
77 
78 
79 template<class Triangulation>
81 {
82  label id = vertexCount_++;
83 
84  if (id == labelMax)
85  {
86  WarningIn
87  (
88  "Foam::DelaunayMesh<Triangulation>::getNewVertexIndex() const"
89  ) << "Vertex counter has overflowed." << endl;
90  }
91 
92  return id;
93 }
94 
95 
96 template<class Triangulation>
98 {
99  return cellCount_;
100 }
101 
102 
103 template<class Triangulation>
105 {
106  return vertexCount_;
107 }
108 
109 
110 template<class Triangulation>
112 {
113  cellCount_ = 0;
114 }
115 
116 
117 template<class Triangulation>
119 {
120  vertexCount_ = 0;
121 }
122 
123 
124 // ************************************************************************* //
label getNewCellIndex() const
Create a new unique cell index and return.
Definition: DelaunayMeshI.H:63
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
messageStream Info
label vertexCount() const
Return the vertex count (the next unique vertex index)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
static const char nl
Definition: Ostream.H:260
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
#define WarningIn(functionName)
Report a warning using Foam::Warning.
void timeCheck(const string &description, const bool check=true) const
Write the cpuTime to screen.
Definition: DelaunayMeshI.H:37
void resetVertexCount()
Set the vertex count to zero.
void resetCellCount()
Set the cell count to zero.
label cellCount() const
Return the cell count (the next unique cell index)
Definition: DelaunayMeshI.H:97
const Time & time() const
Return a reference to the Time object.
Definition: DelaunayMeshI.H:29
label getNewVertexIndex() const
Create a new unique vertex index and return.
Definition: DelaunayMeshI.H:80
static const label labelMax
Definition: label.H:62