vtkPV3FoamMeshZone.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 "vtkPV3FoamPoints.H"
00033
00034
00035 #include "vtkPoints.h"
00036 #include "vtkPolyData.h"
00037 #include "vtkCellArray.h"
00038
00039
00040
00041 vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh
00042 (
00043 const fvMesh& mesh,
00044 const labelList& faceLabels
00045 )
00046 {
00047 vtkPolyData* vtkmesh = vtkPolyData::New();
00048
00049 if (debug)
00050 {
00051 Info<< "<beg> Foam::vtkPV3Foam::faceZoneVTKMesh" << endl;
00052 printMemory();
00053 }
00054
00055
00056
00057 const faceList& meshFaces = mesh.faces();
00058 faceList patchFaces(faceLabels.size());
00059 forAll(faceLabels, faceI)
00060 {
00061 patchFaces[faceI] = meshFaces[faceLabels[faceI]];
00062 }
00063 primitiveFacePatch p(patchFaces, mesh.points());
00064
00065
00066
00067
00068
00069 const pointField& points = p.localPoints();
00070
00071 vtkPoints* vtkpoints = vtkPoints::New();
00072 vtkpoints->Allocate( points.size() );
00073 forAll(points, i)
00074 {
00075 vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
00076 }
00077
00078 vtkmesh->SetPoints(vtkpoints);
00079 vtkpoints->Delete();
00080
00081
00082
00083 const faceList& faces = p.localFaces();
00084
00085 vtkCellArray* vtkcells = vtkCellArray::New();
00086 vtkcells->Allocate( faces.size() );
00087
00088 forAll(faces, faceI)
00089 {
00090 const face& f = faces[faceI];
00091 vtkIdType nodeIds[f.size()];
00092
00093 forAll(f, fp)
00094 {
00095 nodeIds[fp] = f[fp];
00096 }
00097 vtkcells->InsertNextCell(f.size(), nodeIds);
00098 }
00099
00100 vtkmesh->SetPolys(vtkcells);
00101 vtkcells->Delete();
00102
00103 if (debug)
00104 {
00105 Info<< "<end> Foam::vtkPV3Foam::faceZoneVTKMesh" << endl;
00106 printMemory();
00107 }
00108
00109 return vtkmesh;
00110 }
00111
00112
00113 vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh
00114 (
00115 const fvMesh& mesh,
00116 const labelList& pointLabels
00117 )
00118 {
00119 vtkPolyData* vtkmesh = vtkPolyData::New();
00120
00121 if (debug)
00122 {
00123 Info<< "<beg> Foam::vtkPV3Foam::pointZoneVTKMesh" << endl;
00124 printMemory();
00125 }
00126
00127 const pointField& meshPoints = mesh.points();
00128
00129 vtkPoints *vtkpoints = vtkPoints::New();
00130 vtkpoints->Allocate( pointLabels.size() );
00131
00132 forAll(pointLabels, pointI)
00133 {
00134 vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[pointLabels[pointI]]);
00135 }
00136
00137 vtkmesh->SetPoints(vtkpoints);
00138 vtkpoints->Delete();
00139
00140 if (debug)
00141 {
00142 Info<< "<beg> Foam::vtkPV3Foam::pointZoneVTKMesh" << endl;
00143 printMemory();
00144 }
00145
00146 return vtkmesh;
00147 }
00148
00149
00150
Copyright © 2000-2009 OpenCFD Ltd