Java Code Examples for java.io.ObjectInput#readDouble()

The following examples show how to use java.io.ObjectInput#readDouble() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DormandPrince853StepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void readExternal(final ObjectInput in)
  throws IOException {

  // read the local attributes
  yDotKLast = new double[3][];
  final int dimension = in.readInt();
  yDotKLast[0] = (dimension < 0) ? null : new double[dimension];
  yDotKLast[1] = (dimension < 0) ? null : new double[dimension];
  yDotKLast[2] = (dimension < 0) ? null : new double[dimension];

  for (int i = 0; i < dimension; ++i) {
    yDotKLast[0][i] = in.readDouble();
    yDotKLast[1][i] = in.readDouble();
    yDotKLast[2][i] = in.readDouble();
  }

  // read the base state
  super.readExternal(in);

}
 
Example 2
Source File: DormandPrince853StepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void readExternal(final ObjectInput in)
  throws IOException {

  // read the local attributes
  yDotKLast = new double[3][];
  final int dimension = in.readInt();
  yDotKLast[0] = (dimension < 0) ? null : new double[dimension];
  yDotKLast[1] = (dimension < 0) ? null : new double[dimension];
  yDotKLast[2] = (dimension < 0) ? null : new double[dimension];

  for (int i = 0; i < dimension; ++i) {
    yDotKLast[0][i] = in.readDouble();
    yDotKLast[1][i] = in.readDouble();
    yDotKLast[2][i] = in.readDouble();
  }

  // read the base state
  super.readExternal(in);

}
 
Example 3
Source File: GraggBulirschStoerStepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void readExternal(final ObjectInput in)
  throws IOException {

  // read the base class
  final double t = readBaseExternal(in);
  final int dimension = (currentState == null) ? -1 : currentState.length;

  // read the local attributes
  final int degree = in.readInt();
  resetTables(degree);
  currentDegree = degree;

  for (int k = 0; k <= currentDegree; ++k) {
    for (int l = 0; l < dimension; ++l) {
      polynoms[k][l] = in.readDouble();
    }
  }

  // we can now set the interpolated time and state
  setInterpolatedTime(t);

}
 
Example 4
Source File: GraggBulirschStoerStepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void readExternal(final ObjectInput in)
  throws IOException {

  // read the base class
  final double t = readBaseExternal(in);
  final int dimension = (currentState == null) ? -1 : currentState.length;

  // read the local attributes
  final int degree = in.readInt();
  resetTables(degree);
  currentDegree = degree;

  for (int k = 0; k <= currentDegree; ++k) {
    for (int l = 0; l < dimension; ++l) {
      polynoms[k][l] = in.readDouble();
    }
  }

  // we can now set the interpolated time and state
  setInterpolatedTime(t);

}
 
Example 5
Source File: DormandPrince853StepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void readExternal(final ObjectInput in)
  throws IOException {

  // read the local attributes
  yDotKLast = new double[3][];
  final int dimension = in.readInt();
  yDotKLast[0] = (dimension < 0) ? null : new double[dimension];
  yDotKLast[1] = (dimension < 0) ? null : new double[dimension];
  yDotKLast[2] = (dimension < 0) ? null : new double[dimension];

  for (int i = 0; i < dimension; ++i) {
    yDotKLast[0][i] = in.readDouble();
    yDotKLast[1][i] = in.readDouble();
    yDotKLast[2][i] = in.readDouble();
  }

  // read the base state
  super.readExternal(in);

}
 
Example 6
Source File: DummyStepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Read the instance from an input channel.
 * @param in input channel
 * @exception IOException if the instance cannot be read
 */
@Override
public void readExternal(final ObjectInput in)
  throws IOException, ClassNotFoundException {

  // read the base class
  final double t = readBaseExternal(in);

  if (currentState == null) {
      currentDerivative = null;
  } else {
      currentDerivative  = new double[currentState.length];
      for (int i = 0; i < currentDerivative.length; ++i) {
          currentDerivative[i] = in.readDouble();
      }
  }

  // we can now set the interpolated time and state
  setInterpolatedTime(t);

}
 
Example 7
Source File: DummyStepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Read the instance from an input channel.
 * @param in input channel
 * @exception IOException if the instance cannot be read
 */
@Override
public void readExternal(final ObjectInput in)
  throws IOException, ClassNotFoundException {

  // read the base class
  final double t = readBaseExternal(in);

  if (currentState == null) {
      currentDerivative = null;
  } else {
      currentDerivative  = new double[currentState.length];
      for (int i = 0; i < currentDerivative.length; ++i) {
          currentDerivative[i] = in.readDouble();
      }
  }

  // we can now set the interpolated time and state
  setInterpolatedTime(t);

}
 
Example 8
Source File: DormandPrince853StepInterpolator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void readExternal(final ObjectInput in)
  throws IOException {

  // read the local attributes
  yDotKLast = new double[3][];
  final int dimension = in.readInt();
  yDotKLast[0] = (dimension < 0) ? null : new double[dimension];
  yDotKLast[1] = (dimension < 0) ? null : new double[dimension];
  yDotKLast[2] = (dimension < 0) ? null : new double[dimension];

  for (int i = 0; i < dimension; ++i) {
    yDotKLast[0][i] = in.readDouble();
    yDotKLast[1][i] = in.readDouble();
    yDotKLast[2][i] = in.readDouble();
  }

  // read the base state
  super.readExternal(in);

}
 
