fluidity-master/h5hut/visit_plugins/operators/BinnerFilter/BinnerFilter.java
package llnl.visit.operators;

import llnl.visit.AttributeSubject;
import llnl.visit.CommunicationBuffer;
import llnl.visit.Plugin;

// ****************************************************************************
// Class: Binner
//
// Purpose:
//    Bin particles
//
// Notes:      Autogenerated by xml2java.
//
// Programmer: xml2java
// Creation:   Thu Mar 30 12:05:26 PDT 2006
//
// Modifications:
//   
// ****************************************************************************

public class Binner extends AttributeSubject implements Plugin
{
    public Binner()
    {
        super(3);

        dim1 = 0;
        dim2 = 0;
        dim3 = 0;
    }

    public Binner(Binner obj)
    {
        super(3);

        dim1 = obj.dim1;
        dim2 = obj.dim2;
        dim3 = obj.dim3;

        SelectAll();
    }

    public boolean equals(Binner obj)
    {
        // Create the return value
        return ((dim1 == obj.dim1) &&
                (dim2 == obj.dim2) &&
                (dim3 == obj.dim3));
    }

    public String GetName() { return "Binner"; }
    public String GetVersion() { return "1.0"; }

    // Property setting methods
    public void SetDim1(int dim1_)
    {
        dim1 = dim1_;
        Select(0);
    }

    public void SetDim2(int dim2_)
    {
        dim2 = dim2_;
        Select(1);
    }

    public void SetDim3(int dim3_)
    {
        dim3 = dim3_;
        Select(2);
    }

    // Property getting methods
    public int GetDim1() { return dim1; }
    public int GetDim2() { return dim2; }
    public int GetDim3() { return dim3; }

    // Write and read methods.
    public void WriteAtts(CommunicationBuffer buf)
    {
        if(WriteSelect(0, buf))
            buf.WriteInt(dim1);
        if(WriteSelect(1, buf))
            buf.WriteInt(dim2);
        if(WriteSelect(2, buf))
            buf.WriteInt(dim3);
    }

    public void ReadAtts(int n, CommunicationBuffer buf)
    {
        for(int i = 0; i < n; ++i)
        {
            int index = (int)buf.ReadByte();
            switch(index)
            {
            case 0:
                SetDim1(buf.ReadInt());
                break;
            case 1:
                SetDim2(buf.ReadInt());
                break;
            case 2:
                SetDim3(buf.ReadInt());
                break;
            }
        }
    }


    // Attributes
    private int dim1;
    private int dim2;
    private int dim3;
}

