avtClipFilter.h 6.29 KB
Newer Older
hrchilds's avatar
hrchilds committed
1 2
/*****************************************************************************
*
bonnell's avatar
bonnell committed
3
* Copyright (c) 2000 - 2017, Lawrence Livermore National Security, LLC
hrchilds's avatar
hrchilds committed
4
* Produced at the Lawrence Livermore National Laboratory
5
* LLNL-CODE-442911
hrchilds's avatar
hrchilds committed
6 7
* All rights reserved.
*
8
* This file is  part of VisIt. For  details, see https://visit.llnl.gov/.  The
hrchilds's avatar
hrchilds committed
9 10 11 12 13 14 15 16 17 18
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution  and  use  in  source  and  binary  forms,  with  or  without
* modification, are permitted provided that the following conditions are met:
*
*  - Redistributions of  source code must  retain the above  copyright notice,
*    this list of conditions and the disclaimer below.
*  - Redistributions in binary form must reproduce the above copyright notice,
*    this  list of  conditions  and  the  disclaimer (as noted below)  in  the
19 20 21
*    documentation and/or other materials provided with the distribution.
*  - Neither the name of  the LLNS/LLNL nor the names of  its contributors may
*    be used to endorse or promote products derived from this software without
hrchilds's avatar
hrchilds committed
22 23 24 25 26
*    specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT  HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR  IMPLIED WARRANTIES, INCLUDING,  BUT NOT  LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND  FITNESS FOR A PARTICULAR  PURPOSE
27 28 29
* ARE  DISCLAIMED. IN  NO EVENT  SHALL LAWRENCE  LIVERMORE NATIONAL  SECURITY,
* LLC, THE  U.S.  DEPARTMENT OF  ENERGY  OR  CONTRIBUTORS BE  LIABLE  FOR  ANY
* DIRECT,  INDIRECT,   INCIDENTAL,   SPECIAL,   EXEMPLARY,  OR   CONSEQUENTIAL
hrchilds's avatar
hrchilds committed
30 31 32 33 34 35 36 37 38
* DAMAGES (INCLUDING, BUT NOT  LIMITED TO, PROCUREMENT OF  SUBSTITUTE GOODS OR
* SERVICES; LOSS OF  USE, DATA, OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER
* CAUSED  AND  ON  ANY  THEORY  OF  LIABILITY,  WHETHER  IN  CONTRACT,  STRICT
* LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY  WAY
* OUT OF THE  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/

hrchilds's avatar
hrchilds committed
39
// ************************************************************************* //
hrchilds's avatar
hrchilds committed
40
//                              avtClipFilter.h                              //
hrchilds's avatar
hrchilds committed
41 42 43 44 45
// ************************************************************************* //

#ifndef AVT_CLIP_FILTER_H
#define AVT_CLIP_FILTER_H

46
#include <avtPluginStructuredChunkDataTreeIterator.h>
hrchilds's avatar
hrchilds committed
47

48
#include <ClipAttributes.h>
hrchilds's avatar
hrchilds committed
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

class vtkDataSet;
class vtkImplicitBoolean;
class vtkImplicitFunction;
class vtkUnstructuredGrid;


// ****************************************************************************
//  Class: avtClipFilter
//
//  Purpose:
//      Performs the duty of the Clip operator.
//
//  Programmer: Kathleen Bonnell 
//  Creation:   May 7, 2001 
//
//  Modifications:
//    Kathleen Bonnell, Wed Jun 20 13:35:27 PDT 2001
//    Removed vtkGeometryFilter.
//
//    Kathleen Bonnell, Wed Sep 19 12:55:57 PDT 2001 
//    Added string argument to Execute method, in order to match new interface. 
//
//    Hank Childs, Thu Aug 15 21:23:13 PDT 2002
//    Inherited from plugin streamer rather than plugin data tree streamer.
//    Also added some performance gains.
//
hrchilds's avatar
hrchilds committed
76 77 78 79
//    Jeremy Meredith, Mon Aug 11 17:09:53 PDT 2003
//    Rewrote a huge chunk to make use of my new vtkVisItClipper3D.  The 
//    speedup from using this filter whenever possible is really, really big.
//
hrchilds's avatar
hrchilds committed
80 81 82 83
//    Jeremy Meredith, Wed May  5 13:05:35 PDT 2004
//    Made my fast clipper support 2D, and removed the old generic
//    VTK data set clipper.
//
hrchilds's avatar
hrchilds committed
84 85 86
//    Hank Childs, Thu Mar 10 14:33:32 PST 2005
//    Removed data members for filters that are now instantiated on the fly.
//
hrchilds's avatar
hrchilds committed
87 88 89
//    Hank Childs, Sun Mar 27 11:57:52 PST 2005
//    Add support for structured mesh chunking.
//
hrchilds's avatar
hrchilds committed
90
//    Kathleen Bonnell, Fri Apr 28 10:57:21 PDT 2006 
hrchilds's avatar
hrchilds committed
91
//    Add ModifyContract. 
hrchilds's avatar
hrchilds committed
92
//
hrchilds's avatar
hrchilds committed
93 94 95
//    Kathleen Bonnell, Mon Jul 31 11:11:28 PDT 2006 
//    Add Clip1DRGrid. 
//
96 97 98 99 100
//    Sean Ahern, Thu Feb 14 16:18:05 EST 2008
//    Converted to an avtSIMODataTreeIterator to handle multi-plane clip
//    bugs.  Added pipelined clips to get accurate cell clips when
//    multiple planes are used.
//
101 102 103
//    Eric Brugger, Wed Aug 20 16:08:13 PDT 2014
//    Modified the class to work with avtDataRepresentation.
//
hrchilds's avatar
hrchilds committed
104 105
// ****************************************************************************

106 107 108 109
class vtkPlane;

class avtClipFilter : public avtSIMODataTreeIterator,
                      public virtual avtPluginFilter
hrchilds's avatar
hrchilds committed
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
{
  public:
                             avtClipFilter();
    virtual                 ~avtClipFilter();

    static avtFilter        *Create();

    virtual const char      *GetType(void)  { return "avtClipFilter"; };
    virtual const char      *GetDescription(void)
                                 { return "Clipping"; };

    virtual void             SetAtts(const AttributeGroup*);
    virtual bool             Equivalent(const AttributeGroup*);

  protected:
    ClipAttributes           atts;

127
    virtual avtDataTree_p    ExecuteDataTree(avtDataRepresentation *);
128 129 130 131 132 133 134 135 136 137
    int                      ComputeAccurateClip(vtkDataSet *inDS,
                                                 vtkDataSet **outDS,
                                                 ClipAttributes &atts,
                                                 int domain,
                                                 std::string label);
    int                      ComputeFastClip(vtkDataSet *inDS,
                                             vtkDataSet **outDS,
                                             ClipAttributes &atts,
                                             int domain,
                                             std::string label);
hrchilds's avatar
hrchilds committed
138

hrchilds's avatar
hrchilds committed
139
    virtual void             UpdateDataObjectInfo(void);
140 141 142 143 144
    avtContract_p            ModifyContract(avtContract_p);
    virtual vtkUnstructuredGrid *ClipAgainstPlanes(vtkDataSet*, bool,
                                                   vtkPlane*,
                                                   vtkPlane* = NULL,
                                                   vtkPlane* = NULL);
hrchilds's avatar
hrchilds committed
145 146 147

  private:
    bool                     SetUpClipFunctions(vtkImplicitBoolean *, bool&);
hrchilds's avatar
hrchilds committed
148 149
    vtkRectilinearGrid      *Clip1DRGrid(vtkImplicitBoolean *, bool,
                                         vtkRectilinearGrid*);
hrchilds's avatar
hrchilds committed
150 151 152 153
};


#endif