vtkPV3FoamMeshPatch.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "vtkPV3Foam.H"
00030
00031
00032 #include "polyPatch.H"
00033 #include "primitivePatch.H"
00034 #include "vtkPV3FoamPoints.H"
00035
00036
00037 #include "vtkCellArray.h"
00038 #include "vtkPoints.h"
00039 #include "vtkPolyData.h"
00040
00041
00042
00043 vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh
00044 (
00045 const polyPatch& p
00046 )
00047 {
00048 vtkPolyData* vtkmesh = vtkPolyData::New();
00049
00050 if (debug)
00051 {
00052 Info<< "<beg> Foam::vtkPV3Foam::patchVTKMesh - " << p.name() << endl;
00053 printMemory();
00054 }
00055
00056
00057 const Foam::pointField& points = p.localPoints();
00058
00059 vtkPoints *vtkpoints = vtkPoints::New();
00060 vtkpoints->Allocate( points.size() );
00061 forAll(points, i)
00062 {
00063 vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
00064 }
00065
00066 vtkmesh->SetPoints(vtkpoints);
00067 vtkpoints->Delete();
00068
00069
00070
00071 const faceList& faces = p.localFaces();
00072
00073 vtkCellArray* vtkcells = vtkCellArray::New();
00074 vtkcells->Allocate( faces.size() );
00075 forAll(faces, faceI)
00076 {
00077 const face& f = faces[faceI];
00078 vtkIdType nodeIds[f.size()];
00079
00080 forAll(f, fp)
00081 {
00082 nodeIds[fp] = f[fp];
00083 }
00084 vtkcells->InsertNextCell(f.size(), nodeIds);
00085 }
00086
00087 vtkmesh->SetPolys(vtkcells);
00088 vtkcells->Delete();
00089
00090 if (debug)
00091 {
00092 Info<< "<end> Foam::vtkPV3Foam::patchVTKMesh - " << p.name() << endl;
00093 printMemory();
00094 }
00095
00096 return vtkmesh;
00097 }
00098
00099
00100
Copyright © 2000-2009 OpenCFD Ltd