1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
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
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
27 \*---------------------------------------------------------------------------*/
29 #include "vtkPV3Foam.H"
32 #include "polyPatch.H"
33 #include "primitivePatch.H"
34 #include "vtkPV3FoamPoints.H"
37 #include "vtkCellArray.h"
38 #include "vtkPoints.h"
39 #include "vtkPolyData.h"
41 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
43 vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh
48 vtkPolyData* vtkmesh = vtkPolyData::New();
52 Info<< "<beg> Foam::vtkPV3Foam::patchVTKMesh - " << p.name() << endl;
56 // Convert Foam mesh vertices to VTK
57 const Foam::pointField& points = p.localPoints();
59 vtkPoints *vtkpoints = vtkPoints::New();
60 vtkpoints->Allocate( points.size() );
63 vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
66 vtkmesh->SetPoints(vtkpoints);
70 // Add faces as polygons
71 const faceList& faces = p.localFaces();
73 vtkCellArray* vtkcells = vtkCellArray::New();
74 vtkcells->Allocate( faces.size() );
77 const face& f = faces[faceI];
78 vtkIdType nodeIds[f.size()];
84 vtkcells->InsertNextCell(f.size(), nodeIds);
87 vtkmesh->SetPolys(vtkcells);
92 Info<< "<end> Foam::vtkPV3Foam::patchVTKMesh - " << p.name() << endl;
100 // ************************************************************************* //