//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (https://www.swig.org).
// Version 4.1.1
//
// Do not make changes to this file unless you know what you are doing - modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------

namespace QuantLib {

public class FdmMesher : global::System.IDisposable {
  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
  private bool swigCMemOwnBase;

  internal FdmMesher(global::System.IntPtr cPtr, bool cMemoryOwn) {
    swigCMemOwnBase = cMemoryOwn;
    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
  }

  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FdmMesher obj) {
    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
  }

  ~FdmMesher() {
    Dispose(false);
  }

  public void Dispose() {
    Dispose(true);
    global::System.GC.SuppressFinalize(this);
  }

  protected virtual void Dispose(bool disposing) {
    lock(this) {
      if (swigCPtr.Handle != global::System.IntPtr.Zero) {
        if (swigCMemOwnBase) {
          swigCMemOwnBase = false;
          NQuantLibcPINVOKE.delete_FdmMesher(swigCPtr);
        }
        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
      }
    }
  }

  public double dplus(FdmLinearOpIterator iter, uint direction) {
    double ret = NQuantLibcPINVOKE.FdmMesher_dplus(swigCPtr, FdmLinearOpIterator.getCPtr(iter), direction);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public double dminus(FdmLinearOpIterator iter, uint direction) {
    double ret = NQuantLibcPINVOKE.FdmMesher_dminus(swigCPtr, FdmLinearOpIterator.getCPtr(iter), direction);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public double location(FdmLinearOpIterator iter, uint direction) {
    double ret = NQuantLibcPINVOKE.FdmMesher_location(swigCPtr, FdmLinearOpIterator.getCPtr(iter), direction);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public QlArray locations(uint direction) {
    QlArray ret = new QlArray(NQuantLibcPINVOKE.FdmMesher_locations(swigCPtr, direction), true);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public FdmLinearOpLayout layout() {
    global::System.IntPtr cPtr = NQuantLibcPINVOKE.FdmMesher_layout(swigCPtr);
    FdmLinearOpLayout ret = (cPtr == global::System.IntPtr.Zero) ? null : new FdmLinearOpLayout(cPtr, true);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
