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

vtkPV3FoamUpdateInfoFields.H

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 InClass
00026     vtkPV3Foam
00027 
00028 \*---------------------------------------------------------------------------*/
00029 
00030 #ifndef vtkPV3FoamUpdateInfoFields_H
00031 #define vtkPV3FoamUpdateInfoFields_H
00032 
00033 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00034 
00035 template<template<class> class patchType, class meshType>
00036 void Foam::vtkPV3Foam::updateInfoFields
00037 (
00038     vtkDataArraySelection *select
00039 )
00040 {
00041     if (debug)
00042     {
00043         Info<< "<beg> Foam::vtkPV3Foam::updateInfoFields <"
00044             << meshType::Mesh::typeName
00045             << "> [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]"
00046             << endl;
00047     }
00048 
00049     stringList enabledEntries;
00050     // enable 'p' and 'U' on the first call
00051     if (select->GetNumberOfArrays() == 0 && !meshPtr_)
00052     {
00053         enabledEntries.setSize(2);
00054         enabledEntries[0] = "p";
00055         enabledEntries[1] = "U";
00056     }
00057     else
00058     {
00059         // preserve the enabled selections
00060         enabledEntries = getSelectedArrayEntries(select);
00061     }
00062 
00063     select->RemoveAllArrays();
00064 
00065     // use the db directly since this might be called without a mesh,
00066     // but the region must get added back in
00067     word regionPrefix;
00068     if (meshRegion_ != polyMesh::defaultRegion)
00069     {
00070         regionPrefix = meshRegion_;
00071     }
00072 
00073     // Search for list of objects for this time and mesh region
00074     IOobjectList objects(dbPtr_(), dbPtr_().timeName(), regionPrefix);
00075 
00076     //- Add volume fields to GUI
00077     addToSelection<GeometricField<scalar, patchType, meshType> >
00078     (
00079         select,
00080         objects
00081     );
00082     addToSelection<GeometricField<vector, patchType, meshType> >
00083     (
00084         select,
00085         objects
00086     );
00087     addToSelection<GeometricField<sphericalTensor, patchType, meshType> >
00088     (
00089         select,
00090         objects
00091     );
00092     addToSelection<GeometricField<symmTensor, patchType, meshType> >
00093     (
00094         select,
00095         objects
00096     );
00097     addToSelection<GeometricField<tensor, patchType, meshType> >
00098     (
00099         select,
00100         objects
00101     );
00102 
00103     // restore the enabled selections
00104     setSelectedArrayEntries(select, enabledEntries);
00105 
00106     if (debug)
00107     {
00108         Info<< "<end> Foam::vtkPV3Foam::updateInfoFields" << endl;
00109     }
00110 }
00111 
00112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00113 
00114 #endif
00115 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd