vtkPV3FoamMesh.C 15.3 KB
Newer Older
1
2
3
4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
5
    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
6
7
8
9
10
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

11
12
13
14
    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 3 of the License, or
    (at your option) any later version.
15
16
17
18
19
20
21

    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
22
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
23
24
25
26
27

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

#include "vtkPV3Foam.H"

28
// OpenFOAM includes
29
30
31
32
33
#include "cellSet.H"
#include "faceSet.H"
#include "pointSet.H"
#include "fvMeshSubset.H"
#include "vtkPV3FoamReader.h"
34
#include "uindirectPrimitivePatch.H"
35
36
37
38
39
40
41
42
43
44
45

// VTK includes
#include "vtkDataArraySelection.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkPolyData.h"
#include "vtkUnstructuredGrid.h"

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

void Foam::vtkPV3Foam::convertMeshVolume
(
46
47
    vtkMultiBlockDataSet* output,
    int& blockNo
48
49
)
{
50
51
    arrayRange& range = arrayRangeVolume_;
    range.block(blockNo);      // set output block
Mark Olesen's avatar
Mark Olesen committed
52
53
54
55
    label datasetNo = 0;       // restart at dataset 0
    const fvMesh& mesh = *meshPtr_;

    // resize for decomposed polyhedra
56
    regionPolyDecomp_.setSize(range.size());
Mark Olesen's avatar
Mark Olesen committed
57

58
59
    if (debug)
    {
60
        Info<< "<beg> Foam::vtkPV3Foam::convertMeshVolume" << endl;
Mark Olesen's avatar
Mark Olesen committed
61
        printMemory();
62
63
    }

Mark Olesen's avatar
Mark Olesen committed
64
    // Convert the internalMesh
65
    // this looks like more than one part, but it isn't
66
    for (int partId = range.start(); partId < range.end(); ++partId)
Mark Olesen's avatar
Mark Olesen committed
67
68
    {
        const word partName = "internalMesh";
69

Mark Olesen's avatar
Mark Olesen committed
70
        if (!partStatus_[partId])
71
        {
Mark Olesen's avatar
Mark Olesen committed
72
            continue;
73
74
        }

Mark Olesen's avatar
Mark Olesen committed
75
76
77
        vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
        (
            mesh,
Mark Olesen's avatar
Mark Olesen committed
78
            regionPolyDecomp_[datasetNo]
Mark Olesen's avatar
Mark Olesen committed
79
        );
80

Mark Olesen's avatar
Mark Olesen committed
81
82
        if (vtkmesh)
        {
83
            AddToBlock(output, vtkmesh, range, datasetNo, partName);
Mark Olesen's avatar
Mark Olesen committed
84
            vtkmesh->Delete();
85

Mark Olesen's avatar
Mark Olesen committed
86
            partDataset_[partId] = datasetNo++;
Mark Olesen's avatar
Mark Olesen committed
87
        }
88
89
    }

Mark Olesen's avatar
Mark Olesen committed
90
    // anything added?
Mark Olesen's avatar
Mark Olesen committed
91
    if (datasetNo)
92
93
    {
        ++blockNo;
94
    }
95
96
97
98

    if (debug)
    {
        Info<< "<end> Foam::vtkPV3Foam::convertMeshVolume" << endl;
Mark Olesen's avatar
Mark Olesen committed
99
        printMemory();
100
    }
101
102
103
104
105
}


