MeshedSurfaceIOAllocator.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) 2011-2019 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 
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
31 (
32  const IOobject& ioPoints,
33  const IOobject& ioFaces,
34  const IOobject& ioZones
35 )
36 :
37  points_(ioPoints),
38  faces_(ioFaces),
39  zones_(ioZones)
40 {}
41 
42 
44 (
45  const IOobject& ioPoints,
46  const pointField& points,
47  const IOobject& ioFaces,
48  const faceList& faces,
49  const IOobject& ioZones,
50  const surfZoneList& zones
51 )
52 :
53  points_(ioPoints, points),
54  faces_(ioFaces, faces),
55  zones_(ioZones, zones)
56 {}
57 
58 
60 (
61  const IOobject& ioPoints,
62  pointField&& points,
63  const IOobject& ioFaces,
64  faceList&& faces,
65  const IOobject& ioZones,
66  surfZoneList&& zones
67 )
68 :
69  points_(ioPoints, move(points)),
70  faces_(ioFaces, move(faces)),
71  zones_(ioZones, move(zones))
72 {}
73 
74 
75 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
76 
78 {
79  points_.clear();
80  faces_.clear();
81  zones_.clear();
82 }
83 
84 
86 (
87  List<face>&& faces,
88  surfZoneList&& zones
89 )
90 {
91  if (notNull(faces))
92  {
93  faces_.transfer(faces);
94  }
95 
96  if (notNull(zones))
97  {
98  zones_.transfer(zones);
99  }
100 }
101 
102 
104 (
105  pointField&& points,
106  faceList&& faces,
107  surfZoneList&& zones
108 )
109 {
110  // Take over new primitive data.
111  // Optimized to avoid overwriting data at all
112  if (notNull(points))
113  {
114  points_.transfer(points);
115  }
116 
117  resetFaces(move(faces), move(zones));
118 }
119 
120 
122 (
123  List<point>&& points,
124  faceList&& faces,
125  surfZoneList&& zones
126 )
127 {
128  // Take over new primitive data.
129  // Optimized to avoid overwriting data at all
130  if (notNull(points))
131  {
132  points_.transfer(points);
133  }
134 
135  resetFaces(move(faces), move(zones));
136 }
137 
138 
139 // ************************************************************************* //
MeshedSurfaceIOAllocator(const IOobject &ioPoints, const IOobject &ioFaces, const IOobject &ioZones)
Read construct from IOobjects.
void clear()
Clear the list, i.e. set size to zero.
Definition: ListI.H:124
void resetFaces(faceList &&faces, surfZoneList &&zones)
Reset primitive data (points, faces and zones)
void reset(pointField &&points, faceList &&faces, surfZoneList &&zones)
Reset primitive data (points, faces and zones)
bool notNull(const T &t)
Return true if t is not a reference to the nullObject of type T.
Definition: nullObjectI.H:52
void clear()
Clear primitive data (points, faces and zones)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Definition: List.C:342