vtkPV3FoamUpdateInfoFields.H 3.39 KB
Newer Older
1
2
3
4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
Mark Olesen's avatar
Mark Olesen committed
5
    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
    Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM; if not, write to the Free Software Foundation,
    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

InClass
    vtkPV3Foam

\*---------------------------------------------------------------------------*/

Mark Olesen's avatar
Mark Olesen committed
30
31
#ifndef vtkPV3FoamUpdateInfoFields_H
#define vtkPV3FoamUpdateInfoFields_H
32
33
34
35

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

template<template<class> class patchType, class meshType>
Mark Olesen's avatar
Mark Olesen committed
36
void Foam::vtkPV3Foam::updateInfoFields
37
(
Mark Olesen's avatar
Mark Olesen committed
38
    vtkDataArraySelection *select
39
40
41
42
)
{
    if (debug)
    {
Mark Olesen's avatar
Mark Olesen committed
43
44
45
46
        Info<< "<beg> Foam::vtkPV3Foam::updateInfoFields <"
            << meshType::Mesh::typeName
            << "> [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]"
            << endl;
47
48
    }

Mark Olesen's avatar
Mark Olesen committed
49
    stringList enabledEntries;
50
    // enable 'p' and 'U' on the first call
Mark Olesen's avatar
Mark Olesen committed
51
    if (select->GetNumberOfArrays() == 0 && !meshPtr_)
52
    {
Mark Olesen's avatar
Mark Olesen committed
53
54
55
        enabledEntries.setSize(2);
        enabledEntries[0] = "p";
        enabledEntries[1] = "U";
56
57
58
    }
    else
    {
59
        // preserve the enabled selections
Mark Olesen's avatar
Mark Olesen committed
60
        enabledEntries = getSelectedArrayEntries(select);
61
62
    }

Mark Olesen's avatar
Mark Olesen committed
63
    select->RemoveAllArrays();
64

65
66
67
68
69
70
71
72
73
74
    // use the db directly since this might be called without a mesh,
    // but the region must get added back in
    word regionPrefix;
    if (meshRegion_ != polyMesh::defaultRegion)
    {
        regionPrefix = meshRegion_;
    }

    // Search for list of objects for this time and mesh region
    IOobjectList objects(dbPtr_(), dbPtr_().timeName(), regionPrefix);
75
76

    //- Add volume fields to GUI
77
    addToSelection<GeometricField<scalar, patchType, meshType> >
78
    (
Mark Olesen's avatar
Mark Olesen committed
79
        select,
80
81
        objects
    );
82
    addToSelection<GeometricField<vector, patchType, meshType> >
83
    (
Mark Olesen's avatar
Mark Olesen committed
84
        select,
85
86
        objects
    );
87
    addToSelection<GeometricField<sphericalTensor, patchType, meshType> >
88
    (
Mark Olesen's avatar
Mark Olesen committed
89
        select,
90
91
        objects
    );
92
    addToSelection<GeometricField<symmTensor, patchType, meshType> >
93
    (
Mark Olesen's avatar
Mark Olesen committed
94
        select,
95
96
        objects
    );
97
    addToSelection<GeometricField<tensor, patchType, meshType> >
98
    (
Mark Olesen's avatar
Mark Olesen committed
99
        select,
100
101
102
        objects
    );

103
    // restore the enabled selections
Mark Olesen's avatar
Mark Olesen committed
104
    setSelectedArrayEntries(select, enabledEntries);
105
106
107

    if (debug)
    {
Mark Olesen's avatar
Mark Olesen committed
108
        Info<< "<end> Foam::vtkPV3Foam::updateInfoFields" << endl;
109
    }
110
111
112
113
114
115
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif
// ************************************************************************* //