void Foam::vtkPV3Foam::convertMeshLagrangian
(
106
107
    vtkMultiBlockDataSet* output,
    int& blockNo
108
109
)
{
110
111
    arrayRange& range = arrayRangeLagrangian_;
    range.block(blockNo);      // set output block
Mark Olesen's avatar
Mark Olesen committed
112
113
114
    label datasetNo = 0;       // restart at dataset 0
    const fvMesh& mesh = *meshPtr_;

115
116
    if (debug)
    {
117
        Info<< "<beg> Foam::vtkPV3Foam::convertMeshLagrangian" << endl;
Mark Olesen's avatar
Mark Olesen committed
118
        printMemory();
119
120
    }

121
    for (int partId = range.start(); partId < range.end(); ++partId)
Mark Olesen's avatar
Mark Olesen committed
122
123
124
125
    {
        const word cloudName = getPartName(partId);

        if (!partStatus_[partId])
126
127
128
129
        {
            continue;
        }

Mark Olesen's avatar
Mark Olesen committed
130
        vtkPolyData* vtkmesh = lagrangianVTKMesh(mesh, cloudName);
Mark Olesen's avatar
Mark Olesen committed
131

Mark Olesen's avatar
Mark Olesen committed
132
133
        if (vtkmesh)
        {
134
            AddToBlock(output, vtkmesh, range, datasetNo, cloudName);
Mark Olesen's avatar
Mark Olesen committed
135
            vtkmesh->Delete();
136

Mark Olesen's avatar
Mark Olesen committed
137
            partDataset_[partId] = datasetNo++;
Mark Olesen's avatar
Mark Olesen committed
138
        }
139
    }
140

Mark Olesen's avatar
Mark Olesen committed
141
    // anything added?
Mark Olesen's avatar
Mark Olesen committed
142
    if (datasetNo)
143
144
145
146
    {
        ++blockNo;
    }

147
148
149
    if (debug)
    {
        Info<< "<end> Foam::vtkPV3Foam::convertMeshLagrangian" << endl;
Mark Olesen's avatar
Mark Olesen committed
150
        printMemory();
151
    }
152
153
154
155
156
}


void Foam::vtkPV3Foam::convertMeshPatches
(
157
158
    vtkMultiBlockDataSet* output,
    int& blockNo
159
160
)
{
161
162
    arrayRange& range = arrayRangePatches_;
    range.block(blockNo);      // set output block
Mark Olesen's avatar
Mark Olesen committed
163
164
165
166
    label datasetNo = 0;       // restart at dataset 0
    const fvMesh& mesh = *meshPtr_;
    const polyBoundaryMesh& patches = mesh.boundaryMesh();

167
168
    if (debug)
    {
169
        Info<< "<beg> Foam::vtkPV3Foam::convertMeshPatches" << endl;
Mark Olesen's avatar
Mark Olesen committed
170
        printMemory();
171
172
    }

173
    for (int partId = range.start(); partId < range.end(); ++partId)
174
    {
175
        if (!partStatus_[partId])
176
        {
Mark Olesen's avatar
Mark Olesen committed
177
178
            continue;
        }
179

180
181
        const word patchName = getPartName(partId);

182
183
184
185
        labelHashSet patchIds
        (
            patches.patchSet(List<wordRe>(1, wordRe(patchName)))
        );
186

Mark Olesen's avatar
Mark Olesen committed
187
188
        if (debug)
        {
189
            Info<< "Creating VTK mesh for patches [" << patchIds <<"] "
Mark Olesen's avatar
Mark Olesen committed
190
191
                << patchName  << endl;
        }
192

193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
        vtkPolyData* vtkmesh = NULL;
        if (patchIds.size() == 1)
        {
            vtkmesh = patchVTKMesh(patchName, patches[patchIds.begin().key()]);
        }
        else
        {
            // Patch group. Collect patch faces.
            label sz = 0;
            forAllConstIter(labelHashSet, patchIds, iter)
            {
                sz += patches[iter.key()].size();
            }
            labelList meshFaceLabels(sz);
            sz = 0;
            forAllConstIter(labelHashSet, patchIds, iter)
            {
                const polyPatch& pp = patches[iter.key()];
                forAll(pp, i)
                {
                    meshFaceLabels[sz++] = pp.start()+i;
                }
            }
            UIndirectList<face> fcs(mesh.faces(), meshFaceLabels);
            uindirectPrimitivePatch pp(fcs, mesh.points());

            vtkmesh = patchVTKMesh(patchName, pp);
        }

222

Mark Olesen's avatar
Mark Olesen committed
223
224
        if (vtkmesh)
        {
225
            AddToBlock(output, vtkmesh, range, datasetNo, patchName);
Mark Olesen's avatar
Mark Olesen committed
226
            vtkmesh->Delete();
227

Mark Olesen's avatar
Mark Olesen committed
228
            partDataset_[partId] = datasetNo++;
229
230
        }
    }
231

Mark Olesen's avatar
Mark Olesen committed
232
    // anything added?
Mark Olesen's avatar
Mark Olesen committed
233
    if (datasetNo)
234
235
236
237
    {
        ++blockNo;
    }

238
239
240
    if (debug)
    {
        Info<< "<end> Foam::vtkPV3Foam::convertMeshPatches" << endl;
Mark Olesen's avatar
Mark Olesen committed
241
        printMemory();
242
    }
243
244
245
246
247
}


