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-2018 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 
30 Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
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 
43 Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
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 
59 Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
60 (
61  const IOobject& ioPoints,
62  const Xfer<pointField>& points,
63  const IOobject& ioFaces,
64  const Xfer<faceList>& faces,
65  const IOobject& ioZones,
66  const Xfer<surfZoneList>& zones
67 )
68 :
69  points_(ioPoints, points),
70  faces_(ioFaces, faces),
71  zones_(ioZones, zones)
72 {}
73 
74 
75 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
76 
78 {
79  points_.clear();
80  faces_.clear();
81  zones_.clear();
82 }
83 
84 
86 (
87  const Xfer<List<face>>& faces,
88  const Xfer<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  const Xfer<pointField>& points,
106  const Xfer<faceList>& faces,
107  const Xfer<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(faces, zones);
118 }
119 
120 
122 (
123  const Xfer<List<point>>& points,
124  const Xfer<faceList>& faces,
125  const Xfer<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(faces, zones);
136 }
137 
138 
139 // ************************************************************************* //
A simple container for copying or transferring objects of type <T>.
Definition: Xfer.H:85
void resetFaces(const Xfer< faceList > &faces, const Xfer< surfZoneList > &zones)
Reset primitive data (points, faces and zones)
const pointField & points
void clear()
Clear the list, i.e. set size to zero.
Definition: ListI.H:124
bool notNull(const T &t)
Return true if t is not a reference to the nullObject of type T.
Definition: nullObjectI.H:46
void reset(const Xfer< pointField > &points, const Xfer< faceList > &faces, const Xfer< surfZoneList > &zones)
Reset primitive data (points, faces and zones)
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