sampledIsoSurfaceTemplates.C 2.65 KB
Newer Older
mattijs's avatar
mattijs committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
     \\/     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

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

#include "sampledIsoSurface.H"
#include "volFieldsFwd.H"
#include "pointFields.H"
#include "volPointInterpolation.H"

// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //

template <class Type>
Foam::tmp<Foam::Field<Type> >
Foam::sampledIsoSurface::sampleField
(
    const GeometricField<Type, fvPatchField, volMesh>& vField
) const
{
mattijs's avatar
mattijs committed
41
42
    // Recreate geometry if time has changed
    createGeometry();
mattijs's avatar
mattijs committed
43
    return tmp<Field<Type> >(new Field<Type>(vField, surface().meshCells()));
mattijs's avatar
mattijs committed
44
45
46
47
48
49
50
51
52
53
}


template <class Type>
Foam::tmp<Foam::Field<Type> >
Foam::sampledIsoSurface::interpolateField
(
    const interpolation<Type>& interpolator
) const
{
mattijs's avatar
mattijs committed
54
    const fvMesh& fvm = static_cast<const fvMesh&>(mesh());
mattijs's avatar
mattijs committed
55

mattijs's avatar
mattijs committed
56
57
58
    // Get fields to sample. Assume volPointInterpolation!
    const GeometricField<Type, fvPatchField, volMesh>& volFld =
        interpolator.psi();
mattijs's avatar
mattijs committed
59

60
    tmp<GeometricField<Type, pointPatchField, pointMesh> > tpointFld
mattijs's avatar
mattijs committed
61
62
63
    (
        volPointInterpolation::New(fvm).interpolate(volFld)
    );
mattijs's avatar
mattijs committed
64

65
66
67
68
69
    const GeometricField<Type, pointPatchField, pointMesh>& pointFld =
        tpointFld();

    // Get pointers to sampling field (both original and interpolated one)
    getIsoFields();
mattijs's avatar
mattijs committed
70
71
    // Recreate geometry if time has changed
    createGeometry();
mattijs's avatar
mattijs committed
72

mattijs's avatar
mattijs committed
73
74
75
76
77
78
    // Sample.
    return surface().interpolate
    (
        *volFieldPtr_,
        *pointFieldPtr_,
        volFld,
79
        pointFld
mattijs's avatar
mattijs committed
80
    );
mattijs's avatar
mattijs committed
81
82
83
84
}


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