void Foam::vtkPV3Foam::convertMeshCellZones
(
248
249
    vtkMultiBlockDataSet* output,
    int& blockNo
250
251
)
{
252
253
    arrayRange& range = arrayRangeCellZones_;
    range.block(blockNo);      // set output block
Mark Olesen's avatar
Mark Olesen committed
254
255
256
257
    label datasetNo = 0;       // restart at dataset 0
    const fvMesh& mesh = *meshPtr_;

    // resize for decomposed polyhedra
258
    zonePolyDecomp_.setSize(range.size());
Mark Olesen's avatar
Mark Olesen committed
259

260
    if (range.empty())
Mark Olesen's avatar
Mark Olesen committed
261
262
263
264
    {
        return;
    }

265
266
    if (debug)
    {
267
        Info<< "<beg> Foam::vtkPV3Foam::convertMeshCellZones" << endl;
Mark Olesen's avatar
Mark Olesen committed
268
        printMemory();
269
270
    }

Mark Olesen's avatar
Mark Olesen committed
271
    const cellZoneMesh& zMesh = mesh.cellZones();
272
    for (int partId = range.start(); partId < range.end(); ++partId)
273
    {
Mark Olesen's avatar
Mark Olesen committed
274
275
        const word zoneName = getPartName(partId);
        const label  zoneId = zMesh.findZoneID(zoneName);
276

Mark Olesen's avatar
Mark Olesen committed
277
        if (!partStatus_[partId] || zoneId < 0)
278
        {
Mark Olesen's avatar
Mark Olesen committed
279
280
            continue;
        }
Mark Olesen's avatar
Mark Olesen committed
281

Mark Olesen's avatar
Mark Olesen committed
282
283
284
285
286
        if (debug)
        {
            Info<< "Creating VTK mesh for cellZone[" << zoneId << "] "
                << zoneName << endl;
        }
287

Mark Olesen's avatar
Mark Olesen committed
288
289
        fvMeshSubset subsetter(mesh);
        subsetter.setLargeCellSubset(zMesh[zoneId]);
290

Mark Olesen's avatar
Mark Olesen committed
291
292
293
294
295
        vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
        (
            subsetter.subMesh(),
            zonePolyDecomp_[datasetNo]
        );
296

Mark Olesen's avatar
Mark Olesen committed
297
298
299
300
        if (vtkmesh)
        {
            // superCells + addPointCellLabels must contain global cell ids
            inplaceRenumber
301
            (
Mark Olesen's avatar
Mark Olesen committed
302
303
304
305
306
307
308
                subsetter.cellMap(),
                zonePolyDecomp_[datasetNo].superCells()
            );
            inplaceRenumber
            (
                subsetter.cellMap(),
                zonePolyDecomp_[datasetNo].addPointCellLabels()
309
310
            );

Mark Olesen's avatar
Mark Olesen committed
311
312
            // copy pointMap as well, otherwise pointFields fail
            zonePolyDecomp_[datasetNo].pointMap() = subsetter.pointMap();
Mark Olesen's avatar
Mark Olesen committed
313

314
            AddToBlock(output, vtkmesh, range, datasetNo, zoneName);
Mark Olesen's avatar
Mark Olesen committed
315
316
317
            vtkmesh->Delete();

            partDataset_[partId] = datasetNo++;
318
319
        }
    }
320

Mark Olesen's avatar
Mark Olesen committed
321
    // anything added?
Mark Olesen's avatar
Mark Olesen committed
322
    if (datasetNo)
323
324
325
326
    {
        ++blockNo;
    }

327
328
329
    if (debug)
    {
        Info<< "<end> Foam::vtkPV3Foam::convertMeshCellZones" << endl;
Mark Olesen's avatar
Mark Olesen committed
330
        printMemory();
331
    }
332
333
334
}


