OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

MeshedSurfaceIOAllocator.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "MeshedSurfaceIOAllocator.H"
00028 
00029 
00030 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00031 
00032 Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
00033 (
00034     const IOobject& ioPoints,
00035     const IOobject& ioFaces,
00036     const IOobject& ioZones
00037 )
00038 :
00039     points_(ioPoints),
00040     faces_(ioFaces),
00041     zones_(ioZones)
00042 {}
00043 
00044 
00045 Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
00046 (
00047     const IOobject& ioPoints,
00048     const pointField& points,
00049     const IOobject& ioFaces,
00050     const faceList& faces,
00051     const IOobject& ioZones,
00052     const surfZoneList& zones
00053 )
00054 :
00055     points_(ioPoints, points),
00056     faces_(ioFaces, faces),
00057     zones_(ioZones, zones)
00058 {}
00059 
00060 
00061 Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
00062 (
00063     const IOobject& ioPoints,
00064     const Xfer< pointField >& points,
00065     const IOobject& ioFaces,
00066     const Xfer< faceList >& faces,
00067     const IOobject& ioZones,
00068     const Xfer< surfZoneList >& zones
00069 )
00070 :
00071     points_(ioPoints, points),
00072     faces_(ioFaces, faces),
00073     zones_(ioZones, zones)
00074 {}
00075 
00076 
00077 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00078 
00079 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00080 
00081 void Foam::MeshedSurfaceIOAllocator::clear()
00082 {
00083     points_.clear();
00084     faces_.clear();
00085     zones_.clear();
00086 }
00087 
00088 
00089 void Foam::MeshedSurfaceIOAllocator::resetFaces
00090 (
00091     const Xfer< List<face> >& faces,
00092     const Xfer< surfZoneList >& zones
00093 )
00094 {
00095     if (&faces)
00096     {
00097         faces_.transfer(faces());
00098     }
00099 
00100     if (&zones)
00101     {
00102         zones_.transfer(zones());
00103     }
00104 }
00105 
00106 
00107 void Foam::MeshedSurfaceIOAllocator::reset
00108 (
00109     const Xfer< pointField >& points,
00110     const Xfer< faceList >& faces,
00111     const Xfer< surfZoneList >& zones
00112 )
00113 {
00114     // Take over new primitive data.
00115     // Optimized to avoid overwriting data at all
00116     if (&points)
00117     {
00118         points_.transfer(points());
00119     }
00120 
00121     resetFaces(faces, zones);
00122 }
00123 
00124 
00125 void Foam::MeshedSurfaceIOAllocator::reset
00126 (
00127     const Xfer< List<point> >& points,
00128     const Xfer< faceList >& faces,
00129     const Xfer< surfZoneList >& zones
00130 )
00131 {
00132     // Take over new primitive data.
00133     // Optimized to avoid overwriting data at all
00134     if (&points)
00135     {
00136         points_.transfer(points());
00137     }
00138 
00139     resetFaces(faces, zones);
00140 }
00141 
00142 
00143 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd