initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / postProcessing / graphics / PV3FoamReader / vtkPV3Foam / vtkPV3FoamUpdateInfoFields.H
blob7e28460a465c74ffb690359aff588df63accc756
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 InClass
26     vtkPV3Foam
28 \*---------------------------------------------------------------------------*/
30 #ifndef vtkPV3FoamUpdateInfoFields_H
31 #define vtkPV3FoamUpdateInfoFields_H
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 template<template<class> class patchType, class meshType>
36 void Foam::vtkPV3Foam::updateInfoFields
38     vtkDataArraySelection *select
41     if (debug)
42     {
43         Info<< "<beg> Foam::vtkPV3Foam::updateInfoFields <"
44             << meshType::Mesh::typeName
45             << "> [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]"
46             << endl;
47     }
49     stringList enabledEntries;
50     // enable 'p' and 'U' on the first call
51     if (select->GetNumberOfArrays() == 0 && !meshPtr_)
52     {
53         enabledEntries.setSize(2);
54         enabledEntries[0] = "p";
55         enabledEntries[1] = "U";
56     }
57     else
58     {
59         // preserve the enabled selections
60         enabledEntries = getSelectedArrayEntries(select);
61     }
63     select->RemoveAllArrays();
65     // use the db directly since this might be called without a mesh,
66     // but the region must get added back in
67     word regionPrefix;
68     if (meshRegion_ != polyMesh::defaultRegion)
69     {
70         regionPrefix = meshRegion_;
71     }
73     // Search for list of objects for this time and mesh region
74     IOobjectList objects(dbPtr_(), dbPtr_().timeName(), regionPrefix);
76     //- Add volume fields to GUI
77     addToSelection<GeometricField<scalar, patchType, meshType> >
78     (
79         select,
80         objects
81     );
82     addToSelection<GeometricField<vector, patchType, meshType> >
83     (
84         select,
85         objects
86     );
87     addToSelection<GeometricField<sphericalTensor, patchType, meshType> >
88     (
89         select,
90         objects
91     );
92     addToSelection<GeometricField<symmTensor, patchType, meshType> >
93     (
94         select,
95         objects
96     );
97     addToSelection<GeometricField<tensor, patchType, meshType> >
98     (
99         select,
100         objects
101     );
103     // restore the enabled selections
104     setSelectedArrayEntries(select, enabledEntries);
106     if (debug)
107     {
108         Info<< "<end> Foam::vtkPV3Foam::updateInfoFields" << endl;
109     }
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 #endif
115 // ************************************************************************* //