335
void Foam::vtkPV3Foam::convertMeshCellSets
336
(
337
338
    vtkMultiBlockDataSet* output,
    int& blockNo
339
340
)
{
341
342
    arrayRange& range = arrayRangeCellSets_;
    range.block(blockNo);      // set output block
Mark Olesen's avatar
Mark Olesen committed
343
344
345
346
    label datasetNo = 0;       // restart at dataset 0
    const fvMesh& mesh = *meshPtr_;

    // resize for decomposed polyhedra
347
    csetPolyDecomp_.setSize(range.size());
Mark Olesen's avatar
Mark Olesen committed
348

349
350
    if (debug)
    {
351
        Info<< "<beg> Foam::vtkPV3Foam::convertMeshCellSets" << endl;
Mark Olesen's avatar
Mark Olesen committed
352
        printMemory();
353
354
    }

355
    for (int partId = range.start(); partId < range.end(); ++partId)
356
    {
Mark Olesen's avatar
Mark Olesen committed
357
358
359
        const word partName = getPartName(partId);

        if (!partStatus_[partId])
360
        {
Mark Olesen's avatar
Mark Olesen committed
361
362
            continue;
        }
363

Mark Olesen's avatar
Mark Olesen committed
364
365
366
367
        if (debug)
        {
            Info<< "Creating VTK mesh for cellSet=" << partName << endl;
        }
368

Mark Olesen's avatar
Mark Olesen committed
369
370
371
        const cellSet cSet(mesh, partName);
        fvMeshSubset subsetter(mesh);
        subsetter.setLargeCellSubset(cSet);
372

Mark Olesen's avatar
Mark Olesen committed
373
374
375
376
377
        vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
        (
            subsetter.subMesh(),
            csetPolyDecomp_[datasetNo]
        );
378

Mark Olesen's avatar
Mark Olesen committed
379
380
381
382
383
384
385
386
387
        if (vtkmesh)
        {
            // superCells + addPointCellLabels must contain global cell ids
            inplaceRenumber
            (
                subsetter.cellMap(),
                csetPolyDecomp_[datasetNo].superCells()
            );
            inplaceRenumber
388
            (
Mark Olesen's avatar
Mark Olesen committed
389
390
                subsetter.cellMap(),
                csetPolyDecomp_[datasetNo].addPointCellLabels()
391
392
            );

Mark Olesen's avatar
Mark Olesen committed
393
394
            // copy pointMap as well, otherwise pointFields fail
            csetPolyDecomp_[datasetNo].pointMap() = subsetter.pointMap();
Mark Olesen's avatar
Mark Olesen committed
395

396
            AddToBlock(output, vtkmesh, range, datasetNo, partName);
Mark Olesen's avatar
Mark Olesen committed
397
398
399
            vtkmesh->Delete();

            partDataset_[partId] = datasetNo++;
400
401
        }
    }
402

Mark Olesen's avatar
Mark Olesen committed
403
    // anything added?
Mark Olesen's avatar
Mark Olesen committed
404
    if (datasetNo)
405
406
407
408
    {
        ++blockNo;
    }

409
410
    if (debug)
    {
411
        Info<< "<end> Foam::vtkPV3Foam::convertMeshCellSets" << endl;
Mark Olesen's avatar
Mark Olesen committed
412
        printMemory();
413
    }
414
415
}

416

