vtkOpenFOAMPoints.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 InClass
25  vtkPV3Foam
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #ifndef vtkOpenFOAMPoints_H
30 #define vtkOpenFOAMPoints_H
31 
32 // VTK includes
33 #include "vtkPoints.h"
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
38 (
39  vtkPoints *points,
40  const Foam::point& p
41 )
42 {
43  points->InsertNextPoint(p.x(), p.y(), p.z());
44 }
45 
46 #if 0
47 // this should be faster, but didn't get it working ...
48 inline void vtkSetOpenFOAMPoint
49 (
50  vtkPoints *points,
51  const Foam::label id,
52  const Foam::point& p
53 )
54 {
55  points->SetPoint(id, p.x(), p.y(), p.z());
56 }
57 
58 
59 // Convert OpenFOAM mesh vertices to VTK
60 inline vtkPoints* vtkSetOpenFOAMPoints(const Foam::pointField& points)
61 {
62  vtkPoints *vtkpoints = vtkPoints::New();
63  vtkpoints->SetNumberOfPoints(points.size());
64  forAll(points, i)
65  {
66  const Foam::point& p = points[i];
67  vtkpoints->SetPoint(i, p.x(), p.y(), p.z());
68  }
69 
70  return vtkpoints;
71 }
72 
73 #endif
74 
75 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76 
77 #endif
78 
79 // ************************************************************************* //
const Cmpt & z() const
Definition: VectorI.H:87
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const Cmpt & x() const
Definition: VectorI.H:75
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:76
void vtkInsertNextOpenFOAMPoint(vtkPoints *points, const Foam::point &p)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
const Cmpt & y() const
Definition: VectorI.H:81