vtkAMRHomogenizationFilter.h 3.16 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*=========================================================================

 Program:   Visualization Toolkit
 Module:    vtkAMRHomogenizationFilter.h

 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
 All rights reserved.
 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

 This software is distributed WITHOUT ANY WARRANTY; without even
 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 PURPOSE.  See the above copyright notice for more information.

 =========================================================================*/
// .NAME vtkAMRHomogenizationFilter.h -- Creates a non-overlapping AMR dataset
//
// .SECTION Description
// This filter accepts as input an AMR dataset in vtkHierarchicalBoxDataSet
// instance and generates a corresponding homogenized dataset instance of
// non-overlapping AMR pathces.
//
// .SECTION See Also
// vtkHierarchicalBoxDataSet, vtkAMRBox

#ifndef VTKAMRHOMOGENIZATIONFILTER_H_
#define VTKAMRHOMOGENIZATIONFILTER_H_

//#include "vtkHierarchicalBoxDataSetAlgorithm.h"

#include "vtkMultiBlockDataSetAlgorithm.h"

#include <set>

class vtkInformation;
class vtkInformationVector;
class vtkHierarchicalBoxDataSet;
class vtkUniformGrid;

class VTK_AMR_EXPORT vtkAMRHomogenizationFilter :
  public vtkMultiBlockDataSetAlgorithm
{
  public:
    static vtkAMRHomogenizationFilter* New();
    vtkTypeMacro(vtkAMRHomogenizationFilter,vtkMultiBlockDataSetAlgorithm);
    void PrintSelf( std::ostream &oss, vtkIndent indent);

  protected:
    vtkAMRHomogenizationFilter();
    virtual ~vtkAMRHomogenizationFilter();

    // Description:
    // Given the patch extent and the input grid, the patch
    // corresponding to the given extent is extracted.
    // NOTE: the patch is cell-based.
    vtkUniformGrid* ExtractPatch(
        vtkUniformGrid *ug, int patchExtent[6] );

    // Description:
    // Creates a non-overlapping AMR for the given grid starting at the given
    // cellijk. Upon return, the patch extent holds the extents of the patch to
    // be extracted and cellHistory is updated accordingly.
    void GetPatchExtent(
       vtkUniformGrid *ug, int celldims[3], int cellijk[3], int pExtent[6],
       std::set<vtkIdType> &cellHistory );

    // Description:
    // Given an AMR patch at a given level, a set of subset patches are
    // extracted s.t. they are not overlapping based on the pre-computed
    // visibility.
    void ExtractNonOverlappingPatches(
        vtkUniformGrid *ug, const unsigned int level,
        vtkMultiBlockDataSet *out );

    // Description:
    // Homogenizes the input AMR grids into a new instance.
    void HomogenizeGrids(
      vtkHierarchicalBoxDataSet* in, vtkMultiBlockDataSet* out );

    // Standard pipeline routines
    virtual int RequestData(
        vtkInformation*,vtkInformationVector**,vtkInformationVector*);
    virtual int FillInputPortInformation(int port, vtkInformation *info);
    virtual int FillOutputPortInformation(int port, vtkInformation *info);

  private:
    vtkAMRHomogenizationFilter( const vtkAMRHomogenizationFilter& ); // Not implemented
    void operator=( const vtkAMRHomogenizationFilter& ); // Not implemented
};

#endif /* VTKAMRHOMOGENIZATIONFILTER_H_ */