417
418
void Foam::vtkPV3Foam::convertMeshFaceZones
(
419
420
    vtkMultiBlockDataSet* output,
    int& blockNo
421
422
)
{
423
424
    arrayRange& range = arrayRangeFaceZones_;
    range.block(blockNo);      // set output block
Mark Olesen's avatar
Mark Olesen committed
425
426
427
    label datasetNo = 0;       // restart at dataset 0
    const fvMesh& mesh = *meshPtr_;

428
    if (range.empty())
Mark Olesen's avatar
Mark Olesen committed
429
430
431
432
    {
        return;
    }

433
434
    if (debug)
    {
435
        Info<< "<beg> Foam::vtkPV3Foam::convertMeshFaceZones" << endl;
Mark Olesen's avatar
Mark Olesen committed
436
        printMemory();
437
438
    }

Mark Olesen's avatar
Mark Olesen committed
439
    const faceZoneMesh& zMesh = mesh.faceZones();
440
    for (int partId = range.start(); partId < range.end(); ++partId)
441
    {
Mark Olesen's avatar
Mark Olesen committed
442
443
        const word zoneName = getPartName(partId);
        const label  zoneId = zMesh.findZoneID(zoneName);
444

Mark Olesen's avatar
Mark Olesen committed
445
        if (!partStatus_[partId] || zoneId < 0)
446
        {
Mark Olesen's avatar
Mark Olesen committed
447
448
            continue;
        }
449

Mark Olesen's avatar
Mark Olesen committed
450
451
452
453
454
        if (debug)
        {
            Info<< "Creating VTKmesh for faceZone[" << zoneId << "] "
                << zoneName << endl;
        }
455

456
457
        vtkPolyData* vtkmesh = patchVTKMesh(zoneName, zMesh[zoneId]());

Mark Olesen's avatar
Mark Olesen committed
458
459
        if (vtkmesh)
        {
460
            AddToBlock(output, vtkmesh, range, datasetNo, zoneName);
Mark Olesen's avatar
Mark Olesen committed
461
            vtkmesh->Delete();
Mark Olesen's avatar
Mark Olesen committed
462

Mark Olesen's avatar
Mark Olesen committed
463
            partDataset_[partId] = datasetNo++;
464
465
        }
    }
466

Mark Olesen's avatar
Mark Olesen committed
467
    // anything added?
Mark Olesen's avatar
Mark Olesen committed
468
    if (datasetNo)
469
470
471
472
    {
        ++blockNo;
    }

473
474
475
    if (debug)
    {
        Info<< "<end> Foam::vtkPV3Foam::convertMeshFaceZones" << endl;
Mark Olesen's avatar
Mark Olesen committed
476
        printMemory();
477
    }
478
479
480
}


481
void Foam::vtkPV3Foam::convertMeshFaceSets
482
(
483
484
    vtkMultiBlockDataSet* output,
    int& blockNo
485
486
)
{
487
488
    arrayRange& range = arrayRangeFaceSets_;
    range.block(blockNo);      // set output block
Mark Olesen's avatar
Mark Olesen committed
489
490
491
    label datasetNo = 0;       // restart at dataset 0
    const fvMesh& mesh = *meshPtr_;

492
493
    if (debug)
    {
494
        Info<< "<beg> Foam::vtkPV3Foam::convertMeshFaceSets" << endl;
Mark Olesen's avatar
Mark Olesen committed
495
        printMemory();
496
497
    }

498
    for (int partId = range.start(); partId < range.end(); ++partId)
499
    {
Mark Olesen's avatar
Mark Olesen committed
500
        const word partName = getPartName(partId);
501

Mark Olesen's avatar
Mark Olesen committed
502
503
504
505
        if (!partStatus_[partId])
        {
            continue;
        }
506

Mark Olesen's avatar
Mark Olesen committed
507
508
509
510
        if (debug)
        {
            Info<< "Creating VTK mesh for faceSet=" << partName << endl;
        }
511

Mark Olesen's avatar
Mark Olesen committed
512
        const faceSet fSet(mesh, partName);
513

Mark Olesen's avatar
Mark Olesen committed
514
515
516
        vtkPolyData* vtkmesh = faceSetVTKMesh(mesh, fSet);
        if (vtkmesh)
        {
517
            AddToBlock(output, vtkmesh, range, datasetNo, partName);
Mark Olesen's avatar
Mark Olesen committed
518
            vtkmesh->Delete();
Mark Olesen's avatar
Mark Olesen committed
519

Mark Olesen's avatar
Mark Olesen committed
520
            partDataset_[partId] = datasetNo++;
521
522
        }
    }
523

Mark Olesen's avatar
Mark Olesen committed
524
    // anything added?
Mark Olesen's avatar
Mark Olesen committed
525
    if (datasetNo)
526
527
528
529
    {
        ++blockNo;
    }

530
531
    if (debug)
    {
532
        Info<< "<end> Foam::vtkPV3Foam::convertMeshFaceSets" << endl;
Mark Olesen's avatar
Mark Olesen committed
533
        printMemory();
534
    }
535
536
537
538
539
}