Example 9
Source File: RungeKuttaStepInterpolator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void readExternal(final ObjectInput in)
  throws IOException, ClassNotFoundException {

  // read the base class
  final double t = readBaseExternal(in);

  // read the local attributes
  final int n = (currentState == null) ? -1 : currentState.length;
  if (n < 0) {
    previousState = null;
  } else {
    previousState = new double[n];
    for (int i = 0; i < n; ++i) {
      previousState[i] = in.readDouble();
    }
  }

  final int kMax = in.readInt();
  yDotK = (kMax < 0) ? null : new double[kMax][];
  for (int k = 0; k < kMax; ++k) {
    yDotK[k] = (n < 0) ? null : new double[n];
    for (int i = 0; i < n; ++i) {
      yDotK[k][i] = in.readDouble();
    }
  }

  integrator = null;

  if (currentState != null) {
      // we can now set the interpolated time and state
      setInterpolatedTime(t);
  } else {
      interpolatedTime = t;
  }

}
 
Example 10
Source File: AbstractStepInterpolator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Read the base state of the instance.
 * This method does <strong>neither</strong> set the interpolated
 * time nor state. It is up to the derived class to reset it
 * properly calling the {@link #setInterpolatedTime} method later,
 * once all rest of the object state has been set up properly.
 * @param in stream where to read the state from
 * @return interpolated time be set later by the caller
 * @exception IOException in case of read error
 */
protected double readBaseExternal(final ObjectInput in)
  throws IOException {

  final int dimension = in.readInt();
  globalPreviousTime  = in.readDouble();
  globalCurrentTime   = in.readDouble();
  softPreviousTime    = in.readDouble();
  softCurrentTime     = in.readDouble();
  h                   = in.readDouble();
  forward             = in.readBoolean();
  dirtyState          = true;

  if (dimension < 0) {
      currentState = null;
  } else {
      currentState  = new double[dimension];
      for (int i = 0; i < currentState.length; ++i) {
          currentState[i] = in.readDouble();
      }
  }

  // we do NOT handle the interpolated time and state here
  interpolatedTime        = Double.NaN;
  interpolatedState       = (dimension < 0) ? null : new double[dimension];
  interpolatedDerivatives = (dimension < 0) ? null : new double[dimension];

  finalized = true;

  return in.readDouble();

}
 
Example 11
Source File: NordsieckStepInterpolator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void readExternal(final ObjectInput in)
    throws IOException, ClassNotFoundException {

    // read the base class
    final double t = readBaseExternal(in);

    // read the local attributes
    scalingH      = in.readDouble();
    referenceTime = in.readDouble();

    final int n = (currentState == null) ? -1 : currentState.length;
    final boolean hasScaled = in.readBoolean();
    if (hasScaled) {
        scaled = new double[n];
        for (int j = 0; j < n; ++j) {
            scaled[j] = in.readDouble();
        }
    } else {
        scaled = null;
    }

    final boolean hasNordsieck = in.readBoolean();
    if (hasNordsieck) {
        nordsieck = (Array2DRowRealMatrix) in.readObject();
    } else {
        nordsieck = null;
    }

    if (hasScaled && hasNordsieck) {
        // we can now set the interpolated time and state
        stateVariation = new double[n];
        setInterpolatedTime(t);
    } else {
        stateVariation = null;
    }

}
 
Example 12
Source File: Quaterniond.java    From JOML with MIT License 5 votes vote down vote up
public void readExternal(ObjectInput in) throws IOException,
        ClassNotFoundException {
    x = in.readDouble();
    y = in.readDouble();
    z = in.readDouble();
    w = in.readDouble();
}
 
Example 13
Source File: Rayd.java    From JOML with MIT License 5 votes vote down vote up
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    oX = in.readDouble();
    oY = in.readDouble();
    oZ = in.readDouble();
    dX = in.readDouble();
    dY = in.readDouble();
    dZ = in.readDouble();
}
 
Example 14
Source File: NordsieckStepInterpolator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void readExternal(final ObjectInput in)
    throws IOException, ClassNotFoundException {

    // read the base class
    final double t = readBaseExternal(in);

    // read the local attributes
    scalingH      = in.readDouble();
    referenceTime = in.readDouble();

    final int n = (currentState == null) ? -1 : currentState.length;
    final boolean hasScaled = in.readBoolean();
    if (hasScaled) {
        scaled = new double[n];
        for (int j = 0; j < n; ++j) {
            scaled[j] = in.readDouble();
        }
    } else {
        scaled = null;
    }

    final boolean hasNordsieck = in.readBoolean();
    if (hasNordsieck) {
        nordsieck = (Array2DRowRealMatrix) in.readObject();
    } else {
        nordsieck = null;
    }

    if (hasScaled && hasNordsieck) {
        // we can now set the interpolated time and state
        stateVariation = new double[n];
        setInterpolatedTime(t);
    } else {
        stateVariation = null;
    }

}
 
Example 15
Source File: RungeKuttaStepInterpolator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void readExternal(final ObjectInput in)
  throws IOException {

  // read the base class 
  final double t = readBaseExternal(in);

  // read the local attributes
  final int n = (currentState == null) ? -1 : currentState.length;
  final int kMax = in.readInt();
  yDotK = (kMax < 0) ? null : new double[kMax][];
  for (int k = 0; k < kMax; ++k) {
    yDotK[k] = (n < 0) ? null : new double[n];
    for (int i = 0; i < n; ++i) {
      yDotK[k][i] = in.readDouble();
    }
  }

  integrator = null;

  if (currentState != null) {
      // we can now set the interpolated time and state
      setInterpolatedTime(t);
  } else {
      interpolatedTime = t;
  }

}
 
Example 16
Source File: BasicVector.java    From hlta with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void readExternal(ObjectInput in) throws IOException,
        ClassNotFoundException {

    length = in.readInt();

    self = new double[length];

    for (int i = 0; i < length; i++) {
        self[i] = in.readDouble();
    }
}
 
Example 17
Source File: NordsieckStepInterpolator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void readExternal(final ObjectInput in)
    throws IOException, ClassNotFoundException {

    // read the base class
    final double t = readBaseExternal(in);

    // read the local attributes
    scalingH      = in.readDouble();
    referenceTime = in.readDouble();

    final int n = (currentState == null) ? -1 : currentState.length;
    final boolean hasScaled = in.readBoolean();
    if (hasScaled) {
        scaled = new double[n];
        for (int j = 0; j < n; ++j) {
            scaled[j] = in.readDouble();
        }
    } else {
        scaled = null;
    }

    final boolean hasNordsieck = in.readBoolean();
    if (hasNordsieck) {
        nordsieck = (Array2DRowRealMatrix) in.readObject();
    } else {
        nordsieck = null;
    }

    if (hasScaled && hasNordsieck) {
        // we can now set the interpolated time and state
        stateVariation = new double[n];
        setInterpolatedTime(t);
    } else {
        stateVariation = null;
    }

}
 
Example 18
Source File: Vector3d.java    From JOML with MIT License 4 votes vote down vote up
public void readExternal(ObjectInput in) throws IOException,
        ClassNotFoundException {
    x = in.readDouble();
    y = in.readDouble();
    z = in.readDouble();
}
 
Example 19
Source File: Matrix2d.java    From JOML with MIT License 4 votes vote down vote up
public void readExternal(ObjectInput in) throws IOException {
    m00 = in.readDouble();
    m01 = in.readDouble();
    m10 = in.readDouble();
    m11 = in.readDouble();
}
 
Example 20
Source File: GridClientNodeMetricsBean.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    lastUpdateTime = in.readLong();
    maxActiveJobs = in.readInt();
    curActiveJobs = in.readInt();
    avgActiveJobs = in.readFloat();
    maxWaitingJobs = in.readInt();
    curWaitingJobs = in.readInt();
    avgWaitingJobs = in.readFloat();
    maxRejectedJobs = in.readInt();
    curRejectedJobs = in.readInt();
    avgRejectedJobs = in.readFloat();
    maxCancelledJobs = in.readInt();
    curCancelledJobs = in.readInt();
    avgCancelledJobs = in.readFloat();
    totalRejectedJobs = in.readInt();
    totalCancelledJobs = in.readInt();
    totalExecutedJobs = in.readInt();
    maxJobWaitTime = in.readLong();
    curJobWaitTime = in.readLong();
    avgJobWaitTime = in.readDouble();
    maxJobExecTime = in.readLong();
    curJobExecTime = in.readLong();
    avgJobExecTime = in.readDouble();
    totalExecTasks = in.readInt();
    totalIdleTime = in.readLong();
    curIdleTime = in.readLong();
    availProcs = in.readInt();
    load = in.readDouble();
    avgLoad = in.readDouble();
    gcLoad = in.readDouble();
    heapInit = in.readLong();
    heapUsed = in.readLong();
    heapCommitted = in.readLong();
    heapMax = in.readLong();
    nonHeapInit = in.readLong();
    nonHeapUsed = in.readLong();
    nonHeapCommitted = in.readLong();
    nonHeapMax = in.readLong();
    upTime = in.readLong();
    startTime = in.readLong();
    nodeStartTime = in.readLong();
    threadCnt = in.readInt();
    peakThreadCnt = in.readInt();
    startedThreadCnt = in.readLong();
    daemonThreadCnt = in.readInt();
    fileSysFreeSpace = in.readLong();
    fileSysTotalSpace = in.readLong();
    fileSysUsableSpace = in.readLong();
    lastDataVer = in.readLong();
    sentMsgsCnt = in.readInt();
    sentBytesCnt = in.readLong();
    rcvdMsgsCnt = in.readInt();
    rcvdBytesCnt = in.readLong();
}