void Foam::vtkPV3Foam::convertMeshPointZones
(
540
541
    vtkMultiBlockDataSet* output,
    int& blockNo
542
543
)
{
544
545
    arrayRange& range = arrayRangePointZones_;
    range.block(blockNo);      // set output block
Mark Olesen's avatar
Mark Olesen committed
546
    label datasetNo = 0;       // restart at dataset 0
547
    const fvMesh& mesh = *meshPtr_;
Mark Olesen's avatar
Mark Olesen committed
548

549
550
    if (debug)
    {
551
        Info<< "<beg> Foam::vtkPV3Foam::convertMeshPointZones" << endl;
Mark Olesen's avatar
Mark Olesen committed
552
        printMemory();
553
554
    }

555
    if (range.size())
556
    {
Mark Olesen's avatar
Mark Olesen committed
557
        const pointZoneMesh& zMesh = mesh.pointZones();
558
        for (int partId = range.start(); partId < range.end(); ++partId)
559
        {
Mark Olesen's avatar
Mark Olesen committed
560
            word zoneName = getPartName(partId);
Mark Olesen's avatar
Mark Olesen committed
561
            label zoneId = zMesh.findZoneID(zoneName);
562

Mark Olesen's avatar
Mark Olesen committed
563
            if (!partStatus_[partId] || zoneId < 0)
564
565
566
567
            {
                continue;
            }

Mark Olesen's avatar
Mark Olesen committed
568
569
            vtkPolyData* vtkmesh = pointZoneVTKMesh(mesh, zMesh[zoneId]);
            if (vtkmesh)
570
            {
571
                AddToBlock(output, vtkmesh, range, datasetNo, zoneName);
Mark Olesen's avatar
Mark Olesen committed
572
573
                vtkmesh->Delete();

Mark Olesen's avatar
Mark Olesen committed
574
                partDataset_[partId] = datasetNo++;
575
576
577
            }
        }
    }
578

Mark Olesen's avatar
Mark Olesen committed
579
    // anything added?
Mark Olesen's avatar
Mark Olesen committed
580
    if (datasetNo)
581
582
583
584
    {
        ++blockNo;
    }

585
586
587
    if (debug)
    {
        Info<< "<end> Foam::vtkPV3Foam::convertMeshPointZones" << endl;
Mark Olesen's avatar
Mark Olesen committed
588
        printMemory();
589
    }
590
591
592
593
}



594
void Foam::vtkPV3Foam::convertMeshPointSets
595
(
596
597
    vtkMultiBlockDataSet* output,
    int& blockNo
598
599
)
{
600
601
    arrayRange& range = arrayRangePointSets_;
    range.block(blockNo);      // set output block
Mark Olesen's avatar
Mark Olesen committed
602
603
604
    label datasetNo = 0;       // restart at dataset 0
    const fvMesh& mesh = *meshPtr_;

605
606
    if (debug)
    {
607
        Info<< "<beg> Foam::vtkPV3Foam::convertMeshPointSets" << endl;
Mark Olesen's avatar
Mark Olesen committed
608
        printMemory();
609
610
    }

611
    for (int partId = range.start(); partId < range.end(); ++partId)
612
    {
Mark Olesen's avatar
Mark Olesen committed
613
        word partName = getPartName(partId);
614

Mark Olesen's avatar
Mark Olesen committed
615
616
617
618
        if (!partStatus_[partId])
        {
            continue;
        }
619

Mark Olesen's avatar
Mark Olesen committed
620
621
622
623
        if (debug)
        {
            Info<< "Creating VTK mesh for pointSet=" << partName << endl;
        }
624

Mark Olesen's avatar
Mark Olesen committed
625
        const pointSet pSet(mesh, partName);
626

Mark Olesen's avatar
Mark Olesen committed
627
628
629
        vtkPolyData* vtkmesh = pointSetVTKMesh(mesh, pSet);
        if (vtkmesh)
        {
630
            AddToBlock(output, vtkmesh, range, datasetNo, partName);
Mark Olesen's avatar
Mark Olesen committed
631
            vtkmesh->Delete();
Mark Olesen's avatar
Mark Olesen committed
632

Mark Olesen's avatar
Mark Olesen committed
633
            partDataset_[partId] = datasetNo++;
634
635
        }
    }
636

Mark Olesen's avatar
Mark Olesen committed
637
    // anything added?
Mark Olesen's avatar
Mark Olesen committed
638
    if (datasetNo)
639
640
641
642
    {
        ++blockNo;
    }

643
644
    if (debug)
    {
645
        Info<< "<end> Foam::vtkPV3Foam::convertMeshPointSets" << endl;
Mark Olesen's avatar
Mark Olesen committed
646
        printMemory();
647
    }
648
649
}

650

651
// ************************************************************************* //